Changeset 2263 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Nov 14, 2002, 8:12:02 PM (23 years ago)
Author:
ansari
Message:
  • Ajout commande de trace d'elements graphiques (addpoly addctext ...)
  • Ajout de commandes de lecture ascii matrices/vecteurs
  • Trace de vecteur vx vs vy pour tout type de vecteurs

Reza 14/11/2002

Location:
trunk/SophyaPI/PIext
Files:
7 edited

Legend:

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

    r2243 r2263  
    99#include "pdlmgr.h"
    1010#include "ctimer.h"
     11#include "strutilxx.h"
    1112
    1213#include "pistdimgapp.h"
     
    4647
    4748
     49/* Macro pour tester si flag normalized coordinate est present */
     50#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
    4851 
    4952/* --Methode-- */
     
    123126}
    124127else if (kw == "addtext") {
    125   if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl;  return(0); }
     128  if (tokens.size() < 3) {
     129    cout << "Usage: addtext x y txt [colfontatt] [fgnc]" << endl; 
     130    return(0);
     131  }
    126132  double xp = atof(tokens[0].c_str());
    127133  double yp = atof(tokens[1].c_str());
     
    129135  string sop;
    130136  if (tokens.size() > 3) sop = tokens[3];
    131   mImgApp->AddText(txt, xp, yp, sop);
     137  bool fgnc = _CkBoolNC_(4); 
     138  mImgApp->AddText(txt, xp, yp, sop, fgnc);
     139  }
     140else if (kw == "addctext") {
     141  if (tokens.size() < 5) {
     142    cout << "Usage: addctext x y txt s_up s_dn [colfontatt] [updnfatt] [fgnc] " << endl; 
     143    return(0);
     144  }
     145  double xp = atof(tokens[0].c_str());
     146  double yp = atof(tokens[1].c_str());
     147  string sop;
     148  if (tokens.size() > 5) sop = tokens[5];
     149  string sopfss;
     150  if (tokens.size() > 6) sopfss = tokens[6];
     151  bool fgnc = _CkBoolNC_(7); 
     152  mImgApp->AddCompText(tokens[2], tokens[3], tokens[4], xp, yp, sop, sopfss, fgnc);
    132153  }
    133154else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
    134155         (kw == "addarrow") ) {
    135   if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl;  return(0); }
     156  if (tokens.size() < 4) {
     157    cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt] [fgnc]" << endl; 
     158    return(0);
     159  }
    136160  double xp1 = atof(tokens[0].c_str());
    137161  double yp1 = atof(tokens[1].c_str());
     
    140164  string sop;
    141165  if (tokens.size() > 4) sop = tokens[4];
    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);
     166  bool fgnc = _CkBoolNC_(5); 
     167  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
     168  else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
    144169  else {
    145170    bool fgfill = (kw == "addrect") ? false : true;
    146     mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill);
     171    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
    147172  }
    148173}
    149174else if ((kw == "addcirc") || (kw == "addfcirc")) {
    150   if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl;  return(0); }
     175  if (tokens.size() < 3) {
     176    cout << "Usage: addcirc/addfcirc xc yc r [colatt] [fgnc]" << endl; 
     177    return(0);
     178  }
    151179  double xc = atof(tokens[0].c_str());
    152180  double yc = atof(tokens[1].c_str());
     
    154182  string sop;
    155183  if (tokens.size() > 3) sop = tokens[3];
     184  bool fgnc = _CkBoolNC_(4); 
    156185  bool fgfill = (kw == "addcirc") ? false : true;
    157   mImgApp->AddCircle(xc, yc, rad, sop, fgfill);
     186  mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc);
    158187  }
    159188else if (kw == "addmarker") {
    160189  if (tokens.size() < 2) {
    161     cout << "Usage: addmarker x y [gratt]" << endl; 
     190    cout << "Usage: addmarker x y [gratt] [fgnc]" << endl; 
    162191    return(0);
    163192  }
     
    166195  string sop;
    167196  if (tokens.size() > 2) sop = tokens[2];
    168   mImgApp->AddCircle(xm, ym, -1, sop, false);
     197  bool fgnc = _CkBoolNC_(3); 
     198  mImgApp->AddCircle(xm, ym, -1, sop, false, fgnc);
    169199}
    170200else if ((kw == "addarc") || (kw == "addfarc") ) {
    171201  if (tokens.size() < 6) {
    172     cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt]" << endl; 
     202    cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt] [fgnc]" << endl; 
    173203    return(0);
    174204  }
     
    181211  string sop;
    182212  if (tokens.size() > 6) sop = tokens[6];
     213  bool fgnc = _CkBoolNC_(7); 
    183214  bool fgfill = (kw == "addarc") ? false : true;
    184   mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill);
    185 }
     215  mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill, fgnc);
     216}
     217else if ((kw == "addpoly") || (kw == "addfpoly")) {
     218  if (tokens.size() < 1) {
     219    cout << "Usage: addpoly/addfpoly 'x1,y1 x2,y2 x3,y3 ...' [gratt] [fgnc]" << endl; 
     220    return(0);
     221  }
     222  vector<string> sxy;
     223  vector<double> xpol, ypol;
     224  double xp, yp;
     225  FillVStringFrString(tokens[0], sxy);
     226  for(int jkk=0; jkk<sxy.size(); jkk++) {
     227    xp = yp = 0;
     228    if (sscanf(sxy[jkk].c_str(), "%lg,%lg", &xp, &yp) == 2) {
     229      xpol.push_back(xp);
     230      ypol.push_back(yp);
     231    }
     232  }
     233  string sop;
     234  if (tokens.size() > 1) sop = tokens[1];
     235  bool fgnc = _CkBoolNC_(2); 
     236  bool fgfill = (kw == "addpoly") ? false : true;
     237  mImgApp->AddPoly(xpol, ypol, sop, fgfill, fgnc);
     238  }
    186239
    187240
     
    704757  srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
    705758  }
     759
     760#ifndef SANS_EVOLPLANCK
     761/* Lecture matrice/vecteur depuis fichier ASCII  */
     762else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
     763  if(tokens.size() < 2) {
     764    cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name "<<endl;
     765    return(0);
     766    }
     767  TMatrix<r_8> mtx;
     768  TVector<r_8> vec;
     769  FILE* fip = fopen(tokens[1].c_str(), "r");
     770  if (fip == NULL) {
     771    cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
     772    return(0);
     773  }
     774  fclose(fip);
     775  ifstream is(tokens[1].c_str());
     776  sa_size_t nr, nc;
     777  if (kw == "mtxfrascii") {
     778    mtx.ReadASCII(is, nr, nc);
     779    mObjMgr->AddObj(mtx, tokens[0]);   
     780    cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
     781         << tokens[1] << endl;
     782  }
     783  else {
     784    vec.ReadASCII(is, nr, nc);
     785    mObjMgr->AddObj(vec, tokens[0]);   
     786    cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
     787         << tokens[1] << endl;
     788  }
     789}
     790#endif
    706791
    707792else if (kw == "fillnt" ) {
     
    851936usage += "             hugefont  hugeboldfont hugeitalicfont hugebolditalicfont \n";
    852937usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont  \n";
    853 usage += ">> Marker: dotmarker<T>  plusmarker<T>  crossmarker<T> circlemarker <T> \n";
     938usage += ">> Marker: dotmarker<T>  plusmarker<T>  crossmarker<T> circlemarker<T> \n";
    854939usage += "           fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
    855940usage += "           ftrianglemarker<T>  starmarker<T>  fstarmarker<T> \n";
    856 usage += "   with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
     941usage += "   with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n";
     942usage += ">> ArrowMarker: basicarrow<T>  trianglearrow<T>  ftrianglearrow<T> \n";
     943usage += "                arrowshapedarrow<T> farrowshapedarrow<T> \n";
     944usage += "   with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n";
    857945usage += ">> ColorTables: defcmap  grey32  invgrey32  colrj32  colbr32 \n";
    858946usage += "                grey128  invgrey128  colrj128  colbr128 \n";
     
    9141002usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
    9151003usage += "\n Alt<Z> to remove added elements";
    916 usage += "\n  Usage: addtext x y TextString [ColFontPosAtt]";
     1004usage += "\n  Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
    9171005usage += "\n  (use quotes '' for multi word text strings) ";
     1006usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9181007usage += "\n Text position/direction attribute: ";
    9191008usage += "\n      horizleft horizcenter horizright";
    9201009usage += "\n      vertbottom vertcenter verttop ";
    9211010usage += "\n      textdirhoriz textdirvertup textdirvertdown ";
    922 usage += "\n  Related commands: addline addarrow addrect addfrect";
    923 usage += "\n      addcirc addfcirc addarc addfrac settitle graphicatt"; 
     1011usage += "\n  Related commands: addctext addline addarrow addrect addfrect";
     1012usage += "\n      addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt"; 
     1013mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1014
     1015kw = "addctext";
     1016usage = "Adds a composite text string with superscript and subscripts ";
     1017usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
     1018usage += "\n  Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
     1019usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
     1020usage += "\n  Related commands: addtext addline addrect ...";
     1021usage += "\n      (See command addtext and graphicatt for more details)"; 
    9241022mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9251023
     
    9291027usage += "\n The Base/AxesDrawer is used to handle added lines";
    9301028usage += "\n Alt<Z> to remove added elements";
    931 usage += "\n  Usage: addline x1 y1 x2 y2 [GraphicAtt]";
     1029usage += "\n  Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
     1030usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9321031usage += "\n  Related commands: addarrow addtext addrect addfrect ";
    933 usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt"; 
     1032usage += "\n       addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
    9341033mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9351034
     
    9391038usage += "\n The Base/AxesDrawer is used to handle added lines";
    9401039usage += "\n Alt<Z> to remove added elements";
    941 usage += "\n  Usage: addarrow x1 y1 x2 y2 [GraphicAtt]";
     1040usage += "\n  Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
     1041usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9421042usage += "\n  Related commands: addline addtext addrect addfrect ";
    943 usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt"; 
    944 mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1043usage += "\n       addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
     1044mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1045kw = "addarrow_nc";
    9451046
    9461047kw = "addrect";
     
    9491050usage += "\n The Base/AxesDrawer is used to handle added rectangle";
    9501051usage += "\n Alt<Z> to remove added elements";
    951 usage += "\n  Usage: addrect x1 y1 x2 y2 [GraphicAtt]";
     1052usage += "\n  Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
     1053usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9521054usage += "\n  Related commands: addtext addline addarrow addfrect";
    953 usage += "\n       addcirc addfcirc addarc addfarc graphicatt"; 
     1055usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
    9541056mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9551057
     
    9591061usage += "\n The Base/AxesDrawer is used to handle added rectangle";
    9601062usage += "\n Alt<Z> to remove added elements";
    961 usage += "\n  Usage: addfrect x1 y1 x2 y2 [GraphicAtt]";
     1063usage += "\n  Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
     1064usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9621065usage += "\n  Related commands: addtext addline addarrow addrect";
    963 usage += "\n       addcirc addfcirc graphicatt"; 
     1066usage += "\n       addcirc addfcirc addpoly addfpoly graphicatt"; 
    9641067mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9651068
     
    9691072usage += "\n The Base/AxesDrawer is used to handle added circles";
    9701073usage += "\n Alt<Z> to remove added elements";
    971 usage += "\n  Usage: addmarker xpos ypos [GraphicAtt]";
     1074usage += "\n  Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
     1075usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9721076usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    973 usage += "\n       addcirc addfcirc addarc addfarc graphicatt"; 
     1077usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
    9741078mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9751079
     
    9791083usage += "\n The Base/AxesDrawer is used to handle added circles";
    9801084usage += "\n Alt<Z> to remove added elements";
    981 usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
     1085usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
     1086usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9821087usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    983 usage += "\n       addfcirc addarc addfarc graphicatt"; 
     1088usage += "\n       addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
    9841089mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9851090
     
    9891094usage += "\n The Base/AxesDrawer is used to handle added circles";
    9901095usage += "\n Alt<Z> to remove added elements";
    991 usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
     1096usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
     1097usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    9921098usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    993 usage += "\n       addcirc addarc addfarc graphicatt"; 
     1099usage += "\n       addcirc addarc addfarc addpoly addfpoly graphicatt"; 
    9941100mpiac->RegisterCommand(kw, usage, this, "Graphics");
    9951101
     
    9991105usage += "\n The Base/AxesDrawer is used to handle added arcs";
    10001106usage += "\n Alt<Z> to remove added elements";
    1001 usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
     1107usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
     1108usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    10021109usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    1003 usage += "\n       addcirc addfcirc addfarc graphicatt"; 
     1110usage += "\n       addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 
    10041111mpiac->RegisterCommand(kw, usage, this, "Graphics");
    10051112
     
    10091116usage += "\n The Base/AxesDrawer is used to handle added arcs";
    10101117usage += "\n Alt<Z> to remove added elements";
    1011 usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
     1118usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
     1119usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
    10121120usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    1013 usage += "\n       addcirc addfcirc addfarc graphicatt"; 
     1121usage += "\n       addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 
     1122mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1123
     1124kw = "addpoly";
     1125usage = "Adds a polyline/polygon to the current graphic object";
     1126usage += "\n  Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
     1127usage += "\n  Coordinates specified as pairs x,y in a single word (use simple or double quotes";
     1128usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
     1129usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     1130usage += "\n       addcirc addfcirc addfarc  graphicatt"; 
     1131mpiac->RegisterCommand(kw, usage, this, "Graphics");
     1132
     1133kw = "addfpoly";
     1134usage = "Adds a filled polygon to the current graphic object";
     1135usage += "\n  Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
     1136usage += "\n  Coordinates specified as pairs x,y in a single word (use simple or double quotes";
     1137usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
     1138usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
     1139usage += "\n       addcirc addfcirc addfarc  graphicatt"; 
    10141140mpiac->RegisterCommand(kw, usage, this, "Graphics");
    10151141
     
    10391165
    10401166kw = "openfits";
    1041 usage = "Loads a FITS file into an apprpiate object \n Usage: openfits filename";
     1167usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
    10421168usage += "\n  Related commands: savefits openppf"; 
    10431169mpiac->RegisterCommand(kw, usage, this, "FileIO");
     
    10711197usage += "\n  Related commands: ntloop fillnt ";
    10721198mpiac->RegisterCommand(kw, usage, this, "FileIO");
    1073 
     1199#ifndef SANS_EVOLPLANCK
     1200kw = "mtxfrascii";
     1201usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
     1202usage += "\n Usage: mtxfrascii mtx_name file_name";
     1203usage += "\n  Related commands: vecfrascii ntfrascii ";
     1204mpiac->RegisterCommand(kw, usage, this, "FileIO");
     1205kw = "vecfrascii";
     1206usage = "Reads a vactor from an ASCII file (TVector<r_8>)";
     1207usage += "\n Usage: vecfrascii vec_name file_name";
     1208usage += "\n  Related commands: mtxfrascii ntfrascii ";
     1209mpiac->RegisterCommand(kw, usage, this, "FileIO");
     1210#endif
    10741211
    10751212kw = "print";
     
    14911628usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
    14921629usage += "o <Alt>X : Show/Hide the Cut Window \n";
    1493 usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
     1630usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
     1631usage += "o <Alt>E : Removes the last added graphic element \n";
    14941632usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
    14951633usage += "o <Alt>- or <Cntl>- : Zoom out \n";
     
    15101648usage += "           Drawer 0 manages the axes, as well as the added text \n";
    15111649usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
    1512 usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
     1650usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
     1651usage += "o <Alt>E : Removes the last added graphic element \n";
    15131652usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
    15141653usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
     
    15301669usage += "o <Alt>O : = <Alt>G \n";
    15311670usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
    1532 usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
     1671usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
     1672usage += "o <Alt>E : Removes the last added graphic element \n";
    15331673usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
    15341674usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r2218 r2263  
    13941394  return;
    13951395}
    1396 Vector * vx = dynamic_cast<Vector *>(obj);
    1397 if (vx == NULL) {
    1398   cout << "NamedObjMgr::DisplayVector() Error " << nomvx << " not a Vector ! " << endl;
     1396//Vector * vx = dynamic_cast<Vector *>(obj);
     1397BaseArray* bax = dynamic_cast<BaseArray *>(obj);
     1398if (bax == NULL) {
     1399  cout << "NamedObjMgr::DisplayVector() Error " << nomvx << " not a BaseArray ! " << endl;
    13991400  return; 
    14001401}
     
    14051406  return;
    14061407}
    1407 Vector * vy = dynamic_cast<Vector *>(obj);
    1408 if (vy == NULL) {
    1409   cout << "NamedObjMgr::DisplayVector() Error " << nomvy << " not a Vector ! " << endl;
     1408BaseArray* bay = dynamic_cast<BaseArray *>(obj);
     1409if (bay == NULL) {
     1410  cout << "NamedObjMgr::DisplayVector() Error " << nomvy << " not a BaseArray ! " << endl;
    14101411  return; 
    14111412}
    14121413
    1413 
     1414Vector vx = *bax;
     1415Vector vy = *bay;
    14141416Vector * cvx, * cvy;
    14151417
    1416 if (vx->Size() != vy->Size()) {
     1418if (vx.Size() != vy.Size()) {
    14171419  cout << "NamedObjMgr::DisplayVector() Warning / Vx.Size() != Vy.Size() " << endl;
    1418   if (vx->Size() < vy->Size()) {
    1419     cvx = new Vector(*vx);
    1420     cvy = new Vector(vy->SubVector(Range(0, 0, vx->Size()-1)));
     1420  if (vx.Size() < vy.Size()) {
     1421    cvx = new Vector(vx);
     1422    cvy = new Vector(vy.SubVector(Range(0, 0, vx.Size()-1)));
    14211423  }
    14221424  else {
    1423     cvx = new Vector(vx->SubVector(Range(0, 0, vy->Size()-1)));
    1424     cvy = new Vector(*vy);
     1425    cvx = new Vector(vx.SubVector(Range(0, 0, vy.Size()-1)));
     1426    cvy = new Vector(vy);
    14251427  }
    14261428}
    14271429else {
    1428   cvx = new Vector(*vx);
    1429   cvy = new Vector(*vy);
     1430  cvx = new Vector(vx);
     1431  cvy = new Vector(vy);
    14301432}
    14311433
  • trunk/SophyaPI/PIext/piacmd.cc

    r2241 r2263  
    17121712}
    17131713
    1714 /* --Methode-- */
    1715 void PIACmd::HelptoLaTex(string const & fname)
     1714/*  Les definitions suivantes doivent se trouver ds l'en-tete du fichier LaTeX
     1715  \newcommand{\piacommand}[1]{
     1716    \framebox{\bf \Large #1 } \index{#1} % (Command)
     1717  }
     1718
     1719  \newcommand{\piahelpitem}[1]{
     1720    \framebox{\bf \Large #1 } \index{#1} (Help item)
     1721  }
     1722
     1723  \newcommand{\myppageref}[1]{ (p. \pageref{#1} ) }
     1724*/
     1725
     1726/* --Methode-- */
     1727void PIACmd::HelptoLaTeX(string const & fname)
    17161728{
    17171729FILE *fip;
     
    17251737fputs("\\begin{itemize} \n",fip);
    17261738CmdHGroup::iterator it;
    1727 for(it = cmdhgrp.begin(); it != cmdhgrp.end(); it++)
     1739for(it = cmdhgrp.begin(); it != cmdhgrp.end(); it++) {
     1740  if ((*it).first == "All") continue;
    17281741  fprintf(fip,"\\item {\\bf %s }  (p. \\pageref{%s}) \n",
    17291742         (*it).first.c_str(), (*it).first.c_str());
     1743}
    17301744
    17311745fputs("\\end{itemize} \n",fip);
    17321746
    1733 fputs("\\newpage \n",fip);
     1747fputs("\\vspace*{10mm} \n",fip);
    17341748
    17351749CmdExmap::iterator ite;
     
    17501764fputs("\\end{tabular} \n", fip);
    17511765fputs("\\end{center} \n", fip);
    1752 fputs("\n \n \\vspace{1cm} \n",fip);
     1766fputs("\n \n \\newpage  \\vspace{1cm} \n",fip);
    17531767
    17541768fputs("\\begin{center} \n ", fip);
     
    17771791  fprintf(fip,"\\subsection{%s} \\label{%s} \n",
    17781792          (*it).first.c_str(), (*it).first.c_str());
     1793  fprintf(fip,"\\noindent \n");
    17791794  for(ite = helpexmap.begin(); ite != helpexmap.end(); ite++) {
    17801795    if ((*ite).second.group != gid)  continue;
    1781     fprintf(fip,"{ \\Large $ \\star \\star \\star $ }  Help item {\\bf \\Large %s } \\label{%s} \n",
     1796    fprintf(fip,"\\piahelpitem{%s} \\label{%s} \n",
    17821797            (*ite).first.c_str(), (*ite).first.c_str());
    17831798    fputs("\\begin{verbatim} \n",fip);
     
    17871802  for(ite = cmdexmap.begin(); ite != cmdexmap.end(); ite++) {
    17881803    if ((*ite).second.group != gid)  continue;
    1789     fprintf(fip,"{ \\Large $ \\star \\star \\star $ }  Command {\\bf \\Large %s } \\label{%s} \n",
     1804    fprintf(fip,"\\piacommand{%s} \\label{%s} \n",
    17901805            (*ite).first.c_str(), (*ite).first.c_str());
    17911806    fputs("\\begin{verbatim} \n",fip);
  • trunk/SophyaPI/PIext/piacmd.h

    r2241 r2263  
    9191          void          ShowCxxExecWindow();
    9292
    93   virtual void          HelptoLaTex(string const & flnm);
     93  virtual void          HelptoLaTeX(string const & flnm);
    9494
    9595  inline  CmdInterpreter* CurrentInterpreter() { return(curcmdi); }
  • trunk/SophyaPI/PIext/piaversion.h

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

    r2259 r2263  
    1919
    2020#include "pistdimgapp.h"
     21#include "servnobjm.h"
    2122// #include "pihisto2d.h"
    2223#include "psfile.h"
     
    9596m[0]->AppendItem("Open-Fits", 10120);
    9697m[0]->AppendItem("Open-PPF", 10130);
     98#ifndef SANS_EVOLPLANCK
     99m[0]->AppendItem("Open-ASCII", 10140);
     100#endif
    97101// m[0]->AppendItem("Options", 10101);
    98102m[0]->AppendItem("Help", 10100);
     
    251255pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
    252256pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
     257pfc_ascii = new PIFileChooser(this,"ASCII-FileChooser", 10145);
    253258pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
    254259
     
    345350delete pfc_fits;
    346351delete pfc_ppf;
     352delete pfc_ascii;
    347353delete pfc_ps;
    348354
     
    796802
    797803/* --Methode-- */
    798 void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
     804void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop, bool fgcn)
    799805{
    800806PIDrawer *eld=CurrentElDrawer();
     
    813819unsigned long tpd = 0;
    814820gratt.DecodeTextPosDirAtt(opts, tpd, false);
    815 elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd);
     821elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd, fgcn);
    816822eld->Refresh();
    817823}
    818824
    819825/* --Methode-- */
     826void PIStdImgApp::AddCompText(string const & txt, string const & txtup, string const & txtdn,
     827                              double xp, double yp, string const& sop,
     828                              string const& optss, bool fgcn)
     829{
     830PIDrawer *eld=CurrentElDrawer();
     831if (eld == NULL) return;
     832PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     833PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     834if ((eld2 == NULL) && (eld3 == NULL)) return;
     835PIElDrwMgr* elmgr;
     836if (eld2) elmgr = &(eld2->ElDrwMgr());
     837else if (eld3) elmgr = &(eld3->ElDrwMgr());
     838if (elmgr == NULL) return;
     839
     840vector<string> opts;
     841ParseDisplayOption(sop, opts);
     842PIGraphicAtt gratt(opts);
     843unsigned long tpd = 0;
     844gratt.DecodeTextPosDirAtt(opts, tpd, false);
     845ParseDisplayOption(optss, opts);
     846PIGraphicAtt grattss(opts);
     847elmgr->ElAddCompText(xp,yp,txt.c_str(), gratt, txtup, txtdn, grattss, tpd, fgcn);
     848eld->Refresh();
     849}
     850
     851/* --Methode-- */
    820852void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2,
    821                           string const& sop, bool fgarrow)
     853                          string const& sop, bool fgarrow, bool fgcn)
    822854{
    823855PIDrawer *eld=CurrentElDrawer();
     
    835867PIGraphicAtt gratt(opts);
    836868if (fgarrow)
    837   elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt);
    838 else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
     869  elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt, fgcn);
     870else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt, fgcn);
    839871eld->Refresh();
    840872}
     
    842874/* --Methode-- */
    843875void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
    844                                string const& sop, bool fgfill)
     876                               string const& sop, bool fgfill, bool fgcn)
    845877{
    846878PIDrawer *eld=CurrentElDrawer();
     
    872904PIGraphicAtt gratt(opts);
    873905
    874 if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt);
    875 else elmgr->ElAddRect(xp, yp, dx, dy, gratt);
     906if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt, fgcn);
     907else elmgr->ElAddRect(xp, yp, dx, dy, gratt, fgcn);
    876908eld->Refresh();
    877909}
    878910
    879911/* --Methode-- */
    880 void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
     912void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop,
     913                            bool fgfill, bool fgcn)
    881914{
    882915PIDrawer *eld=CurrentElDrawer();
     
    895928  elmgr->ElAddMarker(xc, yc, gratt);
    896929else {
    897   if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
    898   else elmgr->ElAddCirc(xc, yc, r, gratt);
     930  if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt, fgcn);
     931  else elmgr->ElAddCirc(xc, yc, r, gratt, fgcn);
    899932}
    900933eld->Refresh();
     
    903936/* --Methode-- */
    904937void PIStdImgApp::AddArc(double x1, double y1, double x2, double y2,
    905                          double x3, double y3, string const& sop, bool fgfill)
     938                         double x3, double y3, string const& sop, bool fgfill, bool fgcn)
    906939{
    907940PIDrawer *eld=CurrentElDrawer();
     
    919952PIGraphicAtt gratt(opts);
    920953if (fgfill)
    921   elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt);
    922 else  elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt);
     954  elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
     955else  elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
    923956eld->Refresh();
    924957}
     958
     959/* --Methode-- */
     960void PIStdImgApp::AddPoly(vector<double>& xpol, vector<double>& ypol,
     961                          string const& sop, bool fgfill, bool fgcn)
     962{
     963PIDrawer *eld=CurrentElDrawer();
     964if (eld == NULL) return;
     965PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     966PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     967if ((eld2 == NULL) && (eld3 == NULL)) return;
     968PIElDrwMgr* elmgr = NULL;
     969if (eld2) elmgr = &(eld2->ElDrwMgr());
     970else if (eld3) elmgr = &(eld3->ElDrwMgr());
     971if (elmgr == NULL) return;
     972
     973vector<string> opts;
     974ParseDisplayOption(sop, opts);
     975PIGraphicAtt gratt(opts);
     976if (fgfill)
     977  elmgr->ElAddFPoly(xpol, ypol, gratt, fgcn);
     978else  elmgr->ElAddPoly(xpol, ypol, gratt, fgcn);
     979eld->Refresh();
     980
     981}
     982
    925983
    926984/* --Methode-- */
     
    14261484      break;
    14271485       
     1486#ifndef SANS_EVOLPLANCK
     1487    case 10140 :
     1488      pfc_ascii->AcceptNewFile(false);
     1489      mFCMsg = 10145;
     1490      pfc_ascii->SetMsg(mFCMsg);
     1491      SetBlocked();
     1492      pfc_ascii->Show();
     1493      break;
     1494
     1495    case 10145 :
     1496      SetBusy();
     1497      if (data)  {
     1498        string afname = pfc_ascii->GetFileName();
     1499        string nomobj = ObjMgr()->GetServiceObj()->FileName2Name(afname);
     1500        string cmd = "mtxfrascii ";
     1501        cmd += nomobj;  cmd += " ";  cmd += afname;
     1502        try {
     1503          mCmd->Interpret(cmd);
     1504        } 
     1505        catch ( PThrowable & exc ) {
     1506          cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
     1507               << (string)typeid(exc).name() << " Msg= "
     1508               << exc.Msg() << endl;
     1509          cout << endl;
     1510        }
     1511        catch ( ... ) {
     1512          cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ... " << endl;
     1513          cout << endl;
     1514        }
     1515       
     1516      }
     1517      mFCMsg = 0;
     1518      SetReady();
     1519      break;
     1520#endif
     1521
    14281522    case 10105:
    14291523      Stop();
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2243 r2263  
    6666     
    6767  //  Fonction d'ajout de texte (provisoire - Aout 99)
    68      void AddText(string const & txt, double xp, double yp, string const& opt);
     68     void AddText(string const & txt, double xp, double yp, string const& opt, bool fgcn=false);
     69     void AddCompText(string const & txt, string const & txtup, string const & txtdn,
     70                      double xp, double yp, string const& opt,
     71                      string const& optss, bool fgcn=false);
    6972  //  Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
    7073     void AddLine(double xp1, double yp1, double xp2, double yp2,
    71                   string const& opt, bool fgarrow=false);
     74                  string const& opt, bool fgarrow=false, bool fgcn=false);
    7275     void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
    73                        bool fgfill=false);
     76                       bool fgfill=false, bool fgcn=false);
    7477     void AddCircle(double xc, double yc, double r, string const& opt,
    75                     bool fgfill=false);
     78                    bool fgfill=false, bool fgcn=false);
    7679     void AddArc(double x1, double y1, double x2, double y2,
    77                  double x3, double y3, string const& opt, bool fgfill=false);
     80                 double x3, double y3, string const& opt, bool fgfill=false, bool fgcn=false);
     81     void AddPoly(vector<double>& x, vector<double>& y,
     82                  string const& opt, bool fgfill=false, bool fgcn=false);
    7883
    7984  //  Fonction Ajout de titre de trace
     
    172177    PIFileChooser * pfc_fits;   // Pour les fichiers FITS
    173178    PIFileChooser * pfc_ppf;    //  Pour les PPF
     179    PIFileChooser * pfc_ascii;  //  Pour les fichiers ASCII
    174180    PIFileChooser * pfc_ps;     // Pour les PostScript
    175181
Note: See TracChangeset for help on using the changeset viewer.