source: Sophya/trunk/SophyaPI/PIext/pistdimgapp.cc@ 548

Last change on this file since 548 was 548, checked in by ercodmgr, 26 years ago

Ajout trace en medaillon - Reza 4/11/99

  • Property svn:executable set to *
File size: 34.3 KB
Line 
1#include "machdefs.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5
6#include <typeinfo>
7
8#include <string>
9#include <vector>
10
11#include "strutil.h"
12#include "timing.h"
13#include "perrors.h"
14#include "ctimer.h"
15
16#include "psighand.h"
17
18#include "cimage.h" // pour pouvoir faire extract
19
20#include "pistdimgapp.h"
21#include "pihisto2d.h"
22#include "psfile.h"
23#include "piimgtools.h"
24#include "pidrwtools.h"
25
26#include "pistzwin.h"
27
28#include "piinit.h"
29#include "piversion.h"
30#include "piaversion.h"
31
32
33static char ImgDir[256];
34static char WorkDir[256];
35
36
37/* ........................................................... */
38/* Classe PIStdImgApp */
39/* ........................................................... */
40
41/* --Methode-- */
42PIStdImgApp::PIStdImgApp(int narg, char* arg[])
43: PIApplication(420, 320, narg, arg)
44{
45
46// Les menus
47m[0] = new PIMenu(Menubar(),"Fichier");
48m[0]->AppendItem("Help", 10100);
49m[0]->AppendItem("Open-Fits", 10120);
50m[0]->AppendItem("Open-PPF", 10130);
51m[0]->AppendItem("Close", 10110);
52m[0]->AppendItem("delete", 10111);
53// m[0]->AppendItem("Options", 10101);
54m[0]->AppendItem("Exit", 10105);
55
56m[1] = new PIMenu(Menubar(),"Objets");
57m[1]->AppendItem("ObjectManager", 10201);
58m[1]->AppendItem("OpenOutPPF", 10220);
59m[1]->AppendItem("CloseOutPPF", 10230);
60
61m[2] = new PIMenu(Menubar(),"Tools");
62m[2]->AppendItem("Show ImageTools", 10301);
63m[2]->AppendItem("Show DrawerTools", 10302);
64m[2]->AppendItem("Ext.Pave", 10304);
65m[2]->AppendItem("Ext.Pave+Org", 10305);
66m[2]->SetSensitivityMsg(10305, false);
67m[2]->AppendItem("Cuts X,Y", 10306);
68m[2]->SetSensitivityMsg(10306, false);
69mc = new PIMenu(m[2], "StackTools");
70mc->AppendItem("DispNext", 10320);
71mc->AppendItem("Blink 0.5s", 10321);
72mc->AppendItem("Blink 1s", 10322);
73mc->AppendItem("Blink 2s", 10324);
74mc->AppendItem("Stop Blink", 10329);
75mc->AppendItem("RemoveCurrent", 10330);
76m[2]->AppendPDMenu(mc);
77m[2]->SetSensitivity("StackTools", false);
78
79m[3] = new PIMenu(Menubar(),"Window");
80m[3]->AppendItem("StackWindow", 10400);
81m[3]->AppendItem("Window", 10411);
82m[3]->AppendItem("Window 2x1", 10421);
83m[3]->AppendItem("Window 1x2", 10412);
84m[3]->AppendItem("Window 2x2", 10422);
85m[3]->AppendItem("Window 3x1", 10431);
86m[3]->AppendItem("Window 3x3", 10433);
87
88m[4] = new PIMenu(Menubar(),"PostScript");
89m[4]->AppendItem("OpenPS", 10501);
90m[4]->AppendItem("ClosePS", 10505);
91m[4]->AppendItem("Window->PS", 10511);
92m[4]->AppendItem("Image->PS", 10515);
93m[4]->AppendItem("Window->EPS", 10512);
94m[4]->AppendItem("Image->EPS", 10516);
95m[4]->SetSensitivityMsg(10515, false);
96m[4]->SetSensitivityMsg(10516, false);
97
98m[5] = new PIMenu(Menubar(),"Special");
99m[5]->AppendItem("CloseAll", 10601);
100m[5]->AppendCheckItem("Red.Out/Err", 10602);
101m[5]->AppendCheckItem("Catch SigFPE", 10603);
102m[5]->AppendCheckItem("Catch SigSEGV", 10604);
103m[5]->AppendCheckItem("ObjMgr Verb", 10605);
104
105m[6] = new PIMenu(Menubar(),"Modules");
106
107AppendMenu(m[0]);
108AppendMenu(m[1]);
109AppendMenu(m[2]);
110AppendMenu(m[3]);
111AppendMenu(m[4]);
112AppendMenu(m[5]);
113// AppendMenu(m[6]); Menu Modules vide pour le moment
114
115int scsx, scsy;
116ScreenSz(scsx, scsy);
117if (scsy <= 600) mFgScSz = 0;
118else if (scsy <= 800) mFgScSz = 1;
119else if (scsy <= 1024) mFgScSz = 2;
120else mFgScSz = 3;
121int msx = 420+mFgScSz*60;
122int msy = 320+mFgScSz*40;
123MainWin()->SetSize(msx, msy);
124
125int bss = 100+mFgScSz*15;
126gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5);
127gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
128zoom = new PIPixmap(MainWin(), "Zoom", bss, bss, bss+10, 5);
129zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
130cmapv = new PICMapView(MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
131cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
132
133int cpy = bss+10+14+mFgScSz*2+5;
134
135// Creation d'une console avec gestion des commandes
136mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy );
137mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
138mCons->AcceptCmd(true, 50);
139redirecout = false;
140// RedirectStdOutErr(true); pas par defaut
141
142char buff[128];
143mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
144sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
145 (double)PI_VERSIONNUMBER, (float)PeidaVersion());
146mCons->AddStr(buff, PIVA_Blue );
147mCons->AddStr(" ..........................................\n", PIVA_Blue );
148// PrintPeidaVersion();
149
150
151mObjMgr = new NamedObjMgr;
152mCmd = new PIACmd(mObjMgr, this);
153
154// Pas trop de message de la part de NamedObjMgr
155m[5]->SetStateMsg(10605, false);
156mObjMgr->SetVerbose(false);
157
158char* varenv;
159ImgDir[0] = WorkDir[0] = '\0';
160if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
161if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
162
163pfc = new PIFileChooser(this,"FileChooser", 5000);
164
165mObjmgrw = new ObjMgrWind(this);
166mPpinmgrw = new PPInMgrWind(this);
167
168// Attention : A faire apres creation de ObjMgrWind !!!
169mObjMgr->SetImgApp(this);
170
171// Gestion des feneteres widgets et drawers
172mWId = mDId = mBWId = 0;
173mCurWin = NULL;
174mCurWdg = NULL;
175mLastWdg = NULL;
176mGrW = NULL;
177mStW = NULL;
178mGrIdx = mStIdx = -1;
179
180mFCMsg = 0;
181mFgCWImg = false;
182
183// Gestion fichiers PS
184num_eps = 0;
185name_ps = "";
186name_ps = "pia.ps";
187mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
188
189// Gestion OUT-PPF
190mPpfout = NULL;
191name_outppf = "";
192
193// Attributs graphiques courants
194mFCol = mBCol = PI_NotDefColor;
195mLAtt = PI_NotDefLineAtt;
196mFSz = PI_NotDefFontSize;
197mFAtt = PI_NotDefFontAtt;
198mMSz = -1;
199mMrk = PI_NotDefMarker;
200mCmapid = CMAP_OTHER;
201mZoom = 0;
202mAxesFlags = kBoxAxes | kExtTicks | kLabels;
203SetXYLimits(-1, 1., -1., 1.);
204SetInsetLimits(0.4, 0.6, 0.4, 0.6);
205maXlog = maYlog = false;
206SaveGraphicAtt();
207
208// Initialisation
209PIAppInitiator * piai = new PIAppInitiator(this);
210SetReady();
211}
212
213/* --Methode-- */
214PIStdImgApp::~PIStdImgApp()
215{
216int i;
217
218delete mc;
219for(i=0; i<7; i++)
220 if (m[i]) delete m[i];
221
222WindMList::iterator it;
223for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
224
225delete mObjMgr;
226delete mCmd;
227
228delete zoom;
229delete gimv;
230delete cmapv;
231
232delete pfc;
233
234delete mCons;
235
236delete mObjmgrw;
237delete mPpinmgrw;
238
239// Les fichiers
240if (mpsfile) delete mpsfile;
241if (mPpfout) delete mPpfout;
242
243}
244
245/* --Methode-- */
246void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
247{
248PIWdg *sndw;
249PIMessage tmsg, smm;
250
251tmsg = msg;
252msg = UserMsg(msg);
253smm = ModMsg(tmsg);
254
255//printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
256if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
257
258// Messages active-window
259if (smm == PIMsg_Active)
260 {
261 sndw = dynamic_cast<PIWdg *>(sender);
262 switch(sndw->kind())
263 {
264 case PIWindow::ClassId :
265 mCurWin = dynamic_cast<PIWindow *>(sndw);
266 break;
267
268 case PIScDrawWdg::ClassId :
269 case PIDraw3DWdg::ClassId :
270 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
271// cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
272 if (mFgCWImg) {
273// cerr << "*DBG* ImgTools -> NonSensitive " << endl;
274 m[2]->SetSensitivityMsg(10305, false);
275 m[2]->SetSensitivityMsg(10306, false);
276 m[4]->SetSensitivityMsg(10515, false);
277 m[4]->SetSensitivityMsg(10516, false);
278 mFgCWImg = false;
279 }
280 break;
281 case PIImage::ClassId :
282 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
283 if (!mFgCWImg) {
284// cerr << "*DBG* ImgTools -> Sensitive " << endl;
285 m[2]->SetSensitivityMsg(10305, true);
286 m[2]->SetSensitivityMsg(10306, true);
287 m[4]->SetSensitivityMsg(10515, true);
288 m[4]->SetSensitivityMsg(10516, true);
289 mFgCWImg = true;
290 }
291 break;
292 /*
293 default :
294 mCurWdg = NULL;
295 if (mFgCWImg) {
296 m[2]->SetSensitivityMsg(10305, false);
297 m[2]->SetSensitivityMsg(10306, false);
298 m[4]->SetSensitivityMsg(10515, false);
299 m[4]->SetSensitivityMsg(10516, false);
300 mFgCWImg = false;
301 }
302 break;
303 */
304 }
305 }
306// Message window-close
307else if (smm == PIMsg_Close)
308 {
309 sndw = (PIWdg *)sender;
310 if(sndw->kind() == PIWindow::ClassId)
311 {
312 mCurWin = (PIWindow *)sender;
313 if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
314 DeleteWindow(mCurWin);
315 }
316 else
317 printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
318 (int)tmsg, (int)sndw->kind(), (long)sender);
319 }
320
321// Traitement des messages des menus
322else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
323else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
324else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
325else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
326else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
327else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
328else if ( msg == 30200 ) { // Objet PIConsole
329 string s = mCons->GetCmdString();
330 string s2 = "\nExecuting " + s + "\n";
331 mCons->AddStr(s2.c_str(), PIVA_Blue, true);
332 SetBusy();
333#ifdef SANS_EVOLPLANCK
334 TRY {
335 mCmd->Interpret(s);
336 } CATCH(merr) {
337 fflush(stdout);
338 cout << endl;
339 cerr << endl;
340 string es = PeidaExc(merr);
341 cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
342 }
343#else
344 try {
345 mCmd->Interpret(s);
346 }
347 catch ( PException exc ) {
348 fflush(stdout);
349 cout << endl;
350 cerr << endl;
351 cerr << "PIStdImgApp::Process()/ Cmd->Interpret() Exception :" << exc.Msg() << endl;
352 }
353#endif
354 SetReady();
355 }
356
357else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
358 (int)tmsg,(int)msg,(int)smm);
359
360
361return;
362}
363
364/* --Methode-- */
365void PIStdImgApp::SetReady()
366{
367mCons->SetSensitive();
368gimv->SetSensitive();
369PIApplication::SetReady();
370}
371
372/* --Methode-- */
373void PIStdImgApp::SetBusy()
374{
375mCons->SetUnSensitive();
376gimv->SetUnSensitive();
377PIApplication::SetBusy();
378}
379
380/* --Methode-- */
381void PIStdImgApp::SetBlocked()
382{
383mCons->SetUnSensitive();
384gimv->SetUnSensitive();
385PIApplication::SetBlocked();
386}
387
388
389/* --Methode-- */
390int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid)
391{
392PIImage* pii;
393PIWindow* win;
394int sx, sy, px, py, flag;
395
396if (nouv == NULL)
397 {
398 printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
399 return(-1);
400 }
401
402if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
403 {
404 printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
405 nouv->XSize(), nouv->YSize());
406 return(-1);
407 }
408
409int zm = 1;
410if (mZoom == 0) { // Facteur de zoom auto
411 zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() : nouv->YSize();
412 zm = (zm >= 250) ? 250/zm : 1;
413 }
414else zm = mZoom;
415
416if (zm == 0) zm = 1;
417if (zm < -10) zm = -10;
418if (zm > 10) zm = 10;
419
420if (zm > 0) { sx = nouv->XSize()*zm; sy = nouv->YSize()*zm; }
421else {
422 sx = (int)((float)nouv->XSize()*(-1./float(zm)));
423 sy = (int)((float)nouv->YSize()*(-1./float(zm)));
424 }
425if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
426if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
427px = py = 0;
428win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
429pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
430pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
431pii->SetZoomWin(zoom, false);
432pii->SetGloVWin(gimv, false);
433pii->SetCMapWin(cmapv, false);
434pii->SetZoom(zm, false);
435if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, false);
436pii->ShowCursor(true);
437pii->SetUserData(NULL, oid);
438pii->SetImage(nouv, true);
439// printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
440mCurWin = win;
441mCurWdg = pii;
442mLastWdg = pii;
443mBWId++;
444mBWList[mBWId] = pii;
445return(mBWId);
446}
447
448
449/* --Methode-- */
450int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, int oid)
451{
452if (scd == NULL)
453 {
454 printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
455 return(-1);
456 }
457
458// Changement d'attributs graphiques courants du drawer
459if (mFCol != PI_NotDefColor) scd->SetColAtt(mFCol, mBCol);
460if (mLAtt != PI_NotDefLineAtt) scd->SetLineAtt(mLAtt);
461if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) scd->SetFontAtt(mFSz, mFAtt);
462if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) scd->SetMarkerAtt(mMSz, mMrk);
463if ( mCmapid != CMAP_OTHER ) scd->SetColMapId(mCmapid);
464
465
466if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next;
467// Trace en superpoistion
468if ( (opt == Disp_Same) && (mLastWdg) ) {
469 if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
470 else mLastWdg->AddDrawer(scd, true, true, true);
471 scd->Refresh();
472 mDId++;
473 mDrwList[mDId] = scd;
474 return(-mDId);
475}
476// Trace en medaillon
477else if ( (opt == Disp_Inset) && (mLastWdg) ) {
478 PIGrCoord x1, x2, y1, y2;
479 x1 = mIXmin; x2 = mIXmax;
480 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
481 scd->SetAxesFlags(mAxesFlags);
482 scd->UpdateLimits();
483 mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
484 scd->Refresh();
485 mDId++;
486 mDrwList[mDId] = scd;
487 return(-mDId);
488}
489
490PIWindow* win;
491PIScDrawWdg* scw;
492int sx, sy, px, py, flag;
493sx = 200+mFgScSz*100;
494sy = 200+mFgScSz*100;
495win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
496if (typeid(*scd) != typeid(PIHisto2D))
497 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
498else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
499scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
500scw->SetUserData(NULL, oid);
501if (maXlog || maYlog) scw->SetLogScale(maXlog, maYlog); // Echelle log
502if (mFXYlim) // Forcage limites XY
503 scw->SetLimits(mXmin, mXmax, mYmin, mYmax);
504scw->SetAxesFlags(mAxesFlags);
505
506if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
507else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
508// Titre du plot
509if (title.length() <= 0) title = name; string t2="";
510scw->SetTitles(title, t2);
511// scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
512mCurWin = win;
513mCurWdg = scw;
514mLastWdg = scw;
515mBWId++;
516mBWList[mBWId] = scw;
517return(mBWId);
518}
519
520/* --Methode-- */
521int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title, int oid)
522{
523if (dr3 == NULL)
524 {
525 printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
526 return(-1);
527 }
528
529// Changement d'attributs graphiques courants du drawer
530if (mFCol != PI_NotDefColor) dr3->SetColAtt(mFCol, mBCol);
531if (mLAtt != PI_NotDefLineAtt) dr3->SetLineAtt(mLAtt);
532if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) dr3->SetFontAtt(mFSz, mFAtt);
533if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) dr3->SetMarkerAtt(mMSz, mMrk);
534if ( mCmapid != CMAP_OTHER ) dr3->SetColMapId(mCmapid);
535
536if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next;
537// Trace en superpoistion
538if ( (opt == Disp_Same) && (mLastWdg) ) {
539 if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
540 else mLastWdg->AddDrawer(dr3, true, true, true);
541 dr3->Refresh();
542 mDId++;
543 mDrwList[mDId] = dr3;
544 return(-mDId);
545}
546// Trace en medaillon
547else if ( (opt == Disp_Inset) && (mLastWdg) ) {
548 PIGrCoord x1, x2, y1, y2;
549 x1 = mIXmin; x2 = mIXmax;
550 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
551 dr3->SetAxesFlags(mAxesFlags);
552 dr3->UpdateLimits();
553 mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
554 dr3->Refresh();
555 mDId++;
556 mDrwList[mDId] = dr3;
557 return(-mDId);
558}
559
560
561PIWindow* win;
562int sx, sy, px, py, flag;
563sx = 200+mFgScSz*100;
564sy = 200+mFgScSz*100;
565win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
566PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
567wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
568wd3->SetUserData(NULL, oid);
569wd3->AddDrawer3D(dr3, true);
570// Titre du plot
571if (title.length() <= 0) title = name; string t2="";
572wd3->SetTitles(title, t2);
573// wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
574mCurWin = win;
575mCurWdg = wd3;
576mLastWdg = wd3;
577mBWId++;
578mBWList[mBWId] = wd3;
579return(mBWId);
580}
581
582/* --Methode-- */
583void PIStdImgApp::AddText(string const & txt, double xp, double yp)
584{
585if (!mLastWdg) return;
586PIElDrawer *eld=NULL;
587PIScDrawWdg* sdw=NULL;
588PIDraw3DWdg* w3d=NULL;
589PIImage* imgw;
590switch(mLastWdg->kind()) {
591 case PIScDrawWdg::ClassId :
592 sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
593 if (sdw) eld = sdw->BaseDrawer();
594 break;
595 case PIDraw3DWdg::ClassId :
596 w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
597 if (w3d) eld = w3d->BaseDrawer();
598 break;
599 case PIImage::ClassId :
600 imgw = dynamic_cast<PIImage *>(mLastWdg);
601 if (imgw) eld = imgw->MyElDrawer();
602 break;
603 default :
604 break;
605 }
606if (eld) {
607 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) eld->SetFontAtt(mFSz, mFAtt);
608 eld->ElAddText(xp,yp,txt.c_str(),mFCol);
609 eld->Refresh();
610 }
611}
612
613/* --Methode-- */
614void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
615{
616if (nx < 1) nx = 1;
617if (ny < 1) ny = 1;
618if (nx > 8) nx = 8;
619if (ny > 8) ny = 8;
620if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
621char buff[64];
622mWId++;
623int px, py;
624MainWin()->GetScreenPos(px, py);
625sprintf(buff, "PI-GraphicWin (%d)",mWId);
626PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
627win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
628mWList[mWId*10+1] = (PIWindow*)win;
629win->SetAutoDelChilds(true);
630// win->Show();
631mGrW = win;
632mGrIdx = 0;
633}
634
635/* --Methode-- */
636void PIStdImgApp::CreateStackWin(int sx, int sy)
637{
638if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
639char buff[64];
640mWId++;
641int px, py;
642MainWin()->GetScreenPos(px, py);
643sprintf(buff, "PI-StackWin (%d)",mWId);
644PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
645win->SetUserData(NULL, 9999); // UserFlag= 9999
646mWList[mWId*10+2] = (PIWindow*)win;
647win->SetAutoDelChilds(true);
648// win->Show();
649mStW = win;
650m[2]->SetSensitivity("StackTools", true);
651mStIdx = 0;
652}
653
654/* --Methode-- */
655PIWindow* PIStdImgApp::GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
656{
657PIWindow* rw;
658
659switch (typ) {
660 case Disp_Next : // Fenetre graphique courante
661 {
662 if (mGrW == NULL) CreateGraphWin();
663 int nx, ny;
664 mGrW->NbZone(nx, ny);
665 PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
666// cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
667 if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
668 flag = mGrIdx;
669 mGrIdx = (mGrIdx+1)%(nx*ny);
670 rw = mGrW;
671 break;
672 }
673
674 case Disp_Stack : // Fenetre de type stack (empilement)
675 {
676 if (mStW == NULL) CreateStackWin(sx, sy);
677 px = py = 0;
678 sx = mStW->XSize();
679 sy = mStW->YSize();
680 flag = mStIdx;
681 mStIdx++;
682 rw = mStW;
683 }
684 break;
685
686 default : // Fenetre ordinaire
687 {
688 int pwx, pwy;
689 MainWin()->GetScreenPos(pwx, pwy);
690 if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
691 rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
692 rw->SetUserData(NULL, 0); // UserFlag= 0
693 mWId++;
694 mWList[mWId*10] = rw;
695 rw->SetAutoDelChilds(true);
696 // rw->Show();
697 px = py = 0;
698 flag = 0;
699 break;
700 }
701 }
702
703rw->Show();
704mCurWin = rw;
705return(rw);
706}
707
708/* --Methode-- */
709void PIStdImgApp::SetZone(int nzx, int nzy)
710{
711if (!mGrW) CreateGraphWin(nzx, nzy);
712else {
713 int k;
714 PIWdg* cwd;
715 for(k=0; k<mGrW->NbChilds(); k++) {
716 if ((cwd = mGrW->GetChild(k)) == NULL) continue;
717 DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
718 }
719 mGrW->SetZone(nzx, nzy);
720 }
721}
722
723/* --Methode-- */
724void PIStdImgApp::StackWinNext()
725{
726if (mStW) mStW->DispNext();
727}
728
729/* --Methode-- */
730void PIStdImgApp::DeleteWindow(PIWindow* w)
731{
732if (w == NULL) return;
733w->Hide();
734bool ownwindow=false; // To Check if this is one of our windows
735WindMList::iterator it;
736for(it = mWList.begin(); it != mWList.end(); it++)
737 if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
738if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
739if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
740if (w == mCurWin) mCurWin = NULL;
741
742if (!ownwindow) return; // We do nothing if this is not a window we have created ...
743
744int k;
745PIWdg* cwd;
746for(k=0; k<w->NbChilds(); k++) {
747 if ((cwd = w->GetChild(k)) == NULL) continue;
748 DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
749 }
750delete w;
751return;
752}
753
754/* --Methode-- */
755void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
756{
757if (w == NULL) return;
758BWMList::iterator it;
759for(it = mBWList.begin(); it != mBWList.end(); it++)
760 if ((*it).second == w) { mBWList.erase(it); break; }
761int k;
762PIDrawer* drw;
763for(k=0; k<w->NbDrawers(); k++) {
764 if ((drw = w->GetDrawer(k)) == NULL) continue;
765 DrwMList::iterator itt;
766 for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
767 if ((*itt).second == drw) { mDrwList.erase(itt); break; }
768 }
769
770if (w == mCurWdg) {
771 mCurWdg = NULL;
772 if (mFgCWImg) {
773 m[4]->SetSensitivityMsg(10515, false);
774 m[4]->SetSensitivityMsg(10516, false);
775 mFgCWImg = false;
776 }
777 }
778
779if (w == mLastWdg) mLastWdg = NULL;
780
781PIWdg* pw=NULL;
782if (dwin) pw = (PIWdg*)(w->Parent());
783//DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
784if (dw) delete w;
785if (pw && (pw->kind() == PIWindow::ClassId )) {
786 PIWindow* pww = (PIWindow*) pw;
787 if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
788 DeleteWindow((PIWindow*)pw);
789 }
790return;
791}
792
793
794
795/* --Methode-- */
796void PIStdImgApp::DelWRsId(int k)
797{
798//DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
799if (k > 0) { // C'est un BaseWidget
800 BWMList::iterator it;
801 it = mBWList.find(k);
802 if (it == mBWList.end()) return;
803 PIBaseWdg* wd = (*it).second;
804//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
805 DeleteBaseWidget(wd, true, true);
806 }
807else { // C'est un drawer
808 DrwMList::iterator it;
809 it = mDrwList.find(-k);
810 if (it == mDrwList.end()) return;
811 delete (*it).second;
812 mDrwList.erase(it);
813// cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
814 }
815}
816/* --Methode-- */
817bool PIStdImgApp::CheckWRsId(int k)
818{
819if (k > 0) { // C'est un BaseWidget
820 BWMList::iterator it;
821 it = mBWList.find(k);
822 if (it == mBWList.end()) return(false);
823 else return(true);
824 }
825else { // C'est un drawer
826 DrwMList::iterator it;
827 it = mDrwList.find(-k);
828 if (it == mDrwList.end()) return(false);
829 else return(true);
830 }
831}
832
833
834/* --Methode-- */
835void PIStdImgApp::RedirectStdOutErr(bool fg)
836{
837if (fg) {
838 RedirectOutStream(mCons);
839 RedirectErrStream(mCons);
840 m[5]->SetStateMsg(10602, true);
841 redirecout = true;
842 }
843else {
844 RedirectOutStream(NULL);
845 RedirectErrStream(NULL);
846 m[5]->SetStateMsg(10602, false);
847 redirecout = false;
848 }
849return;
850}
851
852/* --Methode-- */
853void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
854{
855PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
856m[5]->SetStateMsg(10603, fgfpe);
857m[5]->SetStateMsg(10604, fgsegv);
858}
859
860/* --Methode-- */
861void PIStdImgApp::CloseAllWindows()
862{
863WindMList::iterator it;
864for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
865mWList.clear();
866mBWList.clear();
867mDrwList.clear();
868mGrW = NULL;
869mStW = NULL;
870mCurWin = NULL;
871mCurWdg = NULL;
872mLastWdg = NULL;
873m[4]->SetSensitivityMsg(10515, false);
874m[4]->SetSensitivityMsg(10516, false);
875}
876
877/* --Methode-- */
878void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
879{
880
881 switch(msg)
882 {
883 case 10100 :
884 mCmd->ShowHelpWindow();
885 break;
886
887 case 10120 :
888 pfc->SetPath(ImgDir);
889 pfc->AcceptNewFile(false);
890 mFCMsg = 10125;
891 pfc->SetMsg(mFCMsg);
892 SetBlocked();
893 pfc->Show();
894 break;
895
896 case 10125 :
897 SetBusy();
898 if (data) {
899 string nomobj="";
900 ObjMgr()->ReadFits(pfc->GetFileName(), nomobj);
901 ObjMgr()->DisplayObj(nomobj, "win");
902 }
903 mFCMsg = 0;
904 SetReady();
905 break;
906
907 case 10130 :
908 pfc->SetPath(WorkDir);
909 pfc->AcceptNewFile(false);
910 mFCMsg = 10135;
911 pfc->SetMsg(mFCMsg);
912 SetBlocked();
913 pfc->Show();
914 break;
915
916 case 10135 :
917 mFCMsg = 0;
918 if (data) {
919 PPInMgrW()->SetFile(pfc->GetFileName());
920 PPInMgrW()->Show();
921 }
922 SetReady();
923 break;
924
925 case 10110 :
926 DeleteWindow(mCurWin);
927 break;
928
929 case 10111 :
930 if (mCurWdg) {
931 int oid = mCurWdg->UserFlag();
932 DeleteBaseWidget(mCurWdg);
933 mObjMgr->DelObj_Id(oid);
934 }
935 break;
936
937 case 10105:
938 Stop();
939 break;
940
941 }
942return;
943}
944
945
946
947/* --Methode-- */
948void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
949{
950
951switch (msg) {
952 case 10201 :
953 ObjMgrW()->Show();
954 break;
955
956 case 10220 :
957 pfc->SetPath(WorkDir);
958 pfc->AcceptNewFile(true);
959 mFCMsg = 10225;
960 pfc->SetMsg(mFCMsg);
961 SetBlocked();
962 pfc->Show();
963 break;
964
965 case 10225 :
966 SetBusy();
967 if (data) {
968 if (mPpfout) {
969 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
970 delete mPpfout;
971 }
972 name_outppf = pfc->GetFileName();
973 mPpfout = NULL;
974 printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
975 mPpfout = new POutPersist(name_outppf);
976 }
977 mFCMsg = 0;
978 SetReady();
979 break;
980
981 case 10230 :
982 if (!mPpfout) break;
983 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
984 delete mPpfout;
985 name_outppf = "";
986 mPpfout = NULL;
987 break;
988
989
990 default:
991 cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
992 break;
993}
994
995return;
996}
997
998/* --Methode-- */
999void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1000{
1001
1002switch (msg) {
1003 case 10301 :
1004 PIImgTools::ShowPIImgTools();
1005 break;
1006 case 10302 :
1007 PIDrwTools::ShowPIDrwTools();
1008 break;
1009
1010 case 10304 :
1011 case 10305 :
1012 {
1013 PIImage* curpimg = NULL;
1014 if (!mCurWdg) return;
1015 if (mCurWdg->kind() != PIImage::ClassId) return;
1016 curpimg = (PIImage*)mCurWdg;
1017 if (curpimg == NULL) return;
1018 P2DArrayAdapter* img = curpimg->Image();
1019 if (img == NULL) return;
1020 int dx = curpimg->XSzPave();
1021 int dy = curpimg->YSzPave();
1022 int x0 = curpimg->XPave()-dx/2;
1023 int y0 = curpimg->YPave()-dy/2;
1024 if (x0 < 0) x0 = 0;
1025 if (y0 < 0) y0 = 0;
1026 int x1 = x0+dx;
1027 int y1 = y0+dy;
1028 if (x1 > img->XSize()) x1 = img->XSize();
1029 if (y1 > img->YSize()) y1 = img->YSize();
1030 dx = x1-x0; dy = y1-y0;
1031 ImageR4* pim = new ImageR4(dx, dy);
1032 int ii, jj;
1033 for(jj=0; jj<dy; jj++)
1034 for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
1035 if (msg == 10305) { // Calcul des coordonnees du sous-pave
1036 double xc1, yc1;
1037 img->Coord(x0, y0, xc1, yc1);
1038 pim->SetOrg((int)xc1, (int)yc1);
1039 }
1040 string nom = mCurWdg->Nom() + "_pave";
1041 ObjMgr()->AddObj(pim, nom);
1042 ObjMgr()->DisplayObj(nom, "w");
1043 break;
1044 }
1045
1046 case 10306 :
1047 {
1048 PIImage* curpimg = NULL;
1049 if (!mCurWdg) return;
1050 if (mCurWdg->kind() != PIImage::ClassId) return;
1051 curpimg = (PIImage*)mCurWdg;
1052 if (curpimg == NULL) return;
1053 curpimg->ShowCuts(true);
1054 break;
1055 }
1056
1057 case 10320 :
1058 if (mStW) mStW->DispNext();
1059 break;
1060
1061 case 10321 :
1062 case 10322 :
1063 case 10324 :
1064// case 10328 :
1065 if (mStW) mStW->StartAutoDisp((msg-10320)*500);
1066 break;
1067
1068 case 10329 :
1069 if (mStW) mStW->StopAutoDisp();
1070 break;
1071
1072 case 103330 :
1073 if (mStW) {
1074 PIWdg* cw = mStW->CurrentWdg();
1075 if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
1076 }
1077 break;
1078
1079 default:
1080 cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
1081 break;
1082 }
1083return;
1084}
1085
1086/* --Methode-- */
1087void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1088{
1089
1090switch (msg) {
1091
1092 case 10400 :
1093 CreateStackWin();
1094 break;
1095
1096 case 10411 :
1097 CreateGraphWin(1,1);
1098 break;
1099 case 10421 :
1100 CreateGraphWin(1,2);
1101 break;
1102 case 10412 :
1103 CreateGraphWin(2,1);
1104 break;
1105 case 10422 :
1106 CreateGraphWin(2,2);
1107 break;
1108 case 10431 :
1109 CreateGraphWin(1,3);
1110 break;
1111 case 10433 :
1112 CreateGraphWin(3,3);
1113 break;
1114
1115 default:
1116 cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
1117 break;
1118 }
1119return;
1120}
1121
1122
1123/* --Methode-- */
1124void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1125{
1126char nomps[64],strg[512];
1127PSFile *mps;
1128int sxt, syt, syo, syo1, sx[4], sy[4];
1129
1130switch (msg)
1131 {
1132 case 10501 :
1133 pfc->SetPath(WorkDir);
1134 pfc->AcceptNewFile(true);
1135 mFCMsg = 10525;
1136 pfc->SetMsg(mFCMsg);
1137 SetBlocked();
1138 pfc->Show();
1139 break;
1140
1141 case 10525 :
1142 SetBusy();
1143 if (data) {
1144 if (mpsfile) {
1145 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1146 delete mpsfile;
1147 }
1148 name_ps = pfc->GetFileName();
1149 printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
1150 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
1151 }
1152 mFCMsg = 0;
1153 SetReady();
1154 break;
1155
1156 case 10505 :
1157 if (!mpsfile) break;
1158 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1159 delete mpsfile;
1160 mpsfile = NULL;
1161 name_ps = "";
1162 break;
1163
1164 case 10511 : // Window -> PS
1165 case 10512 : // Window -> EPS
1166 if (CurrentWindow() == NULL) break;
1167 if (msg == 10512)
1168 {
1169 num_eps++;
1170 sprintf(nomps,"pia%d.eps", num_eps);
1171 printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
1172 mps = new PSFile(nomps);
1173 }
1174 else {
1175 if (mpsfile == NULL) {
1176 name_ps = "pia.ps";
1177 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
1178 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1179 }
1180 printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
1181 mps = mpsfile;
1182 }
1183 CurrentWindow()->PSPrint(mps,0,0);
1184
1185 if (msg == 10512) delete mps; // fichier eps
1186 break;
1187
1188 case 10515 : // Image -> PS
1189 case 10516 : // Image -> EPS
1190 {
1191 PIImage* curpimg = NULL;
1192 if (!mCurWdg) return;
1193 if (mCurWdg->kind() != PIImage::ClassId) return;
1194 curpimg = (PIImage*)mCurWdg;
1195 if (curpimg == NULL) return;
1196 if (msg == 10516)
1197 {
1198 num_eps++;
1199 sprintf(nomps,"pia%d.eps", num_eps);
1200 printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
1201 mps = new PSFile(nomps);
1202 }
1203 else {
1204 if (mpsfile == NULL) {
1205 name_ps = "pia.ps";
1206 mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
1207 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1208 }
1209 printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
1210 mps = mpsfile;
1211 }
1212
1213 sx[0] = gimv->XSize();
1214 sy[0] = gimv->YSize();
1215 sx[1] = zoom->XSize();
1216 sy[1] = zoom->YSize();
1217 sx[2] = cmapv->XSize();
1218 sy[2] = cmapv->YSize();
1219 sx[3] = curpimg->XSize();
1220 sy[3] = curpimg->YSize();
1221 if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
1222 else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
1223 syt = sy[3]+syo;
1224 sxt = sx[3];
1225 if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
1226 if (sxt < sx[2]) sxt = sx[2];
1227
1228 // Pour ecrire le titre
1229 mps->NewPage((float)sxt, (float)syt, PI_Portrait);
1230 mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
1231 sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
1232 curpimg->XPave(), curpimg->YPave());
1233 mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20);
1234 mps->EndBloc();
1235
1236 // Les quatre fenetres glovimage, zoom, cmap, image
1237 gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
1238 zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
1239 cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
1240 curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
1241
1242 if (msg == 10516) delete mps; // fichier eps
1243 break;
1244 }
1245
1246 default:
1247 cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
1248 break;
1249 }
1250
1251}
1252
1253
1254/* --Methode-- */
1255void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1256{
1257switch (msg) {
1258 case 10601:
1259 CloseAllWindows();
1260 break;
1261 case 10602:
1262 RedirectStdOutErr(*((bool*)data));
1263 break;
1264 case 10603:
1265 case 10604:
1266 CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
1267 break;
1268 case 10605:
1269 mObjMgr->SetVerbose(m[5]->GetStateMsg(10605));
1270 break;
1271 default:
1272 cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
1273 break;
1274 }
1275return;
1276}
1277
1278
1279/* --Methode-- */
1280void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)
1281{
1282 mFCol = fg;
1283 mBCol = bg;
1284}
1285/* --Methode-- */
1286void PIStdImgApp::SetLineAtt(PILineAtt lat)
1287{
1288 mLAtt = lat;
1289}
1290/* --Methode-- */
1291void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
1292{
1293 mFSz = fsz;
1294 mFAtt = fat;
1295}
1296/* --Methode-- */
1297void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)
1298{
1299 mMSz = sz;
1300 mMrk = mrk;
1301}
1302/* --Methode-- */
1303void PIStdImgApp::SetColMapId(CMapId cid)
1304{
1305 mCmapid = cid;
1306}
1307/* --Methode-- */
1308void PIStdImgApp::SetZoomAtt(int zoom)
1309{
1310 if ( (zoom > 10) || (zoom < -10) ) zoom = 0;
1311 mZoom = zoom;
1312}
1313/* --Methode-- */
1314void PIStdImgApp::SetAxesAtt(unsigned int axfl)
1315{
1316 mAxesFlags = axfl;
1317}
1318/* --Methode-- */
1319void PIStdImgApp::SetXYLimits(double xmin, double xmax, double ymin, double ymax)
1320{
1321 mXmin = xmin; mXmax= xmax;
1322 mYmin = ymin; mYmax= ymax;
1323}
1324
1325/* --Methode-- */
1326void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
1327{
1328 mIXmin = xmin; mIXmax= xmax;
1329 mIYmin = ymin; mIYmax= ymax;
1330}
1331
1332/* --Methode-- */
1333void PIStdImgApp::SaveGraphicAtt()
1334{
1335 mSFCol = mFCol;
1336 mSBCol = mBCol;
1337 mSLAtt = mLAtt;
1338 mSFSz = mFSz;
1339 mSFAtt = mFAtt;
1340 mSMSz = mMSz;
1341 mSMrk = mMrk;
1342 mSCmapid = mCmapid;
1343 mSZoom = mZoom;
1344 mSAxesFlags = mAxesFlags;
1345 mSXmin = mXmin; mSXmax = mXmax;
1346 mSYmin = mYmin; mSYmax = mYmax;
1347 mSIXmin = mIXmin; mSIXmax = mIXmax;
1348 mSIYmin = mIYmin; mSIYmax = mIYmax;
1349 mSFXYlim = mFXYlim;
1350 mSaXlog = maXlog;
1351 mSaYlog = maYlog;
1352}
1353
1354/* --Methode-- */
1355void PIStdImgApp::RestoreGraphicAtt()
1356{
1357 mFCol = mSFCol;
1358 mBCol = mSBCol;
1359 mLAtt = mSLAtt;
1360 mFSz = mSFSz;
1361 mFAtt = mSFAtt;
1362 mMSz = mSMSz;
1363 mMrk = mSMrk;
1364 mCmapid = mSCmapid;
1365 mZoom = mSZoom;
1366 mAxesFlags = mSAxesFlags;
1367 mXmin = mSXmin; mXmax = mSXmax;
1368 mYmin = mSYmin; mYmax = mSYmax;
1369 mIXmin = mSIXmin; mIXmax = mSIXmax;
1370 mIYmin = mSIYmin; mIYmax = mSIYmax;
1371 mFXYlim = mSFXYlim;
1372 maXlog = mSaXlog;
1373 maYlog = mSaYlog;
1374}
Note: See TracBrowser for help on using the repository browser.