Changeset 2243 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Nov 3, 2002, 10:52:49 PM (23 years ago)
Author:
ansari
Message:

Ajout commande addarc, addarrow, ... , Reza 3/11/2002

Location:
trunk/SophyaPI/PIext
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2217 r2243  
    1313#include "nobjmgr.h"
    1414#include "servnobjm.h"
     15#include "piyfxdrw.h"
    1516
    1617#include "histos.h"
     
    7071else if (kw == "newwin") {
    7172  int nx=1, ny=1;
     73  int sx=0, sy=0;
    7274  //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl;  return(0); }
    7375  if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
    7476  if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
    75   if (mImgApp) mImgApp->CreateGraphWin(nx, ny);
    76   } 
     77  if(tokens.size() > 3) {
     78    sx = atoi(tokens[2].c_str());
     79    sy = atoi(tokens[3].c_str());
     80  }
     81  if (mImgApp) mImgApp->CreateGraphWin(nx, ny, sx, sy);
     82
    7783else if (kw == "stacknext") mImgApp->StackWinNext();
    7884else if (kw == "graphicatt") {
     
    98104  mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
    99105  }
     106else if (kw == "drpanel") {
     107  if (tokens.size() < 4) {
     108    cout << "Usage: drpanel xmin xmax ymin ymax [gratt] [name]" << endl; 
     109    return(0);
     110  }
     111  double xmin = atof(tokens[0].c_str());
     112  double xmax = atof(tokens[1].c_str());
     113  double ymin = atof(tokens[2].c_str());
     114  double ymax = atof(tokens[3].c_str());
     115  char buff[128];
     116  sprintf(buff, "axesnone xylimits=%g,%g,%g,%g", xmin, xmax, ymin, ymax);
     117  string sop = buff;
     118  if (tokens.size() > 4) sop += tokens[4];
     119  string name;
     120  if (tokens.size() > 5) sop += tokens[5];
     121  PIFuncDrawer* gdr = new PIFuncDrawer(NULL);
     122  mImgApp->DispScDrawer(gdr, name, sop);
     123}
    100124else if (kw == "addtext") {
    101125  if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl;  return(0); }
     
    107131  mImgApp->AddText(txt, xp, yp, sop);
    108132  }
    109 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) {
     133else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
     134         (kw == "addarrow") ) {
    110135  if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl;  return(0); }
    111136  double xp1 = atof(tokens[0].c_str());
     
    115140  string sop;
    116141  if (tokens.size() > 4) sop = tokens[4];
    117   if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop);
     142  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false);
     143  else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true);
    118144  else {
    119145    bool fgfill = (kw == "addrect") ? false : true;
    120146    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill);
    121147  }
    122   }
     148}
    123149else if ((kw == "addcirc") || (kw == "addfcirc")) {
    124150  if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl;  return(0); }
     
    131157  mImgApp->AddCircle(xc, yc, rad, sop, fgfill);
    132158  }
     159else if (kw == "addmarker") {
     160  if (tokens.size() < 2) {
     161    cout << "Usage: addmarker x y [gratt]" << endl; 
     162    return(0);
     163  }
     164  double xm = atof(tokens[0].c_str());
     165  double ym = atof(tokens[1].c_str());
     166  string sop;
     167  if (tokens.size() > 2) sop = tokens[2];
     168  mImgApp->AddCircle(xm, ym, -1, sop, false);
     169}
     170else if ((kw == "addarc") || (kw == "addfarc") ) {
     171  if (tokens.size() < 6) {
     172    cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt]" << endl; 
     173    return(0);
     174  }
     175  double x1 = atof(tokens[0].c_str());
     176  double y1 = atof(tokens[1].c_str());
     177  double x2 = atof(tokens[2].c_str());
     178  double y2 = atof(tokens[3].c_str());
     179  double x3 = atof(tokens[4].c_str());
     180  double y3 = atof(tokens[5].c_str());
     181  string sop;
     182  if (tokens.size() > 6) sop = tokens[6];
     183  bool fgfill = (kw == "addarc") ? false : true;
     184  mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill);
     185}
    133186
    134187
     
    775828mpiac->RegisterCommand(kw, usage, this, "Graphics");
    776829kw = "newwin";
    777 usage = "To Create a New Graphic window, with zones \n  Usage: newwin nx ny";
     830usage = "To Create a New Graphic window, with zones \n";
     831usage += "  Window size can be specified \n";
     832usage += "    Usage: newwin [nx ny [sizeX sizeY]] ";
    778833usage += "\n  Related commands: zone"; 
    779834mpiac->RegisterCommand(kw, usage, this, "Graphics");
     
    819874usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
    820875usage += ">> xylimits=xmin,xmax,ymin,ymax  -> Forces X-Y limits in 2-D plots \n";
     876usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
     877 usage += "          The rectangle is defined as a fraction of the widget size\n";
    821878usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
    822879usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
     
    846903mpiac->RegisterCommand(kw, usage, this, "Graphics");
    847904
     905kw = "drpanel";
     906usage = "Creates a new 2D drawing zone for addtext, addline \n";
     907usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
     908usage += "\n  Related commands: addtext addline addrect addcirc ..."; 
     909mpiac->RegisterCommand(kw, usage, this, "Graphics");
     910
    848911kw = "addtext";
    849912usage = "Adds a text string to the current graphic object";
    850 usage += "\n at the specified position (+ color and font attributes) ";
     913usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
    851914usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
    852915usage += "\n Alt<Z> to remove added elements";
    853 usage += "\n Font attribute is common with axes";
    854 usage += "\n  Usage: addtext x y TextString [ColFontAtt]";
     916usage += "\n  Usage: addtext x y TextString [ColFontPosAtt]";
    855917usage += "\n  (use quotes '' for multi word text strings) ";
    856 usage += "\n  Related commands: addline addrect addfrect addcirc addfcirc settitle graphicatt"; 
     918usage += "\n Text position/direction attribute: ";
     919usage += "\n      horizleft horizcenter horizright";
     920usage += "\n      vertbottom vertcenter verttop ";
     921usage += "\n      textdirhoriz textdirvertup textdirvertdown ";
     922usage += "\n  Related commands: addline addarrow addrect addfrect";
     923usage += "\n      addcirc addfcirc addarc addfrac settitle graphicatt"; 
    857924mpiac->RegisterCommand(kw, usage, this, "Graphics");
    858925
    859926kw = "addline";
    860927usage = "Adds a line to the current graphic object";
    861 usage += "\n at the specified position (+ color attribute)";
     928usage += "\n at the specified position (+ graphic attribute)";
    862929usage += "\n The Base/AxesDrawer is used to handle added lines";
    863930usage += "\n Alt<Z> to remove added elements";
    864 usage += "\n  Usage: addline x1 y1 x2 y2 [ColAtt]";
    865 usage += "\n  Related commands: addtext addrect addfrect addcirc addfcirc graphicatt"; 
     931usage += "\n  Usage: addline x1 y1 x2 y2 [GraphicAtt]";
     932usage += "\n  Related commands: addarrow addtext addrect addfrect ";
     933usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt"; 
     934mpiac->RegisterCommand(kw, usage, this, "Graphics");
     935
     936kw = "addarrow";
     937usage = "Adds an arrow to the current graphic object";
     938usage += "\n at the specified position (+ graphic attribute)";
     939usage += "\n The Base/AxesDrawer is used to handle added lines";
     940usage += "\n Alt<Z> to remove added elements";
     941usage += "\n  Usage: addarrow x1 y1 x2 y2 [GraphicAtt]";
     942usage += "\n  Related commands: addline addtext addrect addfrect ";
     943usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt"; 
    866944mpiac->RegisterCommand(kw, usage, this, "Graphics");
    867945
    868946kw = "addrect";
    869947usage = "Adds a rectangle to the current graphic object";
    870 usage += "\n between the specified positions (+ color attribute)";
     948usage += "\n between the specified positions (+ graphic attribute)";
    871949usage += "\n The Base/AxesDrawer is used to handle added rectangle";
    872950usage += "\n Alt<Z> to remove added elements";
    873 usage += "\n  Usage: addrect x1 y1 x2 y2 [ColAtt]";
    874 usage += "\n  Related commands: addtext addline addfrect addcirc addfcirc graphicatt"; 
     951usage += "\n  Usage: addrect x1 y1 x2 y2 [GraphicAtt]";
     952usage += "\n  Related commands: addtext addline addarrow addfrect";
     953usage += "\n       addcirc addfcirc addarc addfarc graphicatt"; 
    875954mpiac->RegisterCommand(kw, usage, this, "Graphics");
    876955
    877956kw = "addfrect";
    878957usage = "Adds a filled rectangle to the current graphic object";
    879 usage += "\n between the specified positions (+ color attribute)";
     958usage += "\n between the specified positions (+ graphic attribute)";
    880959usage += "\n The Base/AxesDrawer is used to handle added rectangle";
    881960usage += "\n Alt<Z> to remove added elements";
    882 usage += "\n  Usage: addfrect x1 y1 x2 y2 [ColAtt]";
    883 usage += "\n  Related commands: addtext addline addrect addcirc addfcirc graphicatt"; 
     961usage += "\n  Usage: addfrect x1 y1 x2 y2 [GraphicAtt]";
     962usage += "\n  Related commands: addtext addline addarrow addrect";
     963usage += "\n       addcirc addfcirc graphicatt"; 
     964mpiac->RegisterCommand(kw, usage, this, "Graphics");
     965
     966kw = "addmarker";
     967usage = "Adds a marker to the current graphic object";
     968usage += "\n at the specified position (+ graphic attribute)";
     969usage += "\n The Base/AxesDrawer is used to handle added circles";
     970usage += "\n Alt<Z> to remove added elements";
     971usage += "\n  Usage: addmarker xpos ypos [GraphicAtt]";
     972usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     973usage += "\n       addcirc addfcirc addarc addfarc graphicatt"; 
    884974mpiac->RegisterCommand(kw, usage, this, "Graphics");
    885975
    886976kw = "addcirc";
    887977usage = "Adds a circle to the current graphic object";
    888 usage += "\n with the specified center and radius (+ color attribute)";
     978usage += "\n with the specified center and radius (+ graphic attribute)";
    889979usage += "\n The Base/AxesDrawer is used to handle added circles";
    890980usage += "\n Alt<Z> to remove added elements";
    891 usage += "\n  Usage: addcirc xcenter ycenter radius [ColAtt]";
    892 usage += "\n  Related commands: addtext addline addfrect addfrect addfcirc graphicatt"; 
     981usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
     982usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     983usage += "\n       addfcirc addarc addfarc graphicatt"; 
    893984mpiac->RegisterCommand(kw, usage, this, "Graphics");
    894985
    895986kw = "addfcirc";
    896987usage = "Adds a filled circle to the current graphic object";
    897 usage += "\n with the specified center and radius (+ color attribute)";
     988usage += "\n with the specified center and radius (+ graphic attribute)";
    898989usage += "\n The Base/AxesDrawer is used to handle added circles";
    899990usage += "\n Alt<Z> to remove added elements";
    900 usage += "\n  Usage: addcirc xcenter ycenter radius [ColAtt]";
    901 usage += "\n  Related commands: addtext addline addfrect addfrect addcirc graphicatt"; 
     991usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
     992usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     993usage += "\n       addcirc addarc addfarc graphicatt"; 
     994mpiac->RegisterCommand(kw, usage, this, "Graphics");
     995
     996kw = "addarc";
     997usage = "Adds an arc to the current graphic object";
     998usage += "\n defined by 3 points (+ graphic attribute)";
     999usage += "\n The Base/AxesDrawer is used to handle added arcs";
     1000usage += "\n Alt<Z> to remove added elements";
     1001usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
     1002usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     1003usage += "\n       addcirc addfcirc addfarc graphicatt"; 
     1004mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1005
     1006kw = "addfarc";
     1007usage = "Adds a filled arc to the current graphic object";
     1008usage += "\n defined by 3 points (+ graphic attribute)";
     1009usage += "\n The Base/AxesDrawer is used to handle added arcs";
     1010usage += "\n Alt<Z> to remove added elements";
     1011usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
     1012usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     1013usage += "\n       addcirc addfcirc addfarc graphicatt"; 
    9021014mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9031015
  • trunk/SophyaPI/PIext/piaversion.h

    r2231 r2243  
    22#define PIAPPVERSION_H_SEEN
    33
    4 #define PIAPP_VERSIONNUMBER  3.62
     4#define PIAPP_VERSIONNUMBER  3.65
    55
    66#endif
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2231 r2243  
    811811ParseDisplayOption(sop, opts);
    812812PIGraphicAtt gratt(opts);
    813 elmgr->ElAddText(xp,yp,txt.c_str(), gratt);
     813unsigned long tpd = 0;
     814gratt.DecodeTextPosDirAtt(opts, tpd, false);
     815elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd);
    814816eld->Refresh();
    815817}
    816818
    817819/* --Methode-- */
    818 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop)
     820void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2,
     821                          string const& sop, bool fgarrow)
    819822{
    820823PIDrawer *eld=CurrentElDrawer();
     
    831834ParseDisplayOption(sop, opts);
    832835PIGraphicAtt gratt(opts);
    833 elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
     836if (fgarrow)
     837  elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt);
     838else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
    834839eld->Refresh();
    835840}
     
    887892ParseDisplayOption(sop, opts);
    888893PIGraphicAtt gratt(opts);
    889 
    890 if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
    891 else elmgr->ElAddCirc(xc, yc, r, gratt);
     894if (r < -0.5)
     895  elmgr->ElAddMarker(xc, yc, gratt);
     896else {
     897  if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
     898  else elmgr->ElAddCirc(xc, yc, r, gratt);
     899}
     900eld->Refresh();
     901}
     902
     903/* --Methode-- */
     904void PIStdImgApp::AddArc(double x1, double y1, double x2, double y2,
     905                         double x3, double y3, string const& sop, bool fgfill)
     906{
     907PIDrawer *eld=CurrentElDrawer();
     908if (eld == NULL) return;
     909PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     910PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     911if ((eld2 == NULL) && (eld3 == NULL)) return;
     912PIElDrwMgr* elmgr = NULL;
     913if (eld2) elmgr = &(eld2->ElDrwMgr());
     914else if (eld3) elmgr = &(eld3->ElDrwMgr());
     915if (elmgr == NULL) return;
     916
     917vector<string> opts;
     918ParseDisplayOption(sop, opts);
     919PIGraphicAtt gratt(opts);
     920if (fgfill)
     921  elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt);
     922else  elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt);
    892923eld->Refresh();
    893924}
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2188 r2243  
    6868     void AddText(string const & txt, double xp, double yp, string const& opt);
    6969  //  Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
    70      void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt);
     70     void AddLine(double xp1, double yp1, double xp2, double yp2,
     71                  string const& opt, bool fgarrow=false);
    7172     void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
    7273                       bool fgfill=false);
    7374     void AddCircle(double xc, double yc, double r, string const& opt,
    7475                    bool fgfill=false);
     76     void AddArc(double x1, double y1, double x2, double y2,
     77                 double x3, double y3, string const& opt, bool fgfill=false);
    7578
    7679  //  Fonction Ajout de titre de trace
Note: See TracChangeset for help on using the changeset viewer.