Index: trunk/SophyaPI/PIext/basexecut.cc
===================================================================
--- trunk/SophyaPI/PIext/basexecut.cc	(revision 2243)
+++ trunk/SophyaPI/PIext/basexecut.cc	(revision 2263)
@@ -9,4 +9,5 @@
 #include "pdlmgr.h"
 #include "ctimer.h"
+#include "strutilxx.h"
 
 #include "pistdimgapp.h"
@@ -46,4 +47,6 @@
 
 
+/* Macro pour tester si flag normalized coordinate est present */
+#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
  
 /* --Methode-- */
@@ -123,5 +126,8 @@
 }
 else if (kw == "addtext") {
-  if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl;  return(0); }
+  if (tokens.size() < 3) { 
+    cout << "Usage: addtext x y txt [colfontatt] [fgnc]" << endl;  
+    return(0); 
+  }
   double xp = atof(tokens[0].c_str());
   double yp = atof(tokens[1].c_str());
@@ -129,9 +135,27 @@
   string sop;
   if (tokens.size() > 3) sop = tokens[3];
-  mImgApp->AddText(txt, xp, yp, sop);
+  bool fgnc = _CkBoolNC_(4);  
+  mImgApp->AddText(txt, xp, yp, sop, fgnc);
+  }
+else if (kw == "addctext") {
+  if (tokens.size() < 5) { 
+    cout << "Usage: addctext x y txt s_up s_dn [colfontatt] [updnfatt] [fgnc] " << endl;  
+    return(0); 
+  }
+  double xp = atof(tokens[0].c_str());
+  double yp = atof(tokens[1].c_str());
+  string sop;
+  if (tokens.size() > 5) sop = tokens[5];
+  string sopfss;
+  if (tokens.size() > 6) sopfss = tokens[6];
+  bool fgnc = _CkBoolNC_(7);  
+  mImgApp->AddCompText(tokens[2], tokens[3], tokens[4], xp, yp, sop, sopfss, fgnc);
   }
 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
 	 (kw == "addarrow") ) {
-  if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl;  return(0); }
+  if (tokens.size() < 4) { 
+    cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt] [fgnc]" << endl;  
+    return(0); 
+  }
   double xp1 = atof(tokens[0].c_str());
   double yp1 = atof(tokens[1].c_str());
@@ -140,13 +164,17 @@
   string sop;
   if (tokens.size() > 4) sop = tokens[4];
-  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false);
-  else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true);
+  bool fgnc = _CkBoolNC_(5);  
+  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
+  else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
   else {
     bool fgfill = (kw == "addrect") ? false : true;
-    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill);
+    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
   }
 }
 else if ((kw == "addcirc") || (kw == "addfcirc")) {
-  if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl;  return(0); }
+  if (tokens.size() < 3) { 
+    cout << "Usage: addcirc/addfcirc xc yc r [colatt] [fgnc]" << endl;  
+    return(0); 
+  }
   double xc = atof(tokens[0].c_str());
   double yc = atof(tokens[1].c_str());
@@ -154,10 +182,11 @@
   string sop;
   if (tokens.size() > 3) sop = tokens[3];
+  bool fgnc = _CkBoolNC_(4);  
   bool fgfill = (kw == "addcirc") ? false : true;
-  mImgApp->AddCircle(xc, yc, rad, sop, fgfill);
+  mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc);
   }
 else if (kw == "addmarker") {
   if (tokens.size() < 2) { 
-    cout << "Usage: addmarker x y [gratt]" << endl;  
+    cout << "Usage: addmarker x y [gratt] [fgnc]" << endl;  
     return(0); 
   }
@@ -166,9 +195,10 @@
   string sop;
   if (tokens.size() > 2) sop = tokens[2];
-  mImgApp->AddCircle(xm, ym, -1, sop, false);
+  bool fgnc = _CkBoolNC_(3);  
+  mImgApp->AddCircle(xm, ym, -1, sop, false, fgnc);
 }
 else if ((kw == "addarc") || (kw == "addfarc") ) {
   if (tokens.size() < 6) { 
-    cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt]" << endl;  
+    cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt] [fgnc]" << endl;  
     return(0); 
   }
@@ -181,7 +211,30 @@
   string sop;
   if (tokens.size() > 6) sop = tokens[6];
+  bool fgnc = _CkBoolNC_(7);  
   bool fgfill = (kw == "addarc") ? false : true;
-  mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill);
-}
+  mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill, fgnc);
+}
+else if ((kw == "addpoly") || (kw == "addfpoly")) {
+  if (tokens.size() < 1) { 
+    cout << "Usage: addpoly/addfpoly 'x1,y1 x2,y2 x3,y3 ...' [gratt] [fgnc]" << endl;  
+    return(0); 
+  }
+  vector<string> sxy;
+  vector<double> xpol, ypol;
+  double xp, yp;
+  FillVStringFrString(tokens[0], sxy);
+  for(int jkk=0; jkk<sxy.size(); jkk++) {
+    xp = yp = 0;
+    if (sscanf(sxy[jkk].c_str(), "%lg,%lg", &xp, &yp) == 2) { 
+      xpol.push_back(xp); 
+      ypol.push_back(yp);
+    }
+  }
+  string sop;
+  if (tokens.size() > 1) sop = tokens[1];
+  bool fgnc = _CkBoolNC_(2);  
+  bool fgfill = (kw == "addpoly") ? false : true;
+  mImgApp->AddPoly(xpol, ypol, sop, fgfill, fgnc);
+  }
 
 
@@ -704,4 +757,36 @@
   srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
   }
+
+#ifndef SANS_EVOLPLANCK
+/* Lecture matrice/vecteur depuis fichier ASCII  */
+else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
+  if(tokens.size() < 2) { 
+    cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name "<<endl;
+    return(0);
+    }
+  TMatrix<r_8> mtx;
+  TVector<r_8> vec;
+  FILE* fip = fopen(tokens[1].c_str(), "r");
+  if (fip == NULL) {
+    cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
+    return(0);
+  }
+  fclose(fip);
+  ifstream is(tokens[1].c_str());
+  sa_size_t nr, nc;
+  if (kw == "mtxfrascii") {
+    mtx.ReadASCII(is, nr, nc);
+    mObjMgr->AddObj(mtx, tokens[0]);    
+    cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file " 
+	 << tokens[1] << endl;
+  }
+  else {
+    vec.ReadASCII(is, nr, nc);
+    mObjMgr->AddObj(vec, tokens[0]);    
+    cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file " 
+	 << tokens[1] << endl;
+  }
+}
+#endif
 
 else if (kw == "fillnt" ) {
@@ -851,8 +936,11 @@
 usage += "             hugefont  hugeboldfont hugeitalicfont hugebolditalicfont \n";
 usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont  \n";
-usage += ">> Marker: dotmarker<T>  plusmarker<T>  crossmarker<T> circlemarker <T> \n";
+usage += ">> Marker: dotmarker<T>  plusmarker<T>  crossmarker<T> circlemarker<T> \n";
 usage += "           fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
 usage += "           ftrianglemarker<T>  starmarker<T>  fstarmarker<T> \n";
-usage += "   with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
+usage += "   with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n";
+usage += ">> ArrowMarker: basicarrow<T>  trianglearrow<T>  ftrianglearrow<T> \n";
+usage += "                arrowshapedarrow<T> farrowshapedarrow<T> \n";
+usage += "   with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n";
 usage += ">> ColorTables: defcmap  grey32  invgrey32  colrj32  colbr32 \n";
 usage += "                grey128  invgrey128  colrj128  colbr128 \n";
@@ -914,12 +1002,22 @@
 usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addtext x y TextString [ColFontPosAtt]";
+usage += "\n  Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
 usage += "\n  (use quotes '' for multi word text strings) ";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n Text position/direction attribute: "; 
 usage += "\n      horizleft horizcenter horizright";
 usage += "\n      vertbottom vertcenter verttop ";
 usage += "\n      textdirhoriz textdirvertup textdirvertdown ";
-usage += "\n  Related commands: addline addarrow addrect addfrect";
-usage += "\n      addcirc addfcirc addarc addfrac settitle graphicatt";  
+usage += "\n  Related commands: addctext addline addarrow addrect addfrect";
+usage += "\n      addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";  
+mpiac->RegisterCommand(kw, usage, this, "Graphics");
+
+kw = "addctext";
+usage = "Adds a composite text string with superscript and subscripts ";
+usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
+usage += "\n  Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
+usage += "\n  Related commands: addtext addline addrect ...";
+usage += "\n      (See command addtext and graphicatt for more details)";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -929,7 +1027,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added lines"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addline x1 y1 x2 y2 [GraphicAtt]";
+usage += "\n  Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addarrow addtext addrect addfrect ";
-usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt";  
+usage += "\n       addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -939,8 +1038,10 @@
 usage += "\n The Base/AxesDrawer is used to handle added lines"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addarrow x1 y1 x2 y2 [GraphicAtt]";
+usage += "\n  Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addline addtext addrect addfrect ";
-usage += "\n       addmarker addcirc addfcirc addarc addfarc graphicatt";  
-mpiac->RegisterCommand(kw, usage, this, "Graphics");
+usage += "\n       addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";  
+mpiac->RegisterCommand(kw, usage, this, "Graphics");
+kw = "addarrow_nc";
 
 kw = "addrect";
@@ -949,7 +1050,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addrect x1 y1 x2 y2 [GraphicAtt]";
+usage += "\n  Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect";
-usage += "\n       addcirc addfcirc addarc addfarc graphicatt";  
+usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -959,7 +1061,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addfrect x1 y1 x2 y2 [GraphicAtt]";
+usage += "\n  Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addrect";
-usage += "\n       addcirc addfcirc graphicatt";  
+usage += "\n       addcirc addfcirc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -969,7 +1072,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added circles"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addmarker xpos ypos [GraphicAtt]";
+usage += "\n  Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
-usage += "\n       addcirc addfcirc addarc addfarc graphicatt";  
+usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -979,7 +1083,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added circles"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
+usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
-usage += "\n       addfcirc addarc addfarc graphicatt";  
+usage += "\n       addfcirc addarc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -989,7 +1094,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added circles"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt]";
+usage += "\n  Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
-usage += "\n       addcirc addarc addfarc graphicatt";  
+usage += "\n       addcirc addarc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -999,7 +1105,8 @@
 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
+usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
-usage += "\n       addcirc addfcirc addfarc graphicatt";  
+usage += "\n       addcirc addfcirc addfarc addpoly addfpoly graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -1009,7 +1116,26 @@
 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 
 usage += "\n Alt<Z> to remove added elements";
-usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]";
+usage += "\n  Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
 usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
-usage += "\n       addcirc addfcirc addfarc graphicatt";  
+usage += "\n       addcirc addfcirc addfarc addpoly addfpoly graphicatt";  
+mpiac->RegisterCommand(kw, usage, this, "Graphics");
+
+kw = "addpoly";
+usage = "Adds a polyline/polygon to the current graphic object";
+usage += "\n  Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
+usage += "\n  Coordinates specified as pairs x,y in a single word (use simple or double quotes";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
+usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
+usage += "\n       addcirc addfcirc addfarc  graphicatt";  
+mpiac->RegisterCommand(kw, usage, this, "Graphics");
+
+kw = "addfpoly";
+usage = "Adds a filled polygon to the current graphic object";
+usage += "\n  Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
+usage += "\n  Coordinates specified as pairs x,y in a single word (use simple or double quotes";
+usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
+usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
+usage += "\n       addcirc addfcirc addfarc  graphicatt";  
 mpiac->RegisterCommand(kw, usage, this, "Graphics");
 
@@ -1039,5 +1165,5 @@
 
 kw = "openfits";
-usage = "Loads a FITS file into an apprpiate object \n Usage: openfits filename";
+usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
 usage += "\n  Related commands: savefits openppf";  
 mpiac->RegisterCommand(kw, usage, this, "FileIO");
@@ -1071,5 +1197,16 @@
 usage += "\n  Related commands: ntloop fillnt ";
 mpiac->RegisterCommand(kw, usage, this, "FileIO");
-
+#ifndef SANS_EVOLPLANCK
+kw = "mtxfrascii";
+usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
+usage += "\n Usage: mtxfrascii mtx_name file_name";
+usage += "\n  Related commands: vecfrascii ntfrascii ";
+mpiac->RegisterCommand(kw, usage, this, "FileIO");
+kw = "vecfrascii";
+usage = "Reads a vactor from an ASCII file (TVector<r_8>)";
+usage += "\n Usage: vecfrascii vec_name file_name";
+usage += "\n  Related commands: mtxfrascii ntfrascii ";
+mpiac->RegisterCommand(kw, usage, this, "FileIO");
+#endif
 
 kw = "print";
@@ -1491,5 +1628,6 @@
 usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
 usage += "o <Alt>X : Show/Hide the Cut Window \n";
-usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
+usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
+usage += "o <Alt>E : Removes the last added graphic element \n";
 usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
 usage += "o <Alt>- or <Cntl>- : Zoom out \n";
@@ -1510,5 +1648,6 @@
 usage += "           Drawer 0 manages the axes, as well as the added text \n";
 usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
-usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
+usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
+usage += "o <Alt>E : Removes the last added graphic element \n";
 usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
 usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
@@ -1530,5 +1669,6 @@
 usage += "o <Alt>O : = <Alt>G \n";
 usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
-usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
+usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
+usage += "o <Alt>E : Removes the last added graphic element \n";
 usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
 usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
