Logo ROOT  
Reference Guide
REveDigitSet.hxx
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_REveDigitSet
13 #define ROOT_REveDigitSet
14 
15 #include "TNamed.h"
16 #include "TAtt3D.h"
17 #include "TAttBBox.h"
18 
19 #include "ROOT/REveUtil.hxx"
20 #include "ROOT/REveElement.hxx"
21 #include "ROOT/REveFrameBox.hxx"
22 #include "ROOT/REveRGBAPalette.hxx"
25 
26 class TRefArray;
27 
28 namespace ROOT {
29 namespace Experimental {
30 
31 class REveDigitSet : public REveElement,
32  public TAtt3D,
33  public TAttBBox,
35 {
36  friend class REveDigitSetEditor;
37  friend class REveDigitSetGL;
38 
39  REveDigitSet(const REveDigitSet&); // Not implemented
40  REveDigitSet& operator=(const REveDigitSet&); // Not implemented
41 
42 public:
44 
47 
48  struct DigitBase_t
49  {
50  // Base-class for digit representation classes.
51 
52  Int_t fValue; // signal value of a digit (can be direct RGBA color)
53  void *fUserData{nullptr}; // user-data for given digit
54 
56  };
57 
58 protected:
59  TRefArray *fDigitIds; // Array holding references to external objects.
60 
61  Int_t fDefaultValue; // Default signal value.
62  Bool_t fValueIsColor; // Interpret signal value as RGBA color.
63  Bool_t fSingleColor; // Use the same color for all digits.
64  Bool_t fAntiFlick; // Make extra render pass to avoid flickering when quads are too small.
65  Bool_t fOwnIds; // Flag specifying if id-objects are owned by the REveDigitSet.
66  REveChunkManager fPlex; // Container of digit data.
67  DigitBase_t* fLastDigit; //! The last / current digit added to collection.
68  Int_t fLastIdx; //! The last / current idx added to collection.
69 
70  Color_t fColor; // Color used for frame (or all digis with single-color).
71  REveFrameBox* fFrame; // Pointer to frame structure.
72  REveRGBAPalette* fPalette; // Pointer to signal-color palette.
73  ERenderMode_e fRenderMode; // Render mode: as-is / line / filled.
74  Bool_t fSelectViaFrame; // Allow selection via frame.
75  Bool_t fHighlightFrame; // Highlight frame when object is selected.
76  Bool_t fDisableLighting;// Disable lighting for rendering.
77  Bool_t fHistoButtons; // Show histogram buttons in object editor.
78 
79  Bool_t fEmitSignals; // Emit signals on secondary-select.
80  Callback_foo fCallbackFoo; //! Additional function to call on secondary-select.
81  TooltipCB_foo fTooltipCBFoo; //! Function providing highlight tooltips when always-sec-select is active.
82 
84  void ReleaseIds();
85 
86 public:
87  REveDigitSet(const char* n="REveDigitSet", const char* t="");
88  virtual ~REveDigitSet();
89 
90  void UseSingleColor();
91 
92  Bool_t GetAntiFlick() const { return fAntiFlick; }
94 
95  virtual void SetMainColor(Color_t color) override;
96 
97  /*
98  virtual void UnSelected();
99  virtual void UnHighlighted();
100 
101  using REveElement::GetHighlightTooltip;
102  virtual TString GetHighlightTooltip();
103  */
104 
105  // Implemented in sub-classes:
106  // virtual void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
107 
108  void RefitPlex();
109  void ScanMinMaxValues(Int_t& min, Int_t& max);
110 
111  // --------------------------------
112 
113  void SetCurrentDigit(Int_t idx);
114 
115  void DigitValue(Int_t value);
116  void DigitColor(Color_t ci);
117  void DigitColor(Color_t ci, Char_t transparency);
119  void DigitColor(UChar_t* rgba);
120 
121  Bool_t GetOwnIds() const { return fOwnIds; }
122  void SetOwnIds(Bool_t o) { fOwnIds = o; }
123 
124  void DigitId(TObject* id);
125  void DigitUserData(void* ud);
126 
127  void DigitId(Int_t n, TObject* id);
128  void DigitUserData(Int_t n, void* ud);
129 
130  DigitBase_t* GetDigit(Int_t n) const { return (DigitBase_t*) fPlex.Atom(n); }
131  TObject* GetId(Int_t n) const;
132  void* GetUserData(Int_t n) const;
134 
135  // --------------------------------
136 
137  // Implemented in subclasses:
138  // virtual void ComputeBBox();
139  /*
140  virtual void Paint(Option_t* option="");
141 
142  virtual void DigitSelected(Int_t idx);
143  virtual void SecSelected(REveDigitSet* qs, Int_t idx); // *SIGNAL*
144  */
145  // --------------------------------
146 
148 
149  REveFrameBox* GetFrame() const { return fFrame; }
150  void SetFrame(REveFrameBox* b);
151 
154 
157 
159 
160  REveRGBAPalette* GetPalette() const { return fPalette; }
161  void SetPalette(REveRGBAPalette* p);
163 
166 
169 
172 
173  Bool_t GetEmitSignals() const { return fEmitSignals; }
175 
178 
181 
182  Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
183 };
184 
185 } // namespace Experimental
186 } // namespace ROOT
187 #endif
l
auto * l
Definition: textangle.C:4
n
const Int_t n
Definition: legend1.C:16
ROOT::Experimental::REveDigitSet::GetOwnIds
Bool_t GetOwnIds() const
Definition: REveDigitSet.hxx:121
ROOT::Experimental::REveDigitSet::SetOwnIds
void SetOwnIds(Bool_t o)
Definition: REveDigitSet.hxx:122
ROOT::Experimental::REveDigitSet::AssertPalette
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
Definition: REveDigitSet.cxx:457
ROOT::Experimental::REveDigitSet::fSingleColor
Bool_t fSingleColor
Definition: REveDigitSet.hxx:63
ROOT::Experimental::REveDigitSet::operator=
REveDigitSet & operator=(const REveDigitSet &)
ROOT::Experimental::REveDigitSet::ERenderMode_e
ERenderMode_e
Definition: REveDigitSet.hxx:43
ROOT::Experimental::REveDigitSet::GetAntiFlick
Bool_t GetAntiFlick() const
Definition: REveDigitSet.hxx:92
ROOT::Experimental::REveDigitSet
Definition: REveDigitSet.hxx:35
ROOT::Experimental::REveDigitSet::SetHighlightFrame
void SetHighlightFrame(Bool_t hf)
Definition: REveDigitSet.hxx:156
f
#define f(i)
Definition: RSha256.hxx:104
ROOT::Experimental::REveDigitSet::SetCurrentDigit
void SetCurrentDigit(Int_t idx)
Set current digit – the one that will receive calls to DigitValue/Color/Id/UserData() functions.
Definition: REveDigitSet.cxx:276
ROOT::Experimental::REveDigitSet::fLastIdx
Int_t fLastIdx
The last / current digit added to collection.
Definition: REveDigitSet.hxx:68
ROOT::Experimental::REveDigitSet::GetPlex
REveChunkManager * GetPlex()
Definition: REveDigitSet.hxx:147
nlohmann::json
basic_json<> json
Definition: REveElement.hxx:58
ROOT::Experimental::REveSecondarySelectable
Definition: REveSecondarySelectable.hxx:25
REveChunkManager.hxx
ROOT::Experimental::REveDigitSet::fColor
Color_t fColor
The last / current idx added to collection.
Definition: REveDigitSet.hxx:70
ROOT::Experimental::REveDigitSet::fCallbackFoo
Callback_foo fCallbackFoo
Definition: REveDigitSet.hxx:80
ROOT::Experimental::REveDigitSet::REveDigitSetEditor
friend class REveDigitSetEditor
Definition: REveDigitSet.hxx:36
ROOT::Experimental::REveDigitSet::fFrame
REveFrameBox * fFrame
Definition: REveDigitSet.hxx:71
ROOT::Experimental::REveDigitSet::fHighlightFrame
Bool_t fHighlightFrame
Definition: REveDigitSet.hxx:75
ROOT::Experimental::REveDigitSet::SetCallbackFoo
void SetCallbackFoo(Callback_foo f)
Definition: REveDigitSet.hxx:177
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::Experimental::REveDigitSet::SetSelectViaFrame
void SetSelectViaFrame(Bool_t sf)
Definition: REveDigitSet.hxx:153
ROOT::Experimental::REveDigitSet::SetEmitSignals
void SetEmitSignals(Bool_t f)
Definition: REveDigitSet.hxx:174
TNamed.h
ROOT::Experimental::REveDigitSet::fAntiFlick
Bool_t fAntiFlick
Definition: REveDigitSet.hxx:64
ROOT::Experimental::REveDigitSet::REveDigitSet
REveDigitSet(const REveDigitSet &)
REveSecondarySelectable.hxx
ROOT::Experimental::REveDigitSet::GetSelectViaFrame
Bool_t GetSelectViaFrame() const
Definition: REveDigitSet.hxx:152
ROOT::Experimental::REveDigitSet::ReleaseIds
void ReleaseIds()
Protected method.
Definition: REveDigitSet.cxx:145
Int_t
int Int_t
Definition: RtypesCore.h:45
ROOT::Experimental::REveDigitSet::REveDigitSet
REveDigitSet(const char *n="REveDigitSet", const char *t="")
ROOT::Experimental::REveDigitSet::GetDisableLighting
Bool_t GetDisableLighting() const
Definition: REveDigitSet.hxx:167
ROOT::Experimental::REveFrameBox
Definition: REveFrameBox.hxx:21
TRefArray
An array of references to TObjects.
Definition: TRefArray.h:39
ROOT::Experimental::REveDigitSet::DigitBase_t::DigitBase_t
DigitBase_t(Int_t v=0)
Definition: REveDigitSet.hxx:55
ROOT::Experimental::REveDigitSet::fRenderMode
ERenderMode_e fRenderMode
Definition: REveDigitSet.hxx:73
ROOT::Experimental::REveDigitSet::SetFrame
void SetFrame(REveFrameBox *b)
Set REveFrameBox pointer.
Definition: REveDigitSet.cxx:426
ROOT::Experimental::REveDigitSet::ScanMinMaxValues
void ScanMinMaxValues(Int_t &min, Int_t &max)
Iterate over the digits and determine min and max signal values.
Definition: REveDigitSet.cxx:244
TString
Basic string class.
Definition: TString.h:136
ROOT::Experimental::REveDigitSet::GetHighlightFrame
Bool_t GetHighlightFrame() const
Definition: REveDigitSet.hxx:155
ROOT::Experimental::REveDigitSet::kRM_AsIs
@ kRM_AsIs
Definition: REveDigitSet.hxx:43
ROOT::Experimental::REveElement
Definition: REveElement.hxx:80
TAtt3D
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:19
Color_t
short Color_t
Definition: RtypesCore.h:83
v
@ v
Definition: rootcling_impl.cxx:3635
b
#define b(i)
Definition: RSha256.hxx:100
ROOT::Experimental::REveDigitSet::GetUserData
void * GetUserData() const
Definition: REveElement.hxx:295
bool
ROOT::Experimental::REveDigitSet::DigitBase_t
Definition: REveDigitSet.hxx:49
ROOT::Experimental::REveDigitSet::GetHistoButtons
Bool_t GetHistoButtons() const
Definition: REveDigitSet.hxx:170
TAttBBox
Helper for management of bounding-box information.
Definition: TAttBBox.h:18
ROOT::Experimental::REveDigitSet::SetHistoButtons
void SetHistoButtons(Bool_t f)
Definition: REveDigitSet.hxx:171
ROOT::Experimental::REveDigitSet::DigitColor
void DigitColor(Color_t ci)
Set color for the last digit added.
Definition: REveDigitSet.cxx:293
ROOT::Experimental::REveDigitSet::DigitBase_t::fUserData
void * fUserData
Definition: REveDigitSet.hxx:53
ROOT::Experimental::REveChunkManager
Definition: REveChunkManager.hxx:29
ROOT::Experimental::REveDigitSet::GetPalette
REveRGBAPalette * GetPalette() const
Definition: REveDigitSet.hxx:160
ROOT::Experimental::REveDigitSet::fSelectViaFrame
Bool_t fSelectViaFrame
Definition: REveDigitSet.hxx:74
ROOT::Experimental::REveDigitSet::GetCallbackFoo
Callback_foo GetCallbackFoo() const
Definition: REveDigitSet.hxx:176
ROOT::Experimental::REveDigitSet::NewDigit
DigitBase_t * NewDigit()
Function providing highlight tooltips when always-sec-select is active.
Definition: REveDigitSet.cxx:134
ROOT::Experimental::REveDigitSet::WriteCoreJson
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition: REveDigitSet.cxx:474
ROOT::Experimental::REveDigitSet::DigitBase_t::fValue
Int_t fValue
Definition: REveDigitSet.hxx:52
ROOT::Experimental::REveDigitSet::DigitValue
void DigitValue(Int_t value)
Set signal value for the last digit added.
Definition: REveDigitSet.cxx:285
ROOT::Experimental::REveDigitSet::REveDigitSetGL
friend class REveDigitSetGL
Definition: REveDigitSet.hxx:37
TAtt3D.h
ROOT::Experimental::REveDigitSet::SetDisableLighting
void SetDisableLighting(Bool_t l)
Definition: REveDigitSet.hxx:168
ROOT::Experimental::REveDigitSet::SetRenderMode
void SetRenderMode(ERenderMode_e rm)
Definition: REveDigitSet.hxx:165
ROOT::Experimental::REveDigitSet::GetId
TObject * GetId(Int_t n) const
Return external TObject associated with digit n.
Definition: REveDigitSet.cxx:365
REveElement.hxx
ROOT::Experimental::REveDigitSet::DigitUserData
void DigitUserData(void *ud)
Set user-data for the last digit added.
Definition: REveDigitSet.cxx:335
TAttBBox.h
ROOT::Experimental::REveDigitSet::fDefaultValue
Int_t fDefaultValue
Definition: REveDigitSet.hxx:61
ROOT::Experimental::REveDigitSet::fPlex
REveChunkManager fPlex
Definition: REveDigitSet.hxx:66
a
auto * a
Definition: textangle.C:12
ROOT::Experimental::REveDigitSet::UseSingleColor
void UseSingleColor()
Instruct digit-set to use single color for its digits.
Definition: REveDigitSet.cxx:162
ROOT::Experimental::REveDigitSet::Callback_foo
void(* Callback_foo)(REveDigitSet *, Int_t, TObject *)
Definition: REveDigitSet.hxx:45
ROOT::Experimental::REveDigitSet::SetPalette
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette pointer.
Definition: REveDigitSet.cxx:444
ROOT::Experimental::REveDigitSet::SetMainColor
virtual void SetMainColor(Color_t color) override
Override from REveElement, forward to Frame.
Definition: REveDigitSet.cxx:170
ROOT::Experimental::REveDigitSet::TooltipCB_foo
TString(* TooltipCB_foo)(REveDigitSet *, Int_t)
Definition: REveDigitSet.hxx:46
ROOT::Experimental::REveDigitSet::SetTooltipCBFoo
void SetTooltipCBFoo(TooltipCB_foo f)
Definition: REveDigitSet.hxx:180
ROOT::Experimental::REveDigitSet::GetDigit
DigitBase_t * GetDigit(Int_t n) const
Definition: REveDigitSet.hxx:130
ROOT::Experimental::REveDigitSet::fDigitIds
TRefArray * fDigitIds
Definition: REveDigitSet.hxx:59
void
typedef void((*Func_t)())
ROOT::Experimental::REveDigitSet::fOwnIds
Bool_t fOwnIds
Definition: REveDigitSet.hxx:65
ROOT::Experimental::REveDigitSet::kRM_Line
@ kRM_Line
Definition: REveDigitSet.hxx:43
ROOT::Experimental::REveDigitSet::GetValueIsColor
Bool_t GetValueIsColor() const
Definition: REveDigitSet.hxx:158
ROOT::Experimental::REveRGBAPalette
Definition: REveRGBAPalette.hxx:26
ROOT::Experimental::REveDigitSet::fTooltipCBFoo
TooltipCB_foo fTooltipCBFoo
Additional function to call on secondary-select.
Definition: REveDigitSet.hxx:81
ROOT::Experimental::REveDigitSet::GetEmitSignals
Bool_t GetEmitSignals() const
Definition: REveDigitSet.hxx:173
ROOT::Experimental::REveDigitSet::GetFrame
REveFrameBox * GetFrame() const
Definition: REveDigitSet.hxx:149
ROOT::Experimental::REveDigitSet::DigitId
void DigitId(TObject *id)
Set external object reference for the last digit added.
Definition: REveDigitSet.cxx:327
REveUtil.hxx
ROOT::Experimental::REveDigitSet::kRM_Fill
@ kRM_Fill
Definition: REveDigitSet.hxx:43
ROOT::Experimental::REveDigitSet::DigitColor
void DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255)
UChar_t
unsigned char UChar_t
Definition: RtypesCore.h:38
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
REveRGBAPalette.hxx
ROOT::Experimental::REveDigitSet::fEmitSignals
Bool_t fEmitSignals
Definition: REveDigitSet.hxx:79
ROOT::Experimental::REveDigitSet::GetTooltipCBFoo
TooltipCB_foo GetTooltipCBFoo() const
Definition: REveDigitSet.hxx:179
ROOT::Experimental::REveDigitSet::GetRenderMode
ERenderMode_e GetRenderMode() const
Definition: REveDigitSet.hxx:164
ROOT::Experimental::REveDigitSet::SetAntiFlick
void SetAntiFlick(Bool_t f)
Definition: REveDigitSet.hxx:93
ROOT::Experimental::REveDigitSet::fDisableLighting
Bool_t fDisableLighting
Definition: REveDigitSet.hxx:76
ROOT::Experimental::REveElement::GetUserData
void * GetUserData() const
Definition: REveElement.hxx:295
REveFrameBox.hxx
ROOT::Experimental::REveDigitSet::~REveDigitSet
virtual ~REveDigitSet()
Destructor.
Definition: REveDigitSet.cxx:122
Char_t
char Char_t
Definition: RtypesCore.h:33
ROOT::Experimental::REveDigitSet::fValueIsColor
Bool_t fValueIsColor
Definition: REveDigitSet.hxx:62
ROOT::Experimental::REveDigitSet::fPalette
REveRGBAPalette * fPalette
Definition: REveDigitSet.hxx:72
ROOT::Experimental::REveDigitSet::RefitPlex
void RefitPlex()
Instruct underlying memory allocator to regroup itself into a contiguous memory chunk.
Definition: REveDigitSet.cxx:236
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Experimental::REveChunkManager::Atom
Char_t * Atom(Int_t idx) const
Definition: REveChunkManager.hxx:61
ROOT::Experimental::REveDigitSet::fLastDigit
DigitBase_t * fLastDigit
Definition: REveDigitSet.hxx:67
int
ROOT::Experimental::REveDigitSet::fHistoButtons
Bool_t fHistoButtons
Definition: REveDigitSet.hxx:77
g
#define g(i)
Definition: RSha256.hxx:105