]>
Commit | Line | Data |
---|---|---|
a8b53f69 | 1 | // $Header$ |
2 | ||
5a5a1232 | 3 | #ifndef REVE_QuadSet_H |
4 | #define REVE_QuadSet_H | |
5 | ||
6 | #include <Gtypes.h> | |
7 | #include <TNamed.h> | |
8 | #include <TAtt3D.h> | |
9 | #include <TAttBBox.h> | |
10 | ||
3aa97c5d | 11 | #include <Reve/Reve.h> |
8be1b0cc | 12 | #include <Reve/RenderElement.h> |
13 | #include <Reve/FrameBox.h> | |
14 | #include <Reve/RGBAPalette.h> | |
15 | #include <Reve/Plex.h> | |
16 | #include <Reve/ZTrans.h> | |
3aa97c5d | 17 | |
5a5a1232 | 18 | #include <vector> |
19 | ||
20 | class TRandom; | |
21 | ||
22 | namespace Reve { | |
23 | ||
24 | struct Quad | |
25 | { | |
26 | Float_t vertices[12]; | |
27 | Int_t color; | |
28 | ||
29 | void ColorFromIdx(Color_t ci); | |
30 | ||
265ecb21 | 31 | Quad(Color_t col = 1) : color(0) |
5a5a1232 | 32 | { ColorFromIdx(col); } |
33 | ||
265ecb21 | 34 | Quad(Color_t col, Float_t* p) : color(0) |
5a5a1232 | 35 | { ColorFromIdx(col); memcpy(vertices, p, 12*sizeof(Float_t)); } |
36 | ||
37 | Quad(TRandom& rnd, Float_t origin, Float_t size); | |
38 | ||
265ecb21 | 39 | Quad(const Quad& org) : color(0) { memcpy(this, &org, sizeof(Quad)); } |
5a5a1232 | 40 | |
a8b53f69 | 41 | virtual ~Quad() {} |
42 | ||
5a5a1232 | 43 | ClassDef(Quad, 1); |
44 | }; | |
45 | ||
3aa97c5d | 46 | class OldQuadSet : public TNamed, public TAtt3D, public TAttBBox |
5a5a1232 | 47 | { |
3aa97c5d | 48 | friend class OldQuadSetGL; |
5a5a1232 | 49 | |
5a5a1232 | 50 | protected: |
51 | std::vector<Quad> fQuads; | |
52 | Double_t fMatrix[16]; | |
53 | Bool_t fTrans; | |
54 | ||
55 | public: | |
3aa97c5d | 56 | OldQuadSet(const Text_t* n="QuadSet", const Text_t* t=""); |
57 | virtual ~OldQuadSet() {} | |
5a5a1232 | 58 | |
59 | Bool_t GetTrans() const { return fTrans; } | |
60 | void SetTrans(Bool_t t) { fTrans = t; } | |
61 | ||
3aa97c5d | 62 | std::vector<Reve::Quad>& Quads() { return fQuads; } |
63 | ||
64 | void Test(Int_t nquads); | |
65 | ||
66 | virtual void ComputeBBox(); | |
67 | ||
68 | virtual void Paint(Option_t* option = ""); | |
69 | ||
70 | ClassDef(OldQuadSet, 1); | |
71 | }; | |
72 | ||
73 | /**************************************************************************/ | |
74 | // To become new implementation of QuadSet ... not finished yet. | |
75 | /**************************************************************************/ | |
76 | ||
77 | class QuadSet : public RenderElement, | |
78 | public TNamed, | |
79 | public TAtt3D, | |
80 | public TAttBBox | |
81 | { | |
82 | friend class QuadSetGL; | |
83 | ||
3c67f72c | 84 | QuadSet(const QuadSet&); // Not implemented |
85 | QuadSet& operator=(const QuadSet&); // Not implemented | |
86 | ||
3aa97c5d | 87 | public: |
88 | enum QuadType_e | |
8be1b0cc | 89 | { |
90 | QT_Undef, | |
91 | QT_FreeQuad, | |
92 | QT_AxisAligned, | |
93 | QT_AxisAlignedFixedDim, | |
94 | QT_AxisAlignedFixedZ, | |
95 | QT_AxisAlignedFixedY, | |
96 | QT_AxisAlignedFixedDimZ, | |
97 | QT_AxisAlignedFixedDimY, | |
98 | // line modes (needed for uniform handling of silicon-strip digits) | |
99 | QT_LineFixedZ, | |
100 | QT_LineFixedY | |
101 | }; | |
102 | ||
103 | enum RenderMode_e { RM_AsIs, RM_Line, RM_Fill }; | |
3aa97c5d | 104 | |
105 | protected: | |
8be1b0cc | 106 | struct QuadBase |
107 | { | |
108 | Int_t fValue; | |
109 | // Here could have additional integer (like time, second threshold). | |
110 | ||
111 | QuadBase(Int_t v=0) : fValue(v) {} | |
3aa97c5d | 112 | }; |
113 | ||
8be1b0cc | 114 | struct FreeQuad : public QuadBase |
115 | { | |
3aa97c5d | 116 | Float_t fVertices[12]; |
117 | }; | |
118 | ||
8be1b0cc | 119 | struct AAFixDimZQuad : public QuadBase |
120 | { | |
3aa97c5d | 121 | Float_t fX, fY; |
122 | }; | |
123 | ||
8be1b0cc | 124 | struct AAFixDimQuad : public AAFixDimZQuad |
125 | { | |
3aa97c5d | 126 | Float_t fZ; |
127 | }; | |
128 | ||
8be1b0cc | 129 | struct AAFixZQuad : public AAFixDimZQuad |
130 | { | |
3aa97c5d | 131 | Float_t fW, fH; |
132 | }; | |
133 | ||
8be1b0cc | 134 | struct AAQuad : public AAFixDimQuad |
135 | { | |
3aa97c5d | 136 | Float_t fW, fH; |
137 | }; | |
138 | ||
8be1b0cc | 139 | struct LineFixedZ : public AAFixDimZQuad |
140 | { | |
141 | Float_t fDx, fDy; | |
142 | }; | |
143 | ||
3aa97c5d | 144 | protected: |
145 | QuadType_e fQuadType; | |
8be1b0cc | 146 | Bool_t fValueIsColor; |
147 | Int_t fDefaultValue; | |
148 | VoidCPlex fPlex; | |
149 | QuadBase* fLastQuad; //! | |
3aa97c5d | 150 | |
3aa97c5d | 151 | Float_t fDefWidth; |
152 | Float_t fDefHeight; | |
8be1b0cc | 153 | Float_t fDefCoord; |
3aa97c5d | 154 | |
8be1b0cc | 155 | FrameBox* fFrame; |
156 | RGBAPalette* fPalette; | |
157 | RenderMode_e fRenderMode; | |
3aa97c5d | 158 | ZTrans fHMTrans; |
159 | ||
8be1b0cc | 160 | static Int_t SizeofAtom(QuadType_e qt); |
161 | QuadBase* NewQuad(); | |
162 | ||
3aa97c5d | 163 | public: |
164 | QuadSet(const Text_t* n="QuadSet", const Text_t* t=""); | |
8be1b0cc | 165 | QuadSet(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize, |
166 | const Text_t* n="QuadSet", const Text_t* t=""); | |
167 | virtual ~QuadSet(); | |
168 | ||
169 | virtual Bool_t CanEditMainColor() { return kTRUE; } | |
170 | ||
171 | void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize); | |
172 | void RefitPlex(); | |
173 | ||
174 | void ScanMinMaxValues(Int_t& min, Int_t& max); | |
175 | ||
176 | Float_t GetDefWidth() const { return fDefWidth; } | |
177 | Float_t GetDefHeight() const { return fDefHeight; } | |
178 | Float_t GetDefCoord() const { return fDefCoord; } | |
179 | ||
180 | void SetDefWidth(Float_t v) { fDefWidth = v ; } | |
181 | void SetDefHeight(Float_t v) { fDefHeight = v ; } | |
182 | void SetDefCoord(Float_t v) { fDefCoord = v ; } | |
183 | ||
184 | // -------------------------------- | |
185 | ||
186 | FrameBox* GetFrame() const { return fFrame; } | |
187 | void SetFrame(FrameBox* b); | |
188 | ||
189 | RGBAPalette* GetPalette() const { return fPalette; } | |
190 | void SetPalette(RGBAPalette* p); | |
191 | ||
192 | RenderMode_e GetRenderMode() const { return fRenderMode; } | |
193 | void SetRenderMode(RenderMode_e rm) { fRenderMode = rm; } | |
3aa97c5d | 194 | |
195 | ZTrans& RefHMTrans() { return fHMTrans; } | |
196 | void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); } | |
197 | void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); } | |
198 | ||
8be1b0cc | 199 | // -------------------------------- |
200 | ||
201 | void AddQuad(Float_t* verts); | |
202 | void AddQuad(Float_t x, Float_t y); | |
203 | void AddQuad(Float_t x, Float_t y, Float_t z); | |
204 | void AddQuad(Float_t x, Float_t y, Float_t w, Float_t h); | |
205 | void AddQuad(Float_t x, Float_t y, Float_t z, Float_t w, Float_t h); | |
206 | ||
207 | void QuadValue(Int_t value); | |
208 | void QuadColor(Color_t ci); | |
209 | void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255); | |
210 | ||
211 | // -------------------------------- | |
212 | ||
213 | // void Test(Int_t nquads); | |
5a5a1232 | 214 | |
215 | virtual void ComputeBBox(); | |
216 | ||
8be1b0cc | 217 | virtual void Paint(Option_t* option=""); |
5a5a1232 | 218 | |
219 | ClassDef(QuadSet, 1); | |
220 | }; | |
221 | ||
222 | } // namespace Reve | |
223 | ||
224 | #endif |