Logo ROOT   6.21/01
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
TGeoManager * fGeoManager
! geometry to show
void WebWindowCallback(unsigned connid, const std::string &arg)
receive data from client
void SetVisLevel(int lvl=3)
Set maximal visible level.
void SetVisLevel(int lvl=3)
Configures maximal visible level.
The manager class for any TGeo geometry.
Definition: TGeoManager.h:42
Returns the available number of logical cores.
Definition: StringConv.hxx:21
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
void SetMaxVisFaces(int cnt)
Set maximal number of faces which should be selected for drawing.
REveGeomDescription fDesc
! geometry description, send to the client as first message
bool fShowHierarchy
! if hierarchy visible by default
void SetShowHierarchy(bool on=true)
Configures default hierarchy browser visibility, only has effect before showing web window...
virtual ~REveGeomViewer()
destructor
std::shared_ptr< RWebWindow > fWebWindow
! web window to show geometry
void SetMaxVisNodes(int cnt)
Set maximal number of nodes which should be selected for drawing.
REveGeomViewer(TGeoManager *mgr=nullptr, const std::string &volname="")
constructor
std::vector< int > GetStackFromJson(const std::string &json, bool node_ids=false)
convert JSON into stack array
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...
basic_json< std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, adl_serializer > json
Definition: REveElement.hxx:51
std::string fSelectedVolume
! name of selected volume
void SelectVolume(const std::string &volname)
Select visible top volume, all other volumes will be disabled.
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 SaveImage(const std::string &fname="geometry.png")
Produce PNG image of drawn geometry Drawing should be completed at the moment Executed asynchronous -...
void SetGeometry(TGeoManager *mgr, const std::string &volname="")
assign new geometry to the viewer
void SetDrawOptions(const std::string &opt)
Configures draw option for geometry Normally has effect before first drawing of the geometry When geo...
void SendGeometry(unsigned connid)
Send data for principal geometry draw.
void Update()
Update geometry drawings in all web displays.