TEveDigitSet.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveDigitSet.h 37390 2010-12-08 11:10:41Z 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_TEveDigitSet
00013 #define ROOT_TEveDigitSet
00014 
00015 #include "TNamed.h"
00016 #include "TQObject.h"
00017 #include "TAtt3D.h"
00018 #include "TAttBBox.h"
00019 
00020 #include "TEveUtil.h"
00021 #include "TEveElement.h"
00022 #include "TEveFrameBox.h"
00023 #include "TEveRGBAPalette.h"
00024 #include "TEveChunkManager.h"
00025 #include "TEveSecondarySelectable.h"
00026 
00027 class TRefArray;
00028 
00029 class TEveDigitSet : public TEveElement,
00030                      public TNamed, public TQObject,
00031                      public TAtt3D,
00032                      public TAttBBox,
00033                      public TEveSecondarySelectable
00034 {
00035    friend class TEveDigitSetEditor;
00036    friend class TEveDigitSetGL;
00037 
00038    TEveDigitSet(const TEveDigitSet&);            // Not implemented
00039    TEveDigitSet& operator=(const TEveDigitSet&); // Not implemented
00040 
00041 public:
00042    enum ERenderMode_e { kRM_AsIs, kRM_Line, kRM_Fill };
00043 
00044    typedef void (*Callback_foo)(TEveDigitSet*, Int_t, TObject*);
00045    typedef TString (*TooltipCB_foo)(TEveDigitSet*, Int_t);
00046 
00047    struct DigitBase_t
00048    {
00049       // Base-class for digit representation classes.
00050 
00051       Int_t  fValue;    // signal value of a digit (can be direct RGBA color)
00052       void  *fUserData; // user-data for given digit
00053 
00054       DigitBase_t(Int_t v=0) : fValue(v), fUserData(0) {}
00055    };
00056 
00057 protected:
00058    TRefArray        *fDigitIds;       //  Array holding references to external objects.
00059 
00060    Int_t             fDefaultValue;   //  Default signal value.
00061    Bool_t            fValueIsColor;   //  Interpret signal value as RGBA color.
00062    Bool_t            fSingleColor;    //  Use the same color for all digits.
00063    Bool_t            fAntiFlick;      // Make extra render pass to avoid flickering when quads are too small.
00064    Bool_t            fOwnIds;         //  Flag specifying if id-objects are owned by the TEveDigitSet.
00065    TEveChunkManager  fPlex;           //  Container of digit data.
00066    DigitBase_t*      fLastDigit;      //! The last / current digit added to collection.
00067    Int_t             fLastIdx;        //! The last / current idx added to collection.
00068 
00069    Color_t           fColor;          //  Color used for frame (or all digis with single-color).
00070    TEveFrameBox*     fFrame;          //  Pointer to frame structure.
00071    TEveRGBAPalette*  fPalette;        //  Pointer to signal-color palette.
00072    ERenderMode_e     fRenderMode;     //  Render mode: as-is / line / filled.
00073    Bool_t            fDisableLighting;//  Disable lighting for rendering.
00074    Bool_t            fHistoButtons;   //  Show histogram buttons in object editor.
00075 
00076    Bool_t            fEmitSignals;    //  Emit signals on secondary-select.
00077    Callback_foo      fCallbackFoo;    //! Additional function to call on secondary-select.
00078    TooltipCB_foo     fTooltipCBFoo;   //! Function providing highlight tooltips when always-sec-select is active.
00079 
00080    DigitBase_t* NewDigit();
00081    void         ReleaseIds();
00082 
00083 public:
00084    TEveDigitSet(const char* n="TEveDigitSet", const char* t="");
00085    virtual ~TEveDigitSet();
00086 
00087    virtual TObject* GetObject(const TEveException&) const
00088    { const TObject* obj = this; return const_cast<TObject*>(obj); }
00089 
00090    void   UseSingleColor();
00091 
00092    Bool_t GetAntiFlick() const   { return fAntiFlick; }
00093    void   SetAntiFlick(Bool_t f) { fAntiFlick = f; }
00094 
00095    virtual void SetMainColor(Color_t color);
00096 
00097    virtual void UnSelected();
00098    virtual void UnHighlighted();
00099 
00100    virtual TString GetHighlightTooltip();
00101 
00102    // Implemented in sub-classes:
00103    // virtual void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
00104 
00105    void RefitPlex();
00106    void ScanMinMaxValues(Int_t& min, Int_t& max);
00107 
00108    // --------------------------------
00109 
00110    void SetCurrentDigit(Int_t idx);
00111 
00112    void DigitValue(Int_t value);
00113    void DigitColor(Color_t ci);
00114    void DigitColor(Color_t ci, Char_t transparency);
00115    void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
00116    void DigitColor(UChar_t* rgba);
00117 
00118    Bool_t GetOwnIds() const     { return fOwnIds; }
00119    void   SetOwnIds(Bool_t o)   { fOwnIds = o; }
00120 
00121    void   DigitId(TObject* id);
00122    void   DigitUserData(void* ud);
00123 
00124    void   DigitId(Int_t n, TObject* id);
00125    void   DigitUserData(Int_t n, void* ud);
00126 
00127    DigitBase_t* GetDigit(Int_t n) const { return (DigitBase_t*) fPlex.Atom(n); }
00128    TObject*     GetId(Int_t n) const;
00129    void*        GetUserData(Int_t n) const;
00130    using TEveElement::GetUserData;
00131 
00132    // --------------------------------
00133 
00134    // Implemented in subclasses:
00135    // virtual void ComputeBBox();
00136 
00137    virtual void Paint(Option_t* option="");
00138 
00139    virtual void DigitSelected(Int_t idx);
00140    virtual void SecSelected(TEveDigitSet* qs, Int_t idx); // *SIGNAL*
00141 
00142    // --------------------------------
00143 
00144    TEveChunkManager* GetPlex() { return &fPlex; }
00145 
00146    TEveFrameBox* GetFrame() const { return fFrame; }
00147    void          SetFrame(TEveFrameBox* b);
00148 
00149    Bool_t GetValueIsColor()  const { return fValueIsColor; }
00150 
00151    TEveRGBAPalette* GetPalette() const { return fPalette; }
00152    void             SetPalette(TEveRGBAPalette* p);
00153    TEveRGBAPalette* AssertPalette();
00154 
00155    ERenderMode_e  GetRenderMode()           const { return fRenderMode; }
00156    void           SetRenderMode(ERenderMode_e rm) { fRenderMode = rm; }
00157 
00158    Bool_t GetDisableLighting() const   { return fDisableLighting; }
00159    void   SetDisableLighting(Bool_t l) { fDisableLighting = l; }
00160 
00161    Bool_t GetHistoButtons() const   { return fHistoButtons; }
00162    void   SetHistoButtons(Bool_t f) { fHistoButtons = f; }
00163 
00164    Bool_t GetEmitSignals() const   { return fEmitSignals; }
00165    void   SetEmitSignals(Bool_t f) { fEmitSignals = f; }
00166 
00167    Callback_foo GetCallbackFoo()         const { return fCallbackFoo; }
00168    void         SetCallbackFoo(Callback_foo f) { fCallbackFoo = f; }
00169 
00170    TooltipCB_foo GetTooltipCBFoo()          const { return fTooltipCBFoo; }
00171    void          SetTooltipCBFoo(TooltipCB_foo f) { fTooltipCBFoo = f; }
00172 
00173    ClassDef(TEveDigitSet, 0); // Base-class for storage of digit collections; provides transformation matrix (TEveTrans), signal to color mapping (TEveRGBAPalette) and visual grouping (TEveFrameBox).
00174 };
00175 
00176 #endif

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