Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
28 class REveGeomViewer {
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 }}
86 
87 #endif