Logo ROOT   6.08/07
Reference Guide
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 
45  typedef TString (*TooltipCB_foo)(TEveDigitSet*, Int_t);
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 
54  DigitBase_t(Int_t v=0) : fValue(v), fUserData(0) {}
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; }
95  void SetAntiFlick(Bool_t f) { fAntiFlick = f; }
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();
108  void ScanMinMaxValues(Int_t& min, Int_t& max);
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 
152  void SetSelectViaFrame(Bool_t sf) { fSelectViaFrame = sf; }
153 
155  void SetHighlightFrame(Bool_t hf) { fHighlightFrame = hf; }
156 
158 
159  TEveRGBAPalette* GetPalette() const { return fPalette; }
160  void SetPalette(TEveRGBAPalette* p);
162 
164  void SetRenderMode(ERenderMode_e rm) { fRenderMode = rm; }
165 
167  void SetDisableLighting(Bool_t l) { fDisableLighting = l; }
168 
170  void SetHistoButtons(Bool_t f) { fHistoButtons = f; }
171 
172  Bool_t GetEmitSignals() const { return fEmitSignals; }
173  void SetEmitSignals(Bool_t f) { fEmitSignals = f; }
174 
176  void SetCallbackFoo(Callback_foo f) { fCallbackFoo = f; }
177 
179  void SetTooltipCBFoo(TooltipCB_foo f) { fTooltipCBFoo = f; }
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.
Bool_t GetDisableLighting() const
Definition: TEveDigitSet.h:166
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
void SetRenderMode(ERenderMode_e rm)
Definition: TEveDigitSet.h:164
void SetEmitSignals(Bool_t f)
Definition: TEveDigitSet.h:173
DigitBase_t * NewDigit()
Function providing highlight tooltips when always-sec-select is active.
DigitBase_t * GetDigit(Int_t n) const
Definition: TEveDigitSet.h:129
const char Option_t
Definition: RtypesCore.h:62
Bool_t GetValueIsColor() const
Definition: TEveDigitSet.h:157
Bool_t fSelectViaFrame
Definition: TEveDigitSet.h:73
TooltipCB_foo GetTooltipCBFoo() const
Definition: TEveDigitSet.h:178
Int_t fDefaultValue
Definition: TEveDigitSet.h:60
void(* Callback_foo)(TEveDigitSet *, Int_t, TObject *)
Definition: TEveDigitSet.h:44
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:21
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
ERenderMode_e GetRenderMode() const
Definition: TEveDigitSet.h:163
An array of references to TObjects.
Definition: TRefArray.h:43
void SetDisableLighting(Bool_t l)
Definition: TEveDigitSet.h:167
Bool_t GetOwnIds() const
Definition: TEveDigitSet.h:120
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.
void * GetUserData() const
Definition: TEveElement.h:302
TEveDigitSet(const TEveDigitSet &)
virtual TObject * GetObject(const TEveException &) const
Get a TObject associated with this render-element.
Definition: TEveDigitSet.h:89
virtual void Paint(Option_t *option="")
Paint this object. Only direct rendering is supported.
Bool_t fAntiFlick
Definition: TEveDigitSet.h:63
Bool_t fOwnIds
Definition: TEveDigitSet.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:254
TEveFrameBox * GetFrame() const
Definition: TEveDigitSet.h:148
Bool_t fHistoButtons
Definition: TEveDigitSet.h:76
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Bool_t GetEmitSignals() const
Definition: TEveDigitSet.h:172
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
virtual TString GetHighlightTooltip()
Return tooltip for highlighted element if always-sec-select is set.
TString(* TooltipCB_foo)(TEveDigitSet *, Int_t)
Definition: TEveDigitSet.h:45
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
Char_t * Atom(Int_t idx) const
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.
void SetCallbackFoo(Callback_foo f)
Definition: TEveDigitSet.h:176
void SetFrame(TEveFrameBox *b)
Set TEveFrameBox pointer.
virtual ~TEveDigitSet()
Destructor.
TRandom2 r(17)
SVector< double, 2 > v
Definition: Dict.h:5
Bool_t fDisableLighting
Definition: TEveDigitSet.h:75
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
Bool_t GetAntiFlick() const
Definition: TEveDigitSet.h:94
TEveDigitSet & operator=(const TEveDigitSet &)
TObject * GetId(Int_t n) const
Return external TObject associated with digit n.
TLine * l
Definition: textangle.C:4
Vector-like container with chunked memory allocation.
ERenderMode_e fRenderMode
Definition: TEveDigitSet.h:72
Bool_t GetSelectViaFrame() const
Definition: TEveDigitSet.h:151
Bool_t fHighlightFrame
Definition: TEveDigitSet.h:74
double f(double x)
void SetPalette(TEveRGBAPalette *p)
Set TEveRGBAPalette pointer.
void RefitPlex()
Instruct underlying memory allocator to regroup itself into a contiguous memory chunk.
Bool_t GetHighlightFrame() const
Definition: TEveDigitSet.h:154
Callback_foo fCallbackFoo
Definition: TEveDigitSet.h:79
Mother of all ROOT objects.
Definition: TObject.h:37
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
typedef void((*Func_t)())
DigitBase_t * fLastDigit
Definition: TEveDigitSet.h:66
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.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Exception class thrown by TEve classes and macros.
Definition: TEveUtil.h:102
virtual void SetMainColor(Color_t color)
Override from TEveElement, forward to Frame.
unsigned char UChar_t
Definition: RtypesCore.h:34
Callback_foo GetCallbackFoo() const
Definition: TEveDigitSet.h:175
void ReleaseIds()
Protected method.
void DigitValue(Int_t value)
Set signal value for the last digit added.
void SetHighlightFrame(Bool_t hf)
Definition: TEveDigitSet.h:155
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
TEveRGBAPalette * GetPalette() const
Definition: TEveDigitSet.h:159