Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RGeomData.hxx
Go to the documentation of this file.
1// Author: Sergey Linev, 14.12.2018
2
3/*************************************************************************
4 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT7_RGeomData
12#define ROOT7_RGeomData
13
14#include <vector>
15#include <string>
16#include <functional>
17#include <memory>
18
20
21#include "TVirtualMutex.h"
22
23class TGeoNode;
24class TGeoManager;
25class TGeoShape;
26class TGeoMatrix;
27class TGeoVolume;
28
29// do not use namespace to avoid too long JSON
30
31namespace ROOT {
32
33class RGeomBrowserIter;
34
35namespace Experimental {
36class RLogChannel;
37} // namespace Experimental
38
39/// Log channel for Geomviewer diagnostics.
40Experimental::RLogChannel &RGeomLog();
41
42/** Base description of geometry node, required only to build hierarchy */
43
45public:
46 int id{0}; ///< node id, index in array
47 std::string name; ///< node name
48 std::vector<int> chlds; ///< list of childs id
49 int vis{0}; ///< visibility flag, 0 - off, 1 - only when level==0, 99 - always
50 bool nochlds{false}; ///< how far in hierarchy depth should be scanned
51
52 std::string color; ///< rgb code in hex format
53 std::string material; ///< name of the material
54 int sortid{0}; ///<! place in sorted array, to check cuts, or id of original node when used search structures
55
56 RGeomNodeBase(int _id = 0) : id(_id) {}
57
58 bool IsVisible() const { return vis > 0; }
59
60 /** Returns argument for regexp */
61 const char *GetArg(int kind)
62 {
63 if (kind == 1) return color.c_str();
64 if (kind == 2) return material.c_str();
65 return name.c_str();
66 }
67};
68
69/** Full node description including matrices and other attributes */
70
71class RGeomNode : public RGeomNodeBase {
72public:
73 std::vector<float> matr; ///< matrix for the node, can have reduced number of elements
74 double vol{0}; ///<! volume estimation
75 int nfaces{0}; ///<! number of shape faces
76 int idshift{-1}; ///<! used to jump over then scan all geom hierarchy
77 bool useflag{false}; ///<! extra flag, used for selection
78 float opacity{1.}; ///<! opacity of the color
79
80 RGeomNode(int _id = 0) : RGeomNodeBase(_id) {}
81
82 /** True when there is shape and it can be displayed */
83 bool CanDisplay() const { return (vol > 0.) && (nfaces > 0); }
84};
85
86/** \class RGeoItem
87\ingroup rbrowser
88\brief Representation of single item in the geometry browser
89*/
90
91class RGeoItem : public Browsable::RItem {
92
93protected:
94 // this is part for browser, visible for I/O
95 int id{0}; ///< node id
96 std::string color; ///< color
97 std::string material; ///< material
98 int vis{0}; ///< visibility of logical node
99 int pvis{0}; ///< visibility of physical node
100 bool top{false}; ///< indicates if node selected as top
101
102public:
103
104 /** Default constructor */
105 RGeoItem() = default;
106
107 RGeoItem(const std::string &_name, int _nchilds, int _nodeid, const std::string &_color,
108 const std::string &_material = "", int _vis = 0, int _pvis = 0) :
109 Browsable::RItem(_name, _nchilds), id(_nodeid), color(_color), material(_material), vis(_vis), pvis(_pvis) {
110 }
111
112 // should be here, one needs virtual table for correct streaming of RRootBrowserReply
113 ~RGeoItem() override = default;
114
115 void SetTop(bool on = true) { top = on; }
116};
117
118
119/** Base class for render info block */
121public:
122 /// virtual destructor required for the I/O
123 virtual ~RGeomRenderInfo() = default;
124};
125
126/** Render info with raw data */
128public:
129 std::vector<unsigned char> raw; ///< float vertices as raw data, JSON_base64
130 std::vector<int> idx; ///< vertex indexes, always triangles
131 ~RGeomRawRenderInfo() override = default;
132};
133
134/** Render info with shape itself - client can produce shape better */
136public:
137 TGeoShape *shape{nullptr}; ///< original shape - can be much less than binary data
138 ~RGeomShapeRenderInfo() override = default;
139};
140
141
142/** RGeomVisible contains description of visible node
143 * It is path to the node plus reference to shape rendering data */
144
146public:
147 int nodeid{0}; ///< selected node id,
148 int seqid{0}; ///< sequence id, used for merging later
149 std::vector<int> stack; ///< path to the node, index in list of childs
150 std::string color; ///< color in rgb format
151 double opacity{1}; ///< opacity
152 RGeomRenderInfo *ri{nullptr}; ///< render information for the shape, can be same for different nodes
153
154 RGeomVisible() = default;
155 RGeomVisible(int _nodeid, int _seqid, const std::vector<int> &_stack) : nodeid(_nodeid), seqid(_seqid), stack(_stack) {}
156};
157
158
159/** Configuration parameters which can be configured on the client
160 * Send as is to-from client */
161
163public:
164 int vislevel{0}; ///< visible level
165 int maxnumnodes{0}; ///< maximal number of nodes
166 int maxnumfaces{0}; ///< maximal number of faces
167 bool showtop{false}; ///< show geometry top volume, off by default
168 int build_shapes{1}; ///< when shapes build on server 0 - never, 1 - TGeoComposite, 2 - plus non-cylindrical, 3 - all
169 int nsegm{0}; ///< number of segments for cylindrical shapes
170 std::string drawopt; ///< draw options for TGeoPainter
171};
172
173
174/** Object with full description for drawing geometry
175 * It includes list of visible items and list of nodes required to build them */
176
178public:
179 RGeomConfig *cfg{nullptr}; ///< current configurations
180 int numnodes{0}; ///< total number of nodes in description
181 std::vector<RGeomNode*> nodes; ///< all used nodes to display visible items and not known for client
182 std::vector<RGeomVisible> visibles; ///< all visible items
183};
184
185
186/** Node information including rendering data */
188public:
189 std::vector<std::string> path; ///< full path to node
190 std::string node_type; ///< node class name
191 std::string node_name; ///< node name
192 std::string shape_type; ///< shape type (if any)
193 std::string shape_name; ///< shape class name (if any)
194
195 RGeomRenderInfo *ri{nullptr}; ///< rendering information (if applicable)
196};
197
198/** Custom settings for physical Node visibility */
200public:
201 std::vector<int> stack; ///< path to the node
202 bool visible{false}; ///< visible flag
203 RGeomNodeVisibility(const std::vector<int> &_stack, bool _visible) : stack(_stack), visible(_visible) {}
204};
205
206using RGeomScanFunc_t = std::function<bool(RGeomNode &, std::vector<int> &, bool, int)>;
207
208using RGeomSignalFunc_t = std::function<void(const std::string &)>;
209
211
212 friend class RGeomBrowserIter;
213
215 public:
216 int id{0}; ///<! sequential id
217 TGeoShape *fShape{nullptr}; ///<! original shape
218 int nfaces{0}; ///<! number of faces in render data
219 RGeomRawRenderInfo fRawInfo; ///<! raw render info
220 RGeomShapeRenderInfo fShapeInfo; ///<! shape itself as info
222
223 bool has_shape() const { return nfaces == 1; }
224 bool has_raw() const { return nfaces > 1; }
225
226 /// Provide render info for visible item
228 {
229 if (has_shape()) return &fShapeInfo;
230 if (has_raw()) return &fRawInfo;
231 return nullptr;
232 }
233
234 void reset()
235 {
236 nfaces = 0;
237 fShapeInfo.shape = nullptr;
238 fRawInfo.raw.clear();
239 }
240 };
241
242 std::vector<TGeoNode *> fNodes; ///<! flat list of all nodes
243 std::vector<RGeomNode> fDesc; ///<! converted description, send to client
244 std::vector<RGeomNodeVisibility> fVisibility; ///<! custom visibility flags for physical nodes
245
246 TGeoVolume *fDrawVolume{nullptr};///<! select volume independent from TGeoManager
247 std::vector<int> fSelectedStack; ///<! selected branch of geometry by stack
248
249 std::vector<int> fHighlightedStack; ///<! highlighted element by stack
250 std::vector<int> fClickedStack; ///<! clicked element by stack
251
252 std::vector<int> fSortMap; ///<! nodes in order large -> smaller volume
253 std::vector<ShapeDescr> fShapes; ///<! shapes with created descriptions
254
255 std::string fSearch; ///<! search string in hierarchy
256 std::string fSearchJson; ///<! drawing json for search
257 std::string fDrawJson; ///<! JSON with main nodes drawn by client
258 int fDrawIdCut{0}; ///<! sortid used for selection of most-significant nodes
259 int fActualLevel{0}; ///<! level can be reduced when selecting nodes
260 bool fPreferredOffline{false}; ///<! indicates that full description should be provided to client
261 int fJsonComp{0}; ///<! default JSON compression
262 std::string fActiveItemName; ///<! name of item which should be activated in hierarchy
263
264 RGeomConfig fCfg; ///<! configuration parameter editable from GUI
265
266 TVirtualMutex *fMutex{nullptr}; ///<! external mutex used to protect all data
267
268 std::vector<std::pair<const void *, RGeomSignalFunc_t>> fSignals; ///<! registered signals
269
270 void PackMatrix(std::vector<float> &arr, TGeoMatrix *matr);
271
272 int MarkVisible(bool on_screen = false);
273
274 void ProduceIdShifts();
275
276 int ScanNodes(bool only_visible, int maxlvl, RGeomScanFunc_t func);
277
278 void ResetRndrInfos();
279
281
283
284 int GetUsedNSegments(int min = 20);
285
286 int CountShapeFaces(TGeoShape *shape);
287
289
290 void CollectNodes(RGeomDrawing &drawing, bool all_nodes = false);
291
292 std::string MakeDrawingJson(RGeomDrawing &drawing, bool has_shapes = false);
293
294 void ClearDescription();
295
296 void BuildDescription(TGeoNode *topnode, TGeoVolume *topvolume);
297
298 TGeoVolume *GetVolume(int nodeid);
299
300 int IsPhysNodeVisible(const std::vector<int> &stack);
301
302public:
303 RGeomDescription() = default;
304
305 void AddSignalHandler(const void *handler, RGeomSignalFunc_t func);
306
307 void RemoveSignalHandler(const void *handler);
308
309 void IssueSignal(const void *handler, const std::string &kind);
310
311 /** Set mutex, it must be recursive one */
312 void SetMutex(TVirtualMutex *mutex) { fMutex = mutex; }
313 /** Return currently used mutex */
314 TVirtualMutex *GetMutex() const { return fMutex; }
315
316 /** Set maximal number of nodes which should be selected for drawing */
317 void SetMaxVisNodes(int cnt) { TLockGuard lock(fMutex); fCfg.maxnumnodes = cnt; }
318 /** Returns maximal visible number of nodes, ignored when non-positive */
319 int GetMaxVisNodes() const { TLockGuard lock(fMutex); return fCfg.maxnumnodes; }
320
321 /** Set maximal number of faces which should be selected for drawing */
322 void SetMaxVisFaces(int cnt) { TLockGuard lock(fMutex); fCfg.maxnumfaces = cnt; }
323 /** Returns maximal visible number of faces, ignored when non-positive */
324 int GetMaxVisFaces() const { TLockGuard lock(fMutex); return fCfg.maxnumfaces; }
325
326 /** Set maximal visible level */
327 void SetVisLevel(int lvl = 3) { TLockGuard lock(fMutex); fCfg.vislevel = lvl; }
328 /** Returns maximal visible level */
329 int GetVisLevel() const { TLockGuard lock(fMutex); return fCfg.vislevel; }
330
331 /** Set draw options as string for JSROOT TGeoPainter */
332 void SetTopVisible(bool on = true) { TLockGuard lock(fMutex); fCfg.showtop = on; }
333 /** Returns draw options, used for JSROOT TGeoPainter */
334 bool GetTopVisible() const { TLockGuard lock(fMutex); return fCfg.showtop; }
335
336 /** Instruct to build binary 3D model already on the server (true) or send TGeoShape as is to client, which can build model itself */
337 void SetBuildShapes(int lvl = 1) { TLockGuard lock(fMutex); fCfg.build_shapes = lvl; }
338 /** Returns true if binary 3D model build already by C++ server (default) */
339 int IsBuildShapes() const { TLockGuard lock(fMutex); return fCfg.build_shapes; }
340
341 /** Set number of segments for cylindrical shapes, if 0 - default value will be used */
342 void SetNSegments(int n = 0) { TLockGuard lock(fMutex); fCfg.nsegm = n; }
343 /** Return of segments for cylindrical shapes, if 0 - default value will be used */
344 int GetNSegments() const { TLockGuard lock(fMutex); return fCfg.nsegm; }
345
346 /** Set draw options as string for JSROOT TGeoPainter */
347 void SetDrawOptions(const std::string &opt = "") { TLockGuard lock(fMutex); fCfg.drawopt = opt; }
348 /** Returns draw options, used for JSROOT TGeoPainter */
349 std::string GetDrawOptions() const { TLockGuard lock(fMutex); return fCfg.drawopt; }
350
351 /** Set JSON compression level for data transfer */
352 void SetJsonComp(int comp = 0) { TLockGuard lock(fMutex); fJsonComp = comp; }
353 /** Returns JSON compression level for data transfer */
354 int GetJsonComp() const { TLockGuard lock(fMutex); return fJsonComp; }
355
356 /** Set preference of offline operations.
357 * Server provides more info to client from the begin on to avoid communication */
359 /** Is offline operations preferred.
360 * After get full description, client can do most operations without extra requests */
362
363
364 void Build(TGeoManager *mgr, const std::string &volname = "");
365
366 void Build(TGeoVolume *vol);
367
368 /** Number of unique nodes in the geometry */
369 int GetNumNodes() const { TLockGuard lock(fMutex); return fDesc.size(); }
370
371 bool IsBuild() const { return GetNumNodes() > 0; }
372
373 std::string ProduceJson(bool all_nodes = false);
374
375 bool IsPrincipalEndNode(int nodeid);
376
377 std::string ProcessBrowserRequest(const std::string &req = "");
378
379 bool HasDrawData() const;
380 void ProduceDrawData();
381 void ProduceSearchData();
382 std::string GetDrawJson() const { TLockGuard lock(fMutex); return fDrawJson; }
383 std::string GetSearch() const { TLockGuard lock(fMutex); return fSearch; }
384 std::string GetSearchJson() const { TLockGuard lock(fMutex); return fSearchJson; }
385 void ClearDrawData();
386
387 void ClearCache();
388
389 int SearchVisibles(const std::string &find, std::string &hjson, std::string &json);
390
391 int FindNodeId(const std::vector<int> &stack);
392
393 std::string ProduceModifyReply(int nodeid);
394
395 std::vector<int> MakeStackByIds(const std::vector<int> &ids);
396
397 std::vector<int> MakeIdsByStack(const std::vector<int> &stack);
398
399 std::vector<int> MakeStackByPath(const std::vector<std::string> &path);
400
401 std::vector<std::string> MakePathByStack(const std::vector<int> &stack);
402
403 bool ProduceDrawingFor(int nodeid, std::string &json, bool check_volume = false);
404
405 bool SetHighlightedItem(const std::vector<int> &stack)
406 {
407 TLockGuard lock(fMutex);
408 bool changed = fHighlightedStack != stack;
409 fHighlightedStack = stack;
410 return changed;
411 }
412
413 std::vector<int> GetHighlightedItem() const
414 {
415 TLockGuard lock(fMutex);
416 return fHighlightedStack;
417 }
418
419 bool SetClickedItem(const std::vector<int> &stack)
420 {
421 TLockGuard lock(fMutex);
422 bool changed = fClickedStack != stack;
423 fClickedStack = stack;
424 return changed;
425 }
426
427 std::vector<int> GetClickedItem() const
428 {
429 TLockGuard lock(fMutex);
430 return fClickedStack;
431 }
432
433 bool SetActiveItem(const std::string &itemname)
434 {
435 TLockGuard lock(fMutex);
436 bool changed = (fActiveItemName != itemname);
437 fActiveItemName = itemname;
438 return changed;
439 }
440
441 std::string GetActiveItem() const
442 {
443 TLockGuard lock(fMutex);
444 return fActiveItemName;
445 }
446
447 bool ChangeConfiguration(const std::string &json);
448
449 std::unique_ptr<RGeomNodeInfo> MakeNodeInfo(const std::vector<int> &stack);
450
451 bool ChangeNodeVisibility(const std::vector<std::string> &path, bool on);
452
453 bool SelectTop(const std::vector<std::string> &path);
454
455 bool SetPhysNodeVisibility(const std::vector<std::string> &path, bool on = true);
456
457 bool SetPhysNodeVisibility(const std::string &path, bool on = true);
458
459 bool ClearPhysNodeVisibility(const std::vector<std::string> &path);
460
462
463 bool SetSearch(const std::string &query, const std::string &json);
464
465 void SavePrimitive(std::ostream &fs, const std::string &name);
466};
467
468} // namespace ROOT
469
470#endif
nlohmann::json json
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
char name[80]
Definition TGX11.cxx:110
Representation of single item in the browser.
Definition RItem.hxx:23
Representation of single item in the geometry browser.
Definition RGeomData.hxx:91
RGeoItem(const std::string &_name, int _nchilds, int _nodeid, const std::string &_color, const std::string &_material="", int _vis=0, int _pvis=0)
std::string color
color
Definition RGeomData.hxx:96
bool top
indicates if node selected as top
void SetTop(bool on=true)
std::string material
material
Definition RGeomData.hxx:97
~RGeoItem() override=default
int pvis
visibility of physical node
Definition RGeomData.hxx:99
int vis
visibility of logical node
Definition RGeomData.hxx:98
int id
node id
Definition RGeomData.hxx:95
RGeoItem()=default
Default constructor.
Iterator of hierarchical geometry structures.
Definition RGeomData.cxx:60
Configuration parameters which can be configured on the client Send as is to-from client.
bool showtop
show geometry top volume, off by default
int maxnumfaces
maximal number of faces
int vislevel
visible level
int maxnumnodes
maximal number of nodes
std::string drawopt
draw options for TGeoPainter
int build_shapes
when shapes build on server 0 - never, 1 - TGeoComposite, 2 - plus non-cylindrical,...
int nsegm
number of segments for cylindrical shapes
int nfaces
! number of faces in render data
RGeomShapeRenderInfo fShapeInfo
! shape itself as info
TGeoShape * fShape
! original shape
RGeomRenderInfo * rndr_info()
Provide render info for visible item.
RGeomRawRenderInfo fRawInfo
! raw render info
RGeomConfig fCfg
! configuration parameter editable from GUI
std::vector< std::pair< const void *, RGeomSignalFunc_t > > fSignals
! registered signals
int IsPhysNodeVisible(const std::vector< int > &stack)
Check if there special settings for specified physical node returns -1 if nothing is found.
std::vector< int > fSelectedStack
! selected branch of geometry by stack
void SetMaxVisNodes(int cnt)
Set maximal number of nodes which should be selected for drawing.
std::string ProcessBrowserRequest(const std::string &req="")
Find description object for requested shape If not exists - will be created.
std::vector< RGeomNode > fDesc
! converted description, send to client
void PackMatrix(std::vector< float > &arr, TGeoMatrix *matr)
Pack matrix into vector, which can be send to client Following sizes can be used for vector: 0 - Iden...
bool ProduceDrawingFor(int nodeid, std::string &json, bool check_volume=false)
Produce shape rendering data for given stack All nodes, which are referencing same shape will be tran...
std::unique_ptr< RGeomNodeInfo > MakeNodeInfo(const std::vector< int > &stack)
Change visibility for specified element Returns true if changes was performed.
bool HasDrawData() const
Check if there is draw data available.
std::vector< int > MakeIdsByStack(const std::vector< int > &stack)
Produce list of node ids for given stack If found nodes preselected - use their ids.
int MarkVisible(bool on_screen=false)
Set visibility flag for each nodes.
void SetVisLevel(int lvl=3)
Set maximal visible level.
void IssueSignal(const void *handler, const std::string &kind)
Issue signal, which distributed on all handlers - excluding source handler.
int GetUsedNSegments(int min=20)
Returns really used number of cylindrical segments.
bool IsPrincipalEndNode(int nodeid)
return true when node used in main geometry drawing and does not have childs for such nodes one could...
bool SetSearch(const std::string &query, const std::string &json)
Change search query and belongs to it json string Returns true if any parameter was really changed.
std::vector< RGeomNodeVisibility > fVisibility
! custom visibility flags for physical nodes
bool SetHighlightedItem(const std::vector< int > &stack)
void SetPreferredOffline(bool on)
Set preference of offline operations.
bool SelectTop(const std::vector< std::string > &path)
Select top node by path Used by the client to change active node Returns true if selected node was ch...
int GetMaxVisNodes() const
Returns maximal visible number of nodes, ignored when non-positive.
int GetVisLevel() const
Returns maximal visible level.
int GetMaxVisFaces() const
Returns maximal visible number of faces, ignored when non-positive.
void ClearCache()
Clear cached data, need to be clear when connection broken.
std::string GetDrawJson() const
void ClearDescription()
Clear geometry description.
std::vector< int > MakeStackByIds(const std::vector< int > &ids)
Creates stack for given array of ids, first element always should be 0.
void SetMaxVisFaces(int cnt)
Set maximal number of faces which should be selected for drawing.
bool IsPreferredOffline() const
Is offline operations preferred.
std::vector< ShapeDescr > fShapes
! shapes with created descriptions
std::string GetSearch() const
int fJsonComp
! default JSON compression
bool ChangeNodeVisibility(const std::vector< std::string > &path, bool on)
Change visibility for specified element Returns true if changes was performed.
void SetMutex(TVirtualMutex *mutex)
Set mutex, it must be recursive one.
std::string fSearch
! search string in hierarchy
std::string fSearchJson
! drawing json for search
void SavePrimitive(std::ostream &fs, const std::string &name)
Save geometry configuration as C++ macro.
std::vector< int > fHighlightedStack
! highlighted element by stack
bool ClearAllPhysVisibility()
Reset all custom visibility settings.
std::string MakeDrawingJson(RGeomDrawing &drawing, bool has_shapes=false)
Produce JSON for the drawing If TGeoShape appears in the drawing, one has to keep typeinfo But in thi...
int fActualLevel
! level can be reduced when selecting nodes
TGeoVolume * GetVolume(int nodeid)
Get volume for specified nodeid If specific volume was configured, it will be returned for nodeid==0.
bool SetActiveItem(const std::string &itemname)
int GetNumNodes() const
Number of unique nodes in the geometry.
void SetTopVisible(bool on=true)
Set draw options as string for JSROOT TGeoPainter.
void ProduceDrawData()
Collect all information required to draw geometry on the client This includes list of each visible no...
void SetNSegments(int n=0)
Set number of segments for cylindrical shapes, if 0 - default value will be used.
bool GetTopVisible() const
Returns draw options, used for JSROOT TGeoPainter.
bool SetPhysNodeVisibility(const std::vector< std::string > &path, bool on=true)
Set visibility of physical node by path It overrules TGeo visibility flags - but only for specific ph...
bool ClearPhysNodeVisibility(const std::vector< std::string > &path)
Reset custom visibility of physical node by path.
void BuildDescription(TGeoNode *topnode, TGeoVolume *topvolume)
Build geometry description.
int SearchVisibles(const std::string &find, std::string &hjson, std::string &json)
Search visible nodes for provided name If number of found elements less than 100, create description ...
std::vector< int > fSortMap
! nodes in order large -> smaller volume
std::string ProduceJson(bool all_nodes=false)
Produce JSON string which can be directly used with build function from JSROOT to create three....
void ClearDrawData()
Clear raw data. Will be rebuild when next connection will be established.
std::vector< std::string > MakePathByStack(const std::vector< int > &stack)
Returns path string for provided stack.
TVirtualMutex * fMutex
! external mutex used to protect all data
void AddSignalHandler(const void *handler, RGeomSignalFunc_t func)
Add signal handler.
bool ChangeConfiguration(const std::string &json)
Change configuration by client Returns true if any parameter was really changed.
void CopyMaterialProperties(TGeoVolume *vol, RGeomNode &node)
Copy material properties.
std::vector< int > GetClickedItem() const
std::vector< int > MakeStackByPath(const std::vector< std::string > &path)
Produce stack based on string path Used to highlight geo volumes by browser hover event.
int ScanNodes(bool only_visible, int maxlvl, RGeomScanFunc_t func)
Iterate over all nodes and call function for visible.
int IsBuildShapes() const
Returns true if binary 3D model build already by C++ server (default)
void ProduceSearchData()
Produces search data if necessary.
TVirtualMutex * GetMutex() const
Return currently used mutex.
void SetJsonComp(int comp=0)
Set JSON compression level for data transfer.
void SetBuildShapes(int lvl=1)
Instruct to build binary 3D model already on the server (true) or send TGeoShape as is to client,...
void CollectNodes(RGeomDrawing &drawing, bool all_nodes=false)
Collect nodes which are used in visibles.
int fDrawIdCut
! sortid used for selection of most-significant nodes
TGeoVolume * fDrawVolume
! select volume independent from TGeoManager
int CountShapeFaces(TGeoShape *shape)
Count number of faces for the shape.
ShapeDescr & MakeShapeDescr(TGeoShape *shape)
Find description object and create render information.
bool fPreferredOffline
! indicates that full description should be provided to client
void SetDrawOptions(const std::string &opt="")
Set draw options as string for JSROOT TGeoPainter.
ShapeDescr & FindShapeDescr(TGeoShape *shape)
Find description object for requested shape If not exists - will be created.
std::vector< int > GetHighlightedItem() const
std::string fDrawJson
! JSON with main nodes drawn by client
void RemoveSignalHandler(const void *handler)
Remove signal handler.
int FindNodeId(const std::vector< int > &stack)
Returns nodeid for given stack array, returns -1 in case of failure.
void ProduceIdShifts()
Count total number of visible childs under each node.
std::string ProduceModifyReply(int nodeid)
Return string with only part of nodes description which were modified Checks also volume.
std::string fActiveItemName
! name of item which should be activated in hierarchy
std::string GetActiveItem() const
void ResetRndrInfos()
Reset shape info, which used to pack binary data.
std::string GetSearchJson() const
int GetNSegments() const
Return of segments for cylindrical shapes, if 0 - default value will be used.
std::string GetDrawOptions() const
Returns draw options, used for JSROOT TGeoPainter.
std::vector< TGeoNode * > fNodes
! flat list of all nodes
int GetJsonComp() const
Returns JSON compression level for data transfer.
void Build(TGeoManager *mgr, const std::string &volname="")
Collect information about geometry hierarchy into flat list like it done in JSROOT ClonedNodes....
std::vector< int > fClickedStack
! clicked element by stack
bool SetClickedItem(const std::vector< int > &stack)
Object with full description for drawing geometry It includes list of visible items and list of nodes...
int numnodes
total number of nodes in description
std::vector< RGeomVisible > visibles
all visible items
RGeomConfig * cfg
current configurations
std::vector< RGeomNode * > nodes
all used nodes to display visible items and not known for client
Base description of geometry node, required only to build hierarchy.
Definition RGeomData.hxx:44
bool IsVisible() const
Definition RGeomData.hxx:58
int vis
visibility flag, 0 - off, 1 - only when level==0, 99 - always
Definition RGeomData.hxx:49
std::string material
name of the material
Definition RGeomData.hxx:53
RGeomNodeBase(int _id=0)
Definition RGeomData.hxx:56
int sortid
! place in sorted array, to check cuts, or id of original node when used search structures
Definition RGeomData.hxx:54
bool nochlds
how far in hierarchy depth should be scanned
Definition RGeomData.hxx:50
std::string color
rgb code in hex format
Definition RGeomData.hxx:52
int id
node id, index in array
Definition RGeomData.hxx:46
std::vector< int > chlds
list of childs id
Definition RGeomData.hxx:48
std::string name
node name
Definition RGeomData.hxx:47
const char * GetArg(int kind)
Returns argument for regexp.
Definition RGeomData.hxx:61
Node information including rendering data.
std::string shape_name
shape class name (if any)
std::string node_type
node class name
std::string node_name
node name
RGeomRenderInfo * ri
rendering information (if applicable)
std::string shape_type
shape type (if any)
std::vector< std::string > path
full path to node
Custom settings for physical Node visibility.
RGeomNodeVisibility(const std::vector< int > &_stack, bool _visible)
bool visible
visible flag
std::vector< int > stack
path to the node
Full node description including matrices and other attributes.
Definition RGeomData.hxx:71
float opacity
! opacity of the color
Definition RGeomData.hxx:78
int idshift
! used to jump over then scan all geom hierarchy
Definition RGeomData.hxx:76
double vol
! volume estimation
Definition RGeomData.hxx:74
bool useflag
! extra flag, used for selection
Definition RGeomData.hxx:77
std::vector< float > matr
matrix for the node, can have reduced number of elements
Definition RGeomData.hxx:73
RGeomNode(int _id=0)
Definition RGeomData.hxx:80
int nfaces
! number of shape faces
Definition RGeomData.hxx:75
bool CanDisplay() const
True when there is shape and it can be displayed.
Definition RGeomData.hxx:83
Render info with raw data.
std::vector< int > idx
vertex indexes, always triangles
std::vector< unsigned char > raw
float vertices as raw data, JSON_base64
~RGeomRawRenderInfo() override=default
Base class for render info block.
virtual ~RGeomRenderInfo()=default
virtual destructor required for the I/O
Render info with shape itself - client can produce shape better.
TGeoShape * shape
original shape - can be much less than binary data
~RGeomShapeRenderInfo() override=default
RGeomVisible contains description of visible node It is path to the node plus reference to shape rend...
int seqid
sequence id, used for merging later
std::string color
color in rgb format
RGeomVisible(int _nodeid, int _seqid, const std::vector< int > &_stack)
RGeomRenderInfo * ri
render information for the shape, can be same for different nodes
double opacity
opacity
int nodeid
selected node id,
RGeomVisible()=default
std::vector< int > stack
path to the node, index in list of childs
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
Geometrical transformation package.
Definition TGeoMatrix.h:38
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:43
This class implements a mutex interface.
const Int_t n
Definition legend1.C:16
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
std::function< void(const std::string &)> RGeomSignalFunc_t
Experimental::RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.
Definition RGeomData.cxx:49
std::function< bool(RGeomNode &, std::vector< int > &, bool, int)> RGeomScanFunc_t