ROOT logo
// @(#)root/eve:$Id: TEveQuadSet.h 33864 2010-06-14 09:47:19Z matevz $
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveQuadSet
#define ROOT_TEveQuadSet

#include "TEveDigitSet.h"

class TRandom;

class TEveQuadSet : public TEveDigitSet
{
   friend class TEveQuadSetGL;

   TEveQuadSet(const TEveQuadSet&);            // Not implemented
   TEveQuadSet& operator=(const TEveQuadSet&); // Not implemented

public:
   enum EQuadType_e
      {
         kQT_Undef,                // unknown-ignored
         kQT_FreeQuad,             // arbitrary quad: specify 4*(x,y,z) quad corners
         kQT_RectangleXY,          // rectangle in x-y plane: specify x, y, z, w, h
         kQT_RectangleXZ,          // rectangle in x-z plane: specify x, y, z, w, h
         kQT_RectangleYZ,          // rectangle in y-z plane: specify x, y, z, w, h
         kQT_RectangleXYFixedDim,  // rectangle in x-y plane: specify x, y, z; w, h taken from fDefWidth/Height
         kQT_RectangleXYFixedZ,    // rectangle in x-y plane: specify x, y, w, h; z taken from fDefCoord
         kQT_RectangleXZFixedY,    // rectangle in x-z plane: specify x, z, w, h; y taken from fDefCoord
         kQT_RectangleYZFixedX,    // rectangle in y-z plane: specify y, z, w, h; x taken from fDefWidth/Height/Coord
         kQT_RectangleXYFixedDimZ, // rectangle in x-y plane: specify x, y; w, h, z taken from fDefWidth/Height/Coord
         kQT_RectangleXZFixedDimY, // rectangle in x-z plane: specify x, z; w, h, y taken from fDefWidth/Height/Coord
         kQT_RectangleYZFixedDimX, // rectangle in y-z plane: specify y, z; w, h, x taken from fDefWidth/Height/Coord
         kQT_Rectangle_End,
         // line modes (needed for uniform handling of silicon-strip digits)
         kQT_LineXYFixedZ,         // line in x-y plane: specify x, y, w(dx), h(dy); z taken from fDefCoord
         kQT_LineXZFixedY,         // line in x-z plane: specify x, z, w(dx), h(dz); y taken from fDefCoord
         kQT_Line_End,
         // hexagon modes
         kQT_HexagonXY,            // horizontal hexagon: specify x, y, z, r
         kQT_HexagonYX,            // vertical   hexagon: specify x, y, z, r
         kQT_Hexagon_End
         // circle modes:
         // QT_CircleXY,          // specify r, z
         // QT_CircleXYFixedZ,    // specify r
         // QT_CircleXYFixedR,    // specify z
      };

protected:

   struct QFreeQuad_t     : public DigitBase_t     { Float_t fVertices[12]; };

   struct QOrigin_t       : public DigitBase_t     { Float_t fA, fB; };

   struct QRectFixDimC_t  : public QOrigin_t       {};

   struct QRectFixDim_t   : public QRectFixDimC_t  { Float_t fC; };

   struct QRectFixC_t     : public QRectFixDimC_t  { Float_t fW, fH; };

   struct QRect_t         : public QRectFixDim_t   { Float_t fW, fH; };

   struct QLineFixC_t     : public QOrigin_t       { Float_t fDx, fDy; };

   struct QHex_t          : public QOrigin_t       { Float_t fC, fR; };

protected:
   EQuadType_e       fQuadType;

   Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A)
   Float_t           fDefHeight;    // Breadth assigned to second coordinate (B)
   Float_t           fDefCoord;     // Default value for third coordinate    (C)

   static Int_t SizeofAtom(EQuadType_e qt);

public:
   TEveQuadSet(const char* n="TEveQuadSet", const char* t="");
   TEveQuadSet(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize,
               const char* n="TEveQuadSet", const char* t="");
   virtual ~TEveQuadSet() {}

   void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);

   Float_t GetDefWidth()  const { return fDefWidth;  }
   Float_t GetDefHeight() const { return fDefHeight; }
   Float_t GetDefCoord()  const { return fDefCoord;  }

   void SetDefWidth(Float_t v)  { fDefWidth  = v; }
   void SetDefHeight(Float_t v) { fDefHeight = v; }
   void SetDefCoord(Float_t v)  { fDefCoord  = v; }

   // --------------------------------

   void AddQuad(Float_t* verts);

   void AddQuad(Float_t a, Float_t b);
   void AddQuad(Float_t a, Float_t b, Float_t c);
   void AddQuad(Float_t a, Float_t b, Float_t w, Float_t h);
   void AddQuad(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h);

   void AddLine(Float_t a, Float_t b, Float_t w, Float_t h);

   void AddHexagon(Float_t a, Float_t b, Float_t z, Float_t r);

   // Wrappers to make transition to TEveDigitSet as base easier
   void QuadValue(Int_t value) { DigitValue(value); }
   void QuadColor(Color_t ci)  { DigitColor(ci); }
   void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255) { DigitColor(r, g, b, a); }
   void QuadId(TObject* id)    { DigitId(id); }

   // --------------------------------

   // void Test(Int_t nquads);

   virtual void ComputeBBox();

   // virtual void Paint(Option_t* option="");

   ClassDef(TEveQuadSet, 0); // Collection of 2D primitives (rectangles, hexagons, or lines); each primitive can be assigned a signal value and a TRef.
};

#endif
 TEveQuadSet.h:1
 TEveQuadSet.h:2
 TEveQuadSet.h:3
 TEveQuadSet.h:4
 TEveQuadSet.h:5
 TEveQuadSet.h:6
 TEveQuadSet.h:7
 TEveQuadSet.h:8
 TEveQuadSet.h:9
 TEveQuadSet.h:10
 TEveQuadSet.h:11
 TEveQuadSet.h:12
 TEveQuadSet.h:13
 TEveQuadSet.h:14
 TEveQuadSet.h:15
 TEveQuadSet.h:16
 TEveQuadSet.h:17
 TEveQuadSet.h:18
 TEveQuadSet.h:19
 TEveQuadSet.h:20
 TEveQuadSet.h:21
 TEveQuadSet.h:22
 TEveQuadSet.h:23
 TEveQuadSet.h:24
 TEveQuadSet.h:25
 TEveQuadSet.h:26
 TEveQuadSet.h:27
 TEveQuadSet.h:28
 TEveQuadSet.h:29
 TEveQuadSet.h:30
 TEveQuadSet.h:31
 TEveQuadSet.h:32
 TEveQuadSet.h:33
 TEveQuadSet.h:34
 TEveQuadSet.h:35
 TEveQuadSet.h:36
 TEveQuadSet.h:37
 TEveQuadSet.h:38
 TEveQuadSet.h:39
 TEveQuadSet.h:40
 TEveQuadSet.h:41
 TEveQuadSet.h:42
 TEveQuadSet.h:43
 TEveQuadSet.h:44
 TEveQuadSet.h:45
 TEveQuadSet.h:46
 TEveQuadSet.h:47
 TEveQuadSet.h:48
 TEveQuadSet.h:49
 TEveQuadSet.h:50
 TEveQuadSet.h:51
 TEveQuadSet.h:52
 TEveQuadSet.h:53
 TEveQuadSet.h:54
 TEveQuadSet.h:55
 TEveQuadSet.h:56
 TEveQuadSet.h:57
 TEveQuadSet.h:58
 TEveQuadSet.h:59
 TEveQuadSet.h:60
 TEveQuadSet.h:61
 TEveQuadSet.h:62
 TEveQuadSet.h:63
 TEveQuadSet.h:64
 TEveQuadSet.h:65
 TEveQuadSet.h:66
 TEveQuadSet.h:67
 TEveQuadSet.h:68
 TEveQuadSet.h:69
 TEveQuadSet.h:70
 TEveQuadSet.h:71
 TEveQuadSet.h:72
 TEveQuadSet.h:73
 TEveQuadSet.h:74
 TEveQuadSet.h:75
 TEveQuadSet.h:76
 TEveQuadSet.h:77
 TEveQuadSet.h:78
 TEveQuadSet.h:79
 TEveQuadSet.h:80
 TEveQuadSet.h:81
 TEveQuadSet.h:82
 TEveQuadSet.h:83
 TEveQuadSet.h:84
 TEveQuadSet.h:85
 TEveQuadSet.h:86
 TEveQuadSet.h:87
 TEveQuadSet.h:88
 TEveQuadSet.h:89
 TEveQuadSet.h:90
 TEveQuadSet.h:91
 TEveQuadSet.h:92
 TEveQuadSet.h:93
 TEveQuadSet.h:94
 TEveQuadSet.h:95
 TEveQuadSet.h:96
 TEveQuadSet.h:97
 TEveQuadSet.h:98
 TEveQuadSet.h:99
 TEveQuadSet.h:100
 TEveQuadSet.h:101
 TEveQuadSet.h:102
 TEveQuadSet.h:103
 TEveQuadSet.h:104
 TEveQuadSet.h:105
 TEveQuadSet.h:106
 TEveQuadSet.h:107
 TEveQuadSet.h:108
 TEveQuadSet.h:109
 TEveQuadSet.h:110
 TEveQuadSet.h:111
 TEveQuadSet.h:112
 TEveQuadSet.h:113
 TEveQuadSet.h:114
 TEveQuadSet.h:115
 TEveQuadSet.h:116
 TEveQuadSet.h:117
 TEveQuadSet.h:118
 TEveQuadSet.h:119
 TEveQuadSet.h:120
 TEveQuadSet.h:121
 TEveQuadSet.h:122
 TEveQuadSet.h:123
 TEveQuadSet.h:124
 TEveQuadSet.h:125
 TEveQuadSet.h:126
 TEveQuadSet.h:127
 TEveQuadSet.h:128
 TEveQuadSet.h:129