source: Sophya/trunk/SophyaPI/PIext/pistdimgapp.h@ 2180

Last change on this file since 2180 was 2165, checked in by ansari, 23 years ago

Ajout commande setaxelabels, adaptations aux modifs PIElDrwMgr et
PIDrawer3D - Reza 7/8/2002

  • Property svn:executable set to *
File size: 6.4 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// Standard Image App R. Ansari 97-98
3// LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
4
5#ifndef PISTIMGAPP_H_SEEN
6#define PISTIMGAPP_H_SEEN
7
8#include <string.h>
9#include <string>
10#include <map>
11#include <functional>
12
13#include "pisysdep.h"
14
15#include PIAPP_H
16#include PIWIN_H
17#include PIMENU_H
18#include PIOPTMENU_H
19
20#include PISTDWDG_H
21
22#include PIFILECHO_H
23#include PIPERIODIC_H
24
25#include "picons.h"
26
27#include "piimage.h"
28#include "pi3dwdg.h"
29#include "nobjmgr.h"
30#include "piacmd.h"
31#include "pisiadw.h"
32#include "pistzwin.h"
33
34#include "pitherm.h"
35
36#include "resusage.h"
37
38
39enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset};
40
41typedef map<long, PIWindow*, less<long> > WindMList;
42typedef map<long, PIBaseWdg*, less<long> > BWMList;
43typedef map<long, PIDrawer*, less<long> > DrwMList;
44
45class PIStdImgApp : public PIApplication {
46public:
47 PIStdImgApp(int narg=0, char* arg[]=NULL);
48 ~PIStdImgApp();
49
50 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
51 virtual void SetReady();
52 virtual void SetBusy();
53 virtual void SetBlocked();
54
55 int DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt, int oid=0);
56 int DispScDrawer(PIDrawer* scd, string const & name, string const & opt,
57 string title="", int oid=0);
58 int Disp3DDrawer(PIDrawer3D* scd, string const & name, string const & opt,
59 string title="", int oid=0);
60
61 // Fonction d'ajout de texte (provisoire - Aout 99)
62 void AddText(string const & txt, double xp, double yp, string const& opt);
63 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
64 void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt);
65 void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
66 bool fgfill=false);
67 void AddCircle(double xc, double yc, double r, string const& opt,
68 bool fgfill=false);
69
70 // Fonction Ajout de titre de trace
71 void SetTitle(string const & titleup, string const & titledown, string const& opt);
72 // Fonction d'Ajout label d'axe X,Y
73 void SetAxeLabels(string const & xLabel, string const & yLabel, string const& opt);
74
75 // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
76 PIDrawer* CurrentElDrawer();
77
78 void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
79 void CreateStackWin(int sx=0, int sy = 0);
80 PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
81 void SetZone(int nzx=1, int nzy=1);
82 void StackWinNext();
83
84 void DeleteWindow(PIWindow* w);
85 void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
86 void DelWRsId(int k);
87 bool CheckWRsId(int k);
88 void CloseAllWindows();
89
90 inline NamedObjMgr* ObjMgr() { return mObjMgr; }
91 inline PIACmd* CmdInterpreter() { return mCmd; }
92
93 PIWindow* CurrentWindow() { return (mCurWin); };
94 PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
95
96 inline PIPixmap* ZoomW() { return zoom; }
97 inline PIPixmap* GloVW() { return gimv; }
98 inline PICMapView* CMapVW() { return cmapv; }
99 inline PIConsole* GetConsole() { return mCons; }
100
101 inline PIMenu* SpecialMenu() { return m[5]; }
102 inline PIMenu* ModulesMenu() { return m[6]; }
103
104 inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
105 inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
106
107// Gestion (show/hide) de la fenetre Stat/ZoomWindow
108 void StatZoomWindowSetVisible(bool fg=true);
109
110// Update de l'info de la fenetre stats/ressources
111 void UpdateStatResourceInfo();
112
113// Redirection ou Non de StdOut/StdErr
114 void RedirectStdOutErr(bool fg = true);
115 inline bool HasRedirectedStdOutErr() { return(redirecout); }
116// Gestion des signaux
117 void CatchSignals(bool fgfpe=true, bool fgsegv=true);
118
119 void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
120 inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
121 void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; }
122 // void SaveGraphicAtt();
123 // void RestoreGraphicAtt();
124 void SetDefaultGraphicAttributes(string const & opt);
125 void SetDefaultAxesAttributes(string const & opt);
126 DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
127
128// Gestion fichiers PS
129 int num_eps;
130 PSFile *mpsfile;
131 string name_ps;
132
133// Gestion OUT-PPF
134 POutPersist* mPpfout;
135 string name_outppf;
136
137private:
138 void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
139 void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
140 void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
141 void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
142 void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
143 void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
144
145
146
147 NamedObjMgr* mObjMgr;
148 PIACmd* mCmd;
149
150 PIMenu* m[7];
151 PIMenu* mc;
152
153 PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ...
154 PIPixmap* zoom;
155 PIPixmap* gimv;
156 PICMapView* cmapv;
157 // Pour afficher des stats
158 PILabel* lab_mem;
159 PIThermometer* therm_mem;
160 PILabel* lab_cpu;
161 PIThermometer* therm_cpu;
162
163 PIFileChooser * pfc_fits; // Pour les fichiers FITS
164 PIFileChooser * pfc_ppf; // Pour les PPF
165 PIFileChooser * pfc_ps; // Pour les PostScript
166
167 PIContainer* consolecont; // Container pour la PIConsole
168 PIConsole* mCons;
169 bool redirecout; // true if stdout/err redirected to mCons;
170
171 WindMList mWList;
172 BWMList mBWList;
173 DrwMList mDrwList;
174
175 int mWId,mDId,mBWId;
176
177 PIBaseWdg* mCurWdg;
178 PIBaseWdg* mLastWdg;
179 PIWindow* mCurWin;
180 PIZoneWindow* mGrW;
181 PIStackWindow* mStW;
182 int mGrIdx;
183 int mStIdx;
184
185 ObjMgrWind* mObjmgrw;
186 PPInMgrWind* mPpinmgrw;
187
188 // Attributs graphiques, etc ...
189 double mIXmin, mIXmax, mIYmin, mIYmax;
190 bool mAddTitle;
191 unsigned int mAxesFlags;
192
193 vector<string> mDefaultAtt;
194 vector<string> mAxesAtt;
195
196 // Controles et gestion divers
197 PIMessage mFCMsg; // Message for processing FileOpen
198 int mFgScSz; // Flag ScreenSize
199 bool mFgCWImg; // true -> Current Widget is PIImage
200
201 // Pour comptabiliser l'utilisation des ressources
202 ResourceUsage resusg;
203 PIPeriodic* resupd_periodic;
204};
205
206#endif
Note: See TracBrowser for help on using the repository browser.