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

Last change on this file since 3269 was 3269, checked in by ansari, 18 years ago

Ajout des commandes nt2dcn et nt2dci , modifs PINtuple pour permettre l'utilisation d'une colonne pour specifier la couleur de trace de chaque marker - Reza 19/06/2007

File size: 44.7 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") {
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 mObjMgr->DisplayNT(tokens[1], tokens[2], tokens[3], ph, tokens[4], tokens[5], ph,
297 tokens[6], tokens[7], tokens[0], false, tokens[8], false);
298 }
299else if (kw == "nt2dci") {
300 if (tokens.size() < 4) {
301 cout << "Usage: nt2dci nameobj color varx vary [errx erry wt label opt]" << endl;
302 return(0);
303 }
304 while (tokens.size() < 9) tokens.push_back("");
305 string ph = "";
306 mObjMgr->DisplayNT(tokens[1], tokens[2], tokens[3], ph, tokens[4], tokens[5], ph,
307 tokens[6], tokens[7], tokens[0], true, tokens[8], false);
308 }
309else if (kw == "nt3d") {
310 if (tokens.size() < 7) {
311 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
312 return(0);
313 }
314 while (tokens.size() < 10) tokens.push_back("");
315 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
316 tokens[6], tokens[7], tokens[8], 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);
328
329// Obsolete : ne pas virer SVP, cmv 26/7/99
330else if (kw == "gfd2d") {
331 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
332 if(tokens.size()<2)
333 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
334 return(0);}
335 string numvary = "";
336 string err = "";
337 string opt = "next";
338 if(tokens.size()>2) err = tokens[2];
339 if(tokens.size()>3) opt = tokens[3];
340 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
341 }
342else if (kw == "gfd3d") {
343 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
344 if(tokens.size()<3)
345 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
346 return(0);}
347 string err = "";
348 string opt = "next";
349 if(tokens.size()>3) err = tokens[3];
350 if(tokens.size()>4) opt = tokens[4];
351 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
352 }
353
354
355else {
356 cerr << "PIAGraphicExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
357 return(-1);
358 }
359
360return(0);
361}
362
363/* --Methode-- */
364bool PIAGraphicExecutor::IsThreadable(string const & keyw)
365{
366 return false;
367}
368
369
370/* --Methode-- */
371void PIAGraphicExecutor::RegisterCommands()
372{
373string kw, usage, grp;
374
375RegisterPIGraphicsHelp(mpiac);
376
377grp = "Graphics";
378string gdesc = "Basic graphics and object display commands";
379mpiac->AddHelpGroup(grp, gdesc);
380kw = "zone";
381usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
382usage += "\n Related commands: newwin";
383mpiac->RegisterCommand(kw, usage, this, grp);
384kw = "newwin";
385usage = "To Create a New Graphic window, with zones \n";
386usage += " Window size can be specified \n";
387usage += " Usage: newwin [nx ny [sizeX sizeY]] ";
388usage += "\n Related commands: zone";
389mpiac->RegisterCommand(kw, usage, this, grp);
390kw = "stacknext";
391usage = "Displays the next widget on stack window \n Usage: stacknext";
392mpiac->RegisterCommand(kw, usage, this, grp);
393
394kw = "graphicatt";
395usage = "To change default graphic options\n Usage: graphicatt att_list\n";
396usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
397usage += "\n ------------------ Graphic attribute list ------------------\n";
398usage += ">> Colors: defcol black white grey red blue green yellow\n";
399usage += " magenta cyan turquoise navyblue orange siennared purple\n";
400usage += " limegreen gold violet violetred blueviolet darkviolet\n";
401usage += " or \"color=name\" \"fgcolor=name\" \"bgcolor=name\" ex: \"color=red\"\n";
402usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline\n";
403usage += " thickdashedline dottedline thindottedline thickdottedline\n";
404usage += " or \"line=type,width\" ex: \"line=dotted,7\"\n";
405usage += ">> Fonts:\n";
406usage += " > Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
407usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont\n";
408usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont\n";
409usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont\n";
410usage += " > Names: deffont courierfont helveticafont timesfont symbolfont \n";
411usage += " or \"font=name,type,size\" ex: \"font=courrier,bolditalic,10\"\n";
412usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T>\n";
413usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T>\n";
414usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T>\n";
415usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ...\n";
416usage += " or \"marker=type,size\" ex: \"marker=plus,10\"\n";
417usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T>\n";
418usage += " arrowshapedarrow<T> farrowshapedarrow<T>\n";
419usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ...\n";
420usage += " or \"arrow=type,size\" ex: \"arrow=arrowshaped,10\"\n";
421usage += "------ Specific options for image displays:\n";
422usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32\n";
423usage += " grey128 invgrey128 colrj128 colbr128\n";
424usage += " red32cm green32cm blue32cm yellow32cm\n";
425usage += " orange32cm cyan32cm violet32cm\n";
426usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
427usage += " midas_bluewhite midas_redwhite\n";
428usage += " multicol16 multicol64\n";
429usage += ">> revcmap : reverse colorMap\n";
430usage += ">> ZoomFactors : zoomxN ex: zoomx1 zoomx2 zoomx3 ...\n";
431usage += " zoom/N ex: zoom/2 zoom/3 zoom/4 ...\n";
432usage += ">> imagecenter=ix,iy : Position the image in widget\n";
433usage += ">> lut=ltyp,min,max : Sets LUT type and min/max\n";
434usage += " (ltyp=lin/log/sqrt/square)\n";
435usage += ">> invx,invy,exchxy : image axes configuration\n";
436usage += ">> for Axes / Axe labels / LogScale / xylimits / defdrrect\n";
437usage += " see setaxesatt command\n";
438usage += "--- General purpose options:\n";
439usage += ">> stat,stats / nsta,nstat,nostat,nostats : Toggle statistic display\n";
440usage += ">> title,tit / notitle,notit -> Toggle automatic title display\n";
441usage += ">> Choose display window: next same win stack inset\n";
442usage += "\n";
443usage += " Related commands: setaxesatt setinsetlimits ";
444mpiac->RegisterCommand(kw, usage, this, grp);
445
446kw = "setaxesatt";
447usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
448usage += "Color/Line/Font attributes and axes attributes \n";
449usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n";
450usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n";
451usage += " centeredaxesgrid finecenteredaxesgrid\n";
452usage += " axescenter=x0,y0 (only with centered axes, default \"axescenter=\")\n";
453usage += " grid nogrid labels nolabels \n";
454usage += " ticks noticks minorticks nominorticks \n";
455usage += " extticks intticks extintticks \n";
456usage += " nbticks=X_NTicks,Y_NTicks \n";
457usage += " tickslen=MajTickLenFrac,MinTickLenFrac \n";
458usage += ">> Axe labels font size: fixedfontsize/autofontsize=fszf \n";
459usage += " autofontsize=fsizef: Font size computed automatically \n";
460usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
461usage += ">> Scale type: linx liny logx logy -> Lin/Log Scales for 2D plots \n";
462usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
463usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
464usage += " The rectangle is defined as a fraction of the widget size\n";
465mpiac->RegisterCommand(kw, usage, this, grp);
466
467kw = "setinsetlimits";
468usage = "Define the display rectangle for drawers added as insets \n";
469usage += " over existing graphic objects - limits expressed as fraction \n";
470usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
471usage += " Usage: setinsetlimits xmin xmax ymin ymax";
472usage += "\n Related commands: graphicatt /inset";
473mpiac->RegisterCommand(kw, usage, this, grp);
474
475kw = "drpanel";
476usage = "Creates a new 2D drawing zone for addtext, addline \n";
477usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
478usage += "\n Related commands: addtext addline addrect addcirc ...";
479mpiac->RegisterCommand(kw, usage, this, grp);
480
481kw = "addtext";
482usage = "Adds a text string to the current graphic object";
483usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
484usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
485usage += "\n Alt<E> to remove the added element";
486usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
487usage += "\n (use quotes '' for multi word text strings) ";
488usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
489usage += "\n Text position/direction attribute: ";
490usage += "\n horizleft horizcenter horizright";
491usage += "\n vertbottom vertcenter verttop ";
492usage += "\n textdirhoriz textdirvertup textdirvertdown ";
493usage += "\n Related commands: addctext addline addarrow addrect addfrect";
494usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
495mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
496
497kw = "addctext";
498usage = "Adds a composite text string with superscript and subscripts ";
499usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
500usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
501usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
502usage += "\n Related commands: addtext addline addrect ...";
503usage += "\n (See command addtext and graphicatt for more details)";
504mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
505
506kw = "addline";
507usage = "Adds a line to the current graphic object";
508usage += "\n at the specified position (+ graphic attribute)";
509usage += "\n The Base/AxesDrawer is used to handle added lines";
510usage += "\n Alt<E> to remove the added element";
511usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
512usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
513usage += "\n Related commands: addarrow addtext addrect addfrect ";
514usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
515mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
516
517kw = "addarrow";
518usage = "Adds an arrow to the current graphic object";
519usage += "\n at the specified position (+ graphic attribute)";
520usage += "\n The Base/AxesDrawer is used to handle added lines";
521usage += "\n Alt<E> to remove the added element";
522usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
523usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
524usage += "\n Related commands: addline addtext addrect addfrect ";
525usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
526mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
527kw = "addarrow_nc";
528
529kw = "addrect";
530usage = "Adds a rectangle to the current graphic object";
531usage += "\n between the specified positions (+ graphic attribute)";
532usage += "\n The Base/AxesDrawer is used to handle added rectangle";
533usage += "\n Alt<E> to remove added element";
534usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
535usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
536usage += "\n Related commands: addtext addline addarrow addfrect";
537usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
538mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
539
540kw = "addfrect";
541usage = "Adds a filled rectangle to the current graphic object";
542usage += "\n between the specified positions (+ graphic attribute)";
543usage += "\n The Base/AxesDrawer is used to handle added rectangle";
544usage += "\n Alt<E> to remove added element";
545usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
546usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
547usage += "\n Related commands: addtext addline addarrow addrect";
548usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
549mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
550
551kw = "addmarker";
552usage = "Adds a marker to the current graphic object";
553usage += "\n at the specified position (+ graphic attribute)";
554usage += "\n The Base/AxesDrawer is used to handle added circles";
555usage += "\n Alt<E> to remove added element";
556usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
557usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
558usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
559usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
560mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
561
562kw = "addcirc";
563usage = "Adds a circle to the current graphic object";
564usage += "\n with the specified center and radius (+ graphic attribute)";
565usage += "\n The Base/AxesDrawer is used to handle added circles";
566usage += "\n Alt<E> to remove added element";
567usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
568usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
569usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
570usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
571mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
572
573kw = "addfcirc";
574usage = "Adds a filled circle to the current graphic object";
575usage += "\n with the specified center and radius (+ graphic attribute)";
576usage += "\n The Base/AxesDrawer is used to handle added circles";
577usage += "\n Alt<E> to remove added element";
578usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
579usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
580usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
581usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
582mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
583
584kw = "addoval";
585usage = "Adds an oval (ellipse) to the current graphic object";
586usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
587usage += "\n The Base/AxesDrawer is used to handle added rectangle";
588usage += "\n Alt<E> to remove added element";
589usage += "\n Usage: addoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
590usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
591usage += "\n Related commands: addfoval addline addarrow addfrect addcirc addfcirc";
592usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
593mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
594
595kw = "addfoval";
596usage = "Adds a filled oval (ellipse) to the current graphic object";
597usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
598usage += "\n The Base/AxesDrawer is used to handle added rectangle";
599usage += "\n Alt<E> to remove added element";
600usage += "\n Usage: addfoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
601usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
602usage += "\n Related commands: addoval addline addarrow addfrect addcirc addfcirc";
603usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
604mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
605
606kw = "addarca";
607usage = "Adds an arc to the current graphic object";
608usage += "\n defined by the circle (center+radius), start angle and angular extension";
609usage += "\n Angles are specified in degrees";
610usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
611usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
612usage += "\n Related commands: addtext addline addfarca addarc ...";
613mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
614
615kw = "addfarca";
616usage = "Adds a filled arc to the current graphic object";
617usage += "\n defined by the circle (center+radius), start angle and angular extension";
618usage += "\n Angles are specified in degrees";
619usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
620usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
621usage += "\n Related commands: addtext addline addarca addarc ...";
622mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
623
624kw = "addarc";
625usage = "Adds an arc to the current graphic object";
626usage += "\n defined by 3 points (+ graphic attribute)";
627usage += "\n The Base/AxesDrawer is used to handle added arcs";
628usage += "\n Alt<E> to remove the added element";
629usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
630usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
631usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
632usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
633mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
634
635kw = "addfarc";
636usage = "Adds a filled arc to the current graphic object";
637usage += "\n defined by 3 points (+ graphic attribute)";
638usage += "\n The Base/AxesDrawer is used to handle added arcs";
639usage += "\n Alt<E> to remove added element";
640usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
641usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
642usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
643usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
644mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
645
646kw = "addpoly";
647usage = "Adds a polyline/polygon to the current graphic object";
648usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
649usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
650usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
651usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
652usage += "\n addcirc addfcirc addfarc graphicatt";
653mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
654
655kw = "addfpoly";
656usage = "Adds a filled polygon to the current graphic object";
657usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
658usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
659usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
660usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
661usage += "\n addcirc addfcirc addfarc graphicatt";
662mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
663
664kw = "settitle";
665usage = "Set the title string (top title / bottom title) for the current graphic object";
666usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
667usage += "\n Related commands: addtext graphicatt";
668mpiac->RegisterCommand(kw, usage, this, grp);
669
670kw = "addtitle";
671usage = "Set the title string (top title / bottom title) \n";
672usage += " alias for settitle ";
673mpiac->RegisterCommand(kw, usage, this, grp);
674
675kw = "setaxelabels";
676usage = "Set the X and Y axis labels for the current 2D graphic object \n";
677usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
678usage += "\n Related commands: settitle addtext graphicatt";
679mpiac->RegisterCommand(kw, usage, this, grp);
680
681kw = "addaxelabels";
682usage = "Set the X and Y axis labels for the current 2D graphic object";
683usage += " alias for setaxelabels ";
684mpiac->RegisterCommand(kw, usage, this, grp);
685
686grp = "Obj. Display";
687kw = "disp";
688usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
689usage += "\n Related commands: surf nt2d nt3d vecplot";
690mpiac->RegisterCommand(kw, usage, this, grp);
691kw = "imag";
692usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
693usage += "\n Related commands: disp imagnav surf nt2d nt3d vecplot";
694mpiac->RegisterCommand(kw, usage, this, grp);
695kw = "imagnav";
696usage = "Displays an object as an image with the ImageNavigator viewer \n";
697usage += "Usage: imagnav nameobj [graphic_attributes]";
698usage += "\n Related commands: disp imag surf nt2d nt3d vecplot";
699mpiac->RegisterCommand(kw, usage, this, grp);
700kw = "surf";
701usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
702usage += "\n Related commands: disp nt2d nt3d vecplot";
703mpiac->RegisterCommand(kw, usage, this, grp);
704kw = "nt2d";
705usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
706usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
707usage += "\n Related commands: disp surf nt2dcn nt2dci nt3d gfd2d vecplot";
708mpiac->RegisterCommand(kw, usage, this, grp);
709kw = "nt2dcn";
710usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
711usage = " with colors specified by a column content (as color names) ";
712usage += "\n Usage : nt2dcn nameobj color varx vary [errx erry wt label graphic_attributes]";
713usage += "\n Related commands: disp surf nt2d nt2dci nt3d gfd2d vecplot";
714mpiac->RegisterCommand(kw, usage, this, grp);
715kw = "nt2dci";
716usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
717usage = " with colors specified by a column content (as color index) ";
718usage += "\n Usage : nt2dci nameobj color varx vary [errx erry wt label graphic_attributes]";
719usage += "\n Related commands: disp surf nt2d nt2dci nt3d gfd2d vecplot";
720mpiac->RegisterCommand(kw, usage, this, grp);
721kw = "nt3d";
722usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
723usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
724usage += "\n Related commands: disp surf nt2d gfd3d ";
725mpiac->RegisterCommand(kw, usage, this, grp);
726kw = "vecplot";
727usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
728usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
729usage += "\n Related commands: disp nt2d ";
730mpiac->RegisterCommand(kw, usage, this, grp);
731
732kw = "bargraph";
733usage = "Bar-Graph view of a sequence of values ";
734usage += "\n Usage: bargraph ValueVarName [gr_opt] ";
735usage += "\n or bargraph ValueVarName LabelVarName ColPosVarName [gr_opt] ";
736usage += "\n ValueVarName,LabelVarName,ColPosVarName are PIACmd interpreter ";
737usage += "\n variable name (vectors) ";
738usage += "\n - ValueVarName: Sequence of values to be represented";
739usage += "\n - LabelVarName: Corresponding labels";
740usage += "\n - ColPosVarName: Corresponding colors or color,position pairs ";
741usage += "\n Use a dash (-) or ! as placeholder for LabelVarName/ColPosVarName";
742usage += "\n Specific graphic options: fill/nofill packfrac=value ";
743usage += "\n horizontalbars/verticalbars barvaluelabel/nobarvaluelabel";
744usage += "\n Related commands: disp nt2d vecplot ...";
745mpiac->RegisterCommand(kw, usage, this, grp);
746kw = "textdrawer";
747usage = "Multi line text darwer ";
748usage += "\n Usage : textdrawer LinesVarName AttVarName [gr_opt] ";
749usage += "\n LinesVarName,AttVarName are PIACmd interpreter variables";
750usage += "\n - LinesVarName: Lines to be displayed";
751usage += "\n - AttVarName: Corresponding font/marker/color attributes";
752usage += "\n Use a dash (-) or ! as placeholder for AttVarName";
753usage += "\n Specific graphic options: frame/noframe";
754usage += "\n Related commands: disp ... ";
755mpiac->RegisterCommand(kw, usage, this, grp);
756
757
758// Ceci est maintenant obsolete, on garde pour info.
759kw = "gfd2d";
760usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
761usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
762usage += "\n Related commands: gfd3d nt2d nt3d ";
763usage += "\n ----- OBSOLETE: utilisez nt2d -----";
764mpiac->RegisterCommand(kw, usage, this, grp);
765kw = "gfd3d";
766usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
767usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
768usage += "\n Related commands: gfd2d nt2d nt3d ";
769usage += "\n ----- OBSOLETE: utilisez nt3d -----";
770mpiac->RegisterCommand(kw, usage, this, grp);
771
772}
773
774
775/* --Methode-- */
776void PIAGraphicExecutor::RegisterPIGraphicsHelp(PIACmd* piac)
777// Methode pour enregistrer le Help des Widgets et Windows de piapp
778{
779string kw,grp,usage;
780
781grp = "Graphics";
782
783kw = "PIImage";
784usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
785usage += "and controls a zoom widget, as well as a global image view widget \n";
786usage += ">>>> Mouse controls : \n";
787usage += "o Button-1: Display current coordinates and pixel value\n";
788usage += " Position the cursor an refresh the zoom widget\n";
789usage += "o Button-2: Defines an image zone and positions the cursor \n";
790usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
791usage += ">>>> Keyboard controls : \n";
792usage += "o <Alt>R : Refresh display \n";
793usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
794usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
795usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
796usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
797usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
798usage += "o <Alt>X : Show/Hide the Cut Window \n";
799usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
800usage += "o <Alt>E : Removes the last added graphic element \n";
801usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
802usage += "o <Alt>- or <Cntl>- : Zoom out \n";
803usage += "o Cursor keys : Moves the image cursor \n";
804piac->RegisterHelp(kw, usage, grp);
805
806kw = "PIScDrawWdg";
807usage = "Manages display of 2-D drawers with interactive zoom \n";
808usage += ">>>> Mouse controls : \n";
809usage += "o Button-1: Display current coordinates \n";
810usage += "o Button-2: Defines a rectangle for zoom \n";
811usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
812usage += ">>>> Keyboard controls : \n";
813usage += "o <Alt>R : Refresh display \n";
814usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
815usage += " (2-D histograms, contour plot ...) \n";
816usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
817usage += " Drawer 0 manages the axes, as well as the added text \n";
818usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
819usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
820usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
821usage += "o <Alt>E : Removes the last added graphic element \n";
822usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
823usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
824usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
825usage += ">>>> Mouse + Keyboard controls : \n";
826usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
827piac->RegisterHelp(kw, usage, grp);
828
829kw = "PIDraw3DWdg";
830usage = "Manages display of 3-D objects (drawers) \n";
831usage += ">>>> Mouse controls : \n";
832usage += "o Button-2: Rotates the observer (camera) around object \n";
833usage += "o Shift-Button-2: Rotates object with camera fixed \n";
834usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
835usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
836usage += ">>>> Keyboard controls : \n";
837usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
838usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
839usage += " (2-D histograms, contour plot ...) \n";
840usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
841usage += " Drawer 0 manages the axes, as well as the added text \n";
842usage += "o <Alt>D : Shows the drawer manipulation pop-up menu \n";
843usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
844usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
845usage += "o <Alt>E : Removes the last added graphic element \n";
846usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
847usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
848piac->RegisterHelp(kw, usage, grp);
849
850kw = "Windows";
851usage = "Objects can be displayed in different windows, or overlayed on the \n";
852usage += "previous display. The graphics attributes next,win,stack,same control \n";
853usage += "the display window. \n";
854usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
855usage += " Graphic windows can be divided int zones. Object is displayed \n";
856usage += " in the next available position, removing a previously displayed \n";
857usage += " widget if necessary \n";
858usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
859usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
860usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
861usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
862usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
863usage += " be activated using the StackTools menu (Blink) \n";
864usage += "o Most objects can be also be displayed overlayed \n";
865usage += " on the last displayed widget (gr_att= same) \n";
866usage += "o The overlay can be on a selected rectangle of the \n";
867usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
868usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
869piac->RegisterHelp(kw, usage, grp);
870
871kw = "PIConsole";
872usage = "Text output area and command editing window (console) \n";
873usage += ">>>> Mouse controls : \n";
874usage += "o Button-1: Rectangle selection for copy/paste \n";
875usage += "o Button-2: Paste text in the command editing line \n";
876usage += "o Button-3: activate display option menu \n";
877usage += ">>>> Keyboard controls : \n";
878usage += "o <Alt>O : activate display option menu \n";
879usage += "o <Alt>V : Paste text in the command editing line \n";
880usage += "o <Alt>A : Selection of the whole window for copy \n";
881usage += "o <Alt>L : Command history (List of command history buffer) \n";
882usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
883usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
884usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
885usage += "o <Ctl>C : Command editing -> Clear the line \n";
886usage += "o Cursor left,right : Command editing -> Move cursor \n";
887usage += "o Cursor Up,Down : recall command from history buffer \n";
888usage += "o Backspace,Del : Command editing \n";
889usage += "o <Return>,<Enter> : Execute command \n";
890piac->RegisterHelp(kw, usage, grp);
891}
892
893/* --Methode-- */
894int PIAGraphicExecutor::BarGraph(string& keyw, vector<string>& tokens)
895{
896 //PAS necessaire pour le moment-- if (kw != "bargraph") return 2;
897 if (tokens.size() < 1) {
898 cout << "Usage: bargraph ValueVarName [gr_opt]" << endl;
899 cout << " or bargraph ValueVarName LabelVarName ColPosVarName [gr_opt]" << endl;
900 return(0);
901 }
902 PIBarGraph* bgd = NULL;
903 vector<string> barvals;
904 string gropt;
905 if (!mpiac->GetVar(tokens[0], barvals)) {
906 cout << "bargraph/Error: No variable with name " << tokens[0] << endl;
907 return(1);
908 }
909 if (tokens.size() < 3) {
910 bgd = new PIBarGraph;
911 for(int k=0; k<barvals.size(); k++)
912 bgd->AddBar(atof(barvals[k].c_str()));
913 if (tokens.size() > 1) gropt = tokens[1];
914 }
915 else {
916 vector<string> barlabs;
917 if (!mpiac->GetVar(tokens[1], barlabs)) {
918 cout << "bargraph/Warning: No variable with name " << tokens[1]
919 << " using Values as labels " << endl;
920 barlabs = barvals;
921 }
922 vector<string> barcols;
923 if (!mpiac->GetVar(tokens[2], barcols)) {
924 cout << "bargraph/Warning: No variable with name " << tokens[1]
925 << " using default attributes " << endl;
926 for(int kad=0; kad<barvals.size(); kad++) barcols.push_back("");
927 }
928 if ( (barvals.size() != barlabs.size()) ||
929 (barvals.size() != barcols.size()) ) {
930 cout << "bargraph/Error: Variables " << tokens[0] << "," << tokens[1]
931 << "," << tokens[2] << " have different sizes" << endl;
932 return(1);
933 }
934 bgd = new PIBarGraph;
935 // Synchronisation necessaire a cause de PIGraphicAtt qui peuvent faire appel a des fontes (Pb Serveur X)
936 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
937 for(int k=0; k<barvals.size(); k++) {
938 double id = k+1;
939 size_t p = barcols[k].find(',');
940 vector<string> sgra;
941 if (p < barcols[k].length()-1) {
942 mImgApp->ParseDisplayOption(barcols[k].substr(0, p), sgra);
943 id = atof(barcols[k].substr(p+1).c_str());
944 }
945 else mImgApp->ParseDisplayOption(barcols[k], sgra);
946 PIGraphicAtt gracol(sgra);
947 bgd->AddBar(id, atof(barvals[k].c_str()), barlabs[k], gracol.GetColor());
948 }
949 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
950 if (tokens.size() > 3) gropt = tokens[3];
951 }
952 string grname = "BarGraph";
953 mImgApp->DispScDrawer(bgd, grname, gropt);
954 return 0;
955}
956
957/* --Methode-- */
958int PIAGraphicExecutor::TextDrawer(string& keyw, vector<string>& tokens)
959{
960 if (tokens.size() < 2) {
961 cout << "Usage: textdrawer TextLinesVarName AttVarName [gr_opt]" << endl;
962 return(0);
963 }
964 vector<string> txtlines;
965 if (!mpiac->GetVar(tokens[0], txtlines)) {
966 cout << "textdrawer/Error: No variable with name" << tokens[0] << endl;
967 return(1);
968 }
969 vector<string> lineatt;
970 if (!mpiac->GetVar(tokens[1], lineatt)) {
971 cout << "textdrawer/Warning: No variable with name" << tokens[1]
972 << " using default attributes " << endl;
973 for(int kad=0; kad<txtlines.size(); kad++) lineatt.push_back("");
974 }
975 if ( (txtlines.size() != lineatt.size()) ) {
976 cout << "textdrawer/Error: Variables " << tokens[0] << "," << tokens[1]
977 << " have different sizes" << endl;
978 return(1);
979 }
980 PITextDrawer* txd = new PITextDrawer;
981 // Synchronisation necessaire a cause de PIGraphicAtt qui peuvent faire appel a des fontes (Pb Serveur X)
982 mImgApp->LockMutex(); // <ZThread> global event loop synchronisation
983 for(int k=0; k<txtlines.size(); k++) {
984 vector<string> sgra;
985 mImgApp->ParseDisplayOption(lineatt[k], sgra);
986 PIGraphicAtt gra(sgra);
987 txd->AddLine(txtlines[k], gra);
988 }
989 mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
990 string grname = "TextDrawer";
991 string gropt = "inset ";
992 if (tokens.size() > 2) gropt += tokens[2];
993 mImgApp->DispScDrawer(txd, grname, gropt);
994 return 0;
995}
Note: See TracBrowser for help on using the repository browser.