Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RGeomViewer.hxx
Go to the documentation of this file.
1// Author: Sergey Linev, 13.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_RGeomViewer
12#define ROOT7_RGeomViewer
13
15#include <ROOT/RGeomData.hxx>
16
17#include <memory>
18
19class TGeoManager;
20class TGeoVolume;
21
22namespace ROOT {
23
24class RWebWindow;
25class RGeomHierarchy;
26
28
29protected:
30
31 TGeoManager *fGeoManager{nullptr}; ///<! geometry to show
32 std::string fSelectedVolume; ///<! name of selected volume
33 RGeomDescription fDesc; ///<! geometry description, send to the client as first message
34 bool fShowHierarchy{true}; ///<! if hierarchy visible by default
35 bool fShowColumns{true}; ///<! show columns in hierarchy
36 std::string fTitle; ///<! title of geometry viewer
37 bool fInfoActive{false}; ///<! true when info page active and node info need to be provided
38
39 std::shared_ptr<RWebWindow> fWebWindow; ///<! web window to show geometry
40
41 std::shared_ptr<RGeomHierarchy> fWebHierarchy; ///<! web handle for hierarchy part
42
43 void WebWindowCallback(unsigned connid, const std::string &arg);
44
45 void WebWindowDisconnect(unsigned connid);
46
47 std::vector<int> GetStackFromJson(const std::string &json, bool node_ids = false);
48
49 void SendGeometry(unsigned connid = 0, bool first_time = false);
50
51 void ProcessSignal(const std::string &);
52
53public:
54
55 RGeomViewer(TGeoManager *mgr = nullptr, const std::string &volname = "");
56 virtual ~RGeomViewer();
57
58 void SetTitle(const std::string &title) { fTitle = title; }
59 const std::string &GetTitle() const { return fTitle; }
60
61 std::string GetWindowAddr() const;
62
63 std::string GetWindowUrl(bool remote);
64
65 void SetGeometry(TGeoManager *mgr, const std::string &volname = "");
66
67 void SelectVolume(const std::string &volname);
68
69 void SetOnlyVolume(TGeoVolume *vol);
70
71 /** Configures maximal number of visible nodes and faces */
72 void SetLimits(int nnodes = 5000, int nfaces = 100000)
73 {
74 fDesc.SetMaxVisNodes(nnodes);
75 fDesc.SetMaxVisFaces(nfaces);
76 }
77
78 /** Configures maximal visible level */
79 void SetVisLevel(int lvl = 3)
80 {
81 fDesc.SetVisLevel(lvl);
82 }
83
84 void SetTopVisible(bool on = true)
85 {
87 }
88
89 /** Configures default hierarchy browser visibility, only has effect before showing web window */
90 void SetShowHierarchy(bool on = true) { fShowHierarchy = on; }
91
92 /** Returns default hierarchy browser visibility */
93 bool GetShowHierarchy() const { return fShowHierarchy; }
94
95 void SetShowColumns(bool on = true) { fShowColumns = on; }
96
97 bool GetShowColumns() const { return fShowColumns; }
98
99 void SetDrawOptions(const std::string &opt);
100
101 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
102
103 void Update();
104
105 void SaveImage(const std::string &fname = "geometry.png", int width = 0, int height = 0);
106
108
109 void SaveAsMacro(const std::string &fname);
110
111 void ClearOnClose(const std::shared_ptr<void> &handle);
112
113};
114
115} // namespace ROOT
116
117#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 width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
void SetMaxVisNodes(int cnt)
Set maximal number of nodes which should be selected for drawing.
void SetVisLevel(int lvl=3)
Set maximal visible level.
void SetMaxVisFaces(int cnt)
Set maximal number of faces which should be selected for drawing.
void SetTopVisible(bool on=true)
Set draw options as string for JSROOT TGeoPainter.
void SetShowColumns(bool on=true)
void SetTitle(const std::string &title)
RGeomDescription & Description()
void Show(const RWebDisplayArgs &args="", bool always_start_new_browser=false)
Show or update geometry in web window If web browser already started - just refresh drawing like "rel...
void SetGeometry(TGeoManager *mgr, const std::string &volname="")
assign new geometry to the viewer
void SetVisLevel(int lvl=3)
Configures maximal visible level.
std::vector< int > GetStackFromJson(const std::string &json, bool node_ids=false)
convert JSON into stack array
virtual ~RGeomViewer()
destructor
void SendGeometry(unsigned connid=0, bool first_time=false)
Send data for principal geometry draw Should be used when essential settings were changed in geometry...
std::string GetWindowAddr() const
Return web window address (name) used for geometry viewer.
std::shared_ptr< RGeomHierarchy > fWebHierarchy
! web handle for hierarchy part
const std::string & GetTitle() const
void WebWindowDisconnect(unsigned connid)
Process disconnect event Clear cache data and dependent connections.
void ClearOnClose(const std::shared_ptr< void > &handle)
Set handle which will be cleared when connection is closed Must be called after window is shown.
bool fShowHierarchy
! if hierarchy visible by default
bool GetShowColumns() const
void SaveAsMacro(const std::string &fname)
Save viewer configuration as macro.
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
void SetTopVisible(bool on=true)
void Update()
Update geometry drawings in all web displays.
void ProcessSignal(const std::string &)
Process signal from geom description when it changed by any means.
bool GetShowHierarchy() const
Returns default hierarchy browser visibility.
void SetDrawOptions(const std::string &opt)
Configures draw option for geometry Normally has effect before first drawing of the geometry When geo...
TGeoManager * fGeoManager
! geometry to show
void SetLimits(int nnodes=5000, int nfaces=100000)
Configures maximal number of visible nodes and faces.
std::string GetWindowUrl(bool remote)
Return web window URL which can be used for connection See ROOT::RWebWindow::GetUrl docu for more det...
std::string fTitle
! title of geometry viewer
bool fShowColumns
! show columns in hierarchy
std::string fSelectedVolume
! name of selected volume
void SetShowHierarchy(bool on=true)
Configures default hierarchy browser visibility, only has effect before showing web window.
void WebWindowCallback(unsigned connid, const std::string &arg)
Process data from client.
bool fInfoActive
! true when info page active and node info need to be provided
void SetOnlyVolume(TGeoVolume *vol)
Draw only specified volume, special case when volume stored without valid geomanager.
void SelectVolume(const std::string &volname)
Select visible top volume, all other volumes will be disabled.
void SaveImage(const std::string &fname="geometry.png", int width=0, int height=0)
Produce PNG image of the geometry If web-browser is shown and drawing completed, image is requested f...
RGeomDescription fDesc
! geometry description, send to the client as first message
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...