Logo ROOT  
Reference Guide
REveDataCollection.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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
13#ifndef ROOT7_REveDataCollection
14#define ROOT7_REveDataCollection
15
16#include <ROOT/REveElement.hxx>
17#include <ROOT/REveCompound.hxx>
20
21#include <functional>
22#include <vector>
23#include <iostream>
24
25class TClass;
26
27namespace ROOT {
28namespace Experimental {
29
30//==============================================================================
32{
33private:
34 void* fDataPtr{nullptr};
35
39
40public:
41
43
44 Bool_t GetRnrSelf() const { return fRnrSelf; }
45 Color_t GetMainColor() const { return fColor; }
46 Bool_t GetFiltered() const { return fFiltered; }
47 Bool_t GetVisible() const { return (!fFiltered) && fRnrSelf; }
48
49 void* GetDataPtr() { return fDataPtr; }
50
51 void SetFiltered(Bool_t i) { fFiltered = i; }
52 void SetMainColor(Color_t i) { fColor = i; }
53 void SetRnrSelf(Bool_t i) { fRnrSelf = i; }
54};
55
56//==============================================================================
59{
60 friend class REveDataCollection;
61
62public:
63 typedef std::function<void (REveDataItemList*, const std::vector<int>&)> ItemsChangeFunc_t;
65
66 struct TTip {
67 std::string fTooltipTitle;
69 };
70
71private:
72 std::vector<REveDataItem*> fItems;
75
76 std::vector< std::unique_ptr<TTip> > fTooltipExpressions;
77
78public:
79 REveDataItemList(const std::string& n = "Items", const std::string& t = "");
80 virtual ~REveDataItemList() {}
81 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
82
83 virtual void ItemChanged(REveDataItem *item);
84 virtual void ItemChanged(Int_t idx);
85 void FillImpliedSelectedSet(Set_t &impSelSet) override;
86
87 void SetItemVisible(Int_t idx, Bool_t visible);
89
90 Bool_t SingleRnrState() const override { return kTRUE; }
91 Bool_t SetRnrState(Bool_t) override;
92
93 void ProcessSelectionStr(ElementId_t id, bool multi, bool secondary, const char* in_secondary_idcs);
94 void ProcessSelection(ElementId_t id, bool multi, bool secondary, const std::set<int>& in_secondary_idcs);
95
96 void AddTooltipExpression(const std::string &title, const std::string &expr, bool init = true);
97
99 std::string GetHighlightTooltip(const std::set<int>& secondary_idcs) const override;
100
103
104 static void DummyItemsChange(REveDataItemList*, const std::vector<int>&);
105 static void DummyFillImpliedSelected(REveDataItemList*, Set_t& impSelSet);
106
107 std::vector< std::unique_ptr<TTip> >& RefToolTipExpressions() {return fTooltipExpressions;}
108};
109
110//==============================================================================
111
113{
114private:
116
117public:
118 typedef std::vector<int> Ids_t;
120
121 TClass *fItemClass{nullptr}; // so far only really need class name
122
124 std::function<bool(void *)> fFilterFoo = [](void *) { return true; };
125
126 REveDataCollection(const std::string& n = "REveDataCollection", const std::string& t = "");
128
129 void ReserveItems(Int_t items_size) { fItemList->fItems.reserve(items_size); }
130 void AddItem(void *data_ptr, const std::string& n, const std::string& t);
131 void ClearItems() { fItemList->fItems.clear(); }
132
133 Bool_t SingleRnrState() const override { return kTRUE; }
134 Bool_t SetRnrState(Bool_t) override;
135
136
137 TClass *GetItemClass() const { return fItemClass; }
138 void SetItemClass(TClass *cls) { fItemClass = cls;
139 }
141
142 void SetFilterExpr(const char* filter);
143 void ApplyFilter();
144
145 const char* GetFilterExpr(){return fFilterExpr.Data();}
146
147 Int_t GetNItems() const { return (Int_t) fItemList->fItems.size(); }
148 void *GetDataPtr(Int_t i) const { return fItemList->fItems[i]->GetDataPtr(); }
149 const REveDataItem* GetDataItem(Int_t i) const { return fItemList->fItems[i]; }
150
151 void StreamPublicMethods(nlohmann::json &cj) const;
152 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
153
154 void SetMainColor(Color_t) override;
155
156};
157
158} // namespace Experimental
159} // namespace ROOT
160
161#endif
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
ROOT::R::TRInterface & r
Definition: Object.C:4
#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
int Int_t
Definition: RtypesCore.h:45
unsigned char UChar_t
Definition: RtypesCore.h:38
bool Bool_t
Definition: RtypesCore.h:63
short Color_t
Definition: RtypesCore.h:92
const Bool_t kTRUE
Definition: RtypesCore.h:100
std::function< bool(void *)> fFilterFoo
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
REveDataCollection(const std::string &n="REveDataCollection", const std::string &t="")
REveDataItemList(const std::string &n="Items", const std::string &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 FillImpliedSelectedSet(Set_t &impSelSet) override
Populate set impSelSet with derived / dependant elements.
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 SetItemsChangeDelegate(ItemsChangeFunc_t)
static void DummyFillImpliedSelected(REveDataItemList *, Set_t &impSelSet)
void SetFillImpliedSelectedDelegate(FillImpliedSelectedFunc_t)
std::vector< REveDataItem * > fItems
static void DummyItemsChange(REveDataItemList *, const std::vector< int > &)
std::function< void(REveDataItemList *, Set_t &)> FillImpliedSelectedFunc_t
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
Definition: REveElement.hxx:64
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
const Int_t n
Definition: legend1.C:16
unsigned int ElementId_t
Definition: REveTypes.hxx:25
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:150
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
basic_json< std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, adl_serializer, std::vector< std::uint8_t > > json
Definition: REveElement.hxx:36