Changeset 2263 in Sophya for trunk/SophyaPI/PIext/basexecut.cc
- Timestamp:
- Nov 14, 2002, 8:12:02 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2243 r2263 9 9 #include "pdlmgr.h" 10 10 #include "ctimer.h" 11 #include "strutilxx.h" 11 12 12 13 #include "pistdimgapp.h" … … 46 47 47 48 49 /* Macro pour tester si flag normalized coordinate est present */ 50 #define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false; 48 51 49 52 /* --Methode-- */ … … 123 126 } 124 127 else 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 } 126 132 double xp = atof(tokens[0].c_str()); 127 133 double yp = atof(tokens[1].c_str()); … … 129 135 string sop; 130 136 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 } 140 else 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); 132 153 } 133 154 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") || 134 155 (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 } 136 160 double xp1 = atof(tokens[0].c_str()); 137 161 double yp1 = atof(tokens[1].c_str()); … … 140 164 string sop; 141 165 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); 144 169 else { 145 170 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); 147 172 } 148 173 } 149 174 else 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 } 151 179 double xc = atof(tokens[0].c_str()); 152 180 double yc = atof(tokens[1].c_str()); … … 154 182 string sop; 155 183 if (tokens.size() > 3) sop = tokens[3]; 184 bool fgnc = _CkBoolNC_(4); 156 185 bool fgfill = (kw == "addcirc") ? false : true; 157 mImgApp->AddCircle(xc, yc, rad, sop, fgfill );186 mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc); 158 187 } 159 188 else if (kw == "addmarker") { 160 189 if (tokens.size() < 2) { 161 cout << "Usage: addmarker x y [gratt] " << endl;190 cout << "Usage: addmarker x y [gratt] [fgnc]" << endl; 162 191 return(0); 163 192 } … … 166 195 string sop; 167 196 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); 169 199 } 170 200 else if ((kw == "addarc") || (kw == "addfarc") ) { 171 201 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; 173 203 return(0); 174 204 } … … 181 211 string sop; 182 212 if (tokens.size() > 6) sop = tokens[6]; 213 bool fgnc = _CkBoolNC_(7); 183 214 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 } 217 else 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 } 186 239 187 240 … … 704 757 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val); 705 758 } 759 760 #ifndef SANS_EVOLPLANCK 761 /* Lecture matrice/vecteur depuis fichier ASCII */ 762 else 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 706 791 707 792 else if (kw == "fillnt" ) { … … 851 936 usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont \n"; 852 937 usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont \n"; 853 usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker 938 usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T> \n"; 854 939 usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n"; 855 940 usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n"; 856 usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n"; 941 usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n"; 942 usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T> \n"; 943 usage += " arrowshapedarrow<T> farrowshapedarrow<T> \n"; 944 usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n"; 857 945 usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n"; 858 946 usage += " grey128 invgrey128 colrj128 colbr128 \n"; … … 914 1002 usage += "\n The Base/AxesDrawer is used to handle added text strings" ; 915 1003 usage += "\n Alt<Z> to remove added elements"; 916 usage += "\n Usage: addtext x y TextString [ColFontPosAtt] ";1004 usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]"; 917 1005 usage += "\n (use quotes '' for multi word text strings) "; 1006 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 918 1007 usage += "\n Text position/direction attribute: "; 919 1008 usage += "\n horizleft horizcenter horizright"; 920 1009 usage += "\n vertbottom vertcenter verttop "; 921 1010 usage += "\n textdirhoriz textdirvertup textdirvertdown "; 922 usage += "\n Related commands: addline addarrow addrect addfrect"; 923 usage += "\n addcirc addfcirc addarc addfrac settitle graphicatt"; 1011 usage += "\n Related commands: addctext addline addarrow addrect addfrect"; 1012 usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt"; 1013 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1014 1015 kw = "addctext"; 1016 usage = "Adds a composite text string with superscript and subscripts "; 1017 usage += "\n at the specified position (+ color/font/pos/dir attributes) "; 1018 usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]"; 1019 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1020 usage += "\n Related commands: addtext addline addrect ..."; 1021 usage += "\n (See command addtext and graphicatt for more details)"; 924 1022 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 925 1023 … … 929 1027 usage += "\n The Base/AxesDrawer is used to handle added lines"; 930 1028 usage += "\n Alt<Z> to remove added elements"; 931 usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt]"; 1029 usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1030 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 932 1031 usage += "\n Related commands: addarrow addtext addrect addfrect "; 933 usage += "\n addmarker addcirc addfcirc addarc addfarc graphicatt";1032 usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 934 1033 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 935 1034 … … 939 1038 usage += "\n The Base/AxesDrawer is used to handle added lines"; 940 1039 usage += "\n Alt<Z> to remove added elements"; 941 usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt]"; 1040 usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1041 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 942 1042 usage += "\n Related commands: addline addtext addrect addfrect "; 943 usage += "\n addmarker addcirc addfcirc addarc addfarc graphicatt"; 944 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1043 usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1044 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1045 kw = "addarrow_nc"; 945 1046 946 1047 kw = "addrect"; … … 949 1050 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 950 1051 usage += "\n Alt<Z> to remove added elements"; 951 usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt]"; 1052 usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1053 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 952 1054 usage += "\n Related commands: addtext addline addarrow addfrect"; 953 usage += "\n addcirc addfcirc addarc addfarc graphicatt";1055 usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 954 1056 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 955 1057 … … 959 1061 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 960 1062 usage += "\n Alt<Z> to remove added elements"; 961 usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt]"; 1063 usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1064 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 962 1065 usage += "\n Related commands: addtext addline addarrow addrect"; 963 usage += "\n addcirc addfcirc graphicatt";1066 usage += "\n addcirc addfcirc addpoly addfpoly graphicatt"; 964 1067 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 965 1068 … … 969 1072 usage += "\n The Base/AxesDrawer is used to handle added circles"; 970 1073 usage += "\n Alt<Z> to remove added elements"; 971 usage += "\n Usage: addmarker xpos ypos [GraphicAtt]"; 1074 usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]"; 1075 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 972 1076 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 973 usage += "\n addcirc addfcirc addarc addfarc graphicatt";1077 usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 974 1078 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 975 1079 … … 979 1083 usage += "\n The Base/AxesDrawer is used to handle added circles"; 980 1084 usage += "\n Alt<Z> to remove added elements"; 981 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt]"; 1085 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]"; 1086 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 982 1087 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 983 usage += "\n addfcirc addarc addfarc graphicatt";1088 usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt"; 984 1089 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 985 1090 … … 989 1094 usage += "\n The Base/AxesDrawer is used to handle added circles"; 990 1095 usage += "\n Alt<Z> to remove added elements"; 991 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt]"; 1096 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]"; 1097 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 992 1098 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 993 usage += "\n addcirc addarc addfarc graphicatt";1099 usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt"; 994 1100 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 995 1101 … … 999 1105 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1000 1106 usage += "\n Alt<Z> to remove added elements"; 1001 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]"; 1107 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]"; 1108 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1002 1109 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1003 usage += "\n addcirc addfcirc addfarc graphicatt";1110 usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 1004 1111 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1005 1112 … … 1009 1116 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1010 1117 usage += "\n Alt<Z> to remove added elements"; 1011 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]"; 1118 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]"; 1119 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1012 1120 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1013 usage += "\n addcirc addfcirc addfarc graphicatt"; 1121 usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 1122 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1123 1124 kw = "addpoly"; 1125 usage = "Adds a polyline/polygon to the current graphic object"; 1126 usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]"; 1127 usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes"; 1128 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1129 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1130 usage += "\n addcirc addfcirc addfarc graphicatt"; 1131 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1132 1133 kw = "addfpoly"; 1134 usage = "Adds a filled polygon to the current graphic object"; 1135 usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]"; 1136 usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes"; 1137 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1138 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1139 usage += "\n addcirc addfcirc addfarc graphicatt"; 1014 1140 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1015 1141 … … 1039 1165 1040 1166 kw = "openfits"; 1041 usage = "Loads a FITS file into an appr piate object \n Usage: openfits filename";1167 usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename"; 1042 1168 usage += "\n Related commands: savefits openppf"; 1043 1169 mpiac->RegisterCommand(kw, usage, this, "FileIO"); … … 1071 1197 usage += "\n Related commands: ntloop fillnt "; 1072 1198 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 1073 1199 #ifndef SANS_EVOLPLANCK 1200 kw = "mtxfrascii"; 1201 usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)"; 1202 usage += "\n Usage: mtxfrascii mtx_name file_name"; 1203 usage += "\n Related commands: vecfrascii ntfrascii "; 1204 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 1205 kw = "vecfrascii"; 1206 usage = "Reads a vactor from an ASCII file (TVector<r_8>)"; 1207 usage += "\n Usage: vecfrascii vec_name file_name"; 1208 usage += "\n Related commands: mtxfrascii ntfrascii "; 1209 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 1210 #endif 1074 1211 1075 1212 kw = "print"; … … 1491 1628 usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n"; 1492 1629 usage += "o <Alt>X : Show/Hide the Cut Window \n"; 1493 usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n"; 1630 usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n"; 1631 usage += "o <Alt>E : Removes the last added graphic element \n"; 1494 1632 usage += "o <Alt>+ or <Cntl>+ : Zoom in \n"; 1495 1633 usage += "o <Alt>- or <Cntl>- : Zoom out \n"; … … 1510 1648 usage += " Drawer 0 manages the axes, as well as the added text \n"; 1511 1649 usage += "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"; 1650 usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n"; 1651 usage += "o <Alt>E : Removes the last added graphic element \n"; 1513 1652 usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n"; 1514 1653 usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n"; … … 1530 1669 usage += "o <Alt>O : = <Alt>G \n"; 1531 1670 usage += "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"; 1671 usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n"; 1672 usage += "o <Alt>E : Removes the last added graphic element \n"; 1533 1673 usage += "o <Alt>A : Activate/Deactivate axes drawing \n"; 1534 1674 usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
Note:
See TracChangeset
for help on using the changeset viewer.