29#include <nlohmann/json.hpp>
58 fItems[idx]->SetRnrSelf(visible);
113 j[
"items"] = nlohmann::json::array();
114 for (
auto & chld :
fItems)
117 i[
"fFiltered"] = chld->GetFiltered();
118 i[
"fRnrSelf"] = chld->GetRnrSelf();
119 i[
"fColor"] = chld->GetMainColor();
120 j[
"items"].push_back(i);
131 std::vector<int> ids;
133 for (
size_t i = 0; i <
fItems.size(); ++i ) {
149 static const REveException eh(
"REveDataItemList::ProcessSelectionStr ");
150 static const std::regex comma_re(
"\\s*,\\s*", std::regex::optimize);
151 std::string str(secondary_idcs);
153 std::sregex_token_iterator itr(str.begin(), str.end(), comma_re, -1);
154 std::sregex_token_iterator end;
157 while (itr != end) sis.insert(std::stoi(*itr++));
159 catch (
const std::invalid_argument&) {
160 throw eh +
"invalid secondary index argument '" + *itr +
"' - must be int.";
178 if (secondary_idcs.empty()) {
183 int idx = *secondary_idcs.begin();
185 void*
data = col->GetDataPtr(idx);
186 std::string
name = col->GetName();
187 auto li =
name.size();
188 if (li &&
name[li-1] ==
's')
194 for (
auto &z : secondary_idcs)
197 data = col->GetDataPtr(idx);
200 std::string eval = t->fTooltipFunction.EvalExpr(
data);
201 res += std::string(
TString::Format(
"\n %s = %s", t->fTooltipTitle.c_str(), eval.c_str()));
215 tt->fTooltipFunction.SetPrecision(2);
221 auto re =
tt->fTooltipFunction.GetFunctionExpressionString();
222 gROOT->ProcessLine(re.c_str());
242 printf(
"REveDataItemList::DummyItemsCahngeDelegate not implemented\n");
251 printf(
"REveDataItemList::DummyFillImpliedSelectedDelegate not implemented\n");
262 std::string lname =
n +
"Items";
279 static const REveException eh(
"REveDataCollection::SetFilterExpr ");
282 throw eh +
"item class has to be set before the filter expression.";
286 int ibeg = 0, iend = strlen(filter);
287 while (ibeg < iend && isspace(filter[ibeg])) ++ibeg;
288 while (iend > ibeg && isspace(filter[iend-1])) --iend;
298 s <<
"*((std::function<bool(" <<
fItemClass->
GetName() <<
"*)>*)" << std::hex << std::showbase
304 gROOT->ProcessLine(s.str().c_str());
308 catch (
const std::exception &exc)
320 if (ii->GetFiltered()) {
321 ii->SetFiltered(
false);
346 ii->SetFiltered( ! res );
348 ids.push_back(idx++);
359 j[
"fPublicFunctions"] = nlohmann::json::array();
363 while ((meth = (
TMethod *)next())) {
368 if (
m ==
"Class" ||
m ==
"Class_Name" ||
m ==
"Class_Version" ||
m ==
"Dictionary" ||
m ==
"IsA" ||
369 m ==
"DeclFileName" ||
m ==
"ImplFileName" ||
m ==
"DeclFileLine" ||
m ==
"ImplFileLine" ||
m ==
"Streamer" ||
370 m ==
"StreamerNVirtual" ||
m ==
"ShowMembers" ||
m ==
"CheckTObjectHashConsistency") {
374 if (
m.BeginsWith(
'~'))
377 if (
m.Contains(
"operator"))
402 j[
"fPublicFunctions"].push_back(jm);
404 if (
m.Contains(
"charge"))
406 printf(
"FOUND chargw methos %s %d\n\n",
m.Data(), cnt);
421 chld->SetMainColor(newv);
429 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