11#ifndef ROOT7_RGeomData
12#define ROOT7_RGeomData
33class RGeomBrowserIter;
35namespace Experimental {
40Experimental::RLogChannel &
RGeomLog();
63 if (kind == 1)
return color.c_str();
64 if (kind == 2)
return material.c_str();
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) :
129 std::vector<unsigned char>
raw;
268 std::vector<std::pair<const void *, RGeomSignalFunc_t>>
fSignals;
309 void IssueSignal(
const void *handler,
const std::string &kind);
391 int FindNodeId(
const std::vector<int> &stack);
399 std::vector<int>
MakeStackByPath(
const std::vector<std::string> &path);
401 std::vector<std::string>
MakePathByStack(
const std::vector<int> &stack);
449 std::unique_ptr<RGeomNodeInfo>
MakeNodeInfo(
const std::vector<int> &stack);
453 bool SelectTop(
const std::vector<std::string> &path);
463 bool SetSearch(
const std::string &query,
const std::string &
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
Representation of single item in the browser.
Representation of single item in the geometry browser.
RGeoItem(const std::string &_name, int _nchilds, int _nodeid, const std::string &_color, const std::string &_material="", int _vis=0, int _pvis=0)
bool top
indicates if node selected as top
void SetTop(bool on=true)
std::string material
material
~RGeoItem() override=default
int pvis
visibility of physical node
int vis
visibility of logical node
RGeoItem()=default
Default constructor.
Iterator of hierarchical geometry structures.
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.
RGeomDescription()=default
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.
int vis
visibility flag, 0 - off, 1 - only when level==0, 99 - always
std::string material
name of the material
int sortid
! place in sorted array, to check cuts, or id of original node when used search structures
bool nochlds
how far in hierarchy depth should be scanned
std::string color
rgb code in hex format
int id
node id, index in array
std::vector< int > chlds
list of childs id
std::string name
node name
const char * GetArg(int kind)
Returns argument for regexp.
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)
std::vector< int > stack
path to the node
Full node description including matrices and other attributes.
float opacity
! opacity of the color
int idshift
! used to jump over then scan all geom hierarchy
double vol
! volume estimation
bool useflag
! extra flag, used for selection
std::vector< float > matr
matrix for the node, can have reduced number of elements
int nfaces
! number of shape faces
bool CanDisplay() const
True when there is shape and it can be displayed.
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
int nodeid
selected node id,
std::vector< int > stack
path to the node, index in list of childs
The manager class for any TGeo geometry.
Geometrical transformation package.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Base abstract class for all shapes.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
This class implements a mutex interface.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
std::function< void(const std::string &)> RGeomSignalFunc_t
Experimental::RLogChannel & RGeomLog()
Log channel for Geomviewer diagnostics.
std::function< bool(RGeomNode &, std::vector< int > &, bool, int)> RGeomScanFunc_t