Changeset 1971 in Sophya
- Timestamp:
- Apr 30, 2002, 2:34:41 PM (23 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r1938 r1971 61 61 nx = ny = 1; 62 62 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str()); 63 mObjMgr->SetGraphicWinZone(nx, ny, false);63 if (mImgApp) mImgApp->SetZone(nx, ny); 64 64 } 65 65 else if (kw == "newwin") { … … 68 68 if(tokens.size() > 0) nx = atoi(tokens[0].c_str()); 69 69 if(tokens.size() > 1) ny = atoi(tokens[1].c_str()); 70 mObjMgr->SetGraphicWinZone(nx, ny, true);70 if (mImgApp) mImgApp->CreateGraphWin(nx, ny); 71 71 } 72 72 else if (kw == "stacknext") mImgApp->StackWinNext(); 73 73 else if (kw == "graphicatt") { 74 74 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); } 75 mObjMgr->SetGraphicAttributes(tokens[0]); 76 } 77 else if (kw == "setxylimits") { 78 if (tokens.size() < 4) { cout << "Usage: setxylimits xmin xmax ymin ymax" << endl; return(0); } 79 double xmin = atof(tokens[0].c_str()); 80 double xmax = atof(tokens[1].c_str()); 81 double ymin = atof(tokens[2].c_str()); 82 double ymax = atof(tokens[3].c_str()); 83 mImgApp->SetXYLimits(xmin, xmax, ymin, ymax); 75 string opts = tokens[0]; 76 if (tokens.size() > 1) 77 for(int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; } 78 if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts); 79 } 80 else if (kw == "setaxesatt") { 81 if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl; return(0); } 82 string opts = tokens[0]; 83 if (tokens.size() > 1) 84 for(int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; } 85 if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts); 84 86 } 85 87 else if (kw == "setinsetlimits") { … … 91 93 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax); 92 94 } 93 else if (kw == "setimgcenter") {94 if (tokens.size() < 2) { cout << "Usage: setimgcenter xc yc" << endl; return(0); }95 int xc = atoi(tokens[0].c_str());96 int yc = atoi(tokens[1].c_str());97 mImgApp->SetImageCenterPosition(xc, yc);98 }99 95 else if (kw == "addtext") { 100 96 if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl; return(0); } … … 102 98 double yp = atof(tokens[1].c_str()); 103 99 string txt = tokens[2]; 104 bool fgsr = false; 105 if (tokens.size() > 3) 106 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr); 107 mImgApp->AddText(txt, xp, yp); 108 if (fgsr) mImgApp->RestoreGraphicAtt(); 100 string sop; 101 if (tokens.size() > 3) sop = tokens[3]; 102 mImgApp->AddText(txt, xp, yp, sop); 109 103 } 110 104 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) { … … 114 108 double xp2 = atof(tokens[2].c_str()); 115 109 double yp2 = atof(tokens[3].c_str()); 116 bool fgsr = false; 117 if (tokens.size() > 4) 118 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[4], fgsr); 119 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2); 110 string sop; 111 if (tokens.size() > 4) sop = tokens[4]; 112 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop); 120 113 else { 121 114 bool fgfill = (kw == "addrect") ? false : true; 122 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, fgfill); 123 } 124 if (fgsr) mImgApp->RestoreGraphicAtt(); 115 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill); 116 } 125 117 } 126 118 else if ((kw == "addcirc") || (kw == "addfcirc")) { … … 130 122 double rad = atof(tokens[2].c_str()); 131 123 bool fgsr = false; 132 if (tokens.size() > 3)133 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr);124 string sop; 125 if (tokens.size() > 3) sop = tokens[3]; 134 126 bool fgfill = (kw == "addcirc") ? false : true; 135 mImgApp->AddCircle(xc, yc, rad, fgfill); 136 if (fgsr) mImgApp->RestoreGraphicAtt(); 127 mImgApp->AddCircle(xc, yc, rad, sop, fgfill); 137 128 } 138 129 … … 141 132 if (tokens.size() < 1) { cout << "Usage: settitle TopTitle [BotTitle] [fontatt]" << endl; return(0); } 142 133 bool fgsr = true; 143 if (tokens.size() > 2)144 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);145 if (tokens.size() < 2)146 tokens.push_back("");147 134 mImgApp->SetTitle(tokens[0], tokens[1]); 148 if (fgsr) mImgApp->RestoreGraphicAtt();149 135 } 150 136 … … 397 383 } 398 384 else { 399 if (tokens.size() < 5) tokens.push_back("n ");385 if (tokens.size() < 5) tokens.push_back("next"); 400 386 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax, 401 387 nx, ny, tokens[4]); … … 415 401 else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) { 416 402 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); } 417 string opt = "n ";403 string opt = "next"; 418 404 if (tokens.size() > 1) opt = tokens[1]; 419 405 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt); … … 457 443 string numvary = ""; 458 444 string err = ""; 459 string opt = "n ";445 string opt = "next"; 460 446 if(tokens.size()>2) err = tokens[2]; 461 447 if(tokens.size()>3) opt = tokens[3]; … … 468 454 return(0);} 469 455 string err = ""; 470 string opt = "n ";456 string opt = "next"; 471 457 if(tokens.size()>3) err = tokens[3]; 472 458 if(tokens.size()>4) opt = tokens[4]; … … 767 753 kw = "graphicatt"; 768 754 usage = "To change default graphic options \n Usage: graphicatt att_list \n"; 769 usage += "att_list=def back to default values, Example: gratt red,circlemarker5";755 usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'"; 770 756 usage += "\n ------------------ Graphic attribute list ------------------ \n"; 771 757 usage += ">> Colors: defcol black white grey red blue green yellow \n"; … … 791 777 usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n"; 792 778 usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n"; 793 usage += ">> Image centering: centerimg-> Position the image in widget \n";779 usage += ">> imagecenter=ix,iy -> Position the image in widget \n"; 794 780 usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n"; 795 usage += " fineaxes grid=fineaxesgrid \n";781 usage += " fineaxes fineaxesgrid \n"; 796 782 usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n"; 797 783 usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n"; … … 799 785 usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n"; 800 786 usage += ">> DisplayWindow: next same win stack inset \n"; 801 usage += " Related commands: set xylimits setinsetlimits setimgcenter";787 usage += " Related commands: setaxesatt setinsetlimits "; 802 788 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 803 789 804 kw = "setxylimits"; 805 usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax"; 806 usage += "\n Related commands: graphicatt /xylimits"; 790 kw = "setaxesatt"; 791 usage = "To set default axes attributes \n Usage: setaxesatt att_list \n"; 792 usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n"; 793 usage += " fineaxes fineaxesgrid \n"; 794 usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n"; 795 usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n"; 807 796 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 797 808 798 809 799 kw = "setinsetlimits"; -
trunk/SophyaPI/PIext/contmodex.cc
r1920 r1971 106 106 // On affiche le Drawer 107 107 int wrsid = 0; 108 bool fgsr = true;109 cout << " dopt " << dopt<<endl;110 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);111 108 112 109 string name = "contour"; 113 cout << " ContModExecutor::Execute() : name "<<name<<" " <<" opt |"<<opt<<"| dopt |"<<dopt<<"| contdrw |"<<contdrw<<endl;114 wrsid = omg.GetImgApp()->DispScDrawer(contdrw, name, opt);110 cout << " ContModExecutor::Execute() : name "<<name<<" " <<"| dopt |"<<dopt<<"| contdrw |"<<contdrw<<endl; 111 wrsid = omg.GetImgApp()->DispScDrawer(contdrw, name, dopt); 115 112 cout << " fin de ContModExecutor::Execute() "<< endl; 116 113 117 114 118 if (fgsr) omg.GetImgApp()->RestoreGraphicAtt();119 115 // Ne pas oublier d'associer le wrsid a l'objet si on utilise le P2DArrayAdapter* arr 120 // Il semble que cela ne soit pas accessible pour le moment depuis l'exterieur ds NamedObjMgr 121 122 123 116 omg.AddWRsId(tokens[0], wrsid); 117 124 118 125 119 } … … 180 174 bool fgsr = true; 181 175 182 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);183 184 176 string name = "contour"; 185 177 186 wrsid = omg.GetImgApp()->DispScDrawer(contdrw, name, opt);178 wrsid = omg.GetImgApp()->DispScDrawer(contdrw, name, dopt); 187 179 188 189 190 if (fgsr) omg.GetImgApp()->RestoreGraphicAtt(); 180 // Ne pas oublier d'associer le wrsid a l'objet si on utilise le P2DArrayAdapter* arr 181 omg.AddWRsId(tokens[0], wrsid); 191 182 192 183 } -
trunk/SophyaPI/PIext/flowmodex.cc
r1925 r1971 89 89 // On affiche le Drawer 90 90 int wrsid = 0; 91 bool fgsr = true;92 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);93 94 91 string name = "ChampVec"; 95 92 96 wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt); 93 wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, dopt); 94 omg.AddWRsId(tokens[0], wrsid); 97 95 98 96 }else if(kw == "plot2dvec"){ … … 140 138 p2dv->SelectVW(ntn[2],ntn[3]); 141 139 142 bool fgsr = true;143 140 if (tokens.size() > 6) dopt = tokens[6]; 144 141 145 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);146 142 string name = "ChampVec"; 147 143 148 int wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt);144 int wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, dopt); 149 145 150 146 } -
trunk/SophyaPI/PIext/nobjmgr.cc
r1905 r1971 1135 1135 1136 1136 int wrsid = 0; 1137 bool fgsr = true;1138 int opt = servnobjm->DecodeDispOption(dopt, fgsr);1139 1137 1140 1138 string n1,r1; … … 1143 1141 if (dr) { 1144 1142 PIDrawer3D * dr3 = dynamic_cast<PIDrawer3D *>(dr); 1145 if(dr3) wrsid = myImgApp->Disp3DDrawer(dr3, n1, opt);1146 else wrsid = myImgApp->DispScDrawer( dr, n1, opt);1147 } 1148 else if (arr) wrsid = myImgApp->DispImage(arr, n1, opt);1143 if(dr3) wrsid = myImgApp->Disp3DDrawer(dr3, n1, dopt); 1144 else wrsid = myImgApp->DispScDrawer( dr, n1, dopt); 1145 } 1146 else if (arr) wrsid = myImgApp->DispImage(arr, n1, dopt); 1149 1147 1150 1148 if(wrsid != 0) { … … 1153 1151 (*it).second.wrsid.push_back(wrsid); 1154 1152 } 1155 if (fgsr) myImgApp->RestoreGraphicAtt(); 1153 1156 1154 return; 1157 1155 } … … 1184 1182 1185 1183 int wrsid = 0; 1186 bool fgsr = true; 1187 int opt = servnobjm->DecodeDispOption(dopt, fgsr); 1188 wrsid = myImgApp->DispImage(arr, n1, opt); 1184 wrsid = myImgApp->DispImage(arr, n1, dopt); 1189 1185 1190 1186 if(wrsid != 0) { … … 1193 1189 (*it).second.wrsid.push_back(wrsid); 1194 1190 } 1195 if (fgsr) myImgApp->RestoreGraphicAtt();1196 1191 return; 1197 1192 } … … 1230 1225 1231 1226 int wrsid = 0; 1232 bool fgsr = true;1233 int opt = servnobjm->DecodeDispOption(dopt, fgsr);1234 1227 PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true); 1235 wrsid = myImgApp->Disp3DDrawer(sdr, n1, opt);1228 wrsid = myImgApp->Disp3DDrawer(sdr, n1, dopt); 1236 1229 if(wrsid >= 0) { 1237 1230 NObjList::iterator it = myObjs->find(nom); … … 1240 1233 } 1241 1234 1242 if (fgsr) myImgApp->RestoreGraphicAtt();1243 1235 return; 1244 1236 } … … 1265 1257 1266 1258 int wrsid = 0; 1267 bool fgsr = true; 1268 dopt = "defline," + dopt; 1269 int opt = servnobjm->DecodeDispOption(dopt, fgsr); 1259 dopt = "defline " + dopt; 1270 1260 1271 1261 string n1,r1; … … 1279 1269 pin->SelectErrBar(erx.c_str(), ery.c_str(), erz.c_str()); 1280 1270 string titre = nmz + "%" + nmy + "%" + nmz; 1281 wrsid = myImgApp->Disp3DDrawer(pin, n1, opt, titre);1271 wrsid = myImgApp->Disp3DDrawer(pin, n1, dopt, titre); 1282 1272 } 1283 1273 else { 1284 1274 PINTuple* pin = new PINTuple(nt, false); 1285 pin->SetStats(Services2NObjMgr::GetStatsOption(dopt));1286 1275 pin->SelectXY(nmx.c_str(), nmy.c_str()); 1287 1276 pin->SelectWt(wt.c_str()); … … 1289 1278 pin->SelectErrBar(erx.c_str(), ery.c_str()); 1290 1279 string titre = nmy + "%" + nmx; 1291 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pin, n1, opt, titre);1280 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pin, n1, dopt, titre); 1292 1281 } 1293 1282 … … 1298 1287 } 1299 1288 1300 if (fgsr) myImgApp->RestoreGraphicAtt();1301 1289 return; 1302 1290 } … … 1326 1314 return;} 1327 1315 1328 // Decodage des options classiques1329 bool fgsr = true;1330 int opt = servnobjm->DecodeDispOption(dopt, fgsr);1331 1316 // Decodage des erreurs a representer 1332 1317 bool errx=false, erry=false, errz=false; … … 1350 1335 pigfd->SelectXY(numvx,numvy); 1351 1336 pigfd->SelectErrBar(errx,erry,errz); 1352 wrsid = myImgApp->Disp3DDrawer(pigfd,n1, opt);1337 wrsid = myImgApp->Disp3DDrawer(pigfd,n1,dopt); 1353 1338 } else { // display 2D 1354 1339 PIGenFitDat* pigfd = new PIGenFitDat(((GeneralFitData*)obj),false); 1355 1340 pigfd->SelectX(numvx); 1356 1341 pigfd->SelectErrBar(errx,erry); 1357 wrsid = myImgApp->DispScDrawer((PIDrawer*)pigfd,n1, opt);1342 wrsid = myImgApp->DispScDrawer((PIDrawer*)pigfd,n1,dopt); 1358 1343 } 1359 1344 … … 1363 1348 (*it).second.wrsid.push_back(wrsid); 1364 1349 } 1365 if (fgsr) myImgApp->RestoreGraphicAtt(); 1350 1366 1351 return; 1367 1352 } … … 1424 1409 PIYfXDrawer * vxydrw = new PIYfXDrawer(avx, avy, true); 1425 1410 1426 // Decodage des options classiques1427 bool fgsr = true;1428 int opt = servnobjm->DecodeDispOption(dopt, fgsr);1429 1411 string nx,rx; 1430 1412 ParseObjectName(nomvx, rx, nx); … … 1434 1416 string title = ny + " (Y) vs. " + nx + " (X)"; 1435 1417 // display 2D 1436 int wrsid = myImgApp->DispScDrawer(vxydrw, title, opt); 1437 1438 if (fgsr) myImgApp->RestoreGraphicAtt(); 1418 int wrsid = myImgApp->DispScDrawer(vxydrw, title, dopt); 1419 1439 1420 return; 1440 1421 … … 1452 1433 1453 1434 1454 /* --Methode-- */1435 /* --Methode-- 1455 1436 void NamedObjMgr::SetGraphicAttributes(string gratt) 1456 1437 { … … 1460 1441 } 1461 1442 1462 /* --Methode-- */1463 1443 void NamedObjMgr::SetGraphicWinZone(int nzx, int nzy, bool fcr) 1464 1444 { … … 1467 1447 else myImgApp->SetZone(nzx, nzy); 1468 1448 } 1449 */ 1469 1450 1470 1451 /* --Methode-- */ -
trunk/SophyaPI/PIext/nobjmgr.h
r1525 r1971 92 92 virtual void DisplayVector(string & nomvx, string& nomvy, string dopt=""); 93 93 94 virtual void SetGraphicAttributes(string gratt="");95 virtual void SetGraphicWinZone(int nzx, int nzy, bool fcr=false);96 97 94 98 95 // Acces au PIApplication et a la classe de service -
trunk/SophyaPI/PIext/nomhistadapter.cc
r1321 r1971 79 79 PIDrawer* NOMAdapter_Histo::GetDrawer(string & dopt) 80 80 { 81 if (typeid(*mHis) == typeid(HProf)) dopt = "fcirclemarker5 ," + dopt;82 else dopt = "thinline ," + dopt;81 if (typeid(*mHis) == typeid(HProf)) dopt = "fcirclemarker5 " + dopt; 82 else dopt = "thinline " + dopt; 83 83 PIHisto * pih = new PIHisto(mHis, false); 84 pih->SetStats(Services2NObjMgr::GetStatsOption(dopt));85 84 return( pih ); 86 85 } … … 252 251 PIDrawer* NOMAdapter_Histo2D::GetDrawer(string & dopt) 253 252 { 254 dopt = "thinline ," + dopt;253 dopt = "thinline " + dopt; 255 254 return( new PIHisto2D(mHis, false) ); 256 255 } -
trunk/SophyaPI/PIext/nommatvecadapter.cc
r1905 r1971 68 68 PIDrawer* NOMAdapter_Vector::GetDrawer(string & dopt) 69 69 { 70 dopt = "thinline ," + dopt;70 dopt = "thinline " + dopt; 71 71 return( new PIYfXDrawer( new POVectorAdapter(mVec, false), NULL, true) ); 72 72 } -
trunk/SophyaPI/PIext/nomtmatvecadapter.cc
r1905 r1971 141 141 if (v == NULL) return(NULL); 142 142 else { 143 dopt = "thinline ," + dopt;143 dopt = "thinline " + dopt; 144 144 return( new PIYfXDrawer( new POTVectorAdapter<T>(v, false), NULL, true) ); 145 145 } -
trunk/SophyaPI/PIext/piaversion.h
r1565 r1971 2 2 #define PIAPPVERSION_H_SEEN 3 3 4 #define PIAPP_VERSIONNUMBER 3. 204 #define PIAPP_VERSIONNUMBER 3.40 5 5 6 6 #endif -
trunk/SophyaPI/PIext/pihisto.cc
r1905 r1971 133 133 } 134 134 135 int 136 PIHisto::DecodeOptionString(vector<string> & opt, bool rmdecopt) 137 { 138 if (opt.size() < 1) return(0); 139 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 140 if ((opt.size() - ndec1) < 1) return(ndec1); // si tout a ete decode 141 142 vector<string> udopt; // On gardera ici les options non decodees 143 unsigned int k = 0; 144 int ndec = opt.size(); 145 for( k=0; k<opt.size(); k++ ) { 146 string opts = opt[k]; 147 if (opts == "stat") SetStats(true); 148 else if (opts == "nostat") SetStats(false); 149 else { 150 ndec--; 151 // S'il faut supprimer les options decodees 152 if (rmdecopt) udopt.push_back(opts); 153 } 154 } 155 // S'il faut supprimer les options decodees, on remplace l'argument opt 156 // par le vecteur des options non decodees. 157 if (rmdecopt) opt = udopt; 158 return(ndec+ndec1); 159 } 160 135 161 void 136 162 PIHisto::DrawStats(PIGraphicUC* g) -
trunk/SophyaPI/PIext/pihisto.h
r546 r1971 17 17 inline Histo* Histogram() { return(mHisto); } 18 18 19 // Methode de decodage des options 20 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 21 19 22 protected: 20 23 virtual void DrawStats(PIGraphicUC* g); -
trunk/SophyaPI/PIext/pintuple.cc
r1920 r1971 259 259 return; 260 260 } 261 262 /* La methode DecodeOptionString permet de decoder un ensemble d'options 263 et de parametre d'affichage specifie sous forme d'un vecteur de string. 264 Si rmdecopt == true, les options decodees sont supprimees du vecteur 265 de string fourni en entree - ce qui permet l'enchainement eventuel 266 de plusieurs decodages de string. 267 Les options peuvent etre sous forme de flag : "stat" "nostat" 268 ou plus complexes, par exemple "dynamic=-3,3" 269 Rc: La methode renvoie le nombre d'options decodees 270 */ 271 272 /* --Methode-- */ 273 int PINTuple::DecodeOptionString(vector<string> & opt, bool rmdecopt) 274 { 275 if (opt.size() < 1) return(0); 276 // On appelle d'abord le decodage de la classe PIDrawer de laquelle 277 // on herite. (Pas obligatoire) on decode donc ici les attributs de 278 // couleur, fontes ... 279 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 280 if ((opt.size() - ndec1) < 1) return(ndec1); // si tout a ete decode 281 282 vector<string> udopt; // On gardera ici les options non decodees 283 unsigned int k = 0; 284 int ndec = opt.size(); 285 for( k=0; k<opt.size(); k++ ) { 286 string opts = opt[k]; 287 if (opts == "stat") SetStats(true); 288 else if (opts == "nostat") SetStats(false); 289 else { 290 // Si option non decode 291 ndec--; 292 // S'il faut supprimer les options decodees 293 if (rmdecopt) udopt.push_back(opts); 294 } 295 } 296 // S'il faut supprimer les options decodees, on remplace l'argument opt 297 // par le vecteur des options non decodees. 298 if (rmdecopt) opt = udopt; 299 return(ndec+ndec1); 300 } -
trunk/SophyaPI/PIext/pintuple.h
r546 r1971 14 14 virtual ~PINTuple(); 15 15 16 16 17 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 17 18 virtual void UpdateLimits(); … … 24 25 inline void SetStats(bool fg=true) { stats = fg; } 25 26 virtual void AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax); 27 28 // Methode de decodage des options 29 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 26 30 27 31 protected: -
trunk/SophyaPI/PIext/pistdimgapp.cc
r1905 r1971 93 93 m[3]->AppendItem("Window", 10411); 94 94 m[3]->AppendItem("Window 2x1", 10421); 95 m[3]->AppendItem("Window 1x2", 10412);95 // m[3]->AppendItem("Window 1x2", 10412); 96 96 m[3]->AppendItem("Window 2x2", 10422); 97 m[3]->AppendItem("Window 3x1", 10431);97 // m[3]->AppendItem("Window 3x1", 10431); 98 98 m[3]->AppendItem("Window 3x3", 10433); 99 99 m[3]->AppendItem("Cur->LastWdg", 10441); 100 100 m[3]->AppendItem("Close CurWin", 10460); 101 m[3]->AppendCheckItem("StatZoomWin", 10470); 102 m[3]->SetStateMsg(10470, true); 101 103 102 104 m[4] = new PIMenu(Menubar(),"PostScript"); … … 138 140 MainWin()->SetSize(msx, msy); 139 141 142 //------------------------------------------------------ 143 // On cree un container intermediaire permettant de gerer 144 // le widget zoom, colormap, stats, ... 145 140 146 int bss = 100+mFgScSz*15; 141 gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5); 147 148 int statc_szy = bss+10+14+mFgScSz*2+5; 149 statcont = new PIContainer(MainWin(), "ZGCSCont", msx, statc_szy, 0, 0); 150 statcont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 151 152 gimv = new PIPixmap(statcont, "GloV", bss, bss, 5, 5); 142 153 gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free); 143 zoom = new PIPixmap( MainWin(), "Zoom", bss, bss, bss+10, 5);154 zoom = new PIPixmap(statcont, "Zoom", bss, bss, bss+10, 5); 144 155 zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free); 145 cmapv = new PICMapView( MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);156 cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10); 146 157 cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 147 148 int cpy = bss+10+14+mFgScSz*2+5; 158 labstat = new PILabel(statcont, "statlabel", msx-2*(bss+20), 20, 2*bss+20, 10); 159 labstat->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 160 labstat->SetLabel("Stat-Zoom-ColMap Window"); 161 labstat->SetForegroundColor(PI_Red); 162 labstat->SetBorderWidth(1); 163 statcont->Show(); 164 // StatZoomWindowSetVisible(true); 165 //------------------------------------------------------ 166 167 //int cpy = bss+10+14+mFgScSz*2+5; 168 int cpy = statc_szy; 149 169 150 170 // Creation d'une console avec gestion des commandes 151 mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy ); 171 consolecont = new PIContainer(MainWin(), "ConsoleCont", msx, msy-cpy, 0, cpy ); 172 consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed); 173 mCons = new PIConsole(consolecont, "Console", 30200, 512, 132, msx, msy-cpy, 0, 0 ); 152 174 mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed); 153 175 mCons->AcceptCmd(true, 50); 176 consolecont->Show(); 154 177 redirecout = false; 155 178 // RedirectStdOutErr(true); pas par defaut … … 200 223 201 224 // Attributs graphiques courants 202 mFCol = mBCol = PI_NotDefColor;203 mLAtt = PI_NotDefLineAtt;204 mFName = PI_DefaultFont;205 mFSz = PI_NotDefFontSize;206 mFAtt = PI_NotDefFontAtt;207 mMSz = -1;208 mMrk = PI_NotDefMarker;209 mCmapid = CMAP_OTHER;210 mRevCmap = false;211 mZoom = 0;212 225 mAxesFlags = kBoxAxes | kExtTicks | kLabels; 213 SetXYLimits(-1, 1., -1., 1.);214 mFXYlim = false;215 226 SetInsetLimits(0.4, 0.6, 0.4, 0.6); 216 SetImageCenterPosition(-1,-1);217 mFImgCenter = false;218 maXlog = maYlog = false;219 227 mAddTitle = true; 220 SaveGraphicAtt();221 228 222 229 // Initialisation … … 269 276 delete gimv; 270 277 delete cmapv; 278 delete labstat; 279 280 delete statcont; 271 281 272 282 delete pfc_fits; … … 275 285 276 286 delete mCons; 287 delete consolecont; 277 288 278 289 delete mObjmgrw; … … 449 460 450 461 /* --Methode-- */ 451 int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid)462 int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop, int oid) 452 463 { 453 464 PIImage* pii; … … 468 479 } 469 480 470 int zm = 1; 471 if (mZoom == 0) { // Facteur de zoom auto 472 zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() : nouv->YSize(); 473 zm = (zm >= 250) ? 250/zm : 1; 474 } 475 else zm = mZoom; 476 477 if (zm == 0) zm = 1; 478 if (zm < -10) zm = -10; 479 if (zm > 10) zm = 10; 480 481 if (zm > 0) { sx = nouv->XSize()*zm; sy = nouv->YSize()*zm; } 482 else { 483 sx = (int)((float)nouv->XSize()*(-1./float(zm))); 484 sy = (int)((float)nouv->YSize()*(-1./float(zm))); 485 } 481 // On decode les options graphiques 482 vector<string> opts; 483 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 484 485 // Pas de same ou inset pour DispImage 486 if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next; 487 488 // Choix de la taille de fenetre 489 #define MINPIIMGSIZE 100 490 sx = (nouv->XSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE; 491 sy = (nouv->YSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE; 486 492 if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100; 487 493 if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100; 488 494 px = py = 0; 489 win = GetWindow( opt, sx, sy, px, py, flag, (char *)name.c_str());495 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str()); 490 496 pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py); 491 497 pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); … … 493 499 pii->SetGloVWin(gimv, false); 494 500 pii->SetCMapWin(cmapv, false); 495 pii->SetZoom(zm, false);496 if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, mRevCmap, false);497 501 pii->ShowCursor(true); 498 502 pii->SetUserData(NULL, oid); 499 // Centrage eventuel du pave 500 if (mFImgCenter && (mXImgCenter > 0) && (mYImgCenter > 0)) { 501 pii->SetImage(nouv, false); 502 pii->SetPave(mXImgCenter, mYImgCenter, true, true); 503 } 504 else pii->SetImage(nouv, true); 503 504 // decode des options en chaine de caracteres 505 pii->DecodeOptionString(mDefaultAtt, false); // d'abord les options par defaut 506 pii->DecodeOptionString(opts); // ensuite, les options specifies en argument 507 508 509 // On recalcule la taille de la fenetre si Disp_Win 510 if (dwopt == Disp_Win) { 511 int sx2 = (int)((float)nouv->XSize()*pii->GetZoomF()); 512 int sy2 = (int)((float)nouv->YSize()*pii->GetZoomF()); 513 514 if (sx2 > 400+mFgScSz*100) sx2 = 400+mFgScSz*100; 515 if (sy2 > 400+mFgScSz*100) sy2 = 400+mFgScSz*100; 516 if (sx2 < MINPIIMGSIZE) sx = MINPIIMGSIZE; 517 if (sy2 < MINPIIMGSIZE) sy = MINPIIMGSIZE; 518 if ((sx2 != sx) || (sy2 != sy)) win->SetSize(sx2, sy2); 519 } 520 521 pii->SetImage(nouv, false); 522 505 523 // printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() ); 506 524 mCurWin = win; … … 509 527 mBWId++; 510 528 mBWList[mBWId] = pii; 529 pii->Refresh(); 511 530 return(mBWId); 512 531 } … … 514 533 515 534 /* --Methode-- */ 516 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, int oid) 535 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, string const& sop, 536 string title, int oid) 517 537 { 518 538 if (scd == NULL) … … 522 542 } 523 543 524 // Changement d'attributs graphiques courants du drawer 525 if (mFCol != PI_NotDefColor) scd->GetGraphicAtt().SetColAtt(mFCol, mBCol); 526 if (mLAtt != PI_NotDefLineAtt) scd->GetGraphicAtt().SetLineAtt(mLAtt); 527 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) 528 scd->GetGraphicAtt().SetFontAtt(mFSz, mFAtt); 529 if ( mFName != PI_DefaultFont ) 530 scd->GetGraphicAtt().SetFontAtt(mFName, scd->GetGraphicAtt().GetFontSz(), 531 scd->GetGraphicAtt().GetFontAtt()); 532 if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) 533 scd->GetGraphicAtt().SetMarkerAtt(mMSz, mMrk); 534 if ( mCmapid != CMAP_OTHER ) scd->GetGraphicAtt().SetColMapId(mCmapid); 535 536 537 if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next; 544 // On decode les options graphiques 545 vector<string> opts; 546 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 547 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 538 548 // Trace en superpoistion 539 if ( (opt == Disp_Same) && (mLastWdg) ) { 549 if ( (dwopt == Disp_Same) && (mLastWdg) ) { 550 // Les options 551 scd->DecodeOptionString(mDefaultAtt, false); 552 scd->DecodeOptionString(opts, true); 553 540 554 if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true); 541 555 else mLastWdg->AddDrawer(scd, true, true, true); … … 546 560 } 547 561 // Trace en medaillon 548 else if ( ( opt == Disp_Inset) && (mLastWdg) ) {562 else if ( (dwopt == Disp_Inset) && (mLastWdg) ) { 549 563 PIGrCoord x1, x2, y1, y2; 550 564 x1 = mIXmin; x2 = mIXmax; 551 565 y2 = 1.-mIYmin; y1 = 1.-mIYmax; 566 // Les options 567 scd->DecodeOptionString(mDefaultAtt, false); 568 scd->DecodeOptionString(opts, true); 569 552 570 scd->SetAxesFlags(mAxesFlags); 553 if (maXlog || maYlog) scd->SetLogScale(maXlog, maYlog); // Echelle log 554 if (mFXYlim) // Forcage limites XY 555 scd->SetLimits(mXmin, mXmax, mYmin, mYmax); 556 else scd->UpdateLimits(); 571 scd->UpdateLimits(); 557 572 mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true); 558 573 scd->Refresh(); … … 562 577 } 563 578 579 // Creation d'un nouveau PIScDrawWdg 564 580 PIWindow* win; 565 581 PIScDrawWdg* scw; … … 567 583 sx = 200+mFgScSz*100; 568 584 sy = 200+mFgScSz*100; 569 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str()); 570 /* 571 if (typeid(*scd) != typeid(PIHisto2D)) 572 else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py); 573 */ 585 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str()); 586 574 587 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py); 575 588 scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 576 589 scw->SetUserData(NULL, oid); 577 if (maXlog || maYlog) scw->SetLogScale(maXlog, maYlog); // Echelle log 578 if (mFXYlim) // Forcage limites XY 579 scw->SetLimits(mXmin, mXmax, mYmin, mYmax);590 591 // Decodage des options : 592 vector<string> scwatt; 580 593 scw->SetAxesFlags(mAxesFlags); 581 // Fonte de trace d'axe 582 scw->BaseDrawer()->GetGraphicAtt().SetFontAtt(mFName, mFSz, mFAtt); 583 /* 584 if (typeid(*scd) != typeid(PIHisto2D)) 585 else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd); 586 */ 587 scw->AddScDrawer(scd, true); 594 if ( mDefaultAtt.size() > 0) { 595 scwatt = mDefaultAtt; 596 scw->DecodeOptionString(scwatt, true); 597 } 598 if ( mAxesAtt.size() > 0) { 599 scwatt = mAxesAtt; 600 scw->DecodeOptionString(scwatt, true); 601 } 602 if (opts.size() > 0) 603 scd->DecodeOptionString(opts, true); 604 if (opts.size() > 0) 605 scw->DecodeOptionString(opts, false); 606 588 607 // Titre du plot 589 608 if (mAddTitle) { … … 592 611 } 593 612 613 scw->AddScDrawer(scd, true); 594 614 // scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$ 615 595 616 mCurWin = win; 596 617 mCurWdg = scw; … … 602 623 603 624 /* --Methode-- */ 604 int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title, int oid) 625 int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, string const& sop, 626 string title, int oid) 605 627 { 606 628 if (dr3 == NULL) … … 610 632 } 611 633 612 // Changement d'attributs graphiques courants du drawer 613 if (mFCol != PI_NotDefColor) dr3->GetGraphicAtt().SetColAtt(mFCol, mBCol); 614 if (mLAtt != PI_NotDefLineAtt) dr3->GetGraphicAtt().SetLineAtt(mLAtt); 615 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) 616 dr3->GetGraphicAtt().SetFontAtt(mFSz, mFAtt); 617 if ( mFName != PI_DefaultFont ) 618 dr3->GetGraphicAtt().SetFontAtt(mFName, dr3->GetGraphicAtt().GetFontSz(), 619 dr3->GetGraphicAtt().GetFontAtt()); 620 if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) 621 dr3->GetGraphicAtt().SetMarkerAtt(mMSz, mMrk); 622 if ( mCmapid != CMAP_OTHER ) dr3->GetGraphicAtt().SetColMapId(mCmapid); 623 624 if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next; 634 // On decode les options graphiques 635 vector<string> opts; 636 DispWinEnum dwopt = ParseDisplayOption(sop, opts); 637 638 if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next; 625 639 // Trace en superpoistion 626 if ( (opt == Disp_Same) && (mLastWdg) ) { 640 if ( (dwopt == Disp_Same) && (mLastWdg) ) { 641 // Les options 642 dr3->DecodeOptionString(mDefaultAtt, false); 643 dr3->DecodeOptionString(opts, true); 644 627 645 if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true); 628 646 else mLastWdg->AddDrawer(dr3, true, true, true); … … 633 651 } 634 652 // Trace en medaillon 635 else if ( ( opt == Disp_Inset) && (mLastWdg) ) {653 else if ( (dwopt == Disp_Inset) && (mLastWdg) ) { 636 654 PIGrCoord x1, x2, y1, y2; 637 655 x1 = mIXmin; x2 = mIXmax; 638 656 y2 = 1.-mIYmin; y1 = 1.-mIYmax; 657 // Les options 658 dr3->DecodeOptionString(mDefaultAtt, false); 659 dr3->DecodeOptionString(opts, true); 660 639 661 dr3->SetAxesFlags(mAxesFlags); 640 662 dr3->UpdateLimits(); … … 651 673 sx = 200+mFgScSz*100; 652 674 sy = 200+mFgScSz*100; 653 win = GetWindow( opt, sx, sy, px, py, flag, (char *)name.c_str());675 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str()); 654 676 PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py); 655 677 wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 656 678 wd3->SetUserData(NULL, oid); 657 wd3->AddDrawer3D(dr3, true); 679 680 // Decodage des options : 681 vector<string> scwatt; 682 // wd3->SetAxesFlags(mAxesFlags); Attributs d'axes 3D a faire 683 if ( mDefaultAtt.size() > 0) { 684 scwatt = mDefaultAtt; 685 wd3->DecodeOptionString(scwatt, true); 686 } 687 if ( mAxesAtt.size() > 0) { 688 scwatt = mAxesAtt; 689 wd3->DecodeOptionString(scwatt, true); 690 } 691 if (opts.size() > 0) 692 dr3->DecodeOptionString(opts, true); 693 if (opts.size() > 0) 694 wd3->DecodeOptionString(opts, false); 695 658 696 // Titre du plot 659 697 if (mAddTitle) { … … 661 699 wd3->SetTitles(title, t2); 662 700 } 701 702 wd3->AddDrawer3D(dr3, true); 663 703 // wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99 704 664 705 mCurWin = win; 665 706 mCurWdg = wd3; … … 671 712 672 713 /* --Methode-- */ 673 void PIStdImgApp::AddText(string const & txt, double xp, double yp )714 void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop) 674 715 { 675 716 PIElDrawer *eld=CurrentElDrawer(); 676 717 if (eld == NULL) return; 677 718 678 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) 679 eld->GetGraphicAtt().SetFontAtt(mFSz, mFAtt); 680 if ( mFName != PI_DefaultFont ) 681 eld->GetGraphicAtt().SetFontAtt(mFName, eld->GetGraphicAtt().GetFontSz(), 682 eld->GetGraphicAtt().GetFontAtt()); 683 eld->ElAddText(xp,yp,txt.c_str(),mFCol); 719 vector<string> opts; 720 ParseDisplayOption(sop, opts); 721 PIGraphicAtt gratt(opts); 722 eld->ElAddText(xp,yp,txt.c_str(), gratt.GetColor()); 684 723 eld->Refresh(); 685 724 } 686 725 687 726 /* --Methode-- */ 688 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2 )727 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop) 689 728 { 690 729 PIElDrawer *eld=CurrentElDrawer(); 691 730 if (eld == NULL) return; 692 731 693 eld->ElAddLine(xp1, yp1, xp2, yp2, mFCol); 732 vector<string> opts; 733 ParseDisplayOption(sop, opts); 734 PIGraphicAtt gratt(opts); 735 eld->ElAddLine(xp1, yp1, xp2, yp2, gratt.GetColor()); 694 736 eld->Refresh(); 695 737 } 696 738 697 739 /* --Methode-- */ 698 void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill) 740 void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2, 741 string const& sop, bool fgfill) 699 742 { 700 743 PIElDrawer *eld=CurrentElDrawer(); … … 715 758 yp = yp2; dy = yp1-yp2; 716 759 } 717 if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, mFCol); 718 else eld->ElAddRect(xp, yp, dx, dy, mFCol); 760 761 vector<string> opts; 762 ParseDisplayOption(sop, opts); 763 PIGraphicAtt gratt(opts); 764 765 if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, gratt.GetColor()); 766 else eld->ElAddRect(xp, yp, dx, dy, gratt.GetColor()); 719 767 eld->Refresh(); 720 768 } 721 769 722 770 /* --Methode-- */ 723 void PIStdImgApp::AddCircle(double xc, double yc, double r, bool fgfill)771 void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill) 724 772 { 725 773 PIElDrawer *eld=CurrentElDrawer(); 726 774 if (eld == NULL) return; 727 775 728 if (fgfill) eld->ElAddFCirc(xc, yc, r, mFCol); 729 else eld->ElAddCirc(xc, yc, r, mFCol); 776 vector<string> opts; 777 ParseDisplayOption(sop, opts); 778 PIGraphicAtt gratt(opts); 779 780 if (fgfill) eld->ElAddFCirc(xc, yc, r, gratt.GetColor()); 781 else eld->ElAddCirc(xc, yc, r, gratt.GetColor()); 730 782 eld->Refresh(); 731 783 } … … 737 789 if (eld == NULL) return; 738 790 739 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )740 eld->GetGraphicAtt().SetFontAtt(mFSz, mFAtt);741 if ( mFName != PI_DefaultFont )742 eld->GetGraphicAtt().SetFontAtt(mFName, eld->GetGraphicAtt().GetFontSz(),743 eld->GetGraphicAtt().GetFontAtt());744 791 eld->SetTitles(titletop, titlebottom); 745 792 eld->Refresh(); … … 815 862 816 863 /* --Methode-- */ 817 PIWindow* PIStdImgApp::GetWindow( inttyp, int& sx, int& sy, int& px, int& py, int& flag, char * nom)864 PIWindow* PIStdImgApp::GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom) 818 865 { 819 866 PIWindow* rw; … … 821 868 switch (typ) { 822 869 case Disp_Next : // Fenetre graphique courante 870 case Disp_Default : 823 871 { 824 872 if (mGrW == NULL) CreateGraphWin(); … … 993 1041 } 994 1042 1043 /* --Methode-- */ 1044 void PIStdImgApp::StatZoomWindowSetVisible(bool fg) 1045 { 1046 1047 if (fg) { 1048 consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free); 1049 int szy = MainWin()->YSize(); 1050 MainWin()->SetSize(MainWin()->XSize(), szy+statcont->YSize()); 1051 consolecont->SetPos(0, statcont->YSize()); 1052 consolecont->SetSize(MainWin()->XSize(), szy); 1053 consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed); 1054 statcont->Show(); 1055 m[3]->SetStateMsg(10470, true); 1056 } 1057 else { 1058 statcont->Hide(); 1059 consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free); 1060 MainWin()->SetSize(MainWin()->XSize(), MainWin()->YSize()-statcont->YSize()); 1061 consolecont->SetPos(0, 0); 1062 consolecont->SetSize(MainWin()->XSize(), MainWin()->YSize()); 1063 consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed); 1064 m[3]->SetStateMsg(10470, false); 1065 } 1066 1067 } 995 1068 996 1069 /* --Methode-- */ … … 1040 1113 m[4]->SetSensitivityMsg(10516, false); 1041 1114 } 1115 1116 //--------------------------------------------------------------------------- 1117 //--------- Gestion des attributs graphiques et autres options de trace ----- 1118 1119 /* --Methode-- */ 1120 void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax) 1121 { 1122 mIXmin = xmin; mIXmax= xmax; 1123 mIYmin = ymin; mIYmax= ymax; 1124 } 1125 1126 /* --Methode-- */ 1127 void PIStdImgApp::SetDefaultGraphicAttributes(string const & opt) 1128 { 1129 ParseDisplayOption(opt, mDefaultAtt); 1130 } 1131 1132 /* --Methode-- */ 1133 void PIStdImgApp::SetDefaultAxesAttributes(string const & opt) 1134 { 1135 ParseDisplayOption(opt, mAxesAtt); 1136 } 1137 1138 /* --Methode-- */ 1139 DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts) 1140 { 1141 DispWinEnum rc = Disp_Next; 1142 //DBG cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl; 1143 if (opts.size() > 0) opts.erase(opts.begin(), opts.end()); 1144 if (sop.length() < 1) return(rc); 1145 string gratt = sop; 1146 for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]); 1147 if ( (gratt == "def") || (gratt == "default") ) return(rc); 1148 // On separe en mots espaces par des blancs ou tabulation 1149 size_t p = 0; 1150 size_t q = 0; 1151 size_t l = gratt.length(); 1152 string token; 1153 while (q < l) { 1154 p = gratt.find_first_not_of(" \t",q); // au debut d'un token 1155 if (p >= l) break; 1156 q = gratt.find_first_of(" \t",p); // Premier blanc ou tab suivant 1157 if (q<l) token = gratt.substr(p,q-p); 1158 else token = gratt.substr(p); 1159 if (token == "") continue; 1160 // Decodage option fenetre d'affichage (win, next, ...) 1161 if (token == "win") rc = Disp_Win; 1162 else if (token == "same") rc = Disp_Same; 1163 else if (token == "inset") rc = Disp_Inset; 1164 else if (token == "stack") rc = Disp_Stack; 1165 // Option a etre decode par les drawers, etc ... 1166 else opts.push_back(token); 1167 } 1168 1169 //DBG cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl; 1170 return (rc); 1171 } 1172 1173 //--------------------------------------------------------------------------- 1174 //------------ Methodes privees (MBProcessx, ...) ---------- 1042 1175 1043 1176 /* --Methode-- */ … … 1295 1428 DeleteWindow(mCurWin); 1296 1429 break; 1430 case 10470 : 1431 StatZoomWindowSetVisible(m[3]->GetStateMsg(10470)); 1432 break; 1297 1433 default: 1298 1434 cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl; … … 1461 1597 1462 1598 1463 /* --Methode-- */1464 void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)1465 {1466 mFCol = fg;1467 mBCol = bg;1468 }1469 /* --Methode-- */1470 void PIStdImgApp::SetLineAtt(PILineAtt lat)1471 {1472 mLAtt = lat;1473 }1474 1475 /* --Methode-- */1476 void PIStdImgApp::SetFontName(PIFontName fn)1477 {1478 mFName = fn;1479 }1480 1481 /* --Methode-- */1482 void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)1483 {1484 mFSz = fsz;1485 mFAtt = fat;1486 }1487 /* --Methode-- */1488 void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)1489 {1490 mMSz = sz;1491 mMrk = mrk;1492 }1493 1494 /* --Methode-- */1495 void PIStdImgApp::SetZoomAtt(int zoom)1496 {1497 if ( (zoom > 10) || (zoom < -10) ) zoom = 0;1498 mZoom = zoom;1499 }1500 /* --Methode-- */1501 void PIStdImgApp::SetAxesAtt(unsigned int axfl)1502 {1503 mAxesFlags = axfl;1504 }1505 /* --Methode-- */1506 void PIStdImgApp::SetXYLimits(double xmin, double xmax, double ymin, double ymax)1507 {1508 mXmin = xmin; mXmax= xmax;1509 mYmin = ymin; mYmax= ymax;1510 }1511 /* --Methode-- */1512 void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)1513 {1514 mIXmin = xmin; mIXmax= xmax;1515 mIYmin = ymin; mIYmax= ymax;1516 }1517 /* --Methode-- */1518 void PIStdImgApp::SetImageCenterPosition(int x, int y)1519 {1520 mXImgCenter = x; mYImgCenter = y;1521 }1522 1523 /* --Methode-- */1524 void PIStdImgApp::SaveGraphicAtt()1525 {1526 mSFCol = mFCol;1527 mSBCol = mBCol;1528 mSLAtt = mLAtt;1529 mSFName = mFName;1530 mSFSz = mFSz;1531 mSFAtt = mFAtt;1532 mSMSz = mMSz;1533 mSMrk = mMrk;1534 mSCmapid = mCmapid;1535 mSRevCmap = mRevCmap;1536 mSZoom = mZoom;1537 mSAxesFlags = mAxesFlags;1538 mSXmin = mXmin; mSXmax = mXmax;1539 mSYmin = mYmin; mSYmax = mYmax;1540 mSIXmin = mIXmin; mSIXmax = mIXmax;1541 mSIYmin = mIYmin; mSIYmax = mIYmax;1542 mSFXYlim = mFXYlim;1543 mSXImgCenter = mXImgCenter;1544 mSYImgCenter = mYImgCenter;1545 mSFImgCenter = mFImgCenter;1546 mSaXlog = maXlog;1547 mSaYlog = maYlog;1548 mSAddTitle = mAddTitle;1549 }1550 1551 /* --Methode-- */1552 void PIStdImgApp::RestoreGraphicAtt()1553 {1554 mFCol = mSFCol;1555 mBCol = mSBCol;1556 mLAtt = mSLAtt;1557 mFName = mSFName;1558 mFSz = mSFSz;1559 mFAtt = mSFAtt;1560 mMSz = mSMSz;1561 mMrk = mSMrk;1562 mCmapid = mSCmapid;1563 mRevCmap = mSRevCmap;1564 mZoom = mSZoom;1565 mAxesFlags = mSAxesFlags;1566 mXmin = mSXmin; mXmax = mSXmax;1567 mYmin = mSYmin; mYmax = mSYmax;1568 mIXmin = mSIXmin; mIXmax = mSIXmax;1569 mIYmin = mSIYmin; mIYmax = mSIYmax;1570 mFXYlim = mSFXYlim;1571 mXImgCenter = mSXImgCenter;1572 mYImgCenter = mSYImgCenter;1573 mFImgCenter = mSFImgCenter;1574 maXlog = mSaXlog;1575 maYlog = mSaYlog;1576 mAddTitle = mSAddTitle;1577 }1578 1599 1579 1600 // ------------------------------------------------- … … 1620 1641 string info = "piapp : Interactive analysis program\n"; 1621 1642 info += buff; 1622 info += "(C) LAL-IN2P3/CNRS 1996-200 0\n";1623 info += "(C) SPP-DAPNIA/CEA 1996-200 0\n";1643 info += "(C) LAL-IN2P3/CNRS 1996-2002\n"; 1644 info += "(C) SPP-DAPNIA/CEA 1996-2002\n"; 1624 1645 infow_txt->SetText(info); 1625 1646 } -
trunk/SophyaPI/PIext/pistdimgapp.h
r1642 r1971 31 31 32 32 33 enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3, Disp_Inset=4};33 enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset}; 34 34 35 35 typedef map<long, PIWindow*, less<long> > WindMList; … … 47 47 virtual void SetBlocked(); 48 48 49 int DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid=0); 50 int DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", int oid=0); 51 int Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0); 49 int DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt, int oid=0); 50 int DispScDrawer(PIDrawer* scd, string const & name, string const & opt, 51 string title="", int oid=0); 52 int Disp3DDrawer(PIDrawer3D* scd, string const & name, string const & opt, 53 string title="", int oid=0); 52 54 53 55 // Fonction d'ajout de texte (provisoire - Aout 99) 54 void AddText(string const & txt, double xp, double yp );56 void AddText(string const & txt, double xp, double yp, string const& opt); 55 57 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001) 56 void AddLine(double xp1, double yp1, double xp2, double yp2); 57 void AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill=false); 58 void AddCircle(double xc, double yc, double r, bool fgfill=false); 58 void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt); 59 void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt, 60 bool fgfill=false); 61 void AddCircle(double xc, double yc, double r, string const& opt, 62 bool fgfill=false); 59 63 60 64 // Fonction Ajout de titre de trace … … 66 70 void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0); 67 71 void CreateStackWin(int sx=0, int sy = 0); 68 PIWindow * GetWindow( inttyp, int& sx, int& sy, int& px, int& py, int& flag, char * nom);72 PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom); 69 73 void SetZone(int nzx=1, int nzy=1); 70 74 void StackWinNext(); … … 93 97 inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; } 94 98 99 // Gestion (show/hide) de la fenetre Stat/ZoomWindow 100 void StatZoomWindowSetVisible(bool fg=true); 101 95 102 // Redirection ou Non de StdOut/StdErr 96 103 void RedirectStdOutErr(bool fg = true); … … 99 106 void CatchSignals(bool fgfpe=true, bool fgsegv=true); 100 107 101 // Gestion d attributs graphiques courants102 void SetColAtt(PIColors fg=PI_NotDefColor,103 PIColors bg=PI_NotDefColor);104 void SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);105 void SetFontName(PIFontName fn=PI_DefaultFont);106 void SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,107 PIFontAtt fat=PI_NotDefFontAtt);108 void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);109 inline void SetColMapId(CMapId cid=CMAP_OTHER) { mCmapid = cid; }110 inline void SetReverseColMapFlag(bool fg=false) { mRevCmap = fg; }111 void SetZoomAtt(int zoom=0);112 void SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels);113 void SetXYLimits(double xmin=-1., double xmax=1., double ymin=-1., double ymax=1.);114 108 void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6); 115 void SetImageCenterPosition(int x=-1, int y=-1);116 inline void UseXYLimits(bool fg=false) { mFXYlim=fg; }117 inline void UseImageCenter(bool fg=false) { mFImgCenter=fg; }118 inline void SetXLogScale(bool logx=false) { maXlog = logx; }119 inline void SetYLogScale(bool logy=false) { maYlog = logy; }120 109 inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; } 121 122 // Pour sauvegarder-restauration de l'etat des attributs graphiques 123 void SaveGraphicAtt(); 124 void RestoreGraphicAtt(); 110 void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; } 111 // void SaveGraphicAtt(); 112 // void RestoreGraphicAtt(); 113 void SetDefaultGraphicAttributes(string const & opt); 114 void SetDefaultAxesAttributes(string const & opt); 115 DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts); 125 116 126 117 // Gestion fichiers PS … … 141 132 void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 142 133 134 143 135 144 136 NamedObjMgr* mObjMgr; … … 148 140 PIMenu* mc; 149 141 142 PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ... 150 143 PIPixmap* zoom; 151 144 PIPixmap* gimv; 152 145 PICMapView* cmapv; 146 PILabel* labstat; 153 147 154 148 PIFileChooser * pfc_fits; // Pour les fichiers FITS … … 156 150 PIFileChooser * pfc_ps; // Pour les PostScript 157 151 152 PIContainer* consolecont; // Container pour la PIConsole 158 153 PIConsole* mCons; 159 154 bool redirecout; // true if stdout/err redirected to mCons; … … 176 171 PPInMgrWind* mPpinmgrw; 177 172 178 // Gestion d attributs graphiques courants, etat sauvegarde 179 PIColors mFCol, mBCol, mSFCol, mSBCol; 180 PILineAtt mLAtt, mSLAtt; 181 PIFontName mFName, mSFName; 182 PIFontSize mFSz, mSFSz; 183 PIFontAtt mFAtt, mSFAtt; 184 int mMSz, mSMSz; 185 PIMarker mMrk,mSMrk; 186 CMapId mCmapid, mSCmapid; 187 bool mRevCmap, mSRevCmap; 188 int mZoom, mSZoom; 189 unsigned int mAxesFlags, mSAxesFlags; 190 double mXmin, mXmax, mYmin, mYmax; 191 double mSXmin, mSXmax, mSYmin, mSYmax; 173 // Attributs graphiques, etc ... 192 174 double mIXmin, mIXmax, mIYmin, mIYmax; 193 double mSIXmin, mSIXmax, mSIYmin, mSIYmax; 194 int mXImgCenter, mYImgCenter; 195 int mSXImgCenter, mSYImgCenter; 196 bool mFXYlim, mSFXYlim; 197 bool mFImgCenter, mSFImgCenter; 198 bool maXlog, mSaXlog; 199 bool maYlog, mSaYlog; 200 bool mAddTitle, mSAddTitle; 175 bool mAddTitle; 176 unsigned int mAxesFlags; 201 177 178 vector<string> mDefaultAtt; 179 vector<string> mAxesAtt; 180 181 // Controles et gestion divers 202 182 PIMessage mFCMsg; // Message for processing FileOpen 203 int mFgScSz; // Dlag ScreenSize183 int mFgScSz; // Flag ScreenSize 204 184 bool mFgCWImg; // true -> Current Widget is PIImage 205 185 }; -
trunk/SophyaPI/PIext/servnobjm.cc
r1931 r1971 53 53 mOmg = omg; 54 54 dynlink = NULL; 55 InitGrAttNames();56 55 } 57 56 … … 235 234 vya->DefineXCoordinate(xmin, (xmax-xmin)/np); 236 235 PIYfXDrawer* dr = new PIYfXDrawer(vya, NULL, true) ; 237 bool fgsr = true; 238 dopt = "thinline," + dopt; 239 int opt = DecodeDispOption(dopt, fgsr); 240 int rsid = mImgapp->DispScDrawer(dr, titre, opt); 241 if (fgsr) mImgapp->RestoreGraphicAtt(); 236 dopt = "thinline " + dopt; 237 int rsid = mImgapp->DispScDrawer(dr, titre, dopt); 242 238 if (nom.length() > 0) { 243 239 mOmg->AddObj(vpy, nom); … … 245 241 } 246 242 } 247 248 243 return; 249 244 } … … 304 299 } 305 300 else titre = nom; 306 bool fgsr = true;307 int opt = DecodeDispOption(dopt, fgsr);308 301 P2DArrayAdapter* arr = new POMatrixAdapter(mtx, false); 309 302 arr->DefineXYCoordinates(xmin, ymin, dx, dy); 310 303 PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true); 311 int rsid = mImgapp->Disp3DDrawer(sdr, titre, opt); 312 if (fgsr) mImgapp->RestoreGraphicAtt(); 304 int rsid = mImgapp->Disp3DDrawer(sdr, titre, dopt); 313 305 if (nom.length() > 0) { 314 306 mOmg->AddObj(mtx, nom); … … 352 344 // nt->Print(0,10); 353 345 PINTuple* pin = new PINTuple(nt, true); 354 pin->SetStats(Services2NObjMgr::GetStatsOption(dopt));355 346 pin->SelectXY(ntn[0], ntn[1]); 356 347 if ( haserr ) pin->SelectErrBar(ntn[2], ntn[3]); 357 348 358 bool fgsr = true; 359 dopt = "defline," + dopt; 360 int opt = DecodeDispOption(dopt, fgsr); 349 dopt = "defline " + dopt; 361 350 string titre = nom + ":" + expy + "%" + expx; 362 mImgapp->DispScDrawer( (PIDrawer*)pin, titre, opt); 363 if (fgsr) mImgapp->RestoreGraphicAtt(); 351 mImgapp->DispScDrawer( (PIDrawer*)pin, titre, dopt); 364 352 return; 365 353 } … … 392 380 PINTuple3D* pin = new PINTuple3D(nt, true); 393 381 pin->SelectXYZ(ntn[0], ntn[1], ntn[2]); 394 bool fgsr = true; 395 dopt = "defline," + dopt; 396 int opt = DecodeDispOption(dopt, fgsr); 382 dopt = "defline " + dopt; 397 383 398 384 // Pour plot a partir de DispScDrawer … … 401 387 // Pour plot a partir de Disp3DDrawer 402 388 string titre = nom + ":" + expy + "%" + expx; 403 mImgapp->Disp3DDrawer(pin, titre, opt); 404 405 if (fgsr) mImgapp->RestoreGraphicAtt(); 389 mImgapp->Disp3DDrawer(pin, titre, dopt); 390 406 391 return; 407 392 } … … 432 417 433 418 PINTuple* pin = new PINTuple(nt, true); 434 pin->SetStats(Services2NObjMgr::GetStatsOption(dopt));435 419 pin->SelectXY(ntn[0], ntn[1]); 436 420 pin->SelectWt(ntn[2]); 437 421 438 bool fgsr = true;439 int opt = DecodeDispOption(dopt, fgsr);440 422 string titre = nom + ":" + expwt + "_" + expy + "%" + expx ; 441 mImgapp->DispScDrawer( (PIDrawer*)pin, titre, opt); 442 if (fgsr) mImgapp->RestoreGraphicAtt(); 423 mImgapp->DispScDrawer( (PIDrawer*)pin, titre, dopt); 443 424 return; 444 425 } … … 1315 1296 1316 1297 1317 // Variable pour stocker l'option de stat des drawers1318 static bool stats_option = true;1319 /* --Methode-- */1320 void Services2NObjMgr::SetDefaultStatsOption(bool opt)1321 {1322 stats_option = opt;1323 }1324 1325 typedef vector<string> GraTok;1326 1327 /* --Methode-- */1328 bool Services2NObjMgr::GetStatsOption(string& gratt)1329 {1330 int ropt = Disp_Next;1331 for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);1332 // On separe en mots separes par des virgules1333 gratt = ","+gratt;1334 size_t p = 0;1335 size_t q = 0;1336 size_t l = gratt.length();1337 string token;1338 1339 GraTok grt;1340 1341 while (q < l) {1342 p = gratt.find_first_not_of(" ,",q+1); // au debut d'un token1343 if (p>=l) break;1344 q = gratt.find_first_of(" ,",p); // la fin du token;1345 token = gratt.substr(p,q-p);1346 grt.push_back(token);1347 }1348 int k;1349 bool fgsame = false;1350 int option = 0;1351 for(k=0; k<grt.size(); k++) {1352 if ( (grt[k] == "same") || (grt[k] == "s") ) option = 1;1353 else if ( (grt[k] == "stat") || (grt[k] == "stats") ) option = 2;1354 else if ( (grt[k] == "nostat") || (grt[k] == "nostats") ) option = 3;1355 }1356 1357 if (option == 0) return(stats_option);1358 else if ( (option == 1) || (option == 3) ) return(false);1359 else return(true);1360 }1361 1362 /* --Methode-- */1363 int Services2NObjMgr::DecodeDispOption(string& gratt, bool& fgsrgr)1364 {1365 int ropt = Disp_Next;1366 if (!mImgapp) return(ropt);1367 1368 for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);1369 1370 if (fgsrgr) mImgapp->SaveGraphicAtt();1371 1372 if ( (gratt == "def") || (gratt == "default") ) { // Remise aux valeurs par defaut = non defini1373 mImgapp->SetColAtt();1374 mImgapp->SetLineAtt();1375 mImgapp->SetFontName();1376 mImgapp->SetFontAtt();1377 mImgapp->SetMarkerAtt();1378 mImgapp->SetColMapId();1379 mImgapp->SetReverseColMapFlag();1380 mImgapp->SetZoomAtt();1381 mImgapp->SetAxesAtt();1382 mImgapp->SetXYLimits();1383 mImgapp->UseXYLimits();1384 mImgapp->SetImageCenterPosition();1385 mImgapp->UseImageCenter();1386 mImgapp->SetXLogScale();1387 mImgapp->SetYLogScale();1388 mImgapp->SetAutoAddTitle();1389 stats_option = true;1390 return(ropt);1391 }1392 1393 // On separe en mots separes par des virgules1394 gratt = ","+gratt;1395 size_t p = 0;1396 size_t q = 0;1397 size_t l = gratt.length();1398 string token;1399 1400 GraTok grt;1401 1402 while (q < l) {1403 p = gratt.find_first_not_of(" ,",q+1); // au debut d'un token1404 if (p>=l) break;1405 q = gratt.find_first_of(" ,",p); // la fin du token;1406 token = gratt.substr(p,q-p);1407 grt.push_back(token);1408 }1409 1410 1411 static GrAttNames::iterator it;1412 1413 int k;1414 bool fgcont = true;1415 fgsrgr = false;1416 1417 for(k=0; k<grt.size(); k++) {1418 // cout << "--DBG--SetGraphicAttributes() " << grt[k] << endl;1419 1420 // Decodage option affichage (win, next, etc1421 fgcont = true;1422 if ( (grt[k] == "win") || (grt[k] == "w") ) ropt = Disp_Win;1423 else if ( (grt[k] == "same") || (grt[k] == "s") ) ropt = Disp_Same;1424 else if ( (grt[k] == "inset") || (grt[k] == "ins") ) ropt = Disp_Inset;1425 else if ( (grt[k] == "stack") || (grt[k] == "st") ) ropt = Disp_Stack;1426 else fgcont = false;1427 if (fgcont) continue;1428 1429 // Utilisation limites X-Y1430 if ( grt[k] == "xylimits" ) { mImgapp->UseXYLimits(true); fgsrgr = true; continue; }1431 if ( grt[k] == "centerimg" ) { mImgapp->UseImageCenter(true); fgsrgr = true; continue; }1432 // Echelle logarithmique d'axe1433 if ( grt[k] == "logx" ) { mImgapp->SetXLogScale(true); fgsrgr = true; continue; }1434 if ( grt[k] == "linx" ) { mImgapp->SetXLogScale(false); fgsrgr = true; continue; }1435 if ( grt[k] == "logy" ) { mImgapp->SetYLogScale(true); fgsrgr = true; continue; }1436 if ( grt[k] == "liny" ) { mImgapp->SetYLogScale(false); fgsrgr = true; continue; }1437 // Ajout automatique de titre1438 if ( ( grt[k] == "tit" ) || ( grt[k] == "title" ) )1439 { mImgapp->SetAutoAddTitle(true); fgsrgr = true; continue; }1440 if ( ( grt[k] == "notit" ) || ( grt[k] == "notitle" ) )1441 { mImgapp->SetAutoAddTitle(false); fgsrgr = true; continue; }1442 1443 // Inversion d'indexage de ColorMap1444 if (grt[k] == "revcmap")1445 { mImgapp->SetReverseColMapFlag(true); fgsrgr = true; continue; }1446 1447 // Si c'est une couleur1448 it = GrAcolors.find(grt[k]);1449 if (it != GrAcolors.end()) { mImgapp->SetColAtt((PIColors)((*it).second.a1)); fgsrgr = true; continue; }1450 // Si c'est un attribut de lignes1451 it = GrAlines.find(grt[k]);1452 if (it != GrAlines.end()) { mImgapp->SetLineAtt(PILineAtt((PILineTypes)((*it).second.a1))); fgsrgr = true; continue; }1453 // Si c'est un attribut de fontes1454 it = GrAfonts.find(grt[k]);1455 if (it != GrAfonts.end()) { mImgapp->SetFontAtt((PIFontSize)((*it).second.a2), (PIFontAtt)((*it).second.a1) );1456 fgsrgr = true; continue; }1457 // Si c'est un nom de fontes1458 it = GrAfontNames.find(grt[k]);1459 if (it != GrAfontNames.end()) { mImgapp->SetFontName((PIFontName)((*it).second.a1));1460 fgsrgr = true; continue; }1461 // Si c'est un attribut de markers1462 it = GrAmarkers.find(grt[k]);1463 if (it != GrAmarkers.end()) { mImgapp->SetMarkerAtt((*it).second.a2, (PIMarker)((*it).second.a1) );1464 fgsrgr = true; continue; }1465 // Si c'est un colormap1466 it = GrAcmap.find(grt[k]);1467 if (it != GrAcmap.end()) { mImgapp->SetColMapId( (CMapId)((*it).second.a1) ); fgsrgr = true; continue; }1468 // Si c'est un facteur de zoom1469 it = GrAzoom.find(grt[k]);1470 if (it != GrAzoom.end()) { mImgapp->SetZoomAtt( (*it).second.a1 ); fgsrgr = true; continue; }1471 // Si c'est un attribut d'axe1472 it = GrAaxes.find(grt[k]);1473 if (it != GrAaxes.end()) { mImgapp->SetAxesAtt( (*it).second.a1 ); fgsrgr = true; continue; }1474 1475 }1476 1477 return(ropt);1478 }1479 1480 1481 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1482 // Initialisation des chaines de caracteres designant les attributs graphiques1483 1484 /* --Methode-- */1485 void Services2NObjMgr::InitGrAttNames()1486 {1487 gratt_item gi;1488 // Les couleurs1489 gi.a2 = 0;1490 gi.a1 = PI_NotDefColor;1491 GrAcolors["defcol"] = gi;1492 gi.a1 = PI_Black;1493 GrAcolors["black"] = gi;1494 gi.a1 = PI_White;1495 GrAcolors["white"] = gi;1496 gi.a1 = PI_Grey;1497 GrAcolors["grey"] = gi;1498 gi.a1 = PI_Red;1499 GrAcolors["red"] = gi;1500 gi.a1 = PI_Blue;1501 GrAcolors["blue"] = gi;1502 gi.a1 = PI_Green;1503 GrAcolors["green"] = gi;1504 gi.a1 = PI_Yellow;1505 GrAcolors["yellow"] = gi;1506 gi.a1 = PI_Magenta;1507 GrAcolors["magenta"] = gi;1508 1509 gi.a1 = PI_Cyan;1510 GrAcolors["cyan"] = gi;1511 gi.a1 = PI_Turquoise;1512 GrAcolors["turquoise"] = gi;1513 gi.a1 = PI_NavyBlue;1514 GrAcolors["navyblue"] = gi;1515 gi.a1 = PI_Orange;1516 GrAcolors["orange"] = gi;1517 gi.a1 = PI_SiennaRed;1518 GrAcolors["siennared"] = gi;1519 gi.a1 = PI_Purple;1520 GrAcolors["purple"] = gi;1521 gi.a1 = PI_LimeGreen;1522 GrAcolors["limegreen"] = gi;1523 gi.a1 = PI_Gold;1524 GrAcolors["gold"] = gi;1525 gi.a1 = PI_Violet;1526 GrAcolors["violet"] = gi;1527 gi.a1 = PI_VioletRed;1528 GrAcolors["violetred"] = gi;1529 gi.a1 = PI_BlueViolet;1530 GrAcolors["blueviolet"] = gi;1531 gi.a1 = PI_DarkViolet;1532 GrAcolors["darkviolet"] = gi;1533 1534 // Les attributs de lignes1535 gi.a2 = 0;1536 gi.a1 = PI_NotDefLineAtt;1537 GrAlines["defline"] = gi;1538 gi.a1 = PI_NormalLine;1539 GrAlines["normalline"] = gi;1540 gi.a1 = PI_ThinLine;1541 GrAlines["thinline"] = gi;1542 gi.a1 = PI_ThickLine;1543 GrAlines["thickline"] = gi;1544 gi.a1 = PI_DashedLine;1545 GrAlines["dashedline"] = gi;1546 gi.a1 = PI_ThinDashedLine;1547 GrAlines["thindashedline"] = gi;1548 gi.a1 = PI_ThickDashedLine;1549 GrAlines["thickdashedline"] = gi;1550 gi.a1 = PI_DottedLine;1551 GrAlines["dottedline"] = gi;1552 gi.a1 = PI_ThinDottedLine;1553 GrAlines["thindottedline"] = gi;1554 gi.a1 = PI_ThickDottedLine;1555 GrAlines["thickdottedline"] = gi;1556 gi.a1 = PI_DashDottedLine;1557 GrAlines["dashdottedline"] = gi;1558 gi.a1 = PI_ThinDashDottedLine;1559 GrAlines["thindashdottedline"] = gi;1560 gi.a1 = PI_ThickDashDottedLine;1561 GrAlines["thickdashdottedline"] = gi;1562 1563 // Noms de fontes1564 gi.a2 = 0;1565 gi.a1 = PI_DefaultFont;1566 GrAfontNames["deffont"] = gi;1567 gi.a1 = PI_CourierFont;1568 GrAfontNames["courierfont"] = gi;1569 gi.a1 = PI_HelveticaFont;1570 GrAfontNames["helveticafont"] = gi;1571 gi.a1 = PI_TimesFont;1572 GrAfontNames["timesfont"] = gi;1573 gi.a1 = PI_SymbolFont;1574 GrAfontNames["symbolfont"] = gi;1575 1576 // Attributs de fontes1577 gi.a2 = PI_NotDefFontSize;1578 gi.a1 = PI_NotDefFontAtt;1579 GrAfontNames["deffontatt"] = gi;1580 gi.a2 = PI_NormalSizeFont;1581 gi.a1 = PI_RomanFont;1582 GrAfonts["normalfont"] = gi;1583 gi.a1 = PI_BoldFont;1584 GrAfonts["boldfont"] = gi;1585 gi.a1 = PI_ItalicFont;1586 GrAfonts["italicfont"] = gi;1587 gi.a1 = PI_BoldItalicFont;1588 GrAfonts["bolditalicfont"] = gi;1589 gi.a2 = PI_SmallSizeFont;1590 gi.a1 = PI_RomanFont;1591 GrAfonts["smallfont"] = gi;1592 gi.a1 = PI_BoldFont;1593 GrAfonts["smallboldfont"] = gi;1594 gi.a1 = PI_ItalicFont;1595 GrAfonts["smallitalicfont"] = gi;1596 gi.a1 = PI_BoldItalicFont;1597 GrAfonts["smallbolditalicfont"] = gi;1598 gi.a2 = PI_LargeSizeFont;1599 gi.a1 = PI_RomanFont;1600 GrAfonts["bigfont"] = gi;1601 GrAfonts["largefont"] = gi;1602 gi.a1 = PI_BoldFont;1603 GrAfonts["bigboldfont"] = gi;1604 gi.a1 = PI_ItalicFont;1605 GrAfonts["bigitalicfont"] = gi;1606 GrAfonts["largeitalicfont"] = gi;1607 gi.a1 = PI_BoldItalicFont;1608 GrAfonts["bigbolditalicfont"] = gi;1609 GrAfonts["largebolditalicfont"] = gi;1610 gi.a2 = PI_HugeSizeFont;1611 gi.a1 = PI_RomanFont;1612 GrAfonts["hugefont"] = gi;1613 gi.a1 = PI_BoldFont;1614 GrAfonts["hugeboldfont"] = gi;1615 gi.a1 = PI_ItalicFont;1616 GrAfonts["hugeitalicfont"] = gi;1617 gi.a1 = PI_BoldItalicFont;1618 GrAfonts["hugebolditalicfont"] = gi;1619 1620 1621 // Les markers1622 const char* mrkn[11] = { "dotmarker", "plusmarker", "crossmarker",1623 "circlemarker", "fcirclemarker", "boxmarker", "fboxmarker",1624 "trianglemarker", "ftrianglemarker", "starmarker", "fstarmarker"};1625 PIMarker mrk[11] = { PI_DotMarker, PI_PlusMarker, PI_CrossMarker,1626 PI_CircleMarker, PI_FCircleMarker, PI_BoxMarker, PI_FBoxMarker,1627 PI_TriangleMarker, PI_FTriangleMarker, PI_StarMarker, PI_FStarMarker};1628 1629 gi.a2 = 0;1630 gi.a1 = PI_NotDefMarker;1631 GrAmarkers["defmarker"] = gi;1632 1633 for(int j=0; j<11; j++) {1634 string smrk;1635 char buff[16];1636 for(int m=1; m<10; m+=2) {1637 sprintf(buff,"%d",m);1638 smrk = (string)mrkn[j] + (string)buff;1639 gi.a1 = mrk[j]; gi.a2 = m;1640 GrAmarkers[smrk] = gi;1641 }1642 }1643 1644 // Les tables de couleurs1645 gi.a2 = 0;1646 gi.a1 = CMAP_OTHER;1647 GrAcmap["defcmap"] = gi;1648 for(int kcc=0; kcc<PIColorMap::NumberStandardColorMaps(); kcc++) {1649 gi.a1 = PIColorMap::GetStandardColorMapId(kcc);1650 string colname = PIColorMap::GetStandardColorMapName(kcc);1651 for(int jll=0; jll<colname.length(); jll++)1652 colname[jll] = tolower(colname[jll]);1653 GrAcmap[colname] = gi;1654 }1655 1656 1657 // La valeur de zoom1658 gi.a2 = 0;1659 gi.a1 = 0;1660 GrAzoom["defzoom"] = gi;1661 gi.a1 = 1;1662 GrAzoom["zoomx1"] = gi;1663 gi.a1 = 2;1664 GrAzoom["zoomx2"] = gi;1665 gi.a1 = 3;1666 GrAzoom["zoomx3"] = gi;1667 gi.a1 = 4;1668 GrAzoom["zoomx4"] = gi;1669 gi.a1 = 5;1670 GrAzoom["zoomx5"] = gi;1671 gi.a1 = -2;1672 GrAzoom["zoom/2"] = gi;1673 gi.a1 = -3;1674 GrAzoom["zoom/3"] = gi;1675 gi.a1 = -4;1676 GrAzoom["zoom/4"] = gi;1677 gi.a1 = -5;1678 GrAzoom["zoom/5"] = gi;1679 1680 // Attributs d'axes1681 gi.a2 = 0;1682 gi.a1 = (int)(kBoxAxes | kExtTicks | kLabels);1683 GrAaxes["stdaxes"] = gi;1684 GrAaxes["defaxes"] = gi;1685 GrAaxes["boxaxes"] = gi;1686 gi.a1 = (int)kAxesDflt;1687 GrAaxes["simpleaxes"] = gi;1688 gi.a1 = (int)(kBoxAxes | kExtTicks | kLabels | kGridOn);1689 GrAaxes["boxaxesgrid"] = gi;1690 1691 gi.a1 = (int)(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks);1692 GrAaxes["fineaxes"] = gi;1693 gi.a1 = (int)(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks | kGridOn);1694 GrAaxes["grid"] = gi;1695 GrAaxes["fineaxesgrid"] = gi;1696 1697 }1698 1298 1699 1299 -
trunk/SophyaPI/PIext/servnobjm.h
r1569 r1971 113 113 // Utilitaires divers 114 114 static void DecodeLoopParameters(string& loop, int& i1, int& i2, int& di); 115 int DecodeDispOption(string& dopt, bool& fgsrgr);116 static bool GetStatsOption(string& dopt);117 static void SetDefaultStatsOption(bool opt);118 115 string FileName2Name(string const & fn); 119 116 char* PClassIdToClassName(int cid); 120 117 121 118 protected: 122 void InitGrAttNames();123 119 124 120 // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr … … 129 125 ObjAdaptList objadaplist; 130 126 131 // Variables membre , en public pour le moment132 struct gratt_item {133 int a1, a2;134 };135 typedef map<string, gratt_item, less<string> > GrAttNames;136 137 // Pour les changements d'attributs graphiques / de visualisation138 GrAttNames GrAcolors;139 GrAttNames GrAlines;140 GrAttNames GrAmarkers;141 GrAttNames GrAfonts;142 GrAttNames GrAfontNames;143 GrAttNames GrAcmap;144 GrAttNames GrAzoom;145 GrAttNames GrAaxes;146 127 147 128 PDynLinkMgr * dynlink; // shared-lib lib.so
Note:
See TracChangeset
for help on using the changeset viewer.