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

Last change on this file since 1837 was 1642, checked in by ansari, 24 years ago

1/ Definition d'attributs graphiques texte pour les nouvelles couleurs violettes
2/ Ajout commandes addline addrect addfrect addfcircle ....

Reza 16/8/2001

  • Property svn:executable set to *
File size: 6.9 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 "picons.h"
24
25#include "piimage.h"
26#include "pi3ddrw.h"
27#include "nobjmgr.h"
28#include "piacmd.h"
29#include "pisiadw.h"
30#include "pistzwin.h"
31
32
33enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3, Disp_Inset=4};
34
35typedef map<long, PIWindow*, less<long> > WindMList;
36typedef map<long, PIBaseWdg*, less<long> > BWMList;
37typedef map<long, PIDrawer*, less<long> > DrwMList;
38
39class PIStdImgApp : public PIApplication {
40public:
41 PIStdImgApp(int narg=0, char* arg[]=NULL);
42 ~PIStdImgApp();
43
44 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
45 virtual void SetReady();
46 virtual void SetBusy();
47 virtual void SetBlocked();
48
49 int DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid=0);
50 int DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", int oid=0);
51 int Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0);
52
53 // Fonction d'ajout de texte (provisoire - Aout 99)
54 void AddText(string const & txt, double xp, double yp);
55 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
56 void AddLine(double xp1, double yp1, double xp2, double yp2);
57 void AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill=false);
58 void AddCircle(double xc, double yc, double r, bool fgfill=false);
59
60 // Fonction Ajout de titre de trace
61 void SetTitle(string const & titleup, string const & titledown);
62
63 // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
64 PIElDrawer* CurrentElDrawer();
65
66 void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
67 void CreateStackWin(int sx=0, int sy = 0);
68 PIWindow * GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
69 void SetZone(int nzx=1, int nzy=1);
70 void StackWinNext();
71
72 void DeleteWindow(PIWindow* w);
73 void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
74 void DelWRsId(int k);
75 bool CheckWRsId(int k);
76 void CloseAllWindows();
77
78 inline NamedObjMgr* ObjMgr() { return mObjMgr; }
79 inline PIACmd* CmdInterpreter() { return mCmd; }
80
81 PIWindow* CurrentWindow() { return (mCurWin); };
82 PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
83
84 inline PIPixmap* ZoomW() { return zoom; }
85 inline PIPixmap* GloVW() { return gimv; }
86 inline PICMapView* CMapVW() { return cmapv; }
87 inline PIConsole* GetConsole() { return mCons; }
88
89 inline PIMenu* SpecialMenu() { return m[5]; }
90 inline PIMenu* ModulesMenu() { return m[6]; }
91
92 inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
93 inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
94
95// Redirection ou Non de StdOut/StdErr
96 void RedirectStdOutErr(bool fg = true);
97 inline bool HasRedirectedStdOutErr() { return(redirecout); }
98// Gestion des signaux
99 void CatchSignals(bool fgfpe=true, bool fgsegv=true);
100
101// Gestion d attributs graphiques courants
102 void SetColAtt(PIColors fg=PI_NotDefColor,
103 PIColors bg=PI_NotDefColor);
104 void SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
105 void SetFontName(PIFontName fn=PI_DefaultFont);
106 void SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
107 PIFontAtt fat=PI_NotDefFontAtt);
108 void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
109 inline void SetColMapId(CMapId cid=CMAP_OTHER) { mCmapid = cid; }
110 inline void SetReverseColMapFlag(bool fg=false) { mRevCmap = fg; }
111 void SetZoomAtt(int zoom=0);
112 void SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels);
113 void SetXYLimits(double xmin=-1., double xmax=1., double ymin=-1., double ymax=1.);
114 void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
115 void SetImageCenterPosition(int x=-1, int y=-1);
116 inline void UseXYLimits(bool fg=false) { mFXYlim=fg; }
117 inline void UseImageCenter(bool fg=false) { mFImgCenter=fg; }
118 inline void SetXLogScale(bool logx=false) { maXlog = logx; }
119 inline void SetYLogScale(bool logy=false) { maYlog = logy; }
120 inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
121
122// Pour sauvegarder-restauration de l'etat des attributs graphiques
123 void SaveGraphicAtt();
124 void RestoreGraphicAtt();
125
126// Gestion fichiers PS
127 int num_eps;
128 PSFile *mpsfile;
129 string name_ps;
130
131// Gestion OUT-PPF
132 POutPersist* mPpfout;
133 string name_outppf;
134
135private:
136 void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
137 void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
138 void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
139 void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
140 void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
141 void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
142
143
144 NamedObjMgr* mObjMgr;
145 PIACmd* mCmd;
146
147 PIMenu* m[7];
148 PIMenu* mc;
149
150 PIPixmap* zoom;
151 PIPixmap* gimv;
152 PICMapView* cmapv;
153
154 PIFileChooser * pfc_fits; // Pour les fichiers FITS
155 PIFileChooser * pfc_ppf; // Pour les PPF
156 PIFileChooser * pfc_ps; // Pour les PostScript
157
158 PIConsole* mCons;
159 bool redirecout; // true if stdout/err redirected to mCons;
160
161 WindMList mWList;
162 BWMList mBWList;
163 DrwMList mDrwList;
164
165 int mWId,mDId,mBWId;
166
167 PIBaseWdg* mCurWdg;
168 PIBaseWdg* mLastWdg;
169 PIWindow* mCurWin;
170 PIZoneWindow* mGrW;
171 PIStackWindow* mStW;
172 int mGrIdx;
173 int mStIdx;
174
175 ObjMgrWind* mObjmgrw;
176 PPInMgrWind* mPpinmgrw;
177
178// Gestion d attributs graphiques courants, etat sauvegarde
179 PIColors mFCol, mBCol, mSFCol, mSBCol;
180 PILineAtt mLAtt, mSLAtt;
181 PIFontName mFName, mSFName;
182 PIFontSize mFSz, mSFSz;
183 PIFontAtt mFAtt, mSFAtt;
184 int mMSz, mSMSz;
185 PIMarker mMrk,mSMrk;
186 CMapId mCmapid, mSCmapid;
187 bool mRevCmap, mSRevCmap;
188 int mZoom, mSZoom;
189 unsigned int mAxesFlags, mSAxesFlags;
190 double mXmin, mXmax, mYmin, mYmax;
191 double mSXmin, mSXmax, mSYmin, mSYmax;
192 double mIXmin, mIXmax, mIYmin, mIYmax;
193 double mSIXmin, mSIXmax, mSIYmin, mSIYmax;
194 int mXImgCenter, mYImgCenter;
195 int mSXImgCenter, mSYImgCenter;
196 bool mFXYlim, mSFXYlim;
197 bool mFImgCenter, mSFImgCenter;
198 bool maXlog, mSaXlog;
199 bool maYlog, mSaYlog;
200 bool mAddTitle, mSAddTitle;
201
202 PIMessage mFCMsg; // Message for processing FileOpen
203 int mFgScSz; // Dlag ScreenSize
204 bool mFgCWImg; // true -> Current Widget is PIImage
205};
206
207#endif
Note: See TracBrowser for help on using the repository browser.