20#include <nlohmann/json.hpp>
29#define REVEGEO_DEBUG_PRINT(fmt, ...) printf(fmt, ##__VA_ARGS__)
31#define REVEGEO_DEBUG_PRINT(fmt, ...)
57std::size_t getHash(std::vector<int> &
vec)
59 std::size_t seed =
vec.size();
61 uint32_t i = (uint32_t)
x;
62 seed ^= i + 0x9e3779b9 + (seed << 6) + (seed >> 2);
71 if ((kind ==
"SelectTop") || (kind ==
"NodeVisibility")) {
76 }
else if (kind ==
"HighlightItem") {
80 ss.insert((
int)getHash(sstack));
86 }
else if (kind ==
"ClickItem") {
90 ss.insert((
int)getHash(sstack));
123 size_t n = sa.size();
124 for (
size_t i = 0; i <
n; ++i) {
135 fRenderData = std::make_unique<REveRenderData>(
"makeGeoTopNode");
146 printf(
"REveGeoTopNodeViz::WriteCoreJson stream geomDescription json size = %lu\n",
json.size());
154 j[
"stack"] = nlohmann::json::array();
155 std::vector<int> stack;
165 printf(
"cicked stack: ");
172 j[
"stack"].push_back(i);
176 printf(
"extra stack: ");
177 int ss = j[
"stack"].size();
178 for (
int i = 0; i < ss; ++i) {
179 int d = j[
"stack"][i];
184 printf(
"node ids from stack: ");
190 printf(
"NODE ID %d\n",
id);
thread_local ElementId_t gSelId
REveElement::List_t fNieces
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
std::unique_ptr< REveRenderData > fRenderData
Externally assigned and controlled user data.
ElementId_t GetElementId() const
void SetChannel(unsigned connid, int chid)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
RGeomDescription fDesc
! geometry description, send to the client as first message
std::shared_ptr< RGeomHierarchy > fWebHierarchy
! web handle for hierarchy part
void SetTNode(TGeoNode *n)
REveGeoTopNodeData(const REveGeoTopNodeData &)=delete
void ProcessSignal(const std::string &)
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
REveGeoTopNodeViz(const REveGeoTopNodeViz &)=delete
void BuildRenderData() override
Write transformation Matrix to render data.
REveGeoTopNodeData * fGeoData
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void FillExtraSelectionData(nlohmann::json &j, const std::set< int > &secondary_idcs) const override
REveSelection * GetHighlight() const
REveSelection * GetSelection() const
std::shared_ptr< ROOT::RWebWindow > GetWebWindow() const
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.
std::vector< int > MakeIdsByStack(const std::vector< int > &stack)
Produce list of node ids for given stack If found nodes preselected - use their ids.
std::string ProduceJson(bool all_nodes=false)
Produce JSON string which can be directly used with build function from JSROOT to create three....
std::vector< std::string > MakePathByStack(const std::vector< int > &stack)
Returns path string for provided stack.
void AddSignalHandler(const void *handler, RGeomSignalFunc_t func)
Add signal handler.
std::vector< int > GetClickedItem() const
std::vector< int > GetHighlightedItem() const
int FindNodeId(const std::vector< int > &stack)
Returns nodeid for given stack array, returns -1 in case of failure.
void Build(TGeoManager *mgr, const std::string &volname="")
Collect information about geometry hierarchy into flat list like it done in JSROOT ClonedNodes....
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
TGeoVolume * GetVolume() const
R__EXTERN REveManager * gEve