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

Last change on this file since 3465 was 3456, checked in by cmv, 18 years ago

ajout commentaire hisrng cmv 12/02/2008

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