Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveQuadSet.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveQuadSet
13 #define ROOT_TEveQuadSet
14 
15 #include "TEveDigitSet.h"
16 
17 class TRandom;
18 
19 class TEveQuadSet : public TEveDigitSet
20 {
21  friend class TEveQuadSetGL;
22 
23  TEveQuadSet(const TEveQuadSet&); // Not implemented
24  TEveQuadSet& operator=(const TEveQuadSet&); // Not implemented
25 
26 public:
27  enum EQuadType_e {
28  kQT_Undef, // unknown-ignored
29  kQT_FreeQuad, // arbitrary quad: specify 4*(x,y,z) quad corners
30  kQT_RectangleXY, // rectangle in x-y plane: specify x, y, z, w, h
31  kQT_RectangleXZ, // rectangle in x-z plane: specify x, y, z, w, h
32  kQT_RectangleYZ, // rectangle in y-z plane: specify x, y, z, w, h
33  kQT_RectangleXYFixedDim, // rectangle in x-y plane: specify x, y, z; w, h taken from fDefWidth/Height
34  kQT_RectangleXYFixedZ, // rectangle in x-y plane: specify x, y, w, h; z taken from fDefCoord
35  kQT_RectangleXZFixedY, // rectangle in x-z plane: specify x, z, w, h; y taken from fDefCoord
36  kQT_RectangleYZFixedX, // rectangle in y-z plane: specify y, z, w, h; x taken from fDefWidth/Height/Coord
37  kQT_RectangleXYFixedDimZ, // rectangle in x-y plane: specify x, y; w, h, z taken from fDefWidth/Height/Coord
38  kQT_RectangleXZFixedDimY, // rectangle in x-z plane: specify x, z; w, h, y taken from fDefWidth/Height/Coord
39  kQT_RectangleYZFixedDimX, // rectangle in y-z plane: specify y, z; w, h, x taken from fDefWidth/Height/Coord
40  kQT_Rectangle_End,
41  // line modes (needed for uniform handling of silicon-strip digits)
42  kQT_LineXYFixedZ, // line in x-y plane: specify x, y, w(dx), h(dy); z taken from fDefCoord
43  kQT_LineXZFixedY, // line in x-z plane: specify x, z, w(dx), h(dz); y taken from fDefCoord
44  kQT_Line_End,
45  // hexagon modes
46  kQT_HexagonXY, // horizontal hexagon: specify x, y, z, r
47  kQT_HexagonYX, // vertical hexagon: specify x, y, z, r
48  kQT_Hexagon_End
49  // circle modes:
50  // QT_CircleXY, // specify r, z
51  // QT_CircleXYFixedZ, // specify r
52  // QT_CircleXYFixedR, // specify z
53  };
54 
55  struct QFreeQuad_t : public DigitBase_t { Float_t fVertices[12]; };
56 
57  struct QOrigin_t : public DigitBase_t { Float_t fA, fB; };
58 
59  struct QRectFixDimC_t : public QOrigin_t {};
60 
61  struct QRectFixDim_t : public QRectFixDimC_t { Float_t fC; };
62 
63  struct QRectFixC_t : public QRectFixDimC_t { Float_t fW, fH; };
64 
65  struct QRect_t : public QRectFixDim_t { Float_t fW, fH; };
66 
67  struct QLineFixC_t : public QOrigin_t { Float_t fDx, fDy; };
68 
69  struct QHex_t : public QOrigin_t { Float_t fC, fR; };
70 
71 protected:
72  EQuadType_e fQuadType;
73 
74  Float_t fDefWidth; // Breadth assigned to first coordinate (A)
75  Float_t fDefHeight; // Breadth assigned to second coordinate (B)
76  Float_t fDefCoord; // Default value for third coordinate (C)
77 
78  static Int_t SizeofAtom(EQuadType_e qt);
79 
80 public:
81  TEveQuadSet(const char* n="TEveQuadSet", const char* t="");
82  TEveQuadSet(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize,
83  const char* n="TEveQuadSet", const char* t="");
84  virtual ~TEveQuadSet() {}
85 
86  void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
87 
88  Float_t GetDefWidth() const { return fDefWidth; }
89  Float_t GetDefHeight() const { return fDefHeight; }
90  Float_t GetDefCoord() const { return fDefCoord; }
91 
92  void SetDefWidth(Float_t v) { fDefWidth = v; }
93  void SetDefHeight(Float_t v) { fDefHeight = v; }
94  void SetDefCoord(Float_t v) { fDefCoord = v; }
95 
96  // --------------------------------
97 
98  void AddQuad(Float_t* verts);
99 
100  void AddQuad(Float_t a, Float_t b);
101  void AddQuad(Float_t a, Float_t b, Float_t c);
102  void AddQuad(Float_t a, Float_t b, Float_t w, Float_t h);
103  void AddQuad(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h);
104 
105  void AddLine(Float_t a, Float_t b, Float_t w, Float_t h);
106 
107  void AddHexagon(Float_t a, Float_t b, Float_t z, Float_t r);
108 
109  // Wrappers to make transition to TEveDigitSet as base easier
110  void QuadValue(Int_t value) { DigitValue(value); }
111  void QuadColor(Color_t ci) { DigitColor(ci); }
112  void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255) { DigitColor(r, g, b, a); }
113  void QuadId(TObject* id) { DigitId(id); }
114 
115  // --------------------------------
116 
117  // void Test(Int_t nquads);
118 
119  virtual void ComputeBBox();
120 
121  // virtual void Paint(Option_t* option="");
122 
123  ClassDef(TEveQuadSet, 0); // Collection of 2D primitives (rectangles, hexagons, or lines); each primitive can be assigned a signal value and a TRef.
124 };
125 
126 #endif