]>
Commit | Line | Data |
---|---|---|
dee1d5f1 | 1 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
2 | * See cxx source for full Copyright notice */ | |
3 | ||
5f91c9e8 | 4 | // $Id$ |
13985652 | 5 | // $MpId: AliMpGraphContext.h,v 1.11 2006/05/24 13:58:13 ivana Exp $ |
dee1d5f1 | 6 | |
0145e89a | 7 | /// \ingroup mpgraphics |
dee1d5f1 | 8 | /// \class AliMpGraphContext |
9 | /// \brief Class describing the correspondance between a given area | |
10 | /// in pad, and a zone of real (cm) position | |
11 | /// | |
13985652 | 12 | /// \author David GUEZ, IPN Orsay |
5f91c9e8 | 13 | |
2998a151 | 14 | #ifndef ALI_MP_GRAPH_CONTEXT_H |
15 | #define ALI_MP_GRAPH_CONTEXT_H | |
5f91c9e8 | 16 | |
2a7ea2e6 | 17 | #include <TObject.h> |
5006ec94 | 18 | |
2a7ea2e6 | 19 | #include "AliMpContainers.h" |
5006ec94 | 20 | |
2a7ea2e6 | 21 | #include <TVector2.h> |
5006ec94 | 22 | #ifdef WITH_ROOT |
23 | #include "AliMpExMap.h" | |
24 | #endif | |
25 | ||
2a7ea2e6 | 26 | #ifdef WITH_STL |
27 | #include <vector> | |
28 | #endif | |
5f91c9e8 | 29 | |
5f91c9e8 | 30 | class MPainter; |
31 | ||
2998a151 | 32 | class AliMpGraphContext : public TObject |
33 | { | |
5006ec94 | 34 | public: |
35 | #ifdef WITH_STL | |
f5671fc3 | 36 | /// GraphContextVector type |
5006ec94 | 37 | typedef std::vector<AliMpGraphContext*> GraphContextVector; |
38 | #endif | |
39 | #ifdef WITH_ROOT | |
f5671fc3 | 40 | /// GraphContextVector type |
5006ec94 | 41 | typedef TObjArray GraphContextVector; |
42 | #endif | |
43 | ||
5f91c9e8 | 44 | public: |
45 | void Push() const; | |
46 | void Pop(); | |
47 | static AliMpGraphContext *Instance(); | |
48 | ||
f5671fc3 | 49 | // |
5f91c9e8 | 50 | // set methods |
f5671fc3 | 51 | // |
52 | /// Set position of the pad area where to draw | |
5f91c9e8 | 53 | void SetPadPosition(const TVector2 &position){fPadPosition=position;} |
f5671fc3 | 54 | /// Set dimensions of the pad area where to draw |
5f91c9e8 | 55 | void SetPadDimensions(const TVector2 &dimensions){fPadDimensions=dimensions;} |
f5671fc3 | 56 | /// Set position of the real area where to draw |
5f91c9e8 | 57 | void SetRealPosition(const TVector2 &position){fRealPosition=position;} |
f5671fc3 | 58 | /// Set dimensions of the real area where to draw |
5f91c9e8 | 59 | void SetRealDimensions(const TVector2 &dimensions){fRealDimensions=dimensions;} |
f5671fc3 | 60 | /// Set color to use |
5f91c9e8 | 61 | void SetColor(Int_t color){fColor=color;} |
62 | ||
f5671fc3 | 63 | // |
5f91c9e8 | 64 | // get methods |
f5671fc3 | 65 | // |
66 | ||
67 | /// Return position of the pad area where to draw | |
5f91c9e8 | 68 | TVector2 GetPadPosition() const {return fPadPosition;} |
f5671fc3 | 69 | /// Return dimensions of the pad area where to draw |
5f91c9e8 | 70 | TVector2 GetPadDimensions() const {return fPadDimensions;} |
f5671fc3 | 71 | /// Return position of the real area where to draw |
5f91c9e8 | 72 | TVector2 GetRealPosition() const{return fRealPosition;} |
f5671fc3 | 73 | /// Return dimensions of the real area where to draw |
5f91c9e8 | 74 | TVector2 GetRealDimensions() const{return fRealDimensions;} |
f5671fc3 | 75 | /// Return color to use |
5f91c9e8 | 76 | Int_t GetColor() const {return fColor;} |
77 | ||
78 | //methods | |
79 | TVector2 RealToPad(const TVector2 &position) const; | |
80 | void RealToPad(const TVector2 &position | |
81 | ,const TVector2 &dimensions, | |
82 | TVector2 &padPosition, | |
83 | TVector2 &padDimensions) const; | |
84 | void SetPadPosForReal(const TVector2 &position,const TVector2 &dimensions); | |
85 | ||
fb1bf5c0 | 86 | protected: |
87 | AliMpGraphContext(const AliMpGraphContext& right); | |
88 | AliMpGraphContext& operator = (const AliMpGraphContext& right); | |
89 | ||
5f91c9e8 | 90 | private: |
91 | //private constructor (not instanciable from outside) | |
92 | AliMpGraphContext(); | |
93 | ||
829425a5 | 94 | ///< static data members |
95 | static AliMpGraphContext *fgInstance; ///< the global instance | |
96 | static GraphContextVector fgStack; ///< the object stack | |
f79c58a5 | 97 | #ifdef WITH_ROOT |
829425a5 | 98 | static Int_t fgStackSize; ///< the object stack size |
f79c58a5 | 99 | #endif |
5f91c9e8 | 100 | |
101 | //data members | |
829425a5 | 102 | Int_t fColor; ///< color to use |
103 | TVector2 fPadPosition; ///< Position of the pad area where to draw | |
104 | TVector2 fPadDimensions; ///< Dimensions of the pad area where to draw | |
5f91c9e8 | 105 | |
829425a5 | 106 | TVector2 fRealPosition; ///< Position of the real area to draw |
107 | TVector2 fRealDimensions; ///< Dimensions of the real area to draw | |
5f91c9e8 | 108 | |
109 | ClassDef(AliMpGraphContext,1) // Correspondance pad area/real world | |
110 | }; | |
111 | ||
2998a151 | 112 | #endif //ALI_MP_GRAPH_CONTEXT_H |
5f91c9e8 | 113 | |
114 |