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

Last change on this file since 4071 was 4071, checked in by ansari, 13 years ago

Trace en coordonnees polaires (2D avec barres d'erreur) classe PINTuple

et introduction des attributs graphiques polarplot, polaraxes ...

Reza, 9 Mai 2012

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