Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveDataCollection.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel and Alja Mrak Tadel: 2006, 2007, 2018
3//
4// Based of initial implementation of generic collection access interface
5// for CMS framework and Fireworks event display by Christopher D. Jones.
6
7/*************************************************************************
8 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
9 * All rights reserved. *
10 * *
11 * For the licensing terms see $ROOTSYS/LICENSE. *
12 * For the list of contributors see $ROOTSYS/README/CREDITS. *
13 *************************************************************************/
14
15
16#ifndef ROOT7_REveDataCollection
17#define ROOT7_REveDataCollection
18
19#include <ROOT/REveElement.hxx>
20#include <ROOT/REveCompound.hxx>
23
24#include <functional>
25#include <vector>
26#include <iostream>
27
28class TClass;
29
30namespace ROOT {
31namespace Experimental {
32
33//==============================================================================
35{
36private:
37 void* fDataPtr{nullptr};
38
42
43public:
44
46
47 Bool_t GetRnrSelf() const { return fRnrSelf; }
48 Color_t GetMainColor() const { return fColor; }
49 Bool_t GetFiltered() const { return fFiltered; }
50 Bool_t GetVisible() const { return (!fFiltered) && fRnrSelf; }
51
52 void* GetDataPtr() { return fDataPtr; }
53
54 void SetFiltered(Bool_t i) { fFiltered = i; }
55 void SetMainColor(Color_t i) { fColor = i; }
56 void SetRnrSelf(Bool_t i) { fRnrSelf = i; }
57};
58
59//==============================================================================
62{
63 friend class REveDataCollection;
64
65public:
66 typedef std::function<void (REveDataItemList*, const std::vector<int>&)> ItemsChangeFunc_t;
67 typedef std::function<void (REveDataItemList*, Set_t&, const std::set<int>&)> FillImpliedSelectedFunc_t;
68
69 struct TTip {
70 std::string fTooltipTitle;
72 };
73
74private:
75 std::vector<REveDataItem*> fItems;
78
79 std::vector< std::unique_ptr<TTip> > fTooltipExpressions;
80
81public:
82 REveDataItemList(const std::string& n = "Items", const std::string& t = "");
83 ~REveDataItemList() override {}
84 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
85
86 virtual void ItemChanged(REveDataItem *item);
87 virtual void ItemChanged(Int_t idx);
88 void FillImpliedSelectedSet(Set_t &impSelSet, const std::set<int>& sec_idcs) override;
89
90 void SetItemVisible(Int_t idx, Bool_t visible);
92
93 Bool_t SingleRnrState() const override { return kTRUE; }
94 Bool_t SetRnrState(Bool_t) override;
95
96 void ProcessSelectionStr(ElementId_t id, bool multi, bool secondary, const char* in_secondary_idcs);
97 void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set<int>& in_secondary_idcs);
98
99 void AddTooltipExpression(const std::string &title, const std::string &expr, bool init = true);
100
102 std::string GetHighlightTooltip(const std::set<int>& secondary_idcs) const override;
103
106
107 static void DummyItemsChange(REveDataItemList*, const std::vector<int>&);
108 static void DummyFillImpliedSelected(REveDataItemList*, Set_t& impSelSet, const std::set<int>& sec_idcs);
109
110 std::vector< std::unique_ptr<TTip> >& RefToolTipExpressions() {return fTooltipExpressions;}
111};
112
113//==============================================================================
114
116{
117private:
119 int fLayer{0};
120
121public:
122 typedef std::vector<int> Ids_t;
124
125 TClass *fItemClass{nullptr}; // so far only really need class name
126
128 std::function<bool(void *)> fFilterFoo = [](void *) { return true; };
129
130 REveDataCollection(const std::string& n = "REveDataCollection", const std::string& t = "");
132
133 void ReserveItems(Int_t items_size) { fItemList->fItems.reserve(items_size); }
134 void AddItem(void *data_ptr, const std::string& n, const std::string& t);
135 void ClearItems() { fItemList->fItems.clear(); }
136
137 Bool_t SingleRnrState() const override { return kTRUE; }
138 Bool_t SetRnrState(Bool_t) override;
139
140
141 TClass *GetItemClass() const { return fItemClass; }
142 void SetItemClass(TClass *cls) { fItemClass = cls;}
143
144 int GetLayer() const { return fLayer; }
145 void SetLayer(int i) { fLayer = i; }
146
148
149 void SetFilterExpr(const char* filter);
150 void ApplyFilter();
151
152 const char* GetFilterExpr(){return fFilterExpr.Data();}
153
154 Int_t GetNItems() const { return (Int_t) fItemList->fItems.size(); }
155 void *GetDataPtr(Int_t i) const { return fItemList->fItems[i]->GetDataPtr(); }
156 const REveDataItem* GetDataItem(Int_t i) const { return fItemList->fItems[i]; }
157
158 void StreamPublicMethods(nlohmann::json &cj) const;
159 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
160
161 void SetMainColor(Color_t) override;
162
163};
164
165} // namespace Experimental
166} // namespace ROOT
167
168#endif
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:85
unsigned char UChar_t
Definition RtypesCore.h:38
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
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
void StreamPublicMethods(nlohmann::json &cj) const
void AddItem(void *data_ptr, const std::string &n, const std::string &t)
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
void SetMainColor(Color_t) override
Set main color of the element.
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
const REveDataItem * GetDataItem(Int_t i) const
std::function< void(REveDataItemList *, Set_t &, const std::set< int > &)> FillImpliedSelectedFunc_t
virtual void ItemChanged(REveDataItem *item)
Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override
Write core json.
void AddTooltipExpression(const std::string &title, const std::string &expr, bool init=true)
FillImpliedSelectedFunc_t fHandlerFillImplied
void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set< int > &in_secondary_idcs)
void ProcessSelectionStr(ElementId_t id, bool multi, bool secondary, const char *in_secondary_idcs)
void SetItemColorRGB(Int_t idx, UChar_t r, UChar_t g, UChar_t b)
std::vector< std::unique_ptr< TTip > > fTooltipExpressions
Bool_t SetRnrState(Bool_t) override
Set render state of this element and of its children to the same value.
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
void SetFillImpliedSelectedDelegate(FillImpliedSelectedFunc_t)
std::vector< REveDataItem * > fItems
void FillImpliedSelectedSet(Set_t &impSelSet, const std::set< int > &sec_idcs) override
Populate set impSelSet with derived / dependant elements.
static void DummyItemsChange(REveDataItemList *, const std::vector< int > &)
static void DummyFillImpliedSelected(REveDataItemList *, Set_t &impSelSet, const std::set< int > &sec_idcs)
std::vector< std::unique_ptr< TTip > > & RefToolTipExpressions()
void SetItemVisible(Int_t idx, Bool_t visible)
std::function< void(REveDataItemList *, const std::vector< int > &)> ItemsChangeFunc_t
virtual std::string GetHighlightTooltip(const std::set< int > &) const
std::set< REveElement * > Set_t
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
const Int_t n
Definition legend1.C:16
unsigned int ElementId_t
Definition REveTypes.hxx:25
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...