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

Last change on this file since 2489 was 2486, checked in by ansari, 22 years ago

Debut d'implementation piapp multi-thread - (avec des pb lors de l'execution de demo.pic) Reza 26 Dec 2003

  • Property svn:executable set to *
File size: 7.8 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 "zthread.h"
37#include "resusage.h"
38
39
40enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset};
41
42typedef map<long, PIWindow*, less<long> > WindMList;
43typedef map<long, PIBaseWdg*, less<long> > BWMList;
44typedef map<long, PIDrawer*, less<long> > DrwMList;
45
46class PIStdImgApp : public PIApplication {
47public:
48 PIStdImgApp(int narg=0, char* arg[]=NULL);
49 ~PIStdImgApp();
50
51 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
52 virtual void SetReady();
53 virtual void SetBusy();
54 virtual void SetBlocked();
55
56 // <ZThread> Multithread execution
57 // On redefinit la methode Run pour gestion multithread
58 virtual void Run();
59 inline ZMutex & getMutex() { return thr_glsyn; }
60
61 // Methodes d'Affichage generique
62 int DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt, int oid=0);
63 int DispScDrawer(PIDrawer* scd, string const & name, string const & opt,
64 string title="", int oid=0);
65 int Disp3DDrawer(PIDrawer3D* scd, string const & name, string const & opt,
66 string title="", int oid=0);
67
68 // Specification (de l'exterieur) de commande a executer
69 inline void SubmitCommand(string const& cmd)
70 { exc_command = cmd; fg_exc_cmd = true; }
71 // Execution de commande soumis de l'exterieur
72 int ExecuteExtCommand();
73
74 // Fonction d'ajout de texte (provisoire - Aout 99)
75 void AddText(string const & txt, double xp, double yp, string const& opt, bool fgcn=false);
76 void AddCompText(string const & txt, string const & txtup, string const & txtdn,
77 double xp, double yp, string const& opt,
78 string const& optss, bool fgcn=false);
79 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
80 void AddLine(double xp1, double yp1, double xp2, double yp2,
81 string const& opt, bool fgarrow=false, bool fgcn=false);
82 void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
83 bool fgfill=false, bool fgcn=false);
84 void AddCircle(double xc, double yc, double r, string const& opt,
85 bool fgfill=false, bool fgcn=false);
86 void AddArc(double xc, double yc, double r, double a, double da,
87 string const& opt, bool fgfill=false, bool fgcn=false);
88 void AddArc(double x1, double y1, double x2, double y2,
89 double x3, double y3, string const& opt, bool fgfill=false, bool fgcn=false);
90 void AddPoly(vector<double>& x, vector<double>& y,
91 string const& opt, bool fgfill=false, bool fgcn=false);
92
93 // Fonction Ajout de titre de trace
94 void SetTitle(string const & titleup, string const & titledown, string const& opt);
95 // Fonction d'Ajout label d'axe X,Y
96 void SetAxeLabels(string const & xLabel, string const & yLabel, string const& opt);
97
98 // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
99 PIDrawer* CurrentElDrawer();
100
101 void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
102 void CreateStackWin(int sx=0, int sy = 0);
103 PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
104 void SetZone(int nzx=1, int nzy=1);
105 void StackWinNext();
106
107 void DeleteWindow(PIWindow* w);
108 void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
109 void DelWRsId(int k);
110 bool CheckWRsId(int k);
111 void CloseAllWindows();
112
113 inline NamedObjMgr* ObjMgr() { return mObjMgr; }
114 inline PIACmd* CmdInterpreter() { return mCmd; }
115
116 PIWindow* CurrentWindow() { return (mCurWin); };
117 PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
118
119 inline PIPixmap* ZoomW() { return zoom; }
120 inline PIPixmap* GloVW() { return gimv; }
121 inline PICMapView* CMapVW() { return cmapv; }
122 inline PIConsole* GetConsole() { return mCons; }
123
124 inline PIMenu* SpecialMenu() { return m[5]; }
125 inline PIMenu* ModulesMenu() { return m[6]; }
126
127 inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
128 inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
129
130// Gestion (show/hide) de la fenetre Stat/ZoomWindow
131 void StatZoomWindowSetVisible(bool fg=true);
132
133// Update de l'info de la fenetre stats/ressources
134 void UpdateStatResourceInfo();
135
136// Redirection ou Non de StdOut/StdErr
137 void RedirectStdOutErr(bool fg = true);
138 inline bool HasRedirectedStdOutErr() { return(redirecout); }
139// Gestion des signaux
140 void CatchSignals(bool fgfpe=true, bool fgsegv=true);
141
142 void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
143 inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
144 void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; }
145 // void SaveGraphicAtt();
146 // void RestoreGraphicAtt();
147 void SetDefaultGraphicAttributes(string const & opt);
148 void SetDefaultAxesAttributes(string const & opt);
149 DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
150
151// Gestion fichiers PS
152 int num_eps;
153 PSFile *mpsfile;
154 string name_ps;
155
156// Gestion OUT-PPF
157 POutPersist* mPpfout;
158 string name_outppf;
159
160private:
161 void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
162 void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
163 void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
164 void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
165 void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
166 void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
167
168
169
170 NamedObjMgr* mObjMgr;
171 PIACmd* mCmd;
172
173 PIMenu* m[7];
174 PIMenu* mc;
175
176 PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ...
177 PIPixmap* zoom;
178 PIPixmap* gimv;
179 PICMapView* cmapv;
180 // Pour afficher des stats et etat thread command
181 PILabel* lab_mem;
182 PIThermometer* therm_mem;
183 PILabel* lab_cpu;
184 PIThermometer* therm_cpu;
185 PILabel* lab_thrcmd;
186
187 PIFileChooser * pfc_fits; // Pour les fichiers FITS
188 PIFileChooser * pfc_ppf; // Pour les PPF
189 PIFileChooser * pfc_ascii; // Pour les fichiers ASCII
190 PIFileChooser * pfc_ps; // Pour les PostScript
191
192 PIContainer* consolecont; // Container pour la PIConsole
193 PIConsole* mCons;
194 bool redirecout; // true if stdout/err redirected to mCons;
195
196 WindMList mWList;
197 BWMList mBWList;
198 DrwMList mDrwList;
199
200 int mWId,mDId,mBWId;
201
202 PIBaseWdg* mCurWdg;
203 PIBaseWdg* mLastWdg;
204 PIWindow* mCurWin;
205 PIZoneWindow* mGrW;
206 PIStackWindow* mStW;
207 int mGrIdx;
208 int mStIdx;
209
210 ObjMgrWind* mObjmgrw;
211 PPInMgrWind* mPpinmgrw;
212
213 // Attributs graphiques, etc ...
214 double mIXmin, mIXmax, mIYmin, mIYmax;
215 bool mAddTitle;
216 unsigned int mAxesFlags;
217
218 vector<string> mDefaultAtt;
219 vector<string> mAxesAtt;
220
221 // Controles et gestion divers
222 PIMessage mFCMsg; // Message for processing FileOpen
223 int mFgScSz; // Flag ScreenSize
224 bool mFgCWImg; // true -> Current Widget is PIImage
225
226 // Pour comptabiliser l'utilisation des ressources
227 ResourceUsage resusg;
228 PIPeriodic* resupd_periodic;
229
230 // Commande specifie de l'exterieur a executer
231 // Pris en charge par resupd_periodic
232 string exc_command;
233 bool fg_exc_cmd;
234 // Attributs pour controle de thread
235 ZMutex thr_glsyn;
236};
237
238#endif
Note: See TracBrowser for help on using the repository browser.