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

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

Suite modifs pour piapp multi-thread - introduction de lock lors de la mise a jour de la fenetre ObjMgr par NamedObjMgr - Reza 1 Jan 2004

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