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

Last change on this file since 2263 was 2263, checked in by ansari, 23 years ago
  • Ajout commande de trace d'elements graphiques (addpoly addctext ...)
  • Ajout de commandes de lecture ascii matrices/vecteurs
  • Trace de vecteur vx vs vy pour tout type de vecteurs

Reza 14/11/2002

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