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