Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
17#include "ROOT/REveUtil.hxx"
18#include "ROOT/REveElement.hxx"
19#include "ROOT/REveFrameBox.hxx"
23
24class TRefArray;
25
26namespace ROOT {
27namespace Experimental {
28
30 friend class REveDigitSetEditor;
31 friend class REveDigitSetGL;
32
33 REveDigitSet(const REveDigitSet&); // Not implemented
34 REveDigitSet& operator=(const REveDigitSet&); // Not implemented
35
36public:
38
39 typedef void (*Callback_foo)(const REveDigitSet*, Int_t, TObject*);
40 typedef std::string (*TooltipCB_foo)(const REveDigitSet*, Int_t);
41
43 {
44 // Base-class for digit representation classes.
45
46 Int_t fValue; // signal value of a digit (can be direct RGBA color)
47 void *fUserData{nullptr}; // user-data for given digit
48
49 DigitBase_t(Int_t v=0) : fValue(v), fUserData(nullptr) {}
50 };
51
52protected:
53 TRefArray *fDigitIds{nullptr}; // Array holding references to external objects.
54
55 Int_t fDefaultValue; // Default signal value.
56 Bool_t fValueIsColor{false}; // Interpret signal value as RGBA color.
57 Bool_t fSingleColor; // Use the same color for all digits.
58 Bool_t fAntiFlick; // Make extra render pass to avoid flickering when quads are too small.
59
60 Bool_t fOwnIds{false}; // Flag specifying if id-objects are owned by the TEveDigitSet.
61 Bool_t fDetIdsAsSecondaryIndices; // Flag specifying if id-objects are owned by the REveDigitSet.
62 REveChunkManager fPlex; // Container of digit data.
63 DigitBase_t* fLastDigit; ///<! The last / current digit added to collection.
64 Int_t fLastIdx; ///<! The last / current idx added to collection.
65
66 Color_t fColor; // Color used for frame (or all digis with single-color).
67 REveFrameBox* fFrame; // Pointer to frame structure.
68 REveRGBAPalette* fPalette; // Pointer to signal-color palette.
69 ERenderMode_e fRenderMode; // Render mode: as-is / line / filled.
70 Bool_t fSelectViaFrame; // Allow selection via frame.
71 Bool_t fHighlightFrame; // Highlight frame when object is selected.
72 Bool_t fDisableLighting;// Disable lighting for rendering.
73 Bool_t fHistoButtons; // Show histogram buttons in object editor.
74
75 Bool_t fEmitSignals; // Emit signals on secondary-select.
76 Callback_foo fCallbackFoo; ///<! Additional function to call on secondary-select.
77 TooltipCB_foo fTooltipCBFoo; ///<! Function providing highlight tooltips when always-sec-select is active.
78
80 void ReleaseIds();
81
82public:
83 REveDigitSet(const char* n="REveDigitSet", const char* t="");
84 ~REveDigitSet() override;
85
86 void UseSingleColor();
87
88 Bool_t GetAntiFlick() const { return fAntiFlick; }
90
91 void SetMainColor(Color_t color) override;
92
93 /*
94 virtual void UnSelected();
95 virtual void UnHighlighted();
96*/
98 std::string GetHighlightTooltip(const std::set<int>& secondary_idcs) const override;
99
100 // Implemented in sub-classes:
101 // virtual void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
102
103 void RefitPlex();
104 void ScanMinMaxValues(Int_t& min, Int_t& max);
105
106 // --------------------------------
107
108 void SetCurrentDigit(Int_t idx);
109
110 void DigitValue(Int_t value);
111 void DigitColor(Color_t ci);
112 void DigitColor(Color_t ci, Char_t transparency);
114 void DigitColor(UChar_t* rgba);
115
116 void DigitId(TObject* id);
117 void DigitId(Int_t n, TObject* id);
118
121
123 TObject* GetId(Int_t n) const;
124
125 // --------------------------------
126
127 // Implemented in subclasses:
128 // virtual void ComputeBBox();
129 /*
130 virtual void Paint(Option_t* option="");
131
132 virtual void DigitSelected(Int_t idx);
133 virtual void SecSelected(REveDigitSet* qs, Int_t idx); // *SIGNAL*
134 */
135 // --------------------------------
136
138
139 REveFrameBox* GetFrame() const { return fFrame; }
140 void SetFrame(REveFrameBox* b);
141
144
147
149
153
156
159
162
165
168
171
172 bool IsDigitVisible(const DigitBase_t*) const;
173 int GetAtomIdxFromShapeIdx(int) const;
174 int GetShapeIdxFromAtomIdx(int) const;
175
176 void NewShapePicked(int shapeId, Int_t selectionId, bool multi);
177
178 bool RequiresExtraSelectionData() const override { return GetAlwaysSecSelect(); };
179 void FillExtraSelectionData(nlohmann::json& j, const std::set<int>& secondary_idcs) const override;
180
181 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
182};
183
184} // namespace Experimental
185} // namespace ROOT
186#endif
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
#define a(i)
Definition RSha256.hxx:99
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:53
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:52
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
void SetMainColor(Color_t color) override
Override from REveElement, forward to Frame.
void DigitId(TObject *id)
Set external object reference for the last digit added.
void NewShapePicked(int shapeId, Int_t selectionId, bool multi)
~REveDigitSet() override
Destructor.
REveRGBAPalette * GetPalette() const
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
TooltipCB_foo GetTooltipCBFoo() const
REveDigitSet(const REveDigitSet &)
REveFrameBox * GetFrame() const
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette pointer.
std::string(* TooltipCB_foo)(const REveDigitSet *, Int_t)
void FillExtraSelectionData(nlohmann::json &j, const std::set< int > &secondary_idcs) const override
void SetTooltipCBFoo(TooltipCB_foo f)
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
DigitBase_t * NewDigit()
Protected method called whenever a new digit is added.
void DigitColor(Color_t ci)
Set color for the last digit added.
void SetCurrentDigit(Int_t idx)
Set current digit – the one that will receive calls to DigitValue/Color/Id/UserData() functions.
int GetAtomIdxFromShapeIdx(int) const
Utility function for maping digit idx with visible shape idx.
bool IsDigitVisible(const DigitBase_t *) const
Utility function for maping digit idx with visible shape idx.
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
Return tooltip for highlighted element if always-sec-select is set.
void ScanMinMaxValues(Int_t &min, Int_t &max)
Iterate over the digits and determine min and max signal values.
void UseSingleColor()
Instruct digit-set to use single color for its digits.
void(* Callback_foo)(const REveDigitSet *, Int_t, TObject *)
void RefitPlex()
Instruct underlying memory allocator to regroup itself into a contiguous memory chunk.
void SetRenderMode(ERenderMode_e rm)
DigitBase_t * GetDigit(Int_t n) const
REveDigitSet & operator=(const REveDigitSet &)
Int_t fLastIdx
! The last / current idx added to collection.
void SetCallbackFoo(Callback_foo f)
void ReleaseIds()
Protected method.
DigitBase_t * fLastDigit
! The last / current digit added to collection.
int GetShapeIdxFromAtomIdx(int) const
Utility function for maping shape idx to digit idx.
void DigitValue(Int_t value)
Set signal value for the last digit added.
Callback_foo GetCallbackFoo() const
void SetFrame(REveFrameBox *b)
Set REveFrameBox pointer.
TooltipCB_foo fTooltipCBFoo
! Function providing highlight tooltips when always-sec-select is active.
TObject * GetId(Int_t n) const
Set external object reference for digit n.
ERenderMode_e GetRenderMode() const
Callback_foo fCallbackFoo
! Additional function to call on secondary-select.
bool RequiresExtraSelectionData() const override
virtual std::string GetHighlightTooltip(const std::set< int > &) const
Mother of all ROOT objects.
Definition TObject.h:42
An array of references to TObjects.
Definition TRefArray.h:33
const Int_t n
Definition legend1.C:16
TLine l
Definition textangle.C:4