Changeset 2265 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Nov 15, 2002, 12:58:41 AM (23 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2263 r2265 117 117 double ymax = atof(tokens[3].c_str()); 118 118 char buff[128]; 119 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g ", xmin, xmax, ymin, ymax);119 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g ", xmin, xmax, ymin, ymax); 120 120 string sop = buff; 121 121 if (tokens.size() > 4) sop += tokens[4]; 122 122 string name; 123 if (tokens.size() > 5) sop += tokens[5];123 if (tokens.size() > 5) name = tokens[5]; 124 124 PIFuncDrawer* gdr = new PIFuncDrawer(NULL); 125 125 mImgApp->DispScDrawer(gdr, name, sop); … … 185 185 bool fgfill = (kw == "addcirc") ? false : true; 186 186 mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc); 187 } 188 else if ((kw == "addarca") || (kw == "addfarca")) { 189 if (tokens.size() < 5) { 190 cout << "Usage: addarca/addfarca xc yc r a da [colatt] [fgnc]" << endl; 191 return(0); 192 } 193 double xc = atof(tokens[0].c_str()); 194 double yc = atof(tokens[1].c_str()); 195 double rad = atof(tokens[2].c_str()); 196 double ang = atof(tokens[3].c_str()); 197 double dang = atof(tokens[4].c_str()); 198 string sop; 199 if (tokens.size() > 5) sop = tokens[5]; 200 bool fgnc = _CkBoolNC_(6); 201 bool fgfill = (kw == "addarca") ? false : true; 202 mImgApp->AddArc(xc, yc, rad, ang, dang, sop, fgfill, fgnc); 187 203 } 188 204 else if (kw == "addmarker") { … … 1001 1017 usage += "\n at the specified position (+ color/font/pos/dir attributes) "; 1002 1018 usage += "\n The Base/AxesDrawer is used to handle added text strings" ; 1003 usage += "\n Alt< Z> to remove added elements";1019 usage += "\n Alt<E> to remove the added element"; 1004 1020 usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]"; 1005 1021 usage += "\n (use quotes '' for multi word text strings) "; … … 1011 1027 usage += "\n Related commands: addctext addline addarrow addrect addfrect"; 1012 1028 usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt"; 1013 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1029 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1014 1030 1015 1031 kw = "addctext"; … … 1020 1036 usage += "\n Related commands: addtext addline addrect ..."; 1021 1037 usage += "\n (See command addtext and graphicatt for more details)"; 1022 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1038 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1023 1039 1024 1040 kw = "addline"; … … 1026 1042 usage += "\n at the specified position (+ graphic attribute)"; 1027 1043 usage += "\n The Base/AxesDrawer is used to handle added lines"; 1028 usage += "\n Alt< Z> to remove added elements";1044 usage += "\n Alt<E> to remove the added element"; 1029 1045 usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1030 1046 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1031 1047 usage += "\n Related commands: addarrow addtext addrect addfrect "; 1032 1048 usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1033 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1049 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1034 1050 1035 1051 kw = "addarrow"; … … 1037 1053 usage += "\n at the specified position (+ graphic attribute)"; 1038 1054 usage += "\n The Base/AxesDrawer is used to handle added lines"; 1039 usage += "\n Alt< Z> to remove added elements";1055 usage += "\n Alt<E> to remove the added element"; 1040 1056 usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1041 1057 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1042 1058 usage += "\n Related commands: addline addtext addrect addfrect "; 1043 1059 usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1044 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1060 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1045 1061 kw = "addarrow_nc"; 1046 1062 … … 1049 1065 usage += "\n between the specified positions (+ graphic attribute)"; 1050 1066 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 1051 usage += "\n Alt< Z> to remove added elements";1067 usage += "\n Alt<E> to remove added element"; 1052 1068 usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1053 1069 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1054 1070 usage += "\n Related commands: addtext addline addarrow addfrect"; 1055 1071 usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1056 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1072 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1057 1073 1058 1074 kw = "addfrect"; … … 1060 1076 usage += "\n between the specified positions (+ graphic attribute)"; 1061 1077 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 1062 usage += "\n Alt< Z> to remove added elements";1078 usage += "\n Alt<E> to remove added element"; 1063 1079 usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]"; 1064 1080 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1065 1081 usage += "\n Related commands: addtext addline addarrow addrect"; 1066 1082 usage += "\n addcirc addfcirc addpoly addfpoly graphicatt"; 1067 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1083 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1068 1084 1069 1085 kw = "addmarker"; … … 1071 1087 usage += "\n at the specified position (+ graphic attribute)"; 1072 1088 usage += "\n The Base/AxesDrawer is used to handle added circles"; 1073 usage += "\n Alt< Z> to remove added elements";1089 usage += "\n Alt<E> to remove added element"; 1074 1090 usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]"; 1075 1091 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1076 1092 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1077 1093 usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1078 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1094 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1079 1095 1080 1096 kw = "addcirc"; … … 1082 1098 usage += "\n with the specified center and radius (+ graphic attribute)"; 1083 1099 usage += "\n The Base/AxesDrawer is used to handle added circles"; 1084 usage += "\n Alt< Z> to remove added elements";1100 usage += "\n Alt<E> to remove added element"; 1085 1101 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]"; 1086 1102 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1087 1103 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1088 1104 usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt"; 1089 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1105 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1090 1106 1091 1107 kw = "addfcirc"; … … 1093 1109 usage += "\n with the specified center and radius (+ graphic attribute)"; 1094 1110 usage += "\n The Base/AxesDrawer is used to handle added circles"; 1095 usage += "\n Alt< Z> to remove added elements";1111 usage += "\n Alt<E> to remove added element"; 1096 1112 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]"; 1097 1113 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1098 1114 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1099 1115 usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt"; 1100 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1116 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1117 1118 kw = "addarca"; 1119 usage = "Adds an arc to the current graphic object"; 1120 usage += "\n defined by the circle (center+radius), start angle and angular extension"; 1121 usage += "\n Angles are specified in degrees"; 1122 usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]"; 1123 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1124 usage += "\n Related commands: addtext addline addfarca addarc ..."; 1125 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1126 1127 kw = "addfarca"; 1128 usage = "Adds a filled arc to the current graphic object"; 1129 usage += "\n defined by the circle (center+radius), start angle and angular extension"; 1130 usage += "\n Angles are specified in degrees"; 1131 usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]"; 1132 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1133 usage += "\n Related commands: addtext addline addarca addarc ..."; 1134 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1101 1135 1102 1136 kw = "addarc"; … … 1104 1138 usage += "\n defined by 3 points (+ graphic attribute)"; 1105 1139 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1106 usage += "\n Alt<Z> to remove added elements"; 1140 usage += "\n Alt<E> to remove the added element"; 1141 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]"; 1142 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1143 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1144 usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt"; 1145 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1146 1147 kw = "addfarc"; 1148 usage = "Adds a filled arc to the current graphic object"; 1149 usage += "\n defined by 3 points (+ graphic attribute)"; 1150 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1151 usage += "\n Alt<E> to remove added element"; 1107 1152 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]"; 1108 1153 usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)"; 1109 1154 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1110 1155 usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 1111 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1112 1113 kw = "addfarc"; 1114 usage = "Adds a filled arc to the current graphic object"; 1115 usage += "\n defined by 3 points (+ graphic attribute)"; 1116 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1117 usage += "\n Alt<Z> to remove added elements"; 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)"; 1120 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1121 usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt"; 1122 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1156 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1123 1157 1124 1158 kw = "addpoly"; … … 1129 1163 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1130 1164 usage += "\n addcirc addfcirc addfarc graphicatt"; 1131 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1165 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1132 1166 1133 1167 kw = "addfpoly"; … … 1138 1172 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1139 1173 usage += "\n addcirc addfcirc addfarc graphicatt"; 1140 mpiac->RegisterCommand(kw, usage, this, "Graphic s");1174 mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts"); 1141 1175 1142 1176 kw = "settitle"; -
trunk/SophyaPI/PIext/piacmd.cc
r2263 r2265 1233 1233 } 1234 1234 1235 int Sum_RPNStack_(stack<double>& s, double& sx, double& sx2, string& line) 1236 { 1237 sx = sx2 = 0.; 1238 int nn = 0; 1239 double x = 0.; 1240 while( !s.empty() ) { 1241 x = s.top(); s.pop(); 1242 sx += x; sx2 += x*x; 1243 nn++; 1244 } 1245 return(nn); 1246 } 1247 1248 int Product_RPNStack_(stack<double>& s, double& px, string& line) 1249 { 1250 px = 1.; 1251 int nn = 0; 1252 double x = 0.; 1253 while( !s.empty() ) { 1254 x = s.top(); s.pop(); 1255 px *= x; nn++; 1256 } 1257 return(nn); 1258 } 1235 1259 1236 1260 /* --Methode-- */ … … 1329 1353 if ( Check_myRPNStack_(rpnstack, x, y, line) ) return(1); 1330 1354 rpnstack.top() = atan2(x,y); 1355 } 1356 // Fonction a N arguments - Somme, produit, etc ... 1357 else if ((args[k] == "sum") || (args[k] == "mean") || 1358 (args[k] == "sigma") || (args[k] == "sigma2") ) { 1359 double sx, sx2; 1360 int nn = Sum_RPNStack_(rpnstack, sx, sx2, line); 1361 if (args[k] == "sum") rpnstack.push(sx); 1362 else { 1363 if (nn == 0) { 1364 cerr << "PIACmd::EvalRPNExpr: mean/sigma error- RPN stack empty: " 1365 << line << endl; 1366 return(1); 1367 } 1368 double fnn = nn; 1369 if (args[k] == "mean") rpnstack.push(sx/fnn); 1370 else if (args[k] == "sigma2") rpnstack.push(sx2/fnn-(x*x/(fnn*fnn))); 1371 else rpnstack.push(sqrt(sx2/fnn-(x*x/(fnn*fnn)))); 1372 } 1373 } 1374 else if (args[k] == "product") { 1375 double px; 1376 int nn = Product_RPNStack_(rpnstack, px, line); 1377 if (nn == 0) { 1378 cerr << "PIACmd::EvalRPNExpr: product error- RPN stack empty: " 1379 << line << endl; 1380 return(1); 1381 } 1382 rpnstack.push(px); 1331 1383 } 1332 1384 // Fonctions de manipulation de stack -
trunk/SophyaPI/PIext/pistdimgapp.cc
r2263 r2265 933 933 eld->Refresh(); 934 934 } 935 /* --Methode-- */ 936 void PIStdImgApp::AddArc(double xc, double yc, double r, double a, double da, 937 string const& sop, bool fgfill, bool fgcn) 938 { 939 PIDrawer *eld=CurrentElDrawer(); 940 if (eld == NULL) return; 941 PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld); 942 PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld); 943 if ((eld2 == NULL) && (eld3 == NULL)) return; 944 PIElDrwMgr* elmgr = NULL; 945 if (eld2) elmgr = &(eld2->ElDrwMgr()); 946 else if (eld3) elmgr = &(eld3->ElDrwMgr()); 947 948 vector<string> opts; 949 ParseDisplayOption(sop, opts); 950 PIGraphicAtt gratt(opts); 951 if (fgfill) elmgr->ElAddFArc(xc, yc, r, a, da, gratt, fgcn); 952 else elmgr->ElAddArc(xc, yc, r, a, da, gratt, fgcn); 953 eld->Refresh(); 954 } 935 955 936 956 /* --Methode-- */ -
trunk/SophyaPI/PIext/pistdimgapp.h
r2263 r2265 77 77 void AddCircle(double xc, double yc, double r, string const& opt, 78 78 bool fgfill=false, bool fgcn=false); 79 void AddArc(double xc, double yc, double r, double a, double da, 80 string const& opt, bool fgfill=false, bool fgcn=false); 79 81 void AddArc(double x1, double y1, double x2, double y2, 80 82 double x3, double y3, string const& opt, bool fgfill=false, bool fgcn=false);
Note:
See TracChangeset
for help on using the changeset viewer.