ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TEveDigitSet.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_TEveDigitSet
13 #define ROOT_TEveDigitSet
14 
15 #include "TNamed.h"
16 #include "TQObject.h"
17 #include "TAtt3D.h"
18 #include "TAttBBox.h"
19 
20 #include "TEveUtil.h"
21 #include "TEveElement.h"
22 #include "TEveFrameBox.h"
23 #include "TEveRGBAPalette.h"
24 #include "TEveChunkManager.h"
26 
27 class TRefArray;
28 
29 class TEveDigitSet : public TEveElement,
30  public TNamed, public TQObject,
31  public TAtt3D,
32  public TAttBBox,
34 {
35  friend class TEveDigitSetEditor;
36  friend class TEveDigitSetGL;
37 
38  TEveDigitSet(const TEveDigitSet&); // Not implemented
39  TEveDigitSet& operator=(const TEveDigitSet&); // Not implemented
40 
41 public:
43 
46 
47  struct DigitBase_t
48  {
49  // Base-class for digit representation classes.
50 
51  Int_t fValue; // signal value of a digit (can be direct RGBA color)
52  void *fUserData; // user-data for given digit
53 
55  };
56 
57 protected:
58  TRefArray *fDigitIds; // Array holding references to external objects.
59 
60  Int_t fDefaultValue; // Default signal value.
61  Bool_t fValueIsColor; // Interpret signal value as RGBA color.
62  Bool_t fSingleColor; // Use the same color for all digits.
63  Bool_t fAntiFlick; // Make extra render pass to avoid flickering when quads are too small.
64  Bool_t fOwnIds; // Flag specifying if id-objects are owned by the TEveDigitSet.
65  TEveChunkManager fPlex; // Container of digit data.
66  DigitBase_t* fLastDigit; //! The last / current digit added to collection.
67  Int_t fLastIdx; //! The last / current idx added to collection.
68 
69  Color_t fColor; // Color used for frame (or all digis with single-color).
70  TEveFrameBox* fFrame; // Pointer to frame structure.
71  TEveRGBAPalette* fPalette; // Pointer to signal-color palette.
72  ERenderMode_e fRenderMode; // Render mode: as-is / line / filled.
73  Bool_t fSelectViaFrame; // Allow selection via frame.
74  Bool_t fHighlightFrame; // Highlight frame when object is selected.
75  Bool_t fDisableLighting;// Disable lighting for rendering.
76  Bool_t fHistoButtons; // Show histogram buttons in object editor.
77 
78  Bool_t fEmitSignals; // Emit signals on secondary-select.
79  Callback_foo fCallbackFoo; //! Additional function to call on secondary-select.
80  TooltipCB_foo fTooltipCBFoo; //! Function providing highlight tooltips when always-sec-select is active.
81 
83  void ReleaseIds();
84 
85 public:
86  TEveDigitSet(const char* n="TEveDigitSet", const char* t="");
87  virtual ~TEveDigitSet();
88 
89  virtual TObject* GetObject(const TEveException&) const
90  { const TObject* obj = this; return const_cast<TObject*>(obj); }
91 
92  void UseSingleColor();
93 
94  Bool_t GetAntiFlick() const { return fAntiFlick; }
96 
97  virtual void SetMainColor(Color_t color);
98 
99  virtual void UnSelected();
100  virtual void UnHighlighted();
101 
102  virtual TString GetHighlightTooltip();
103 
104  // Implemented in sub-classes:
105  // virtual void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
106 
107  void RefitPlex();
109 
110  // --------------------------------
111 
112  void SetCurrentDigit(Int_t idx);
113 
114  void DigitValue(Int_t value);
115  void DigitColor(Color_t ci);
116  void DigitColor(Color_t ci, Char_t transparency);
117  void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255);
118  void DigitColor(UChar_t* rgba);
119 
120  Bool_t GetOwnIds() const { return fOwnIds; }
121  void SetOwnIds(Bool_t o) { fOwnIds = o; }
122 
123  void DigitId(TObject* id);
124  void DigitUserData(void* ud);
125 
126  void DigitId(Int_t n, TObject* id);
127  void DigitUserData(Int_t n, void* ud);
128 
129  DigitBase_t* GetDigit(Int_t n) const { return (DigitBase_t*) fPlex.Atom(n); }
130  TObject* GetId(Int_t n) const;
131  void* GetUserData(Int_t n) const;
133 
134  // --------------------------------
135 
136  // Implemented in subclasses:
137  // virtual void ComputeBBox();
138 
139  virtual void Paint(Option_t* option="");
140 
141  virtual void DigitSelected(Int_t idx);
142  virtual void SecSelected(TEveDigitSet* qs, Int_t idx); // *SIGNAL*
143 
144  // --------------------------------
145 
147 
148  TEveFrameBox* GetFrame() const { return fFrame; }
149  void SetFrame(TEveFrameBox* b);
150 
153 
156 
158 
159  TEveRGBAPalette* GetPalette() const { return fPalette; }
160  void SetPalette(TEveRGBAPalette* p);
162 
165 
168 
171 
172  Bool_t GetEmitSignals() const { return fEmitSignals; }
174 
177 
180 
181  ClassDef(TEveDigitSet, 0); // Base-class for storage of digit collections; provides transformation matrix (TEveTrans), signal to color mapping (TEveRGBAPalette) and visual grouping (TEveFrameBox).
182 };
183 
184 #endif
TEveChunkManager fPlex
Definition: TEveDigitSet.h:65
Semi-abstract interface for classes supporting secondary-selection.
Char_t * Atom(Int_t idx) const
void DigitId(TObject *id)
Set external object reference for the last digit added.
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
Bool_t fSingleColor
Definition: TEveDigitSet.h:62
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
void SetRenderMode(ERenderMode_e rm)
Definition: TEveDigitSet.h:164
Bool_t GetValueIsColor() const
Definition: TEveDigitSet.h:157
void SetEmitSignals(Bool_t f)
Definition: TEveDigitSet.h:173
DigitBase_t * NewDigit()
Function providing highlight tooltips when always-sec-select is active.
const char Option_t
Definition: RtypesCore.h:62
TObject * GetId(Int_t n) const
Return external TObject associated with digit n.
Bool_t fSelectViaFrame
Definition: TEveDigitSet.h:73
Int_t fDefaultValue
Definition: TEveDigitSet.h:60
Bool_t GetOwnIds() const
Definition: TEveDigitSet.h:120
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:29
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
virtual void DigitSelected(Int_t idx)
Called from renderer when a digit with index idx is selected.
TRefArray * fDigitIds
Definition: TEveDigitSet.h:58
Basic string class.
Definition: TString.h:137
Editor for TEveDigitSet class.
TEveRGBAPalette * AssertPalette()
Make sure the TEveRGBAPalette pointer is not null.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
Bool_t fEmitSignals
Definition: TEveDigitSet.h:78
Description of a 2D or 3D frame that can be used to visually group a set of objects.
Definition: TEveFrameBox.h:18
An array of references to TObjects.
Definition: TRefArray.h:43
Bool_t GetSelectViaFrame() const
Definition: TEveDigitSet.h:151
void SetDisableLighting(Bool_t l)
Definition: TEveDigitSet.h:167
virtual void UnHighlighted()
Virtual function called when both fHighlighted is false and fImpliedHighlighted is 0...
virtual void SecSelected(TEveDigitSet *qs, Int_t idx)
Emit a SecSelected signal.
TEveDigitSet(const TEveDigitSet &)
TString(* TooltipCB_foo)(TEveDigitSet *, Int_t)
Definition: TEveDigitSet.h:45
virtual void Paint(Option_t *option="")
Paint this object. Only direct rendering is supported.
TFile * f
Bool_t fAntiFlick
Definition: TEveDigitSet.h:63
DigitBase_t * GetDigit(Int_t n) const
Definition: TEveDigitSet.h:129
Bool_t fOwnIds
Definition: TEveDigitSet.h:64
Bool_t fHistoButtons
Definition: TEveDigitSet.h:76
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
void SetSelectViaFrame(Bool_t sf)
Definition: TEveDigitSet.h:152
void SetTooltipCBFoo(TooltipCB_foo f)
Definition: TEveDigitSet.h:179
virtual void UnSelected()
Virtual function called when both fSelected is false and fImpliedSelected is 0.
void SetAntiFlick(Bool_t f)
Definition: TEveDigitSet.h:95
Bool_t GetEmitSignals() const
Definition: TEveDigitSet.h:172
virtual TString GetHighlightTooltip()
Return tooltip for highlighted element if always-sec-select is set.
void DigitColor(Color_t ci)
Set color for the last digit added.
Int_t fLastIdx
The last / current digit added to collection.
Definition: TEveDigitSet.h:67
TooltipCB_foo fTooltipCBFoo
Additional function to call on secondary-select.
Definition: TEveDigitSet.h:80
void SetHistoButtons(Bool_t f)
Definition: TEveDigitSet.h:170
OpenGL renderer class for TEveDigitSet.
short Color_t
Definition: RtypesCore.h:79
Color_t fColor
The last / current idx added to collection.
Definition: TEveDigitSet.h:69
TEveFrameBox * fFrame
Definition: TEveDigitSet.h:70
void UseSingleColor()
Instruct digit-set to use single color for its digits.
void DigitUserData(void *ud)
Set user-data for the last digit added.
virtual TObject * GetObject(const TEveException &) const
Get a TObject associated with this render-element.
Definition: TEveDigitSet.h:89
TThread * t[5]
Definition: threadsh1.C:13
ERenderMode_e GetRenderMode() const
Definition: TEveDigitSet.h:163
void SetCallbackFoo(Callback_foo f)
Definition: TEveDigitSet.h:176
void SetFrame(TEveFrameBox *b)
Set TEveFrameBox pointer.
virtual ~TEveDigitSet()
Destructor.
ROOT::R::TRInterface & r
Definition: Object.C:4
SVector< double, 2 > v
Definition: Dict.h:5
Bool_t fDisableLighting
Definition: TEveDigitSet.h:75
TEveRGBAPalette * GetPalette() const
Definition: TEveDigitSet.h:159
Bool_t fValueIsColor
Definition: TEveDigitSet.h:61
void SetOwnIds(Bool_t o)
Definition: TEveDigitSet.h:121
TEveChunkManager * GetPlex()
Definition: TEveDigitSet.h:146
TEveRGBAPalette * fPalette
Definition: TEveDigitSet.h:71
TEveDigitSet & operator=(const TEveDigitSet &)
TLine * l
Definition: textangle.C:4
Vector-like container with chunked memory allocation.
ERenderMode_e fRenderMode
Definition: TEveDigitSet.h:72
void * GetUserData() const
Definition: TEveElement.h:302
Bool_t fHighlightFrame
Definition: TEveDigitSet.h:74
ClassDef(TEveDigitSet, 0)
void SetPalette(TEveRGBAPalette *p)
Set TEveRGBAPalette pointer.
void RefitPlex()
Instruct underlying memory allocator to regroup itself into a contiguous memory chunk.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
Callback_foo fCallbackFoo
Definition: TEveDigitSet.h:79
Mother of all ROOT objects.
Definition: TObject.h:58
void SetCurrentDigit(Int_t idx)
Set current digit – the one that will receive calls to DigitValue/Color/Id/UserData() functions...
char Char_t
Definition: RtypesCore.h:29
TooltipCB_foo GetTooltipCBFoo() const
Definition: TEveDigitSet.h:178
typedef void((*Func_t)())
void(* Callback_foo)(TEveDigitSet *, Int_t, TObject *)
Definition: TEveDigitSet.h:44
DigitBase_t * fLastDigit
Definition: TEveDigitSet.h:66
Callback_foo GetCallbackFoo() const
Definition: TEveDigitSet.h:175
Helper for management of bounding-box information.
Definition: TAttBBox.h:19
Bool_t GetHistoButtons() const
Definition: TEveDigitSet.h:169
void ScanMinMaxValues(Int_t &min, Int_t &max)
Iterate over the digits and determine min and max signal values.
Bool_t GetHighlightFrame() const
Definition: TEveDigitSet.h:154
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
TEveFrameBox * GetFrame() const
Definition: TEveDigitSet.h:148
virtual void SetMainColor(Color_t color)
Override from TEveElement, forward to Frame.
unsigned char UChar_t
Definition: RtypesCore.h:34
void ReleaseIds()
Protected method.
TObject * obj
void DigitValue(Int_t value)
Set signal value for the last digit added.
void SetHighlightFrame(Bool_t hf)
Definition: TEveDigitSet.h:155
float value
Definition: math.cpp:443
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
const Int_t n
Definition: legend1.C:16
Base-class for storage of digit collections; provides transformation matrix (TEveTrans), signal to color mapping (TEveRGBAPalette) and visual grouping (TEveFrameBox).
Definition: TEveDigitSet.h:29
Bool_t GetDisableLighting() const
Definition: TEveDigitSet.h:166
Bool_t GetAntiFlick() const
Definition: TEveDigitSet.h:94