Logo ROOT  
Reference Guide
REveGeomViewer.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_REveGeomViewer
13 #define ROOT7_REveGeomViewer
14 
15 #include <ROOT/RWebDisplayArgs.hxx>
16 #include <ROOT/REveGeomData.hxx>
17 
18 #include <memory>
19 
20 class TGeoManager;
21 
22 namespace ROOT {
23 namespace Experimental {
24 
25 class RWebWindow;
26 class REveManager;
27 
29 
30  friend class REveManager;
31 
32 protected:
33 
34  TGeoManager *fGeoManager{nullptr}; ///<! geometry to show
35  std::string fSelectedVolume; ///<! name of selected volume
36  REveGeomDescription fDesc; ///<! geometry description, send to the client as first message
37  bool fShowHierarchy{true}; ///<! if hierarchy visible by default
38 
39  std::shared_ptr<RWebWindow> fWebWindow; ///<! web window to show geometry
40 
41  void WebWindowCallback(unsigned connid, const std::string &arg);
42 
43  std::vector<int> GetStackFromJson(const std::string &json, bool node_ids = false);
44 
45  void SendGeometry(unsigned connid);
46 
47 public:
48 
49  REveGeomViewer(TGeoManager *mgr = nullptr, const std::string &volname = "");
50  virtual ~REveGeomViewer();
51 
52  void SetGeometry(TGeoManager *mgr, const std::string &volname = "");
53 
54  void SelectVolume(const std::string &volname);
55 
56  /** Configures maximal number of visible nodes and faces */
57  void SetLimits(int nnodes = 5000, int nfaces = 100000)
58  {
59  fDesc.SetMaxVisNodes(nnodes);
60  fDesc.SetMaxVisFaces(nfaces);
61  }
62 
63  /** Configures maximal visible level */
64  void SetVisLevel(int lvl = 3)
65  {
66  fDesc.SetVisLevel(lvl);
67  }
68 
69  /** Configures default hierarchy browser visibility, only has effect before showing web window */
70  void SetShowHierarchy(bool on = true) { fShowHierarchy = on; }
71 
72  /** Returns default hierarchy browser visibility */
73  bool GetShowHierarchy() const { return fShowHierarchy; }
74 
75  void SetDrawOptions(const std::string &opt);
76 
77  void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
78 
79  void Update();
80 
81  void SaveImage(const std::string &fname = "geometry.png");
82 
83 };
84 
85 } // namespace Experimental
86 } // namespace ROOT
87 
88 #endif
ROOT::Experimental::REveGeomViewer::SelectVolume
void SelectVolume(const std::string &volname)
Select visible top volume, all other volumes will be disabled.
Definition: REveGeomViewer.cxx:75
ROOT::Experimental::REveGeomViewer::REveGeomViewer
REveGeomViewer(TGeoManager *mgr=nullptr, const std::string &volname="")
constructor
Definition: REveGeomViewer.cxx:32
ROOT::Experimental::REveGeomDescription
Definition: REveGeomData.hxx:161
ROOT::Experimental::REveGeomViewer::Show
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...
Definition: REveGeomViewer.cxx:86
ROOT::Experimental::REveGeomViewer::SetGeometry
void SetGeometry(TGeoManager *mgr, const std::string &volname="")
assign new geometry to the viewer
Definition: REveGeomViewer.cxx:61
nlohmann::json
basic_json<> json
Definition: REveElement.hxx:58
RWebDisplayArgs.hxx
ROOT::Experimental::REveGeomViewer::~REveGeomViewer
virtual ~REveGeomViewer()
destructor
Definition: REveGeomViewer.cxx:53
ROOT::Experimental::REveGeomViewer::fSelectedVolume
std::string fSelectedVolume
! name of selected volume
Definition: REveGeomViewer.hxx:35
ROOT::Experimental::RWebDisplayArgs
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
Definition: RWebDisplayArgs.hxx:29
ROOT::Experimental::REveGeomViewer::SendGeometry
void SendGeometry(unsigned connid)
Send data for principal geometry draw.
Definition: REveGeomViewer.cxx:127
ROOT::Experimental::REveGeomViewer::fWebWindow
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
Definition: REveGeomViewer.hxx:39
ROOT::Experimental::REveGeomDescription::SetMaxVisNodes
void SetMaxVisNodes(int cnt)
Set maximal number of nodes which should be selected for drawing.
Definition: REveGeomData.hxx:238
ROOT::Experimental::REveGeomViewer::fGeoManager
TGeoManager * fGeoManager
! geometry to show
Definition: REveGeomViewer.hxx:34
REveGeomData.hxx
ROOT::Experimental::REveGeomViewer::SetLimits
void SetLimits(int nnodes=5000, int nfaces=100000)
Configures maximal number of visible nodes and faces.
Definition: REveGeomViewer.hxx:57
ROOT::Experimental::REveGeomViewer::GetShowHierarchy
bool GetShowHierarchy() const
Returns default hierarchy browser visibility.
Definition: REveGeomViewer.hxx:73
ROOT::Experimental::REveGeomViewer::SaveImage
void SaveImage(const std::string &fname="geometry.png")
Produce PNG image of drawn geometry Drawing should be completed at the moment Executed asynchronous -...
Definition: REveGeomViewer.cxx:157
ROOT::Experimental::REveGeomDescription::SetMaxVisFaces
void SetMaxVisFaces(int cnt)
Set maximal number of faces which should be selected for drawing.
Definition: REveGeomData.hxx:244
ROOT::Experimental::REveGeomViewer::WebWindowCallback
void WebWindowCallback(unsigned connid, const std::string &arg)
receive data from client
Definition: REveGeomViewer.cxx:167
ROOT::Experimental::REveGeomViewer::SetVisLevel
void SetVisLevel(int lvl=3)
Configures maximal visible level.
Definition: REveGeomViewer.hxx:64
ROOT::Experimental::REveGeomViewer::GetStackFromJson
std::vector< int > GetStackFromJson(const std::string &json, bool node_ids=false)
convert JSON into stack array
Definition: REveGeomViewer.cxx:109
ROOT::Experimental::REveGeomViewer::fDesc
REveGeomDescription fDesc
! geometry description, send to the client as first message
Definition: REveGeomViewer.hxx:36
ROOT::Experimental::REveGeomViewer::fShowHierarchy
bool fShowHierarchy
! if hierarchy visible by default
Definition: REveGeomViewer.hxx:37
ROOT::Experimental::REveGeomViewer
Definition: REveGeomViewer.hxx:28
ROOT::Experimental::REveManager
Definition: REveManager.hxx:44
ROOT::Experimental::REveGeomDescription::SetVisLevel
void SetVisLevel(int lvl=3)
Set maximal visible level.
Definition: REveGeomData.hxx:250
ROOT::Experimental::REveGeomViewer::SetShowHierarchy
void SetShowHierarchy(bool on=true)
Configures default hierarchy browser visibility, only has effect before showing web window.
Definition: REveGeomViewer.hxx:70
TGeoManager
The manager class for any TGeo geometry.
Definition: TGeoManager.h:45
ROOT::Experimental::REveGeomViewer::SetDrawOptions
void SetDrawOptions(const std::string &opt)
Configures draw option for geometry Normally has effect before first drawing of the geometry When geo...
Definition: REveGeomViewer.cxx:144
ROOT::Experimental::REveGeomViewer::Update
void Update()
Update geometry drawings in all web displays.
Definition: REveGeomViewer.cxx:101
ROOT
VSD Structures.
Definition: StringConv.hxx:21