28#include <nlohmann/json.hpp>
57 fItems[idx]->SetRnrSelf(visible);
112 j[
"items"] = nlohmann::json::array();
113 for (
auto & chld :
fItems)
116 i[
"fFiltered"] = chld->GetFiltered();
117 i[
"fRnrSelf"] = chld->GetRnrSelf();
118 i[
"fColor"] = chld->GetMainColor();
119 j[
"items"].push_back(i);
130 std::vector<int> ids;
132 for (
size_t i = 0; i <
fItems.size(); ++i ) {
148 static const REveException eh(
"REveDataItemList::ProcessSelectionStr ");
149 static const std::regex comma_re(
"\\s*,\\s*", std::regex::optimize);
150 std::string str(secondary_idcs);
152 std::sregex_token_iterator itr(str.begin(), str.end(), comma_re, -1);
153 std::sregex_token_iterator end;
156 while (itr != end) sis.insert(std::stoi(*itr++));
158 catch (
const std::invalid_argument&) {
159 throw eh +
"invalid secondary index argument '" + *itr +
"' - must be int.";
177 if (secondary_idcs.empty()) {
182 int idx = *secondary_idcs.begin();
184 void*
data = col->GetDataPtr(idx);
185 std::string
name = col->GetName();
186 auto li =
name.size();
187 if (li &&
name[li-1] ==
's')
193 for (
auto &z : secondary_idcs)
196 data = col->GetDataPtr(idx);
199 std::string eval = t->fTooltipFunction.EvalExpr(
data);
200 res += std::string(
TString::Format(
"\n %s = %s", t->fTooltipTitle.c_str(), eval.c_str()));
214 tt->fTooltipFunction.SetPrecision(2);
220 auto re =
tt->fTooltipFunction.GetFunctionExpressionString();
221 gROOT->ProcessLine(re.c_str());
241 printf(
"REveDataItemList::DummyItemsCahngeDelegate not implemented\n");
250 printf(
"REveDataItemList::DummyFillImpliedSelectedDelegate not implemented\n");
261 std::string lname =
n +
"Items";
278 static const REveException eh(
"REveDataCollection::SetFilterExpr ");
281 throw eh +
"item class has to be set before the filter expression.";
285 int ibeg = 0, iend = strlen(filter);
286 while (ibeg < iend && isspace(filter[ibeg])) ++ibeg;
287 while (iend > ibeg && isspace(filter[iend-1])) --iend;
297 s <<
"*((std::function<bool(" <<
fItemClass->
GetName() <<
"*)>*)" << std::hex << std::showbase
303 gROOT->ProcessLine(s.str().c_str());
307 catch (
const std::exception &exc)
319 if (ii->GetFiltered()) {
320 ii->SetFiltered(
false);
345 ii->SetFiltered( ! res );
347 ids.push_back(idx++);
358 j[
"fPublicFunctions"] = nlohmann::json::array();
362 while ((meth = (
TMethod *)next())) {
367 if (
m ==
"Class" ||
m ==
"Class_Name" ||
m ==
"Class_Version" ||
m ==
"Dictionary" ||
m ==
"IsA" ||
368 m ==
"DeclFileName" ||
m ==
"ImplFileName" ||
m ==
"DeclFileLine" ||
m ==
"ImplFileLine" ||
m ==
"Streamer" ||
369 m ==
"StreamerNVirtual" ||
m ==
"ShowMembers" ||
m ==
"CheckTObjectHashConsistency") {
373 if (
m.BeginsWith(
'~'))
376 if (
m.Contains(
"operator"))
401 j[
"fPublicFunctions"].push_back(jm);
403 if (
m.Contains(
"charge"))
405 printf(
"FOUND chargw methos %s %d\n\n",
m.Data(), cnt);
420 chld->SetMainColor(newv);
428 chld->SetMainColor(newv);
#define R__LOG_ERROR(...)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 SetFilterExpr(const char *filter)
TClass * GetItemClass() const
static Color_t fgDefaultColor
std::function< bool(void *)> fFilterFoo
void StreamPublicMethods(nlohmann::json &cj) const
REveDataItemList * fItemList
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.
REveDataCollection(const std::string &n="REveDataCollection", const std::string &t="")
REveDataItemList(const std::string &n="Items", const std::string &t="")
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 SetItemsChangeDelegate(ItemsChangeFunc_t)
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.
ItemsChangeFunc_t fHandlerItemsChange
static void DummyItemsChange(REveDataItemList *, const std::vector< int > &)
static void DummyFillImpliedSelected(REveDataItemList *, Set_t &impSelSet, const std::set< int > &sec_idcs)
void SetItemVisible(Int_t idx, Bool_t visible)
std::function< void(REveDataItemList *, const std::vector< int > &)> ItemsChangeFunc_t
const std::string & GetName() const
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
void SetupDefaultColorAndTransparency(Color_t col, Bool_t can_edit_color, Bool_t can_edit_transparency)
Set up element to use built-in main color and set flags allowing editing of main color and transparen...
virtual void AddElement(REveElement *el)
Add el to the list of children.
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
std::set< REveElement * > Set_t
ElementId_t GetElementId() const
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual Color_t GetMainColor() const
REveException Exception-type thrown by Eve classes.
SelectionSet_t & RefSelectedSet()
REveSelection Container for selected and highlighted elements.
void NewElementPicked(ElementId_t id, bool multi, bool secondary, const std::set< int > &secondary_idcs={})
Called from GUI when user picks or un-picks an element.
const TList * GetListOfAllPublicMethods(Bool_t load=kTRUE)
Returns a list of all public methods of this class and its base classes.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
const char * GetReturnTypeName() const
Get full type description of function return type, e,g.: "class TDirectory*".
Each ROOT method (see TMethod) has a linked list of its arguments.
const char * GetTypeName() const
Get type of method argument, e.g.: "class TDirectory*" -> "TDirectory" Result needs to be used or cop...
Each ROOT class (see TClass) has a linked list of methods.
TClass * GetClass() const
virtual TList * GetListOfMethodArgs()
Returns methodarg list and additionally updates fDataMember in TMethod by calling FindDataMember();.
const char * GetName() const override
Returns name of object.
virtual Int_t GetLast() const
Returns index of last object in collection.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
R__EXTERN REveManager * gEve
RLogChannel & REveLog()
Log channel for Eve diagnostics.
std::string fTooltipTitle