| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 | // Module PIext :   PIHisto2D PIH2DWdg | 
|---|
| 3 | // Traceur Histo-2D    C. Magneville 97-98 | 
|---|
| 4 | // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef PIHISTO2D_H | 
|---|
| 7 | #define PIHISTO2D_H | 
|---|
| 8 |  | 
|---|
| 9 | #include "pisysdep.h" | 
|---|
| 10 | #include PIMENU_H | 
|---|
| 11 | #include PIMENUBAR_H | 
|---|
| 12 | #include PIOPTMENU_H | 
|---|
| 13 |  | 
|---|
| 14 | #include "histos2.h" | 
|---|
| 15 | #include "piscdrawwdg.h" | 
|---|
| 16 |  | 
|---|
| 17 | //////////////////////////////////////////////////////////////////// | 
|---|
| 18 | class PIHisto2D : public PIDrawer { | 
|---|
| 19 | public: | 
|---|
| 20 | PIHisto2D(Histo2D* histo, bool ad=false); | 
|---|
| 21 | virtual            ~PIHisto2D(); | 
|---|
| 22 | void       UseColors(bool fg=false, CMapId cmap=CMAP_GREYINV32); | 
|---|
| 23 | void       UseScale(unsigned short type=0,float logscale=10.); | 
|---|
| 24 | void       UseDisplay(unsigned short type=0, float fnpt=0.5); | 
|---|
| 25 | void       UseDyn(float hmin=1., float hmax=-1.); | 
|---|
| 26 | void       UseFrac(float frmin=0.1, float frmax=0.9); | 
|---|
| 27 | void       Print(int lp=0); | 
|---|
| 28 | virtual void       Draw(PIGraphicUC* g,double xmin,double ymin,double xmax,double ymax); | 
|---|
| 29 | virtual void       UpdateLimits(); | 
|---|
| 30 | virtual void       DrawStats(PIGraphicUC* g); | 
|---|
| 31 |  | 
|---|
| 32 | inline Histo2D*       Histogram() { return(mHisto); } | 
|---|
| 33 | inline bool           Color() { return(mFgCol); } | 
|---|
| 34 | inline CMapId         ColMap() { return(mCmap); } | 
|---|
| 35 | inline unsigned short TypScale() { return(mTypScal); } | 
|---|
| 36 | inline unsigned short TypDisplay() { return(mTypDisp); } | 
|---|
| 37 | inline float          FPoints() { return(mFPoints); } | 
|---|
| 38 | inline float          HMax() { return(mHMax);} | 
|---|
| 39 | inline float          HMin() { return(mHMin);} | 
|---|
| 40 | inline float          FMax() { return(mFracMax);} | 
|---|
| 41 | inline float          FMin() { return(mFracMin);} | 
|---|
| 42 | inline float          LogScale() { return(mLogScale);} | 
|---|
| 43 |  | 
|---|
| 44 | protected: | 
|---|
| 45 | int NPixBin(PIGraphicUC* g); | 
|---|
| 46 | char HPrint2(float f); | 
|---|
| 47 |  | 
|---|
| 48 | Histo2D* mHisto; | 
|---|
| 49 | bool mAdDO; | 
|---|
| 50 | bool mFgCol; | 
|---|
| 51 | CMapId mCmap; | 
|---|
| 52 | unsigned short mTypScal; | 
|---|
| 53 | unsigned short mTypDisp; | 
|---|
| 54 | float mFPoints; | 
|---|
| 55 | float mHMin,mHMax; | 
|---|
| 56 | float mFracMin,mFracMax; | 
|---|
| 57 | float mLogScale; | 
|---|
| 58 | }; | 
|---|
| 59 |  | 
|---|
| 60 | //////////////////////////////////////////////////////////////////// | 
|---|
| 61 | class PIH2DWdg : public PIScDrawWdg { | 
|---|
| 62 | public: | 
|---|
| 63 | PIH2DWdg(PIContainerGen *par, char *nom, int sx=300, int sy=300, | 
|---|
| 64 | int px=0, int py=0); | 
|---|
| 65 | ~PIH2DWdg(); | 
|---|
| 66 |  | 
|---|
| 67 | void               SetHisto(Histo2D* histo); | 
|---|
| 68 | void               SetPIHisto(PIHisto2D* pih2); | 
|---|
| 69 | inline PIHisto2D*  GetPIHisto() {return mPih;} | 
|---|
| 70 |  | 
|---|
| 71 | virtual string     GetClickText(double x, double y); | 
|---|
| 72 | virtual void       ActivateSpecializedControls();   // Pour activer des controles specifiques | 
|---|
| 73 | virtual void       But3Press(int x, int y); | 
|---|
| 74 |  | 
|---|
| 75 | protected: | 
|---|
| 76 | PIHisto2D*  mPih; | 
|---|
| 77 |  | 
|---|
| 78 | }; | 
|---|
| 79 |  | 
|---|
| 80 | //////////////////////////////////////////////////////////////////// | 
|---|
| 81 | class H2WinArg : public PIWindow { | 
|---|
| 82 | public : | 
|---|
| 83 | H2WinArg(PIH2DWdg *par); | 
|---|
| 84 | ~H2WinArg(); | 
|---|
| 85 | void SetPIH2DWdg(PIH2DWdg* h2wdg); | 
|---|
| 86 | void SetText(); | 
|---|
| 87 | void GetText(); | 
|---|
| 88 | virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
| 89 |  | 
|---|
| 90 | protected: | 
|---|
| 91 | PIH2DWdg  * mH2Wdg; | 
|---|
| 92 |  | 
|---|
| 93 | PIOptMenu * mOPop[3]; | 
|---|
| 94 | PIButton  * mBut[4]; | 
|---|
| 95 | PILabel   * mLab[4]; | 
|---|
| 96 | PIText    * mText[3]; | 
|---|
| 97 | PIScale   * mPScal; | 
|---|
| 98 |  | 
|---|
| 99 | bool mFgCol; | 
|---|
| 100 | CMapId mCmap; | 
|---|
| 101 | unsigned short mTypScal; | 
|---|
| 102 | unsigned short mTypDisp; | 
|---|
| 103 | float mFPoints; | 
|---|
| 104 | float mHMin,mHMax; | 
|---|
| 105 | float mFracMin,mFracMax; | 
|---|
| 106 | float mLogScale; | 
|---|
| 107 | }; | 
|---|
| 108 |  | 
|---|
| 109 | #endif | 
|---|