12 #include <Reve/Reve.h>
13 #include <Reve/RenderElement.h>
14 #include <Reve/FrameBox.h>
15 #include <Reve/RGBAPalette.h>
16 #include <Reve/Plex.h>
17 #include <Reve/ZTrans.h>
30 void ColorFromIdx(Color_t ci);
32 Quad(Color_t col = 1) : color(0)
33 { ColorFromIdx(col); }
35 Quad(Color_t col, Float_t* p) : color(0)
36 { ColorFromIdx(col); memcpy(vertices, p, 12*sizeof(Float_t)); }
38 Quad(TRandom& rnd, Float_t origin, Float_t size);
40 Quad(const Quad& org) : color(0) { memcpy(this, &org, sizeof(Quad)); }
47 class OldQuadSet : public TNamed, public TAtt3D, public TAttBBox
49 friend class OldQuadSetGL;
52 std::vector<Quad> fQuads;
57 OldQuadSet(const Text_t* n="QuadSet", const Text_t* t="");
58 virtual ~OldQuadSet() {}
60 Bool_t GetTrans() const { return fTrans; }
61 void SetTrans(Bool_t t) { fTrans = t; }
63 std::vector<Reve::Quad>& Quads() { return fQuads; }
65 void Test(Int_t nquads);
67 virtual void ComputeBBox();
69 virtual void Paint(Option_t* option = "");
71 ClassDef(OldQuadSet, 1);
74 /**************************************************************************/
75 // To become new implementation of QuadSet ... somewhat finished.
76 /**************************************************************************/
78 class QuadSet : public RenderElement,
79 public TNamed, public TQObject,
83 friend class QuadSetEditor;
84 friend class QuadSetGL;
86 QuadSet(const QuadSet&); // Not implemented
87 QuadSet& operator=(const QuadSet&); // Not implemented
92 QT_Undef, // unknown-ignored
93 QT_FreeQuad, // arbitrary quad: specify 4*(x,y,z) quad corners
94 QT_RectangleXY, // rectangle in x-y plane: specify x, y, z, w, h
95 QT_RectangleXZ, // rectangle in x-z plane: specify x, y, z, w, h
96 QT_RectangleYZ, // rectangle in y-z plane: specify x, y, z, w, h
97 QT_RectangleXYFixedDim, // rectangle in x-y plane: specify x, y, z; w, h taken from fDefWidth/Height
98 QT_RectangleXYFixedZ, // rectangle in x-y plane: specify x, y, w, h; z taken from fDefCoord
99 QT_RectangleXZFixedY, // rectangle in x-z plane: specify x, z, w, h; y taken from fDefCoord
100 QT_RectangleYZFixedX, // rectangle in y-z plane: specify y, z, w, h; x taken from fDefWidth/Height/Coord
101 QT_RectangleXYFixedDimZ, // rectangle in x-y plane: specify x, y; w, h, z taken from fDefWidth/Height/Coord
102 QT_RectangleXZFixedDimY, // rectangle in x-z plane: specify x, z; w, h, y taken from fDefWidth/Height/Coord
103 QT_RectangleYZFixedDimX, // rectangle in y-z plane: specify y, z; w, h, x taken from fDefWidth/Height/Coord
105 // line modes (needed for uniform handling of silicon-strip digits)
106 QT_LineXYFixedZ, // line in x-y plane: specify x, y, w(dx), h(dy); z taken from fDefCoord
107 QT_LineXZFixedY, // line in x-z plane: specify x, z, w(dx), h(dz); y taken from fDefCoord
110 QT_HexagonXY, // horizontal hexagon: specify x, y, z, r
111 QT_HexagonYX, // vertical hexagon: specify x, y, z, r
114 // QT_CircleXY, // specify r, z
115 // QT_CircleXYFixedZ, // specify r
116 // QT_CircleXYFixedR, // specify z
119 enum RenderMode_e { RM_AsIs, RM_Line, RM_Fill };
127 // Here could have additional integer (like time, second threshold).
129 QuadBase(Int_t v=0) : fValue(v), fId() {}
132 struct QFreeQuad : public QuadBase { Float_t fVertices[12]; };
134 struct QOrigin : public QuadBase { Float_t fA, fB; };
136 struct QRectFixDimC : public QOrigin { };
138 struct QRectFixDim : public QRectFixDimC { Float_t fC; };
140 struct QRectFixC : public QRectFixDimC { Float_t fW, fH; };
142 struct QRect : public QRectFixDim { Float_t fW, fH; };
144 struct QLineFixC : public QOrigin { Float_t fDx, fDy; };
146 struct QHex : public QOrigin { Float_t fC, fR; };
149 QuadType_e fQuadType;
151 Bool_t fValueIsColor;
152 Bool_t fOwnIds; //Flag specifying if id-objects are owned by the QuadSet
154 QuadBase* fLastQuad; //!
156 Float_t fDefWidth; // Breadth assigned to first coordinate (A)
157 Float_t fDefHeight; // Breadth assigned to second coordinate (B)
158 Float_t fDefCoord; // Default value for third coordinate (C)
161 RGBAPalette* fPalette;
162 RenderMode_e fRenderMode;
163 Bool_t fDisableLigting;
165 Bool_t fHistoButtons;
168 static Int_t SizeofAtom(QuadType_e qt);
174 QuadSet(const Text_t* n="QuadSet", const Text_t* t="");
175 QuadSet(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize,
176 const Text_t* n="QuadSet", const Text_t* t="");
179 virtual Bool_t CanEditMainColor() { return kTRUE; }
180 virtual void SetMainColor(Color_t color);
182 void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
185 void ScanMinMaxValues(Int_t& min, Int_t& max);
187 Float_t GetDefWidth() const { return fDefWidth; }
188 Float_t GetDefHeight() const { return fDefHeight; }
189 Float_t GetDefCoord() const { return fDefCoord; }
191 void SetDefWidth(Float_t v) { fDefWidth = v ; }
192 void SetDefHeight(Float_t v) { fDefHeight = v ; }
193 void SetDefCoord(Float_t v) { fDefCoord = v ; }
195 // --------------------------------
197 FrameBox* GetFrame() const { return fFrame; }
198 void SetFrame(FrameBox* b);
200 Bool_t GetValueIsColor() const { return fValueIsColor; }
202 RGBAPalette* GetPalette() const { return fPalette; }
203 void SetPalette(RGBAPalette* p);
204 RGBAPalette* AssertPalette();
206 RenderMode_e GetRenderMode() const { return fRenderMode; }
207 void SetRenderMode(RenderMode_e rm) { fRenderMode = rm; }
209 Bool_t GetEmitSignals() const { return fEmitSignals; }
210 void SetEmitSignals(Bool_t f) { fEmitSignals = f; }
212 Bool_t GetHistoButtons() const { return fHistoButtons; }
213 void SetHistoButtons(Bool_t f) { fHistoButtons = f; }
215 ZTrans& RefHMTrans() { return fHMTrans; }
216 void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); }
217 void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); }
219 // --------------------------------
221 void AddQuad(Float_t* verts);
223 void AddQuad(Float_t a, Float_t b);
224 void AddQuad(Float_t a, Float_t b, Float_t c);
225 void AddQuad(Float_t a, Float_t b, Float_t w, Float_t h);
226 void AddQuad(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h);
228 void AddLine(Float_t a, Float_t b, Float_t w, Float_t h);
230 void AddHexagon(Float_t a, Float_t b, Float_t z, Float_t r);
232 void QuadValue(Int_t value);
233 void QuadColor(Color_t ci);
234 void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
236 void QuadId(TObject* id);
237 Bool_t GetOwnIds() const { return fOwnIds; }
238 void SetOwnIds(Bool_t o) { fOwnIds = o; }
240 QuadBase* GetQuad(Int_t n) { return (QuadBase*) fPlex.Atom(n); }
241 TObject* GetId(Int_t n) { return GetQuad(n)->fId.GetObject(); }
243 virtual void QuadSelected(Int_t idx);
245 virtual void CtrlClicked(QuadSet* qs, Int_t idx); // *SIGNAL*
247 // --------------------------------
249 // void Test(Int_t nquads);
251 virtual void ComputeBBox();
253 virtual void Paint(Option_t* option="");
255 VoidCPlex* GetPlex() { return &fPlex; }
257 ClassDef(QuadSet, 1);