source: Sophya/trunk/SophyaPI/PIext/graphexecut.cc@ 3551

Last change on this file since 3551 was 3551, checked in by ansari, 17 years ago

Petites ameliorations aide en ligne, Reza 13/12/2008

File size: 47.0 KB
Line 
1#include "sopnamsp.h"
2#include "piacmd.h"
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <math.h>
7
8#include "graphexecut.h"
9
10#include "strutilxx.h"
11
12#include "pistdimgapp.h"
13#include "nobjmgr.h"
14
15#include "nomgadapter.h"
16#include "piyfxdrw.h"
17#include "pibargraph.h"
18#include "pitxtdrw.h"
19
20
21
22/* --Methode-- */
23PIAGraphicExecutor::PIAGraphicExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
24{
25mpiac = piac;
26mObjMgr = omg;
27mImgApp = app;
28RegisterCommands();
29}
30
31PIAGraphicExecutor::~PIAGraphicExecutor()
32{
33}
34
35
36/* Macro pour tester si flag normalized coordinate est present */
37#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
38
39
40/* --Methode-- */
41int PIAGraphicExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
42{
43// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
44if (kw == "zone") {
45 while (tokens.size() < 2) tokens.push_back("1");
46 int nx, ny;
47 nx = ny = 1;
48 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
49 if (mImgApp) {
50 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
51 mImgApp->SetZone(nx, ny);
52 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
53 }
54}
55else if (kw == "newwin") {
56 int nx=1, ny=1;
57 int sx=0, sy=0;
58 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
59 if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
60 if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
61 if(tokens.size() > 3) {
62 sx = atoi(tokens[2].c_str());
63 sy = atoi(tokens[3].c_str());
64 }
65 if (mImgApp) {
66 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
67 mImgApp->CreateGraphWin(nx, ny, sx, sy);
68 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
69 }
70}
71else if (kw == "stacknext") {
72 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
73 mImgApp->StackWinNext();
74 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
75}
76else if (kw == "graphicatt") {
77 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
78 string opts = tokens[0];
79 if (tokens.size() > 1)
80 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
81 if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts);
82 }
83else if (kw == "setaxesatt") {
84 if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl; return(0); }
85 string opts = tokens[0];
86 if (tokens.size() > 1)
87 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
88 if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts);
89 }
90else if (kw == "setinsetlimits") {
91 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
92 double xmin = atof(tokens[0].c_str());
93 double xmax = atof(tokens[1].c_str());
94 double ymin = atof(tokens[2].c_str());
95 double ymax = atof(tokens[3].c_str());
96 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
97 }
98else if (kw == "drpanel") {
99 if (tokens.size() < 4) {
100 cout << "Usage: drpanel xmin xmax ymin ymax [gratt] [name]" << endl;
101 return(0);
102 }
103 double xmin = atof(tokens[0].c_str());
104 double xmax = atof(tokens[1].c_str());
105 double ymin = atof(tokens[2].c_str());
106 double ymax = atof(tokens[3].c_str());
107 char buff[128];
108 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g ", xmin, xmax, ymin, ymax);
109 string sop = buff;
110 if (tokens.size() > 4) sop += tokens[4];
111 string name;
112 if (tokens.size() > 5) name = tokens[5];
113 PIFuncDrawer* gdr = new PIFuncDrawer(NULL);
114 mImgApp->DispScDrawer(gdr, name, sop);
115}
116//---- Ajout d'elements graphiques
117else if (kw == "addtext") {
118 if (tokens.size() < 3) {
119 cout << "Usage: addtext x y txt [colfontatt] [fgnc]" << endl;
120 return(0);
121 }
122 double xp = atof(tokens[0].c_str());
123 double yp = atof(tokens[1].c_str());
124 string txt = tokens[2];
125 string sop;
126 if (tokens.size() > 3) sop = tokens[3];
127 bool fgnc = _CkBoolNC_(4);
128 mImgApp->AddText(txt, xp, yp, sop, fgnc);
129 }
130else if (kw == "addctext") {
131 if (tokens.size() < 5) {
132 cout << "Usage: addctext x y txt s_up s_dn [colfontatt] [updnfatt] [fgnc] " << endl;
133 return(0);
134 }
135 double xp = atof(tokens[0].c_str());
136 double yp = atof(tokens[1].c_str());
137 string sop;
138 if (tokens.size() > 5) sop = tokens[5];
139 string sopfss;
140 if (tokens.size() > 6) sopfss = tokens[6];
141 bool fgnc = _CkBoolNC_(7);
142 mImgApp->AddCompText(tokens[2], tokens[3], tokens[4], xp, yp, sop, sopfss, fgnc);
143 }
144else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
145 (kw == "addoval") || (kw == "addfoval") ||
146 (kw == "addarrow") ) {
147 if (tokens.size() < 4) {
148 if ( (kw == "addoval") || (kw == "addfoval") )
149 cout << "Usage addoval/addfoval/addarrow xc yc dx dy [colatt] [fgnc]" << endl;
150 else
151 cout << "Usage: addline/addrect/addfrect/addarrow x1 y1 x2 y2 [colatt] [fgnc]" << endl;
152 return(0);
153 }
154 double xp1 = atof(tokens[0].c_str());
155 double yp1 = atof(tokens[1].c_str());
156 double xp2 = atof(tokens[2].c_str());
157 double yp2 = atof(tokens[3].c_str());
158 string sop;
159 if (tokens.size() > 4) sop = tokens[4];
160 bool fgnc = _CkBoolNC_(5);
161 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
162 else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
163 else {
164 bool fgfill = ((kw == "addrect") || (kw == "addoval")) ? false : true;
165 if ( (kw == "addrect") || (kw == "addfrect") )
166 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
167 else mImgApp->AddOval(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
168 }
169}
170else if ((kw == "addcirc") || (kw == "addfcirc")) {
171 if (tokens.size() < 3) {
172 cout << "Usage: addcirc/addfcirc xc yc r [colatt] [fgnc]" << endl;
173 return(0);
174 }
175 double xc = atof(tokens[0].c_str());
176 double yc = atof(tokens[1].c_str());
177 double rad = atof(tokens[2].c_str());
178 string sop;
179 if (tokens.size() > 3) sop = tokens[3];
180 bool fgnc = _CkBoolNC_(4);
181 bool fgfill = (kw == "addcirc") ? false : true;
182 mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc);
183 }
184else if ((kw == "addarca") || (kw == "addfarca")) {
185 if (tokens.size() < 5) {
186 cout << "Usage: addarca/addfarca xc yc r a da [colatt] [fgnc]" << endl;
187 return(0);
188 }
189 double xc = atof(tokens[0].c_str());
190 double yc = atof(tokens[1].c_str());
191 double rad = atof(tokens[2].c_str());
192 double ang = atof(tokens[3].c_str());
193 double dang = atof(tokens[4].c_str());
194 string sop;
195 if (tokens.size() > 5) sop = tokens[5];
196 bool fgnc = _CkBoolNC_(6);
197 bool fgfill = (kw == "addarca") ? false : true;
198 mImgApp->AddArc(xc, yc, rad, ang, dang, sop, fgfill, fgnc);
199 }
200else if (kw == "addmarker") {
201 if (tokens.size() < 2) {
202 cout << "Usage: addmarker x y [gratt] [fgnc]" << endl;
203 return(0);
204 }
205 double xm = atof(tokens[0].c_str());
206 double ym = atof(tokens[1].c_str());
207 string sop;
208 if (tokens.size() > 2) sop = tokens[2];
209 bool fgnc = _CkBoolNC_(3);
210 mImgApp->AddCircle(xm, ym, -1, sop, false, fgnc);
211}
212else if ((kw == "addarc") || (kw == "addfarc") ) {
213 if (tokens.size() < 6) {
214 cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt] [fgnc]" << endl;
215 return(0);
216 }
217 double x1 = atof(tokens[0].c_str());
218 double y1 = atof(tokens[1].c_str());
219 double x2 = atof(tokens[2].c_str());
220 double y2 = atof(tokens[3].c_str());
221 double x3 = atof(tokens[4].c_str());
222 double y3 = atof(tokens[5].c_str());
223 string sop;
224 if (tokens.size() > 6) sop = tokens[6];
225 bool fgnc = _CkBoolNC_(7);
226 bool fgfill = (kw == "addarc") ? false : true;
227 mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill, fgnc);
228}
229else if ((kw == "addpoly") || (kw == "addfpoly")) {
230 if (tokens.size() < 1) {
231 cout << "Usage: addpoly/addfpoly 'x1,y1 x2,y2 x3,y3 ...' [gratt] [fgnc]" << endl;
232 return(0);
233 }
234 vector<string> sxy;
235 vector<double> xpol, ypol;
236 double xp, yp;
237 FillVStringFrString(tokens[0], sxy);
238 for(int jkk=0; jkk<sxy.size(); jkk++) {
239 xp = yp = 0;
240 if (sscanf(sxy[jkk].c_str(), "%lg,%lg", &xp, &yp) == 2) {
241 xpol.push_back(xp);
242 ypol.push_back(yp);
243 }
244 }
245 string sop;
246 if (tokens.size() > 1) sop = tokens[1];
247 bool fgnc = _CkBoolNC_(2);
248 bool fgfill = (kw == "addpoly") ? false : true;
249 mImgApp->AddPoly(xpol, ypol, sop, fgfill, fgnc);
250 }
251
252
253else if ((kw == "settitle") || (kw == "addtitle")) {
254 if (tokens.size() < 1) { cout << "Usage: settitle/addtitle TopTitle [BotTitle] [fontatt]" << endl; return(0); }
255 if(tokens.size()<2) tokens.push_back("");
256 string gropt;
257 if(tokens.size()>2) gropt = tokens[2];
258 mImgApp->SetTitle(tokens[0], tokens[1], gropt);
259}
260
261else if ((kw == "setaxelabels") || (kw == "addaxelabels")) {
262 if (tokens.size() < 2) { cout << "Usage: setaxelabels/addaxelabels xLabel yLabel [fontatt]" << endl; return(0); }
263 string gropt;
264 if(tokens.size()>2) gropt = tokens[2];
265 mImgApp->SetAxeLabels(tokens[0], tokens[1], gropt);
266}
267
268// >>>>>>>>>>> Affichage des objets
269else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") || (kw == "imagnav") ) {
270 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag/imagnav nameobj [opt]" << endl; return(0); }
271 string opt = "next";
272 if (tokens.size() > 1) opt = tokens[1];
273 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
274 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
275 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt, false);
276 else if (kw == "imagnav") mObjMgr->DisplayImage(tokens[0], opt, true);
277 }
278
279else if (kw == "nt2d") {
280 if (tokens.size() < 3) {
281 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
282 return(0);
283 }
284 while (tokens.size() < 8) tokens.push_back("");
285 string ph = "";
286 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
287 tokens[5], tokens[6], ph, false, tokens[7], false);
288 }
289else if ((kw == "nt2dcn")||(kw == "nt2dci")) {
290 if (tokens.size() < 4) {
291 cout << "Usage: nt2dcn nameobj color varx vary [errx erry wt label opt]" << endl;
292 return(0);
293 }
294 while (tokens.size() < 9) tokens.push_back("");
295 string ph = "";
296 bool colidx = false;
297 if (kw == "nt2dci") colidx = true;
298 mObjMgr->DisplayNT(tokens[0], tokens[2], tokens[3], ph, tokens[4], tokens[5], ph,
299 tokens[6], tokens[7], tokens[1], colidx, tokens[8], false);
300 }
301else if (kw == "nt3d") {
302 if (tokens.size() < 7) {
303 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
304 return(0);
305 }
306 while (tokens.size() < 10) tokens.push_back("");
307 string ph = "";
308 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
309 tokens[6], tokens[7], tokens[8], ph, false, tokens[9], true);
310 }
311else if (kw == "vecplot") {
312 if (tokens.size() < 2) {
313 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
314 return(0);
315 }
316 while (tokens.size() < 3) tokens.push_back("");
317 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
318}
319else if (kw == "bargraph") return BarGraph(kw, tokens);
320else if (kw == "textdrawer") return TextDrawer(kw, tokens);
321else if (kw == "pirgbdisp") {
322 if (tokens.size() < 1) {
323 cout << "Usage: pirgbdisp PI-RGB_FileName [gr_opt]" << endl;
324 return(0);
325 }
326 string gropt = "lut=rgb rgb216cm ";
327 if (tokens.size() > 1) gropt += tokens[1];
328 PIPixRGBArray * rgbimg = new PIPixRGBArray(tokens[0].c_str());
329 P2DPixRGBAdapter * argbimg = new P2DPixRGBAdapter(rgbimg, true);
330 mImgApp->DispImage(argbimg, tokens[0], gropt);
331}
332else if ((kw == "win2rgb")||(kw == "wdg2rgb")) {
333 if (tokens.size() < 1) {
334 cout << "Usage: win2rgb/wdg2rgb PI-RGB_FileName" << endl;
335 return(0);
336 }
337 PIWdg* wdg=NULL;
338 if (kw=="win2rgb") wdg=(PIWdg*)mImgApp->CurrentBaseWdg();
339 else wdg=(PIWdg*) mImgApp->CurrentWindow();
340 if (wdg==NULL) return 1;
341 PIPixRGBArray rgba(10,10);
342 mImgApp->CkEvt_LockMutex();
343 wdg->ExportToRGB(rgba);
344 mImgApp->UnlockMutex();
345 if (kw=="win2rgb")
346 cout << " Exporting current window to PI-RGB-file " << tokens[0] << endl;
347 else cout << " Exporting current widget to PI-RGB-file " << tokens[0] << endl;
348 rgba.SaveToFile(tokens[0].c_str());
349}
350// Obsolete : ne pas virer SVP, cmv 26/7/99
351else if (kw == "gfd2d") {
352 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
353 if(tokens.size()<2)
354 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
355 return(0);}
356 string numvary = "";
357 string err = "";
358 string opt = "next";
359 if(tokens.size()>2) err = tokens[2];
360 if(tokens.size()>3) opt = tokens[3];
361 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
362 }
363
364else if (kw == "gfd3d") {
365 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
366 if(tokens.size()<3)
367 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
368 return(0);}
369 string err = "";
370 string opt = "next";
371 if(tokens.size()>3) err = tokens[3];
372 if(tokens.size()>4) opt = tokens[4];
373 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
374 }
375
376
377else {
378 cerr << "PIAGraphicExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
379 return(-1);
380 }
381
382return(0);
383}
384
385/* --Methode-- */
386bool PIAGraphicExecutor::IsThreadable(string const & keyw)
387{
388 return false;
389}
390
391
392/* --Methode-- */
393void PIAGraphicExecutor::RegisterCommands()
394{
395string kw, usage, grp;
396
397RegisterPIGraphicsHelp(mpiac);
398
399grp = "Graphics";
400string gdesc = "Basic graphics and object display commands";
401mpiac->AddHelpGroup(grp, gdesc);
402kw = "zone";
403usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
404usage += "\n Related commands: newwin";
405mpiac->RegisterCommand(kw, usage, this, grp);
406kw = "newwin";
407usage = "To Create a New Graphic window, with zones \n";
408usage += " Window size can be specified \n";
409usage += " Usage: newwin [nx ny [sizeX sizeY]] ";
410usage += "\n Related commands: zone";
411mpiac->RegisterCommand(kw, usage, this, grp);
412kw = "stacknext";
413usage = "Displays the next widget on stack window \n Usage: stacknext";
414mpiac->RegisterCommand(kw, usage, this, grp);
415
416kw = "graphicatt";
417usage = "To change default graphic options\n Usage: graphicatt att_list\n";
418usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
419usage += "\n ------------------ Graphic attribute list ------------------\n";
420usage += ">> Colors: defcol black white grey red blue green yellow\n";
421usage += " magenta cyan turquoise navyblue orange siennared purple\n";
422usage += " limegreen gold violet violetred blueviolet darkviolet\n";
423usage += " or \"color=name\" \"fgcolor=name\" \"bgcolor=name\" ex: \"color=red\"\n";
424usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline\n";
425usage += " thickdashedline dottedline thindottedline thickdottedline\n";
426usage += " or \"line=type,width\" ex: \"line=dotted,7\"\n";
427usage += ">> Fonts:\n";
428usage += " > Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
429usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont\n";
430usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont\n";
431usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont\n";
432usage += " > Names: deffont courierfont helveticafont timesfont symbolfont \n";
433usage += " or \"font=name,type,size\" ex: \"font=courrier,bolditalic,10\"\n";
434usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T>\n";
435usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T>\n";
436usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T>\n";
437usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ...\n";
438usage += " or \"marker=type,size\" ex: \"marker=plus,10\"\n";
439usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T>\n";
440usage += " arrowshapedarrow<T> farrowshapedarrow<T>\n";
441usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ...\n";
442usage += " or \"arrow=type,size\" ex: \"arrow=arrowshaped,10\"\n";
443usage += "------ Specific options for image displays:\n";
444usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32\n";
445usage += " grey128 invgrey128 colrj128 colbr128\n";
446usage += " red32cm green32cm blue32cm yellow32cm\n";
447usage += " orange32cm cyan32cm violet32cm\n";
448usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
449usage += " midas_bluewhite midas_redwhite\n";
450usage += " multicol16 multicol64 rgb216cm rgb512cm rgb4096cm\n";
451usage += ">> revcmap : reverse colorMap\n";
452usage += ">> ZoomFactors : zoomxN ex: zoomx1 zoomx2 zoomx3 ...\n";
453usage += " zoom/N ex: zoom/2 zoom/3 zoom/4 ...\n";
454usage += ">> imagecenter=ix,iy : Position the image in widget\n";
455usage += ">> lut=ltyp,min,max : Sets LUT type and min/max\n";
456usage += " (ltyp=lin/log/sqrt/square/rgb)\n";
457usage += ">> autolut=alt[,ns[,min,max]] : AutoLut method selection \n";
458usage += " (alt=minmax/meansig/hispeak/histail/hisrng)\n";
459usage += ">> invx,invy,exchxy : image axes configuration\n";
460usage += "--- General purpose options:\n";
461usage += ">> stat,stats / nsta,nstat,nostat,nostats : Toggle statistic display\n";
462usage += ">> title,tit / notitle,notit -> Toggle automatic title display\n";
463usage += ">> Choose display window: next same win stack inset\n";
464usage += ">> for Axes / Axe labels / LogScale / xylimits / defdrrect\n";
465usage += " see setaxesatt command\n";
466usage += "\n";
467usage += " Related commands: setaxesatt setinsetlimits ";
468mpiac->RegisterCommand(kw, usage, this, grp);
469
470kw = "setaxesatt";
471usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
472usage += "Color/Line/Font attributes and axes attributes \n";
473usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n";
474usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n";
475usage += " centeredaxesgrid finecenteredaxesgrid\n";
476usage += " axescenter=x0,y0 (only with centered axes, default \"axescenter=\")\n";
477usage += " grid nogrid labels nolabels \n";
478usage += " ticks noticks minorticks nominorticks \n";
479usage += " extticks intticks extintticks \n";
480usage += " nbticks=X_NTicks,Y_NTicks \n";
481usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n";
482usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n";
483usage += " autofontsize=fsizef: Font size computed automatically \n";
484usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
485usage += ">> Scale type: linx liny logx logy -> Lin/Log Scales for 2D plots \n";
486usage += ">> AxeDirection: Reverse X/Y axe drawing direction \n";
487usage += " revax revay axelr axedu (or axerl/axeud -> revax/revay) \n";
488usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
489usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
490usage += " The rectangle is defined as a fraction of the widget size\n";
491mpiac->RegisterCommand(kw, usage, this, grp);
492
493kw = "setinsetlimits";
494usage = "Define the display rectangle for drawers added as insets \n";
495usage += " over existing graphic objects - limits expressed as fraction \n";
496usage += " graphic object size (0. .. 1.) Xmax at right, YMax top \n ";
497usage += " Usage: setinsetlimits xmin xmax ymin ymax";
498usage += "\n Related commands: graphicatt /inset";
499mpiac->RegisterCommand(kw, usage, this, grp);
500
501kw = "drpanel";
502usage = "Creates a new 2D drawing zone for addtext, addline \n";
503usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
504usage += "\n Related commands: addtext addline addrect addcirc ...";
505mpiac->RegisterCommand(kw, usage, this, grp);
506
507grp = "Graphic-Elts";
508gdesc = "Simple graphic objects (lines, circles, text...) creation and display";
509mpiac->AddHelpGroup(grp, gdesc);
510
511kw = "addtext";
512usage = "Adds a text string to the current graphic object";
513usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
514usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
515usage += "\n Alt<E> to remove the added element";
516usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
517usage += "\n (use quotes '' for multi word text strings) ";
518usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
519usage += "\n Text position/direction attribute: ";
520usage += "\n horizleft horizcenter horizright";
521usage += "\n vertbottom vertcenter verttop ";
522usage += "\n textdirhoriz textdirvertup textdirvertdown ";
523usage += "\n Related commands: addctext addline addarrow addrect addfrect";
524usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
525mpiac->RegisterCommand(kw, usage, this, grp);
526
527kw = "addctext";
528usage = "Adds a composite text string with superscript and subscripts ";
529usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
530usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
531usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
532usage += "\n Related commands: addtext addline addrect ...";
533usage += "\n (See command addtext and graphicatt for more details)";
534mpiac->RegisterCommand(kw, usage, this, grp);
535
536kw = "addline";
537usage = "Adds a line to the current graphic object";
538usage += "\n at the specified position (+ graphic attribute)";
539usage += "\n The Base/AxesDrawer is used to handle added lines";
540usage += "\n Alt<E> to remove the added element";
541usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
542usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
543usage += "\n Related commands: addarrow addtext addrect addfrect ";
544usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
545mpiac->RegisterCommand(kw, usage, this, grp);
546
547kw = "addarrow";
548usage = "Adds an arrow to the current graphic object";
549usage += "\n at the specified position (+ graphic attribute)";
550usage += "\n The Base/AxesDrawer is used to handle added lines";
551usage += "\n Alt<E> to remove the added element";
552usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
553usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
554usage += "\n Related commands: addline addtext addrect addfrect ";
555usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
556mpiac->RegisterCommand(kw, usage, this, grp);
557kw = "addarrow_nc";
558
559kw = "addrect";
560usage = "Adds a rectangle to the current graphic object";
561usage += "\n between the specified positions (+ graphic attribute)";
562usage += "\n The Base/AxesDrawer is used to handle added rectangle";
563usage += "\n Alt<E> to remove added element";
564usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
565usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
566usage += "\n Related commands: addtext addline addarrow addfrect";
567usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
568mpiac->RegisterCommand(kw, usage, this, grp);
569
570kw = "addfrect";
571usage = "Adds a filled rectangle to the current graphic object";
572usage += "\n between the specified positions (+ graphic attribute)";
573usage += "\n The Base/AxesDrawer is used to handle added rectangle";
574usage += "\n Alt<E> to remove added element";
575usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
576usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
577usage += "\n Related commands: addtext addline addarrow addrect";
578usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
579mpiac->RegisterCommand(kw, usage, this, grp);
580
581kw = "addmarker";
582usage = "Adds a marker to the current graphic object";
583usage += "\n at the specified position (+ graphic attribute)";
584usage += "\n The Base/AxesDrawer is used to handle added circles";
585usage += "\n Alt<E> to remove added element";
586usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
587usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
588usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
589usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
590mpiac->RegisterCommand(kw, usage, this, grp);
591
592kw = "addcirc";
593usage = "Adds a circle to the current graphic object";
594usage += "\n with the specified center and radius (+ graphic attribute)";
595usage += "\n The Base/AxesDrawer is used to handle added circles";
596usage += "\n Alt<E> to remove added element";
597usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
598usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
599usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
600usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
601mpiac->RegisterCommand(kw, usage, this, grp);
602
603kw = "addfcirc";
604usage = "Adds a filled circle to the current graphic object";
605usage += "\n with the specified center and radius (+ graphic attribute)";
606usage += "\n The Base/AxesDrawer is used to handle added circles";
607usage += "\n Alt<E> to remove added element";
608usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
609usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
610usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
611usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
612mpiac->RegisterCommand(kw, usage, this, grp);
613
614kw = "addoval";
615usage = "Adds an oval (ellipse) to the current graphic object";
616usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
617usage += "\n The Base/AxesDrawer is used to handle added rectangle";
618usage += "\n Alt<E> to remove added element";
619usage += "\n Usage: addoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
620usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
621usage += "\n Related commands: addfoval addline addarrow addfrect addcirc addfcirc";
622usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
623mpiac->RegisterCommand(kw, usage, this, grp);
624
625kw = "addfoval";
626usage = "Adds a filled oval (ellipse) to the current graphic object";
627usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
628usage += "\n The Base/AxesDrawer is used to handle added rectangle";
629usage += "\n Alt<E> to remove added element";
630usage += "\n Usage: addfoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
631usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
632usage += "\n Related commands: addoval addline addarrow addfrect addcirc addfcirc";
633usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
634mpiac->RegisterCommand(kw, usage, this, grp);
635
636kw = "addarca";
637usage = "Adds an arc to the current graphic object";
638usage += "\n defined by the circle (center+radius), start angle and angular extension";
639usage += "\n Angles are specified in degrees";
640usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
641usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
642usage += "\n Related commands: addtext addline addfarca addarc ...";
643mpiac->RegisterCommand(kw, usage, this, grp);
644
645kw = "addfarca";
646usage = "Adds a filled arc to the current graphic object";
647usage += "\n defined by the circle (center+radius), start angle and angular extension";
648usage += "\n Angles are specified in degrees";
649usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
650usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
651usage += "\n Related commands: addtext addline addarca addarc ...";
652mpiac->RegisterCommand(kw, usage, this, grp);
653
654kw = "addarc";
655usage = "Adds an arc to the current graphic object";
656usage += "\n defined by 3 points (+ graphic attribute)";
657usage += "\n The Base/AxesDrawer is used to handle added arcs";
658usage += "\n Alt<E> to remove the added element";
659usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
660usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
661usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
662usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
663mpiac->RegisterCommand(kw, usage, this, grp);
664
665kw = "addfarc";
666usage = "Adds a filled arc to the current graphic object";
667usage += "\n defined by 3 points (+ graphic attribute)";
668usage += "\n The Base/AxesDrawer is used to handle added arcs";
669usage += "\n Alt<E> to remove added element";
670usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
671usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
672usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
673usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
674mpiac->RegisterCommand(kw, usage, this, grp);
675
676kw = "addpoly";
677usage = "Adds a polyline/polygon to the current graphic object";
678usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
679usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
680usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
681usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
682usage += "\n addcirc addfcirc addfarc graphicatt";
683mpiac->RegisterCommand(kw, usage, this, grp);
684
685kw = "addfpoly";
686usage = "Adds a filled polygon to the current graphic object";
687usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
688usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
689usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
690usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
691usage += "\n addcirc addfcirc addfarc graphicatt";
692mpiac->RegisterCommand(kw, usage, this, grp);
693
694kw = "settitle";
695usage = "Set the title string (top title / bottom title) for the current graphic object";
696usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
697usage += "\n Related commands: addtext graphicatt";
698mpiac->RegisterCommand(kw, usage, this, grp);
699
700kw = "addtitle";
701usage = "Set the title string (top title / bottom title) \n";
702usage += " alias for settitle ";
703mpiac->RegisterCommand(kw, usage, this, grp);
704
705kw = "setaxelabels";
706usage = "Set the X and Y axis labels for the current 2D graphic object \n";
707usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
708usage += "\n Related commands: settitle addtext graphicatt";
709mpiac->RegisterCommand(kw, usage, this, grp);
710
711kw = "addaxelabels";
712usage = "Set the X and Y axis labels for the current 2D graphic object";
713usage += " alias for setaxelabels ";
714mpiac->RegisterCommand(kw, usage, this, grp);
715
716grp = "Obj. Display";
717gdesc = "Most useful commands to view and display objects ";
718mpiac->AddHelpGroup(grp, gdesc);
719
720kw = "disp";
721usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
722usage += "\n Related commands: surf nt2d nt3d vecplot";
723mpiac->RegisterCommand(kw, usage, this, grp);
724kw = "imag";
725usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
726usage += "\n Related commands: disp imagnav surf nt2d nt3d vecplot";
727mpiac->RegisterCommand(kw, usage, this, grp);
728kw = "imagnav";
729usage = "Displays an object as an image with the ImageNavigator viewer \n";
730usage += "Usage: imagnav nameobj [graphic_attributes]";
731usage += "\n Related commands: disp imag surf nt2d nt3d vecplot";
732mpiac->RegisterCommand(kw, usage, this, grp);
733kw = "surf";
734usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
735usage += "\n Related commands: disp nt2d nt3d vecplot";
736mpiac->RegisterCommand(kw, usage, this, grp);
737kw = "nt2d";
738usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
739usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
740usage += "\n Related commands: disp surf nt2dcn nt2dci nt3d gfd2d vecplot";
741mpiac->RegisterCommand(kw, usage, this, grp);
742kw = "nt2dcn";
743usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
744usage = " with colors specified by a column content (as color names) ";
745usage += "\n Usage : nt2dcn nameobj color varx vary [errx erry wt label graphic_attributes]";
746usage += "\n Related commands: disp surf nt2d nt2dci nt3d gfd2d vecplot";
747mpiac->RegisterCommand(kw, usage, this, grp);
748kw = "nt2dci";
749usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
750usage = " with colors specified by a column content (as color index) ";
751usage += "\n Usage : nt2dci nameobj color varx vary [errx erry wt label graphic_attributes]";
752usage += "\n Related commands: disp surf nt2d nt2dci nt3d gfd2d vecplot";
753mpiac->RegisterCommand(kw, usage, this, grp);
754kw = "nt3d";
755usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
756usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
757usage += "\n Related commands: disp surf nt2d gfd3d ";
758mpiac->RegisterCommand(kw, usage, this, grp);
759kw = "vecplot";
760usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
761usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
762usage += "\n Related commands: disp nt2d ";
763mpiac->RegisterCommand(kw, usage, this, grp);
764
765kw = "bargraph";
766usage = "Bar-Graph view of a sequence of values ";
767usage += "\n Usage: bargraph ValueVarName [gr_opt] ";
768usage += "\n or bargraph ValueVarName LabelVarName ColPosVarName [gr_opt] ";
769usage += "\n ValueVarName,LabelVarName,ColPosVarName are PIACmd interpreter ";
770usage += "\n variable name (vectors) ";
771usage += "\n - ValueVarName: Sequence of values to be represented";
772usage += "\n - LabelVarName: Corresponding labels";
773usage += "\n - ColPosVarName: Corresponding colors or color,position pairs ";
774usage += "\n Use a dash (-) or ! as placeholder for LabelVarName/ColPosVarName";
775usage += "\n Specific graphic options: fill/nofill packfrac=value ";
776usage += "\n horizontalbars/verticalbars barvaluelabel/nobarvaluelabel";
777usage += "\n Related commands: disp nt2d vecplot ...";
778mpiac->RegisterCommand(kw, usage, this, grp);
779kw = "textdrawer";
780usage = "Multi line text darwer ";
781usage += "\n Usage : textdrawer LinesVarName AttVarName [gr_opt] ";
782usage += "\n LinesVarName,AttVarName are PIACmd interpreter variables";
783usage += "\n - LinesVarName: Lines to be displayed";
784usage += "\n - AttVarName: Corresponding font/marker/color attributes";
785usage += "\n Use a dash (-) or ! as placeholder for AttVarName";
786usage += "\n Specific graphic options: frame/noframe";
787usage += "\n Related commands: disp ... ";
788mpiac->RegisterCommand(kw, usage, this, grp);
789
790// Importation/affichage fichier format PI-RGB
791kw = "pirgbdisp";
792usage = "Read and display RGB-image object (PIPixRGBArray) from file ";
793usage += "\n Usage : pirgbdisp PI-RGB_FileName [gr_opt] ";
794usage += "\n gr_opt (def=rgb216cm):zoom, rgb4096cm rgb32768cm lut=rgb[,min,max]";
795usage += "\n Related commands: win2rgb wdg2rgb ";
796mpiac->RegisterCommand(kw, usage, this, grp);
797
798// Export to PI-RGB file
799grp = "GraphicExport";
800gdesc = "Commands to export graphics (widget/windows in postscript or PI-RGB image files";
801mpiac->AddHelpGroup(grp, gdesc);
802
803kw = "win2rgb";
804usage = " Export the current window to a PI-RGB file (.rgb)";
805usage += "\n Usage : win2rgb PI-RGB_FileName (.rgb)";
806usage += "\n Related commands: pirgbdisp wdg2rgb ";
807mpiac->RegisterCommand(kw, usage, this, grp);
808kw = "wdg2rgb";
809usage = " Export the current widget to a PI-RGB file (.rgb)";
810usage += "\n Usage : wdg2rgb PI-RGB_FileName (.rgb)";
811usage += "\n Related commands: pirgbdisp win2rgb ";
812mpiac->RegisterCommand(kw, usage, this, grp);
813
814// Ceci est maintenant obsolete, on garde pour info.
815grp = "Obj. Display";
816kw = "gfd2d";
817usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
818usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
819usage += "\n Related commands: gfd3d nt2d nt3d ";
820usage += "\n ----- OBSOLETE: utilisez nt2d -----";
821mpiac->RegisterCommand(kw, usage, this, grp);
822kw = "gfd3d";
823usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
824usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
825usage += "\n Related commands: gfd2d nt2d nt3d ";
826usage += "\n ----- OBSOLETE: utilisez nt3d -----";
827mpiac->RegisterCommand(kw, usage, this, grp);
828
829}
830
831
832/* --Methode-- */
833void PIAGraphicExecutor::RegisterPIGraphicsHelp(PIACmd* piac)
834// Methode pour enregistrer le Help des Widgets et Windows de piapp
835{
836string kw,grp,usage;
837
838grp = "Graphics";
839
840kw = "PIImage";
841usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
842usage += "and controls a zoom widget, as well as a global image view widget \n";
843usage += ">>>> Mouse controls : \n";
844usage += "o Button-1: Display current coordinates and pixel value\n";
845usage += " Position the cursor an refresh the zoom widget\n";
846usage += "o Button-2: Defines an image zone and positions the cursor \n";
847usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
848usage += ">>>> Keyboard controls : \n";
849usage += "o <Alt>R : Refresh display \n";
850usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
851usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
852usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
853usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
854usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
855usage += "o <Alt>X : Show/Hide the Cut Window \n";
856usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
857usage += "o <Alt>E : Removes the last added graphic element \n";
858usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
859usage += "o <Alt>- or <Cntl>- : Zoom out \n";
860usage += "o Cursor keys : Moves the image cursor \n";
861piac->RegisterHelp(kw, usage, grp);
862
863kw = "PIScDrawWdg";
864usage = "Manages display of 2-D drawers with interactive zoom \n";
865usage += ">>>> Mouse controls : \n";
866usage += "o Button-1: Display current coordinates \n";
867usage += "o Button-2: Defines a rectangle for zoom \n";
868usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
869usage += ">>>> Keyboard controls : \n";
870usage += "o <Alt>R : Refresh display \n";
871usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
872usage += " (2-D histograms, contour plot ...) \n";
873usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
874usage += " Drawer 0 manages the axes, as well as the added text \n";
875usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
876usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
877usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
878usage += "o <Alt>E : Removes the last added graphic element \n";
879usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
880usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
881usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
882usage += ">>>> Mouse + Keyboard controls : \n";
883usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
884piac->RegisterHelp(kw, usage, grp);
885
886kw = "PIDraw3DWdg";
887usage = "Manages display of 3-D objects (drawers) \n";
888usage += ">>>> Mouse controls : \n";
889usage += "o Button-2: Rotates the observer (camera) around object \n";
890usage += "o Shift-Button-2: Rotates object with camera fixed \n";
891usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
892usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
893usage += ">>>> Keyboard controls : \n";
894usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
895usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
896usage += " (2-D histograms, contour plot ...) \n";
897usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
898usage += " Drawer 0 manages the axes, as well as the added text \n";
899usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
900usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
901usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
902usage += "o <Alt>E : Removes the last added graphic element \n";
903usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
904usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
905piac->RegisterHelp(kw, usage, grp);
906
907kw = "Windows";
908usage = "Objects can be displayed in different windows, or overlayed on the \n";
909usage += "previous display. The graphics attributes next,win,stack,same control \n";
910usage += "the display window. \n";
911usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
912usage += " Graphic windows can be divided int zones. Object is displayed \n";
913usage += " in the next available position, removing a previously displayed \n";
914usage += " widget if necessary \n";
915usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
916usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
917usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
918usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
919usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
920usage += " be activated using the StackTools menu (Blink) \n";
921usage += "o Most objects can be also be displayed overlayed \n";
922usage += " on the last displayed widget (gr_att= same) \n";
923usage += " or by specifying a widget name samew=Widgetname \n";
924usage += "o The widget/window name can be specified (gr_att wname=Name) \n";
925usage += "o The overlay can be on a selected rectangle of the last \n";
926usage += " displayed widget (gr_att: inset or inset=fxmin,fxmax,fymin,fymax) \n";
927usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
928piac->RegisterHelp(kw, usage, grp);
929
930kw = "PIConsole";
931usage = "Text output area and command editing window (console) \n";
932usage += ">>>> Mouse controls : \n";
933usage += "o Button-1: Rectangle selection for copy/paste \n";
934usage += "o Button-2: Paste text in the command editing line \n";
935usage += "o Button-3: activate display option menu \n";
936usage += ">>>> Keyboard controls : \n";
937usage += "o <Alt>O : activate display option menu \n";
938usage += "o <Alt>V : Paste text in the command editing line \n";
939usage += "o <Alt>A : Selection of the whole window for copy \n";
940usage += "o <Alt>L : Command history (List of command history buffer) \n";
941usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
942usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
943usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
944usage += "o <Ctl>C : Stop/break command execution by PIACmd/Commander \n";
945usage += "o Cursor left,right : Command editing -> Move cursor \n";
946usage += "o Cursor Up,Down : recall command from history buffer \n";
947usage += "o Backspace,Del : Command editing \n";
948usage += "o <Return>,<Enter> : Execute command \n";
949piac->RegisterHelp(kw, usage, grp);
950}
951
952/* --Methode-- */
953int PIAGraphicExecutor::BarGraph(string& keyw, vector<string>& tokens)
954{
955 //PAS necessaire pour le moment-- if (kw != "bargraph") return 2;
956 if (tokens.size() < 1) {
957 cout << "Usage: bargraph ValueVarName [gr_opt]" << endl;
958 cout << " or bargraph ValueVarName LabelVarName ColPosVarName [gr_opt]" << endl;
959 return(0);
960 }
961 PIBarGraph* bgd = NULL;
962 vector<string> barvals;
963 string gropt;
964 if (!mpiac->GetVar(tokens[0], barvals)) {
965 cout << "bargraph/Error: No variable with name " << tokens[0] << endl;
966 return(1);
967 }
968 if (tokens.size() < 3) {
969 bgd = new PIBarGraph;
970 for(int k=0; k<barvals.size(); k++)
971 bgd->AddBar(atof(barvals[k].c_str()));
972 if (tokens.size() > 1) gropt = tokens[1];
973 }
974 else {
975 vector<string> barlabs;
976 if (!mpiac->GetVar(tokens[1], barlabs)) {
977 cout << "bargraph/Warning: No variable with name " << tokens[1]
978 << " using Values as labels " << endl;
979 barlabs = barvals;
980 }
981 vector<string> barcols;
982 if (!mpiac->GetVar(tokens[2], barcols)) {
983 cout << "bargraph/Warning: No variable with name " << tokens[1]
984 << " using default attributes " << endl;
985 for(int kad=0; kad<barvals.size(); kad++) barcols.push_back("");
986 }
987 if ( (barvals.size() != barlabs.size()) ||
988 (barvals.size() != barcols.size()) ) {
989 cout << "bargraph/Error: Variables " << tokens[0] << "," << tokens[1]
990 << "," << tokens[2] << " have different sizes" << endl;
991 return(1);
992 }
993 bgd = new PIBarGraph;
994 // Synchronisation necessaire a cause de PIGraphicAtt qui peuvent faire appel a des fontes (Pb Serveur X)
995 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
996 for(int k=0; k<barvals.size(); k++) {
997 double id = k+1;
998 size_t p = barcols[k].find(',');
999 vector<string> sgra;
1000 if (p < barcols[k].length()-1) {
1001 mImgApp->ParseDisplayOption(barcols[k].substr(0, p), sgra);
1002 id = atof(barcols[k].substr(p+1).c_str());
1003 }
1004 else mImgApp->ParseDisplayOption(barcols[k], sgra);
1005 PIGraphicAtt gracol(sgra);
1006 bgd->AddBar(id, atof(barvals[k].c_str()), barlabs[k], gracol.GetColor());
1007 }
1008 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
1009 if (tokens.size() > 3) gropt = tokens[3];
1010 }
1011 string grname = "BarGraph";
1012 mImgApp->DispScDrawer(bgd, grname, gropt);
1013 return 0;
1014}
1015
1016/* --Methode-- */
1017int PIAGraphicExecutor::TextDrawer(string& keyw, vector<string>& tokens)
1018{
1019 if (tokens.size() < 2) {
1020 cout << "Usage: textdrawer TextLinesVarName AttVarName [gr_opt]" << endl;
1021 return(0);
1022 }
1023 vector<string> txtlines;
1024 if (!mpiac->GetVar(tokens[0], txtlines)) {
1025 cout << "textdrawer/Error: No variable with name" << tokens[0] << endl;
1026 return(1);
1027 }
1028 vector<string> lineatt;
1029 if (!mpiac->GetVar(tokens[1], lineatt)) {
1030 cout << "textdrawer/Warning: No variable with name" << tokens[1]
1031 << " using default attributes " << endl;
1032 for(int kad=0; kad<txtlines.size(); kad++) lineatt.push_back("");
1033 }
1034 if ( (txtlines.size() != lineatt.size()) ) {
1035 cout << "textdrawer/Error: Variables " << tokens[0] << "," << tokens[1]
1036 << " have different sizes" << endl;
1037 return(1);
1038 }
1039 PITextDrawer* txd = new PITextDrawer;
1040 // Synchronisation necessaire a cause de PIGraphicAtt qui peuvent faire appel a des fontes (Pb Serveur X)
1041 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
1042 for(int k=0; k<txtlines.size(); k++) {
1043 vector<string> sgra;
1044 mImgApp->ParseDisplayOption(lineatt[k], sgra);
1045 PIGraphicAtt gra(sgra);
1046 txd->AddLine(txtlines[k], gra);
1047 }
1048 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
1049 string grname = "TextDrawer";
1050 string gropt = "inset ";
1051 if (tokens.size() > 2) gropt += tokens[2];
1052 mImgApp->DispScDrawer(txd, grname, gropt);
1053 return 0;
1054}
Note: See TracBrowser for help on using the repository browser.