Logo ROOT  
Reference Guide
REveManager.hxx
Go to the documentation of this file.
1 // @(#)root/eve7:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 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_REveManager
13 #define ROOT7_REveManager
14 
15 #include <ROOT/REveElement.hxx>
16 
17 #include <ROOT/RWebDisplayArgs.hxx>
18 
19 #include "TSysEvtHandler.h"
20 #include "TTimer.h"
21 
22 #include <memory>
23 #include <unordered_map>
24 
25 class TMap;
26 class TExMap;
27 class TMacro;
28 class TFolder;
29 class TGeoManager;
30 
31 namespace ROOT {
32 namespace Experimental {
33 
34 class REveSelection;
35 class REveViewer;
36 class REveViewerList;
37 class REveScene;
38 class REveSceneList;
39 
40 class RWebWindow;
41 class REveGeomViewer;
42 
44 {
45  REveManager(const REveManager&) = delete;
46  REveManager& operator=(const REveManager&) = delete;
47 
48 public:
50  private:
51  RRedrawDisabler(const RRedrawDisabler &) = delete;
53 
54  REveManager *fMgr{nullptr};
55 
56  public:
58  {
59  if (fMgr)
61  }
62  virtual ~RRedrawDisabler()
63  {
64  if (fMgr)
65  fMgr->EnableRedraw();
66  }
67  };
68 
70  public:
72  virtual ~RExceptionHandler() { Remove(); }
73 
74  virtual EStatus Handle(std::exception& exc);
75 
77  };
78 
79  struct Conn
80  {
81  unsigned fId{0};
82 
83  Conn() = default;
84  Conn(unsigned int cId) : fId(cId) {}
85  };
86 
87 protected:
88  RExceptionHandler *fExcHandler{nullptr}; //!< exception handler
89 
90  TMap *fVizDB{nullptr};
93 
94  TMap *fGeometries{nullptr}; // TODO: use std::map<std::string, std::unique_ptr<TGeoManager>>
95  TMap *fGeometryAliases{nullptr}; // TODO: use std::map<std::string, std::string>
96 
97  TFolder *fMacroFolder{nullptr};
98 
99  REveScene *fWorld{nullptr};
100 
103 
106 
114 
115  // ElementId management
116  std::unordered_map<ElementId_t, REveElement*> fElementIdMap;
119  ElementId_t fMaxElementIds{std::numeric_limits<ElementId_t>::max()};
120 
121  // Selection / highlight elements
125 
126  std::shared_ptr<ROOT::Experimental::RWebWindow> fWebWindow;
127  std::vector<Conn> fConnList;
128 
129  void WindowConnect(unsigned connid);
130  void WindowData(unsigned connid, const std::string &arg);
131  void WindowDisconnect(unsigned connid);
132 
133 public:
134  REveManager(); // (Bool_t map_window=kTRUE, Option_t* opt="FI");
135  virtual ~REveManager();
136 
138 
139  REveSelection *GetSelection() const { return fSelection; }
140  REveSelection *GetHighlight() const { return fHighlight; }
141 
142  REveSceneList *GetScenes() const { return fScenes; }
143  REveViewerList *GetViewers() const { return fViewers; }
144 
145  REveScene *GetGlobalScene() const { return fGlobalScene; }
146  REveScene *GetEventScene() const { return fEventScene; }
147 
148  REveScene *GetWorld() const { return fWorld; }
149 
150  REveViewer *SpawnNewViewer(const char *name, const char *title = "");
151  REveScene *SpawnNewScene(const char *name, const char *title = "");
152 
153  TFolder *GetMacroFolder() const { return fMacroFolder; }
154  TMacro *GetMacro(const char *name) const;
155 
158 
159  void Redraw3D(Bool_t resetCameras = kFALSE, Bool_t dropLogicals = kFALSE)
160  {
162  if (resetCameras) fResetCameras = kTRUE;
163  if (dropLogicals) fDropLogicals = kTRUE;
164  }
165  void RegisterRedraw3D();
166  void DoRedraw3D();
167  void FullRedraw3D(Bool_t resetCameras = kFALSE, Bool_t dropLogicals = kFALSE);
168 
169  void ClearAllSelections();
170 
173 
174  void AddElement(REveElement *element, REveElement *parent = nullptr);
175  void AddGlobalElement(REveElement *element, REveElement *parent = nullptr);
176 
177  void RemoveElement(REveElement* element, REveElement *parent);
178 
180  void AssignElementId (REveElement* element);
181  void PreDeleteElement(REveElement* element);
182  void BrowseElement(ElementId_t id);
183 
184  // VizDB - Visualization-parameter data-base.
186  Bool_t replace, Bool_t update);
188  REveElement *FindVizDBEntry (const TString& tag);
189 
190  void LoadVizDB(const TString& filename, Bool_t replace, Bool_t update);
191  void LoadVizDB(const TString& filename);
192  void SaveVizDB(const TString& filename);
193 
195  Bool_t GetVizDBUpdate () const { return fVizDBUpdate; }
198 
199 
200  // Geometry management.
201  TGeoManager *GetGeometry(const TString& filename);
202  TGeoManager *GetGeometryByAlias(const TString& alias);
204  void RegisterGeometryAlias(const TString& alias, const TString& filename);
205 
206  void ClearROOTClassSaved();
207 
208  void AddLocation(const std::string& name, const std::string& path);
209  void SetDefaultHtmlPage(const std::string& path);
210  void SetClientVersion(const std::string& version);
211 
212  static REveManager* Create();
213  static void Terminate();
214 
215  // Access to internals, needed for low-level control in advanced
216  // applications.
217 
219 
220  // void Send(void* buff, unsigned connid);
221  void Send(unsigned connid, const std::string &data);
222  void SendBinary(unsigned connid, const void *data, std::size_t len);
223 
225 
227 
228  void Show(const RWebDisplayArgs &args = "");
229 
230  std::shared_ptr<REveGeomViewer> ShowGeometry(const RWebDisplayArgs &args = "");
231 };
232 
234 
235 }}
236 
237 #endif
ROOT::Experimental::REveManager::fSelectionList
REveElement * fSelectionList
Definition: REveManager.hxx:122
ROOT::Experimental::REveManager::SaveVizDB
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
Definition: REveManager.cxx:515
m
auto * m
Definition: textangle.C:8
ROOT::Experimental::REveManager::fRedrawTimer
TTimer fRedrawTimer
Definition: REveManager.hxx:113
ROOT::Experimental::REveManager::RExceptionHandler::~RExceptionHandler
virtual ~RExceptionHandler()
Definition: REveManager.hxx:72
ROOT::Experimental::REveManager::DoRedraw3D
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
Definition: REveManager.cxx:242
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
ROOT::Experimental::REveManager::Conn::Conn
Conn(unsigned int cId)
Definition: REveManager.hxx:84
ROOT::Experimental::REveManager::BroadcastElementsOf
void BroadcastElementsOf(REveElement::List_t &els)
Definition: REveManager.cxx:927
ROOT::Experimental::REveManager::SpawnNewScene
REveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Definition: REveManager.cxx:214
ROOT::Experimental::REveManager::fVizDBUpdate
Bool_t fVizDBUpdate
Definition: REveManager.hxx:92
ROOT::Experimental::REveManager::RRedrawDisabler
Definition: REveManager.hxx:49
ROOT::Experimental::REveManager::Redraw3D
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: REveManager.hxx:159
ROOT::Experimental::REveManager::REveManager
REveManager()
Definition: REveManager.cxx:66
ROOT::Experimental::REveManager::GetScenes
REveSceneList * GetScenes() const
Definition: REveManager.hxx:142
ROOT::Experimental::REveManager::GetHighlight
REveSelection * GetHighlight() const
Definition: REveManager.hxx:140
ROOT::Experimental::ElementId_t
unsigned int ElementId_t
Definition: REveTypes.hxx:25
TFolder
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
ROOT::Experimental::REveManager::GetVizDBReplace
Bool_t GetVizDBReplace() const
Definition: REveManager.hxx:194
ROOT::Experimental::REveManager::Create
static REveManager * Create()
If global REveManager* REX::gEve is not set initialize it.
Definition: REveManager.cxx:696
ROOT::Experimental::REveManager::SetVizDBReplace
void SetVizDBReplace(Bool_t r)
Definition: REveManager.hxx:196
ROOT::Experimental::REveManager::SetVizDBUpdate
void SetVizDBUpdate(Bool_t u)
Definition: REveManager.hxx:197
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::Experimental::REveManager::RRedrawDisabler::RRedrawDisabler
RRedrawDisabler(const RRedrawDisabler &)=delete
ROOT::Experimental::REveManager::ClearROOTClassSaved
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
Definition: REveManager.cxx:653
ROOT::Experimental::REveManager::GetEventScene
REveScene * GetEventScene() const
Definition: REveManager.hxx:146
ROOT::Experimental::REveManager::RemoveElement
void RemoveElement(REveElement *element, REveElement *parent)
Remove element from parent.
Definition: REveManager.cxx:314
ROOT::Experimental::REveManager::BrowseElement
void BrowseElement(ElementId_t id)
Activate EVE browser (summary view) for specified element id.
Definition: REveManager.cxx:359
ROOT::Experimental::REveManager::fGeometryAliases
TMap * fGeometryAliases
Definition: REveManager.hxx:95
ROOT::Experimental::REveManager::fNumElementIds
ElementId_t fNumElementIds
Definition: REveManager.hxx:118
ROOT::Experimental::REveManager::fWorld
REveScene * fWorld
Definition: REveManager.hxx:99
RWebDisplayArgs.hxx
ROOT::Experimental::REveManager::fWebWindow
std::shared_ptr< ROOT::Experimental::RWebWindow > fWebWindow
Definition: REveManager.hxx:126
ROOT::Experimental::REveManager::fLastElementId
ElementId_t fLastElementId
Definition: REveManager.hxx:117
TStdExceptionHandler::Remove
virtual void Remove()
Remove std::exception handler from system handler list.
Definition: TSysEvtHandler.cxx:220
ROOT::Experimental::REveManager::RExceptionHandler::RExceptionHandler
RExceptionHandler()
Definition: REveManager.hxx:71
ROOT::Experimental::REveManager::fResetCameras
Bool_t fResetCameras
Definition: REveManager.hxx:109
ROOT::Experimental::REveManager::WindowConnect
void WindowConnect(unsigned connid)
Process new connection from web window.
Definition: REveManager.cxx:745
ROOT::Experimental::REveManager::EnforceTimerActive
void EnforceTimerActive(Bool_t ta)
Definition: REveManager.hxx:218
ROOT::Experimental::REveManager::~REveManager
virtual ~REveManager()
Destructor.
Definition: REveManager.cxx:166
ROOT::Experimental::REveManager::GetKeepEmptyCont
Bool_t GetKeepEmptyCont() const
Definition: REveManager.hxx:171
TTimer.h
ROOT::Experimental::RWebDisplayArgs
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
Definition: RWebDisplayArgs.hxx:29
TStdExceptionHandler::Add
virtual void Add()
Add std::exception handler to system handler list.
Definition: TSysEvtHandler.cxx:209
TString
Basic string class.
Definition: TString.h:136
ROOT::Experimental::REveManager::fViewers
REveViewerList * fViewers
Definition: REveManager.hxx:101
ROOT::Experimental::REveElement
Definition: REveElement.hxx:41
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
ROOT::Experimental::REveManager::WindowDisconnect
void WindowDisconnect(unsigned connid)
Process disconnect of web window.
Definition: REveManager.cxx:790
ROOT::Experimental::REveManager::WindowData
void WindowData(unsigned connid, const std::string &arg)
Process data from web window.
Definition: REveManager.cxx:821
ROOT::Experimental::REveManager::fDropLogicals
Bool_t fDropLogicals
Definition: REveManager.hxx:110
ROOT::Experimental::REveManager::fScenes
REveSceneList * fScenes
Definition: REveManager.hxx:102
bool
ROOT::Experimental::REveManager::GetViewers
REveViewerList * GetViewers() const
Definition: REveManager.hxx:143
ROOT::Experimental::REveManager::GetVizDBUpdate
Bool_t GetVizDBUpdate() const
Definition: REveManager.hxx:195
ROOT::Experimental::REveManager::LoadVizDB
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
Definition: REveManager.cxx:488
ROOT::Experimental::REveManager::fHighlight
REveSelection * fHighlight
Definition: REveManager.hxx:124
ROOT::Experimental::REveManager::AddElement
void AddElement(REveElement *element, REveElement *parent=nullptr)
Add an element.
Definition: REveManager.cxx:289
ROOT::Experimental::REveManager::RRedrawDisabler::fMgr
REveManager * fMgr
Definition: REveManager.hxx:54
update
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
Definition: RooAdaptiveGaussKronrodIntegrator1D.cxx:652
ROOT::Experimental::REveManager::SetClientVersion
void SetClientVersion(const std::string &version)
Set client version, used as prefix in scripts URL When changed, web browser will reload all related J...
Definition: REveManager.cxx:687
TTimer
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
ROOT::Experimental::REveManager::FindVizDBEntry
REveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
Definition: REveManager.cxx:477
ROOT::Experimental::REveManager::operator=
REveManager & operator=(const REveManager &)=delete
ROOT::Experimental::REveManager::fConnList
std::vector< Conn > fConnList
Definition: REveManager.hxx:127
ROOT::Experimental::REveManager::GetMacroFolder
TFolder * GetMacroFolder() const
Definition: REveManager.hxx:153
ROOT::Experimental::REveElement::List_t
std::list< REveElement * > List_t
Definition: REveElement.hxx:48
ROOT::Experimental::REveScene
Definition: REveScene.hxx:34
REveElement.hxx
ROOT::Experimental::REveManager::GetMacro
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
Definition: REveManager.cxx:224
ROOT::Experimental::REveManager::ClearAllSelections
void ClearAllSelections()
Clear all selection objects.
Definition: REveManager.cxx:277
ROOT::Experimental::REveManager::fSelection
REveSelection * fSelection
Definition: REveManager.hxx:123
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
ROOT::Experimental::REveManager::PreDeleteElement
void PreDeleteElement(REveElement *element)
Called from REveElement prior to its destruction so the framework components (like object editor) can...
Definition: REveManager.cxx:373
ROOT::Experimental::REveManager::fExcHandler
RExceptionHandler * fExcHandler
exception handler
Definition: REveManager.hxx:88
ROOT::Experimental::REveManager::SpawnNewViewer
REveViewer * SpawnNewViewer(const char *name, const char *title="")
Create a new GL viewer.
Definition: REveManager.cxx:204
ROOT::Experimental::REveManager::AddGlobalElement
void AddGlobalElement(REveElement *element, REveElement *parent=nullptr)
Add a global element, i.e.
Definition: REveManager.cxx:303
ROOT::Experimental::REveSelection
REveSelection Container for selected and highlighted elements.
Definition: REveSelection.hxx:29
ROOT::Experimental::REveManager::RRedrawDisabler::RRedrawDisabler
RRedrawDisabler(REveManager *m)
Definition: REveManager.hxx:57
ROOT::Experimental::REveManager::fElementIdMap
std::unordered_map< ElementId_t, REveElement * > fElementIdMap
Definition: REveManager.hxx:116
ROOT::Experimental::REveManager::GetGeometryByAlias
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
Definition: REveManager.cxx:620
ROOT::Experimental::REveManager::SetKeepEmptyCont
void SetKeepEmptyCont(Bool_t k)
Definition: REveManager.hxx:172
ROOT::Experimental::REveManager::RExceptionHandler::Handle
virtual EStatus Handle(std::exception &exc)
Handle exceptions deriving from REveException.
Definition: REveManager.cxx:730
TStdExceptionHandler::EStatus
EStatus
Definition: TSysEvtHandler.h:175
ROOT::Experimental::REveSceneList
Definition: REveScene.hxx:131
ROOT::Experimental::REveManager::FullRedraw3D
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
Definition: REveManager.cxx:266
ROOT::Experimental::REveManager::Conn::Conn
Conn()=default
TMacro
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
unsigned int
ROOT::Experimental::REveManager::fMacroFolder
TFolder * fMacroFolder
Definition: REveManager.hxx:97
ROOT::Experimental::REveManager::GetSelection
REveSelection * GetSelection() const
Definition: REveManager.hxx:139
ROOT::Experimental::REveManager::REveManager
REveManager(const REveManager &)=delete
ROOT::Experimental::REveManager::fFullRedraw
Bool_t fFullRedraw
Definition: REveManager.hxx:108
ROOT::Experimental::REveManager::SetDefaultHtmlPage
void SetDefaultHtmlPage(const std::string &path)
Set content of default window HTML page.
Definition: REveManager.cxx:676
ROOT::Experimental::REveManager::RegisterRedraw3D
void RegisterRedraw3D()
Register a request for 3D redraw.
Definition: REveManager.cxx:232
ROOT::Experimental::REveManager::EnableRedraw
void EnableRedraw()
Definition: REveManager.hxx:157
ROOT::Experimental::REveManager::Terminate
static void Terminate()
Properly terminate global REveManager.
Definition: REveManager.cxx:712
ROOT::Experimental::REveManager::Send
void Send(unsigned connid, const std::string &data)
Definition: REveManager.cxx:881
ROOT::Experimental::REveManager::RExceptionHandler
Definition: REveManager.hxx:69
ROOT::Experimental::REveManager::fRedrawDisabled
Int_t fRedrawDisabled
Definition: REveManager.hxx:107
ROOT::Experimental::REveManager::DisableRedraw
void DisableRedraw()
Definition: REveManager.hxx:156
ROOT::Experimental::REveManager::AssignElementId
void AssignElementId(REveElement *element)
Assign a unique ElementId to given element.
Definition: REveManager.cxx:335
ROOT::Experimental::REveManager::InsertVizDBEntry
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
Definition: REveManager.cxx:419
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
ROOT::Experimental::REveManager::GetWorld
REveScene * GetWorld() const
Definition: REveManager.hxx:148
ROOT::Experimental::REveManager::Show
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
Definition: REveManager.cxx:961
ROOT::Experimental::REveManager::RRedrawDisabler::operator=
RRedrawDisabler & operator=(const RRedrawDisabler &)=delete
ROOT::Experimental::REveManager::Conn
Definition: REveManager.hxx:80
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Experimental::REveManager::GetGlobalScene
REveScene * GetGlobalScene() const
Definition: REveManager.hxx:145
ROOT::Experimental::REveManager
Definition: REveManager.hxx:44
ROOT::Experimental::REveManager::SendBinary
void SendBinary(unsigned connid, const void *data, std::size_t len)
Definition: REveManager.cxx:887
TExMap
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
ROOT::Experimental::REveViewerList
REveViewerList List of Viewers providing common operations on REveViewer collections.
Definition: REveViewer.hxx:53
ROOT::Experimental::REveManager::ShowGeometry
std::shared_ptr< REveGeomViewer > ShowGeometry(const RWebDisplayArgs &args="")
Show current geometry in web browser.
Definition: REveManager.cxx:974
make_cnn_model.model
model
Definition: make_cnn_model.py:6
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
ROOT::Experimental::REveManager::GetGeometry
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
Definition: REveManager.cxx:561
ROOT::Experimental::REveManager::Conn::fId
unsigned fId
Definition: REveManager.hxx:81
ROOT::Experimental::REveManager::RegisterGeometryAlias
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
Definition: REveManager.cxx:645
ROOT::Experimental::REveManager::fGeometries
TMap * fGeometries
Definition: REveManager.hxx:94
ROOT::Experimental::REveManager::fVizDB
TMap * fVizDB
Definition: REveManager.hxx:90
ROOT::Experimental::REveViewer
REveViewer Reve representation of TGLViewer.
Definition: REveViewer.hxx:28
ROOT::Experimental::REveManager::GetExcHandler
RExceptionHandler * GetExcHandler() const
Definition: REveManager.hxx:137
ROOT::Experimental::REveManager::fGlobalScene
REveScene * fGlobalScene
Definition: REveManager.hxx:104
ROOT::Experimental::REveManager::fVizDBReplace
Bool_t fVizDBReplace
Definition: REveManager.hxx:91
TGeoManager
The manager class for any TGeo geometry.
Definition: TGeoManager.h:45
ROOT::Experimental::gEve
R__EXTERN REveManager * gEve
Definition: REveManager.hxx:233
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Experimental::REveManager::fKeepEmptyCont
Bool_t fKeepEmptyCont
Definition: REveManager.hxx:111
TStdExceptionHandler
Definition: TSysEvtHandler.h:172
ROOT::Experimental::REveManager::fEventScene
REveScene * fEventScene
Definition: REveManager.hxx:105
ROOT::Experimental::REveManager::FindElementById
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
Definition: REveManager.cxx:324
ROOT::Experimental::REveManager::fTimerActive
Bool_t fTimerActive
Definition: REveManager.hxx:112
ROOT::Experimental::REveManager::DestroyElementsOf
void DestroyElementsOf(REveElement::List_t &els)
Definition: REveManager.cxx:894
ROOT::Experimental::REveManager::AddLocation
void AddLocation(const std::string &name, const std::string &path)
Register new directory to THttpServer.
Definition: REveManager.cxx:667
int
ROOT::Experimental::REveManager::fMaxElementIds
ElementId_t fMaxElementIds
Definition: REveManager.hxx:119
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
ROOT::Experimental::REveManager::GetDefaultGeometry
TGeoManager * GetDefaultGeometry()
Get the default geometry.
Definition: REveManager.cxx:634
TSysEvtHandler.h
ROOT::Experimental::REveManager::RRedrawDisabler::~RRedrawDisabler
virtual ~RRedrawDisabler()
Definition: REveManager.hxx:62