Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TEveDigitSet.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveDigitSet
0013 #define ROOT_TEveDigitSet
0014 
0015 #include "TNamed.h"
0016 #include "TQObject.h"
0017 #include "TAtt3D.h"
0018 #include "TAttBBox.h"
0019 
0020 #include "TEveUtil.h"
0021 #include "TEveElement.h"
0022 #include "TEveFrameBox.h"
0023 #include "TEveRGBAPalette.h"
0024 #include "TEveChunkManager.h"
0025 #include "TEveSecondarySelectable.h"
0026 
0027 class TRefArray;
0028 
0029 class TEveDigitSet : public TEveElement,
0030                      public TNamed, public TQObject,
0031                      public TAtt3D,
0032                      public TAttBBox,
0033                      public TEveSecondarySelectable
0034 {
0035    friend class TEveDigitSetEditor;
0036    friend class TEveDigitSetGL;
0037 
0038    TEveDigitSet(const TEveDigitSet&);            // Not implemented
0039    TEveDigitSet& operator=(const TEveDigitSet&); // Not implemented
0040 
0041 public:
0042    enum ERenderMode_e { kRM_AsIs, kRM_Line, kRM_Fill };
0043 
0044    typedef void (*Callback_foo)(TEveDigitSet*, Int_t, TObject*);
0045    typedef TString (*TooltipCB_foo)(TEveDigitSet*, Int_t);
0046 
0047    struct DigitBase_t
0048    {
0049       // Base-class for digit representation classes.
0050 
0051       Int_t  fValue;    // signal value of a digit (can be direct RGBA color)
0052       void  *fUserData; // user-data for given digit
0053 
0054       DigitBase_t(Int_t v=0) : fValue(v), fUserData(nullptr) {}
0055    };
0056 
0057 protected:
0058    TRefArray        *fDigitIds;       //  Array holding references to external objects.
0059 
0060    Int_t             fDefaultValue;   //  Default signal value.
0061    Bool_t            fValueIsColor;   //  Interpret signal value as RGBA color.
0062    Bool_t            fSingleColor;    //  Use the same color for all digits.
0063    Bool_t            fAntiFlick;      // Make extra render pass to avoid flickering when quads are too small.
0064    Bool_t            fOwnIds;         //  Flag specifying if id-objects are owned by the TEveDigitSet.
0065    TEveChunkManager  fPlex;           //  Container of digit data.
0066    DigitBase_t*      fLastDigit;      //! The last / current digit added to collection.
0067    Int_t             fLastIdx;        //! The last / current idx added to collection.
0068 
0069    Color_t           fColor;          //  Color used for frame (or all digis with single-color).
0070    TEveFrameBox*     fFrame;          //  Pointer to frame structure.
0071    TEveRGBAPalette*  fPalette;        //  Pointer to signal-color palette.
0072    ERenderMode_e     fRenderMode;     //  Render mode: as-is / line / filled.
0073    Bool_t            fSelectViaFrame; //  Allow selection via frame.
0074    Bool_t            fHighlightFrame; //  Highlight frame when object is selected.
0075    Bool_t            fDisableLighting;//  Disable lighting for rendering.
0076    Bool_t            fHistoButtons;   //  Show histogram buttons in object editor.
0077 
0078    Bool_t            fEmitSignals;    //  Emit signals on secondary-select.
0079    Callback_foo      fCallbackFoo;    //! Additional function to call on secondary-select.
0080    TooltipCB_foo     fTooltipCBFoo;   //! Function providing highlight tooltips when always-sec-select is active.
0081 
0082    DigitBase_t* NewDigit();
0083    void         ReleaseIds();
0084 
0085 public:
0086    TEveDigitSet(const char* n="TEveDigitSet", const char* t="");
0087    ~TEveDigitSet() override;
0088 
0089    TObject* GetObject(const TEveException&) const override
0090    { const TObject* obj = this; return const_cast<TObject*>(obj); }
0091 
0092    void   UseSingleColor();
0093 
0094    Bool_t GetAntiFlick() const   { return fAntiFlick; }
0095    void   SetAntiFlick(Bool_t f) { fAntiFlick = f; }
0096 
0097    void SetMainColor(Color_t color) override;
0098 
0099    void UnSelected() override;
0100    void UnHighlighted() override;
0101 
0102    TString GetHighlightTooltip() override;
0103 
0104    // Implemented in sub-classes:
0105    // virtual void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
0106 
0107    void RefitPlex();
0108    void ScanMinMaxValues(Int_t& min, Int_t& max);
0109 
0110    // --------------------------------
0111 
0112    void SetCurrentDigit(Int_t idx);
0113 
0114    void DigitValue(Int_t value);
0115    void DigitColor(Color_t ci);
0116    void DigitColor(Color_t ci, Char_t transparency);
0117    void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
0118    void DigitColor(UChar_t* rgba);
0119 
0120    Bool_t GetOwnIds() const     { return fOwnIds; }
0121    void   SetOwnIds(Bool_t o)   { fOwnIds = o; }
0122 
0123    void   DigitId(TObject* id);
0124    void   DigitUserData(void* ud);
0125 
0126    void   DigitId(Int_t n, TObject* id);
0127    void   DigitUserData(Int_t n, void* ud);
0128 
0129    DigitBase_t* GetDigit(Int_t n) const { return (DigitBase_t*) fPlex.Atom(n); }
0130    TObject*     GetId(Int_t n) const;
0131    void*        GetUserData(Int_t n) const;
0132    using TEveElement::GetUserData;
0133 
0134    // --------------------------------
0135 
0136    // Implemented in subclasses:
0137    // virtual void ComputeBBox();
0138 
0139    void Paint(Option_t* option="") override;
0140 
0141    virtual void DigitSelected(Int_t idx);
0142    virtual void SecSelected(TEveDigitSet* qs, Int_t idx); // *SIGNAL*
0143 
0144    // --------------------------------
0145 
0146    TEveChunkManager* GetPlex() { return &fPlex; }
0147 
0148    TEveFrameBox* GetFrame() const { return fFrame; }
0149    void          SetFrame(TEveFrameBox* b);
0150 
0151    Bool_t GetSelectViaFrame() const    { return fSelectViaFrame; }
0152    void   SetSelectViaFrame(Bool_t sf) { fSelectViaFrame = sf; }
0153 
0154    Bool_t GetHighlightFrame() const    { return fHighlightFrame; }
0155    void   SetHighlightFrame(Bool_t hf) { fHighlightFrame = hf; }
0156 
0157    Bool_t GetValueIsColor()  const { return fValueIsColor; }
0158 
0159    TEveRGBAPalette* GetPalette() const { return fPalette; }
0160    void             SetPalette(TEveRGBAPalette* p);
0161    TEveRGBAPalette* AssertPalette();
0162 
0163    ERenderMode_e  GetRenderMode()           const { return fRenderMode; }
0164    void           SetRenderMode(ERenderMode_e rm) { fRenderMode = rm; }
0165 
0166    Bool_t GetDisableLighting() const   { return fDisableLighting; }
0167    void   SetDisableLighting(Bool_t l) { fDisableLighting = l; }
0168 
0169    Bool_t GetHistoButtons() const   { return fHistoButtons; }
0170    void   SetHistoButtons(Bool_t f) { fHistoButtons = f; }
0171 
0172    Bool_t GetEmitSignals() const   { return fEmitSignals; }
0173    void   SetEmitSignals(Bool_t f) { fEmitSignals = f; }
0174 
0175    Callback_foo GetCallbackFoo()         const { return fCallbackFoo; }
0176    void         SetCallbackFoo(Callback_foo f) { fCallbackFoo = f; }
0177 
0178    TooltipCB_foo GetTooltipCBFoo()          const { return fTooltipCBFoo; }
0179    void          SetTooltipCBFoo(TooltipCB_foo f) { fTooltipCBFoo = f; }
0180 
0181    ClassDefOverride(TEveDigitSet, 0); // Base-class for storage of digit collections; provides transformation matrix (TEveTrans), signal to color mapping (TEveRGBAPalette) and visual grouping (TEveFrameBox).
0182 };
0183 
0184 #endif