Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveGeoTopNode.hxx
Go to the documentation of this file.
1
2#ifndef ROOT7_REveGeoTopNode
3#define ROOT7_REveGeoTopNode
4
6#include <ROOT/RGeomData.hxx>
9
10class TGeoNode;
11class TGeoIterator;
12
13
14namespace ROOT {
15namespace Experimental {
16
17class REveGeoTopNodeData;
18/////////////////////////////////////////////////////////////////////////
19////////////////////////////////////////////////////////////////////////
20// REveGeomDescription
21////////////////////////////////////////////////////////////////////////
22////////////////////////////////////////////////////////////////////////
23
26protected:
27 std::vector<RGeomNodeVisibility> fVisibilitySelf;
28 std::vector<RGeomNodeVisibility> fVisibilityRec;
29
30 virtual void RefineGeoItem(ROOT::RGeoItem &item, const std::vector<int> &stack) override;
31 virtual bool IsFullModelStreamedAtOnce() const override { return false; }
32
33 class Apex {
34 std::vector<std::string> fPath;
35 TGeoNode *fNode{nullptr};
36
37 public:
38 void SetFromPath(std::vector<std::string> absPath);
39 TGeoNode *LocateNodeWithPath(const std::vector<std::string> &path) const;
40
41 TGeoNode *GetNode() { return fNode; }
42 std::string GetFlatPath() const;
43 const std::vector<std::string>& GetPath() const { return fPath; }
44 std::vector<int> GetIndexStack() const;
45 };
46
48
49public:
52
58
59 bool ChangeEveVisibility(const std::vector<int> &stack, ERnrFlags rnrFlag, bool on);
60 std::vector<int> GetIndexStack() { return fApex.GetIndexStack(); }
61 const std::vector<std::string>& GetApexPath() const { return fApex.GetPath();}
62 void InitPath(const std::vector<std::string>& path);
64 TGeoNode* LocateNodeWithPath(const std::vector<std::string> &path) { return fApex.LocateNodeWithPath(path); }
65
66 bool GetVisiblityForStack(const std::vector<int>& stack);
67
68 void ImportFile(const char* filePath);
69 static TGeoManager* GetGeoManager();
70};
71
72/////////////////////////////////////////////////////////////////////////
73////////////////////////////////////////////////////////////////////////
74// REveGeomHierarchy
75////////////////////////////////////////////////////////////////////////
76////////////////////////////////////////////////////////////////////////
77
79{
81protected:
82 virtual void WebWindowCallback(unsigned connid, const std::string &kind) override;
83
84public:
86 RGeomHierarchy(desc, th){};
87
89 virtual ~REveGeomHierarchy(){};
90};
91
92/////////////////////////////////////////////////////////////////////////
93////////////////////////////////////////////////////////////////////////
94// REveGeoTopNodeData
95////////////////////////////////////////////////////////////////////////
96////////////////////////////////////////////////////////////////////////
97
99 friend class REveGeoTopNodeViz;
100private:
101 std::shared_ptr<REveGeomHierarchy> fWebHierarchy; ///<! web handle for hierarchy part
102
103protected:
106
108
109public:
110 REveGeoTopNodeData(const char* fileName);
112
113 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
114 void ProcessSignal(const std::string &);
116
117 void SetChannel(unsigned connid, int chid);
118 void VisibilityChanged(bool on, REveGeomDescription::ERnrFlags flag, const std::vector<int>& path);
119 void InitPath(const std::string& path);
120};
121
122/////////////////////////////////////////////////////////////////////////
123////////////////////////////////////////////////////////////////////////
124// REveGeoTopNodeViz
125////////////////////////////////////////////////////////////////////////
126////////////////////////////////////////////////////////////////////////
129{
130public:
137
138private:
139 struct BShape {
141 std::vector<int> indices;
142 std::vector<float> vertices;
143 };
144
145 struct BNode {
149 int color;
150 float trans[16];
151 bool visible{true};
152 };
153
156
158 std::vector<BNode> fNodes;
159 std::vector<BShape> fShapes;
161
162 void CollectNodes(TGeoVolume *volume, std::vector<BNode> &bnl, std::vector<BShape> &browsables);
163 void CollectShapes(TGeoNode *node, std::set<TGeoShape *> &shapes, std::vector<BShape> &browsables);
164 bool AcceptNode(TGeoIterator& it, bool skip = true) const;
165
166public:
167 REveGeoTopNodeViz(const Text_t *n = "REveGeoTopNodeViz", const Text_t *t = "");
168 void SetGeoData(REveGeoTopNodeData *d, bool rebuild = true);
169 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
170 void BuildRenderData() override;
171 void ComputeBBox() override;
172 void GetIndicesFromBrowserStack(const std::vector<int> &stack, std::set<int>& outStack);
173
174 void SetVisLevel(int);
175 void VisibilityChanged(bool on, REveGeomDescription::ERnrFlags flag, const std::vector<int>& path);
176 void BuildDesc();
177
178 EMode GetVizMode() const { return fMode; }
179 void SetVizMode(EMode mode);
180
182 std::string GetHighlightTooltip(const std::set<int>& secondary_idcs) const override;
183};
184
185} // namespace Experimental
186} // namespace ROOT
187
188#endif
189
#define d(i)
Definition RSha256.hxx:102
char Text_t
General string (char)
Definition RtypesCore.h:77
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 on
Option_t Option_t TPoint TPoint const char mode
virtual std::string GetHighlightTooltip(const std::set< int > &) const
void SetChannel(unsigned connid, int chid)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void InitPath(const std::string &path)
std::shared_ptr< REveGeomHierarchy > fWebHierarchy
! web handle for hierarchy part
void VisibilityChanged(bool on, REveGeomDescription::ERnrFlags flag, const std::vector< int > &path)
REveGeoTopNodeData(const REveGeoTopNodeData &)=delete
void ProcessSignal(const std::string &)
REveGeoTopNodeData & operator=(const REveGeoTopNodeData &)=delete
void GetIndicesFromBrowserStack(const std::vector< int > &stack, std::set< int > &outStack)
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
REveGeoTopNodeViz(const REveGeoTopNodeViz &)=delete
void CollectNodes(TGeoVolume *volume, std::vector< BNode > &bnl, std::vector< BShape > &browsables)
void BuildRenderData() override
Build fRenderData, what the client draws.
void ComputeBBox() override
Fill the bounding box (virtual from REveElement) from the box of the apex node's shape.
void VisibilityChanged(bool on, REveGeomDescription::ERnrFlags flag, const std::vector< int > &path)
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void SetGeoData(REveGeoTopNodeData *d, bool rebuild=true)
REveGeoTopNodeViz & operator=(const REveGeoTopNodeViz &)=delete
bool AcceptNode(TGeoIterator &it, bool skip=true) const
void CollectShapes(TGeoNode *node, std::set< TGeoShape * > &shapes, std::vector< BShape > &browsables)
void SetFromPath(std::vector< std::string > absPath)
TGeoNode * LocateNodeWithPath(const std::vector< std::string > &path) const
const std::vector< std::string > & GetPath() const
void InitPath(const std::vector< std::string > &path)
bool ChangeEveVisibility(const std::vector< int > &stack, ERnrFlags rnrFlag, bool on)
std::vector< RGeomNodeVisibility > fVisibilitySelf
virtual void RefineGeoItem(ROOT::RGeoItem &item, const std::vector< int > &stack) override
Method which allows to add/modify information in RGeoItem which will be provided to client - like tit...
virtual bool IsFullModelStreamedAtOnce() const override
Decide if the whole model is streamed at once Function is called from ProcessBrowserRequest.
bool GetVisiblityForStack(const std::vector< int > &stack)
TGeoNode * LocateNodeWithPath(const std::vector< std::string > &path)
const std::vector< std::string > & GetApexPath() const
std::vector< RGeomNodeVisibility > fVisibilityRec
REveGeomHierarchy(REveGeomDescription &desc, bool th)
void SetReceiver(REveGeoTopNodeData *data)
virtual void WebWindowCallback(unsigned connid, const std::string &kind) override
Table signal handling.
Representation of single item in the geometry browser.
Definition RGeomData.hxx:88
Web-based ROOT geometry hierarchy viewer.
A geometry iterator.
Definition TGeoNode.h:249
The manager class for any TGeo geometry.
Definition TGeoManager.h:46
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
Base abstract class for all shapes.
Definition TGeoShape.h:25
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:45
const Int_t n
Definition legend1.C:16