Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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;
34class RLogChannel;
35
36/// Log channel for Geomviewer diagnostics.
37RLogChannel &RGeomLog();
38
39/** Base description of geometry node, required only to build hierarchy */
40
42public:
43 int id{0}; ///< node id, index in array
44 std::string name; ///< node name
45 std::vector<int> chlds; ///< list of childs id
46 int vis{0}; ///< visibility flag, 0 - off, 1 - only when level==0, 99 - always
47 bool nochlds{false}; ///< how far in hierarchy depth should be scanned
48
49 std::string color; ///< rgb code in hex format
50 std::string material; ///< name of the material
51 int sortid{0}; ///<! place in sorted array, to check cuts, or id of original node when used search structures
52
53 RGeomNodeBase(int _id = 0) : id(_id) {}
54
55 bool IsVisible() const { return vis > 0; }
56
57 /** Returns argument for regexp */
58 const char *GetArg(int kind)
59 {
60 if (kind == 1) return color.c_str();
61 if (kind == 2) return material.c_str();
62 return name.c_str();
63 }
64};
65
66/** Full node description including matrices and other attributes */
67
68class RGeomNode : public RGeomNodeBase {
69public:
70 std::vector<float> matr; ///< matrix for the node, can have reduced number of elements
71 double vol{0}; ///<! volume estimation
72 int nfaces{0}; ///<! number of shape faces
73 int idshift{-1}; ///<! used to jump over then scan all geom hierarchy
74 bool useflag{false}; ///<! extra flag, used for selection
75 float opacity{1.}; ///<! opacity of the color
76
78
79 /** True when there is shape and it can be displayed */
80 bool CanDisplay() const { return (vol > 0.) && (nfaces > 0); }
81};
82
83/** \class RGeoItem
84\ingroup rbrowser
85\brief Representation of single item in the geometry browser
86*/
87
88class RGeoItem : public Browsable::RItem {
89
90protected:
91 // this is part for browser, visible for I/O
92 int id{0}; ///< node id
93 std::string color; ///< color
94 std::string material; ///< material
95 int vis{0}; ///< visibility of logical node
96 int pvis{0}; ///< visibility of physical node
97 bool top{false}; ///< indicates if node selected as top
98
99public:
100
101 /** Default constructor */
102 RGeoItem() = default;
103
104 RGeoItem(const std::string &_name, int _nchilds, int _nodeid, const std::string &_color,
105 const std::string &_material = "", int _vis = 0, int _pvis = 0) :
106 Browsable::RItem(_name, _nchilds), id(_nodeid), color(_color), material(_material), vis(_vis), pvis(_pvis) {
107 }
108
109 // should be here, one needs virtual table for correct streaming of RRootBrowserReply
110 ~RGeoItem() override = default;
111
112 void SetTop(bool on = true) { top = on; }
113};
114
115
116/** Base class for render info block */
118public:
119 /// virtual destructor required for the I/O
120 virtual ~RGeomRenderInfo() = default;
121};
122
123/** Render info with raw data */
125public:
126 std::vector<unsigned char> raw; ///< float vertices as raw data, JSON_base64
127 std::vector<int> idx; ///< vertex indexes, always triangles
128 ~RGeomRawRenderInfo() override = default;
129};
130
131/** Render info with shape itself - client can produce shape better */
133public:
134 TGeoShape *shape{nullptr}; ///< original shape - can be much less than binary data
135 ~RGeomShapeRenderInfo() override = default;
136};
137
138
139/** RGeomVisible contains description of visible node
140 * It is path to the node plus reference to shape rendering data */
141
143public:
144 int nodeid{0}; ///< selected node id,
145 int seqid{0}; ///< sequence id, used for merging later
146 std::vector<int> stack; ///< path to the node, index in list of childs
147 std::string color; ///< color in rgb format
148 double opacity{1}; ///< opacity
149 RGeomRenderInfo *ri{nullptr}; ///< render information for the shape, can be same for different nodes
150
151 RGeomVisible() = default;
152 RGeomVisible(int _nodeid, int _seqid, const std::vector<int> &_stack) : nodeid(_nodeid), seqid(_seqid), stack(_stack) {}
153};
154
155
156/** Configuration parameters which can be configured on the client
157 * Send as is to-from client */
158
160public:
161 int vislevel{0}; ///< visible level
162 int maxnumnodes{0}; ///< maximal number of nodes
163 int maxnumfaces{0}; ///< maximal number of faces
164 bool showtop{false}; ///< show geometry top volume, off by default
165 int build_shapes{1}; ///< when shapes build on server 0 - never, 1 - TGeoComposite, 2 - plus non-cylindrical, 3 - all
166 int nsegm{0}; ///< number of segments for cylindrical shapes
167 std::string drawopt; ///< draw options for TGeoPainter
168};
169
170
171/** Object with full description for drawing geometry
172 * It includes list of visible items and list of nodes required to build them */
173
175public:
176 RGeomConfig *cfg{nullptr}; ///< current configurations
177 int numnodes{0}; ///< total number of nodes in description
178 std::vector<RGeomNode*> nodes; ///< all used nodes to display visible items and not known for client
179 std::vector<RGeomVisible> visibles; ///< all visible items
180};
181
182
183/** Node information including rendering data */
185public:
186 std::vector<std::string> path; ///< full path to node
187 std::string node_type; ///< node class name
188 std::string node_name; ///< node name
189 std::string shape_type; ///< shape type (if any)
190 std::string shape_name; ///< shape class name (if any)
191
192 RGeomRenderInfo *ri{nullptr}; ///< rendering information (if applicable)
193};
194
195/** Custom settings for physical Node visibility */
197public:
198 std::vector<int> stack; ///< path to the node
199 bool visible{false}; ///< visible flag
200 RGeomNodeVisibility(const std::vector<int> &_stack, bool _visible) : stack(_stack), visible(_visible) {}
201};
202
203using RGeomScanFunc_t = std::function<bool(RGeomNode &, std::vector<int> &, bool, int)>;
204
205using RGeomSignalFunc_t = std::function<void(const std::string &)>;
206
208
209 friend class RGeomBrowserIter;
210
212 public:
213 int id{0}; ///<! sequential id
214 TGeoShape *fShape{nullptr}; ///<! original shape
215 int nfaces{0}; ///<! number of faces in render data
216 RGeomRawRenderInfo fRawInfo; ///<! raw render info
217 RGeomShapeRenderInfo fShapeInfo; ///<! shape itself as info
219
220 bool has_shape() const { return nfaces == 1; }
221 bool has_raw() const { return nfaces > 1; }
222
223 /// Provide render info for visible item
225 {
226 if (has_shape()) return &fShapeInfo;
227 if (has_raw()) return &fRawInfo;
228 return nullptr;
229 }
230
231 void reset()
232 {
233 nfaces = 0;
234 fShapeInfo.shape = nullptr;
235 fRawInfo.raw.clear();
236 }
237 };
238
239 std::vector<TGeoNode *> fNodes; ///<! flat list of all nodes
240 std::vector<RGeomNode> fDesc; ///<! converted description, send to client
241 std::vector<RGeomNodeVisibility> fVisibility; ///<! custom visibility flags for physical nodes
242
243 TGeoVolume *fDrawVolume{nullptr};///<! select volume independent from TGeoManager
244 std::vector<int> fSelectedStack; ///<! selected branch of geometry by stack
245
246 std::vector<int> fHighlightedStack; ///<! highlighted element by stack
247 std::vector<int> fClickedStack; ///<! clicked element by stack
248
249 std::vector<int> fSortMap; ///<! nodes in order large -> smaller volume
250 std::vector<ShapeDescr> fShapes; ///<! shapes with created descriptions
251
252 std::string fSearch; ///<! search string in hierarchy
253 std::string fSearchJson; ///<! drawing json for search
254 std::string fDrawJson; ///<! JSON with main nodes drawn by client
255 int fDrawIdCut{0}; ///<! sortid used for selection of most-significant nodes
256 int fActualLevel{0}; ///<! level can be reduced when selecting nodes
257 bool fPreferredOffline{false}; ///<! indicates that full description should be provided to client
258 int fJsonComp{0}; ///<! default JSON compression
259 std::string fActiveItemName; ///<! name of item which should be activated in hierarchy
260
261 RGeomConfig fCfg; ///<! configuration parameter editable from GUI
262
263 TVirtualMutex *fMutex{nullptr}; ///<! external mutex used to protect all data
264
265 std::vector<std::pair<const void *, RGeomSignalFunc_t>> fSignals; ///<! registered signals
266
267 void PackMatrix(std::vector<float> &arr, TGeoMatrix *matr);
268
269 int MarkVisible(bool on_screen = false);
270
271 void ProduceIdShifts();
272
273 int ScanNodes(bool only_visible, int maxlvl, RGeomScanFunc_t func);
274
275 void ResetRndrInfos();
276
278
280
281 int GetUsedNSegments(int min = 20);
282
283 int CountShapeFaces(TGeoShape *shape);
284
286
287 void CollectNodes(RGeomDrawing &drawing, bool all_nodes = false);
288
289 std::string MakeDrawingJson(RGeomDrawing &drawing, bool has_shapes = false);
290
291 void ClearDescription();
292
294
295 TGeoVolume *GetVolume(int nodeid);
296
297 int IsPhysNodeVisible(const std::vector<int> &stack);
298
299 /** clear drawing data without locking mutex */
301 {
302 fDrawJson.clear();
303 fSearchJson.clear();
304 }
305
306public:
307 RGeomDescription() = default;
308
309 void AddSignalHandler(const void *handler, RGeomSignalFunc_t func);
310
311 void RemoveSignalHandler(const void *handler);
312
313 void IssueSignal(const void *handler, const std::string &kind);
314
315 /** Set mutex, it must be recursive one */
316 void SetMutex(TVirtualMutex *mutex) { fMutex = mutex; }
317 /** Return currently used mutex */
318 TVirtualMutex *GetMutex() const { return fMutex; }
319
320 /** Set maximal number of nodes which should be selected for drawing */
321 void SetMaxVisNodes(int cnt)
322 {
323 TLockGuard lock(fMutex);
324 fCfg.maxnumnodes = cnt;
326 }
327 /** Returns maximal visible number of nodes, ignored when non-positive */
328 int GetMaxVisNodes() const
329 {
330 TLockGuard lock(fMutex);
331 return fCfg.maxnumnodes;
332 }
333
334 /** Set maximal number of faces which should be selected for drawing */
335 void SetMaxVisFaces(int cnt)
336 {
337 TLockGuard lock(fMutex);
338 fCfg.maxnumfaces = cnt;
340 }
341 /** Returns maximal visible number of faces, ignored when non-positive */
342 int GetMaxVisFaces() const
343 {
344 TLockGuard lock(fMutex);
345 return fCfg.maxnumfaces;
346 }
347
348 /** Set maximal visible level */
349 void SetVisLevel(int lvl = 3)
350 {
351 TLockGuard lock(fMutex);
352 fCfg.vislevel = lvl;
354 }
355 /** Returns maximal visible level */
356 int GetVisLevel() const
357 {
358 TLockGuard lock(fMutex);
359 return fCfg.vislevel;
360 }
361
362 /** Set draw options as string for JSROOT TGeoPainter */
363 void SetTopVisible(bool on = true)
364 {
365 TLockGuard lock(fMutex);
366 fCfg.showtop = on;
368 }
369 /** Returns draw options, used for JSROOT TGeoPainter */
370 bool GetTopVisible() const
371 {
372 TLockGuard lock(fMutex);
373 return fCfg.showtop;
374 }
375
376 /** Instruct to build binary 3D model already on the server (true) or send TGeoShape as is to client, which can build model itself */
377 void SetBuildShapes(int lvl = 1)
378 {
379 TLockGuard lock(fMutex);
382 }
383 /** Returns true if binary 3D model build already by C++ server (default) */
384 int IsBuildShapes() const
385 {
386 TLockGuard lock(fMutex);
387 return fCfg.build_shapes;
388 }
389
390 /** Set number of segments for cylindrical shapes, if 0 - default value will be used */
391 void SetNSegments(int n = 0)
392 {
393 TLockGuard lock(fMutex);
394 fCfg.nsegm = n;
396 }
397 /** Return of segments for cylindrical shapes, if 0 - default value will be used */
398 int GetNSegments() const
399 {
400 TLockGuard lock(fMutex);
401 return fCfg.nsegm;
402 }
403
404 /** Set draw options as string for JSROOT TGeoPainter */
405 void SetDrawOptions(const std::string &opt = "")
406 {
407 TLockGuard lock(fMutex);
408 fCfg.drawopt = opt;
410 }
411 /** Returns draw options, used for JSROOT TGeoPainter */
412 std::string GetDrawOptions() const
413 {
414 TLockGuard lock(fMutex);
415 return fCfg.drawopt;
416 }
417
418 /** Set JSON compression level for data transfer */
419 void SetJsonComp(int comp = 0)
420 {
421 TLockGuard lock(fMutex);
422 fJsonComp = comp;
424 }
425 /** Returns JSON compression level for data transfer */
426 int GetJsonComp() const
427 {
428 TLockGuard lock(fMutex);
429 return fJsonComp;
430 }
431
432 /** Set preference of offline operations.
433 * Server provides more info to client from the begin on to avoid communication */
435 {
436 TLockGuard lock(fMutex);
438 }
439 /** Is offline operations preferred.
440 * After get full description, client can do most operations without extra requests */
442 {
443 TLockGuard lock(fMutex);
444 return fPreferredOffline;
445 }
446
447 /** Get top node path */
448 const std::vector<int>& GetSelectedStack() const { return fSelectedStack; }
449
450 void Build(TGeoManager *mgr, const std::string &volname = "");
451
452 void Build(TGeoVolume *vol);
453
454 /** Number of unique nodes in the geometry */
455 int GetNumNodes() const { TLockGuard lock(fMutex); return fDesc.size(); }
456
457 bool IsBuild() const { return GetNumNodes() > 0; }
458
459 std::string ProduceJson(bool all_nodes = false);
460
461 bool IsPrincipalEndNode(int nodeid);
462
463 std::string ProcessBrowserRequest(const std::string &req = "");
464
465 bool HasDrawData() const;
466 void ProduceDrawData();
467 void ProduceSearchData();
468 std::string GetDrawJson() const { TLockGuard lock(fMutex); return fDrawJson; }
469 std::string GetSearch() const { TLockGuard lock(fMutex); return fSearch; }
470 std::string GetSearchJson() const { TLockGuard lock(fMutex); return fSearchJson; }
471 void ClearDrawData();
472
473 void ClearCache();
474
475 int SearchVisibles(const std::string &find, std::string &hjson, std::string &json);
476
477 int FindNodeId(const std::vector<int> &stack);
478
479 std::string ProduceModifyReply(int nodeid);
480
481 std::vector<int> MakeStackByIds(const std::vector<int> &ids);
482
483 std::vector<int> MakeIdsByStack(const std::vector<int> &stack);
484
485 std::vector<int> MakeStackByPath(const std::vector<std::string> &path);
486
487 std::vector<std::string> MakePathByStack(const std::vector<int> &stack);
488
489 bool ProduceDrawingFor(int nodeid, std::string &json, bool check_volume = false);
490
491 bool SetHighlightedItem(const std::vector<int> &stack)
492 {
493 TLockGuard lock(fMutex);
494 bool changed = fHighlightedStack != stack;
495 fHighlightedStack = stack;
496 return changed;
497 }
498
499 std::vector<int> GetHighlightedItem() const
500 {
501 TLockGuard lock(fMutex);
502 return fHighlightedStack;
503 }
504
505 bool SetClickedItem(const std::vector<int> &stack)
506 {
507 TLockGuard lock(fMutex);
508 bool changed = fClickedStack != stack;
509 fClickedStack = stack;
510 return changed;
511 }
512
513 std::vector<int> GetClickedItem() const
514 {
515 TLockGuard lock(fMutex);
516 return fClickedStack;
517 }
518
519 bool SetActiveItem(const std::string &itemname)
520 {
521 TLockGuard lock(fMutex);
522 bool changed = (fActiveItemName != itemname);
524 return changed;
525 }
526
527 std::string GetActiveItem() const
528 {
529 TLockGuard lock(fMutex);
530 return fActiveItemName;
531 }
532
533 bool ChangeConfiguration(const std::string &json);
534
535 std::unique_ptr<RGeomNodeInfo> MakeNodeInfo(const std::vector<int> &stack);
536
537 bool ChangeNodeVisibility(const std::vector<std::string> &path, bool on);
538
539 bool SelectTop(const std::vector<std::string> &path);
540
541 bool SetPhysNodeVisibility(const std::vector<std::string> &path, bool on = true);
542
543 bool SetPhysNodeVisibility(const std::string &path, bool on = true);
544
545 bool ClearPhysNodeVisibility(const std::vector<std::string> &path);
546
548
549 bool SetSearch(const std::string &query, const std::string &json);
550
551 void SavePrimitive(std::ostream &fs, const std::string &name);
552};
553
554} // namespace ROOT
555
556#endif
nlohmann::json json
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:88
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:93
bool top
indicates if node selected as top
Definition RGeomData.hxx:97
void SetTop(bool on=true)
std::string material
material
Definition RGeomData.hxx:94
~RGeoItem() override=default
int pvis
visibility of physical node
Definition RGeomData.hxx:96
int vis
visibility of logical node
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...
const std::vector< int > & GetSelectedStack() const
Get top node path.
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 drawing data.
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 _ClearDrawData()
clear drawing data without locking mutex
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:41
bool IsVisible() const
Definition RGeomData.hxx:55
int vis
visibility flag, 0 - off, 1 - only when level==0, 99 - always
Definition RGeomData.hxx:46
std::string material
name of the material
Definition RGeomData.hxx:50
RGeomNodeBase(int _id=0)
Definition RGeomData.hxx:53
int sortid
! place in sorted array, to check cuts, or id of original node when used search structures
Definition RGeomData.hxx:51
bool nochlds
how far in hierarchy depth should be scanned
Definition RGeomData.hxx:47
std::string color
rgb code in hex format
Definition RGeomData.hxx:49
std::vector< int > chlds
list of childs id
Definition RGeomData.hxx:45
std::string name
node name
Definition RGeomData.hxx:44
const char * GetArg(int kind)
Returns argument for regexp.
Definition RGeomData.hxx:58
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:68
float opacity
! opacity of the color
Definition RGeomData.hxx:75
int idshift
! used to jump over then scan all geom hierarchy
Definition RGeomData.hxx:73
double vol
! volume estimation
Definition RGeomData.hxx:71
bool useflag
! extra flag, used for selection
Definition RGeomData.hxx:74
std::vector< float > matr
matrix for the node, can have reduced number of elements
Definition RGeomData.hxx:70
RGeomNode(int _id=0)
Definition RGeomData.hxx:77
int nfaces
! number of shape faces
Definition RGeomData.hxx:72
bool CanDisplay() const
True when there is shape and it can be displayed.
Definition RGeomData.hxx:80
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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.
Definition RGeomData.cxx:49
std::function< bool(RGeomNode &, std::vector< int > &, bool, int)> RGeomScanFunc_t
std::function< void(const std::string &)> RGeomSignalFunc_t