Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RGeomViewer.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Sergey Linev, 13.12.2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_RGeomViewer
13#define ROOT7_RGeomViewer
14
16#include <ROOT/RGeomData.hxx>
17
18#include <memory>
19
20class TGeoManager;
21class TGeoVolume;
22
23namespace ROOT {
24namespace Experimental {
25
26class RWebWindow;
27
29
30protected:
31
32 TGeoManager *fGeoManager{nullptr}; ///<! geometry to show
33 std::string fSelectedVolume; ///<! name of selected volume
34 RGeomDescription fDesc; ///<! geometry description, send to the client as first message
35 bool fShowHierarchy{true}; ///<! if hierarchy visible by default
36 std::string fTitle; ///<! title of geometry viewer
37
38 std::shared_ptr<RWebWindow> fWebWindow; ///<! web window to show geometry
39
40 void WebWindowCallback(unsigned connid, const std::string &arg);
41
42 std::vector<int> GetStackFromJson(const std::string &json, bool node_ids = false);
43
44 void SendGeometry(unsigned connid);
45
46public:
47
48 RGeomViewer(TGeoManager *mgr = nullptr, const std::string &volname = "");
49 virtual ~RGeomViewer();
50
51 void SetTitle(const std::string &title) { fTitle = title; }
52 const std::string &GetTitle() const { return fTitle; }
53
54 std::string GetWindowAddr() const;
55
56 void SetGeometry(TGeoManager *mgr, const std::string &volname = "");
57
58 void SelectVolume(const std::string &volname);
59
60 void SetOnlyVolume(TGeoVolume *vol);
61
62 /** Configures maximal number of visible nodes and faces */
63 void SetLimits(int nnodes = 5000, int nfaces = 100000)
64 {
65 fDesc.SetMaxVisNodes(nnodes);
66 fDesc.SetMaxVisFaces(nfaces);
67 }
68
69 /** Configures maximal visible level */
70 void SetVisLevel(int lvl = 3)
71 {
72 fDesc.SetVisLevel(lvl);
73 }
74
75 void SetTopVisible(bool on = true)
76 {
78 }
79
80 /** Configures default hierarchy browser visibility, only has effect before showing web window */
81 void SetShowHierarchy(bool on = true) { fShowHierarchy = on; }
82
83 /** Returns default hierarchy browser visibility */
84 bool GetShowHierarchy() const { return fShowHierarchy; }
85
86 void SetDrawOptions(const std::string &opt);
87
88 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
89
90 void Update();
91
92 void SaveImage(const std::string &fname = "geometry.png", int width = 0, int height = 0);
93
94};
95
96} // namespace Experimental
97} // namespace ROOT
98
99#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 SetTitle(const std::string &title)
void SetTopVisible(bool on=true)
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
std::vector< int > GetStackFromJson(const std::string &json, bool node_ids=false)
convert JSON into stack array
virtual ~RGeomViewer()
destructor
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
std::string GetWindowAddr() const
Return URL address of web window used for geometry viewer.
void SetVisLevel(int lvl=3)
Configures maximal visible level.
std::string fSelectedVolume
! name of selected volume
bool fShowHierarchy
! if hierarchy visible by default
void Update()
Update geometry drawings in all web displays.
void SetLimits(int nnodes=5000, int nfaces=100000)
Configures maximal number of visible nodes and faces.
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...
void SetShowHierarchy(bool on=true)
Configures default hierarchy browser visibility, only has effect before showing web window.
TGeoManager * fGeoManager
! geometry to show
const std::string & GetTitle() const
RGeomDescription fDesc
! geometry description, send to the client as first message
void SendGeometry(unsigned connid)
Send data for principal geometry draw.
void WebWindowCallback(unsigned connid, const std::string &arg)
receive data from client
std::string fTitle
! title of geometry viewer
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...
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.