TEveQuadSet.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveQuadSet.h 37234 2010-12-03 18:20:15Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TEveQuadSet
00013 #define ROOT_TEveQuadSet
00014 
00015 #include "TEveDigitSet.h"
00016 
00017 class TRandom;
00018 
00019 class TEveQuadSet : public TEveDigitSet
00020 {
00021    friend class TEveQuadSetGL;
00022 
00023    TEveQuadSet(const TEveQuadSet&);            // Not implemented
00024    TEveQuadSet& operator=(const TEveQuadSet&); // Not implemented
00025 
00026 public:
00027    enum EQuadType_e {
00028       kQT_Undef,                // unknown-ignored
00029       kQT_FreeQuad,             // arbitrary quad: specify 4*(x,y,z) quad corners
00030       kQT_RectangleXY,          // rectangle in x-y plane: specify x, y, z, w, h
00031       kQT_RectangleXZ,          // rectangle in x-z plane: specify x, y, z, w, h
00032       kQT_RectangleYZ,          // rectangle in y-z plane: specify x, y, z, w, h
00033       kQT_RectangleXYFixedDim,  // rectangle in x-y plane: specify x, y, z; w, h taken from fDefWidth/Height
00034       kQT_RectangleXYFixedZ,    // rectangle in x-y plane: specify x, y, w, h; z taken from fDefCoord
00035       kQT_RectangleXZFixedY,    // rectangle in x-z plane: specify x, z, w, h; y taken from fDefCoord
00036       kQT_RectangleYZFixedX,    // rectangle in y-z plane: specify y, z, w, h; x taken from fDefWidth/Height/Coord
00037       kQT_RectangleXYFixedDimZ, // rectangle in x-y plane: specify x, y; w, h, z taken from fDefWidth/Height/Coord
00038       kQT_RectangleXZFixedDimY, // rectangle in x-z plane: specify x, z; w, h, y taken from fDefWidth/Height/Coord
00039       kQT_RectangleYZFixedDimX, // rectangle in y-z plane: specify y, z; w, h, x taken from fDefWidth/Height/Coord
00040       kQT_Rectangle_End,
00041       // line modes (needed for uniform handling of silicon-strip digits)
00042       kQT_LineXYFixedZ,         // line in x-y plane: specify x, y, w(dx), h(dy); z taken from fDefCoord
00043       kQT_LineXZFixedY,         // line in x-z plane: specify x, z, w(dx), h(dz); y taken from fDefCoord
00044       kQT_Line_End,
00045       // hexagon modes
00046       kQT_HexagonXY,            // horizontal hexagon: specify x, y, z, r
00047       kQT_HexagonYX,            // vertical   hexagon: specify x, y, z, r
00048       kQT_Hexagon_End
00049       // circle modes:
00050       // QT_CircleXY,          // specify r, z
00051       // QT_CircleXYFixedZ,    // specify r
00052       // QT_CircleXYFixedR,    // specify z
00053    };
00054 
00055    struct QFreeQuad_t     : public DigitBase_t     { Float_t fVertices[12]; };
00056 
00057    struct QOrigin_t       : public DigitBase_t     { Float_t fA, fB; };
00058 
00059    struct QRectFixDimC_t  : public QOrigin_t       {};
00060 
00061    struct QRectFixDim_t   : public QRectFixDimC_t  { Float_t fC; };
00062 
00063    struct QRectFixC_t     : public QRectFixDimC_t  { Float_t fW, fH; };
00064 
00065    struct QRect_t         : public QRectFixDim_t   { Float_t fW, fH; };
00066 
00067    struct QLineFixC_t     : public QOrigin_t       { Float_t fDx, fDy; };
00068 
00069    struct QHex_t          : public QOrigin_t       { Float_t fC, fR; };
00070 
00071 protected:
00072    EQuadType_e       fQuadType;
00073 
00074    Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A)
00075    Float_t           fDefHeight;    // Breadth assigned to second coordinate (B)
00076    Float_t           fDefCoord;     // Default value for third coordinate    (C)
00077 
00078    static Int_t SizeofAtom(EQuadType_e qt);
00079 
00080 public:
00081    TEveQuadSet(const char* n="TEveQuadSet", const char* t="");
00082    TEveQuadSet(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize,
00083                const char* n="TEveQuadSet", const char* t="");
00084    virtual ~TEveQuadSet() {}
00085 
00086    void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
00087 
00088    Float_t GetDefWidth()  const { return fDefWidth;  }
00089    Float_t GetDefHeight() const { return fDefHeight; }
00090    Float_t GetDefCoord()  const { return fDefCoord;  }
00091 
00092    void SetDefWidth(Float_t v)  { fDefWidth  = v; }
00093    void SetDefHeight(Float_t v) { fDefHeight = v; }
00094    void SetDefCoord(Float_t v)  { fDefCoord  = v; }
00095 
00096    // --------------------------------
00097 
00098    void AddQuad(Float_t* verts);
00099 
00100    void AddQuad(Float_t a, Float_t b);
00101    void AddQuad(Float_t a, Float_t b, Float_t c);
00102    void AddQuad(Float_t a, Float_t b, Float_t w, Float_t h);
00103    void AddQuad(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h);
00104 
00105    void AddLine(Float_t a, Float_t b, Float_t w, Float_t h);
00106 
00107    void AddHexagon(Float_t a, Float_t b, Float_t z, Float_t r);
00108 
00109    // Wrappers to make transition to TEveDigitSet as base easier
00110    void QuadValue(Int_t value) { DigitValue(value); }
00111    void QuadColor(Color_t ci)  { DigitColor(ci); }
00112    void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255) { DigitColor(r, g, b, a); }
00113    void QuadId(TObject* id)    { DigitId(id); }
00114 
00115    // --------------------------------
00116 
00117    // void Test(Int_t nquads);
00118 
00119    virtual void ComputeBBox();
00120 
00121    // virtual void Paint(Option_t* option="");
00122 
00123    ClassDef(TEveQuadSet, 0); // Collection of 2D primitives (rectangles, hexagons, or lines); each primitive can be assigned a signal value and a TRef.
00124 };
00125 
00126 #endif

Generated on Tue Jul 5 14:14:59 2011 for ROOT_528-00b_version by  doxygen 1.5.1