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
18
19#include "TSysEvtHandler.h"
20#include "TTimer.h"
21
22#include <memory>
23#include <unordered_map>
24
25class TMap;
26class TExMap;
27class TMacro;
28class TFolder;
29class TGeoManager;
30
31namespace ROOT {
32namespace Experimental {
33
34class REveSelection;
35class REveViewer;
36class REveViewerList;
37class REveScene;
38class REveSceneList;
39
40class RWebWindow;
41class REveGeomViewer;
42
44{
45 REveManager(const REveManager&); // Not implemented
46 REveManager& operator=(const REveManager&); // Not implemented
47
48public:
50 private:
51 RRedrawDisabler(const RRedrawDisabler &); // Not implemented
52 RRedrawDisabler &operator=(const RRedrawDisabler &); // Not implemented
53
54 REveManager *fMgr{nullptr};
55
56 public:
58 {
59 if (fMgr)
61 }
63 {
64 if (fMgr)
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
87protected:
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
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
133public:
134 REveManager(); // (Bool_t map_window=kTRUE, Option_t* opt="FI");
135 virtual ~REveManager();
136
138
141
142 REveSceneList *GetScenes() const { return fScenes; }
143 REveViewerList *GetViewers() const { return fViewers; }
144
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
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
183 // VizDB - Visualization-parameter data-base.
184 Bool_t InsertVizDBEntry(const TString& tag, REveElement* model,
185 Bool_t replace, Bool_t update);
186 Bool_t InsertVizDBEntry(const TString& tag, REveElement* model);
187 REveElement* FindVizDBEntry (const TString& tag);
188
189 void LoadVizDB(const TString& filename, Bool_t replace, Bool_t update);
190 void LoadVizDB(const TString& filename);
191 void SaveVizDB(const TString& filename);
192
194 Bool_t GetVizDBUpdate () const { return fVizDBUpdate; }
197
198
199 // Geometry management.
200 TGeoManager* GetGeometry(const TString& filename);
203 void RegisterGeometryAlias(const TString& alias, const TString& filename);
204
205 void ClearROOTClassSaved();
206
207 void AddLocation(const std::string& name, const std::string& path);
208 void SetDefaultHtmlPage(const std::string& path);
209 void SetClientVersion(const std::string& version);
210
211 static REveManager* Create();
212 static void Terminate();
213
214 // Access to internals, needed for low-level control in advanced
215 // applications.
216
218
219 // void Send(void* buff, unsigned connid);
220 void Send(unsigned connid, const std::string &data);
221 void SendBinary(unsigned connid, const void *data, std::size_t len);
222
224
226
227 void Show(const RWebDisplayArgs &args = "");
228
229 std::shared_ptr<REveGeomViewer> ShowGeometry(const RWebDisplayArgs &args = "");
230};
231
233
234}}
235
236#endif
#define R__EXTERN
Definition: DllImport.h:27
ROOT::R::TRInterface & r
Definition: Object.C:4
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
std::list< REveElement * > List_t
Definition: REveElement.hxx:77
virtual EStatus Handle(std::exception &exc)
Handle exceptions deriving from REveException.
RRedrawDisabler & operator=(const RRedrawDisabler &)
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
TFolder * GetMacroFolder() const
REveScene * GetEventScene() const
void DestroyElementsOf(REveElement::List_t &els)
REveSelection * GetHighlight() const
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register 'name' as an alias for geometry file 'filename'.
void PreDeleteElement(REveElement *element)
Called from REveElement prior to its destruction so the framework components (like object editor) can...
REveSceneList * GetScenes() const
void ClearAllSelections()
Clear all selection objects.
RExceptionHandler * fExcHandler
exception handler
Definition: REveManager.hxx:88
void AssignElementId(REveElement *element)
Assign a unique ElementId to given element.
TGeoManager * GetDefaultGeometry()
Get the default geometry.
void SetDefaultHtmlPage(const std::string &path)
Set content of default window HTML page.
REveSelection * GetSelection() const
void AddLocation(const std::string &name, const std::string &path)
Register new directory to THttpServer.
void Send(unsigned connid, const std::string &data)
static void Terminate()
Properly terminate global REveManager.
REveManager & operator=(const REveManager &)
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
REveManager(const REveManager &)
std::unordered_map< ElementId_t, REveElement * > fElementIdMap
static REveManager * Create()
If global REveManager* REX::gEve is not set initialize it.
void WindowConnect(unsigned connid)
Process new connection from web window.
std::vector< Conn > fConnList
REveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
REveScene * GetGlobalScene() const
std::shared_ptr< ROOT::Experimental::RWebWindow > fWebWindow
std::shared_ptr< REveGeomViewer > ShowGeometry(const RWebDisplayArgs &args="")
Show current geometry in web browser.
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
void RegisterRedraw3D()
Register a request for 3D redraw.
void SendBinary(unsigned connid, const void *data, std::size_t len)
void AddElement(REveElement *element, REveElement *parent=nullptr)
Add an element.
void SetClientVersion(const std::string &version)
Set client version, used as prefix in scripts URL When changed, web browser will reload all related J...
void AddGlobalElement(REveElement *element, REveElement *parent=nullptr)
Add a global element, i.e.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
REveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
void RemoveElement(REveElement *element, REveElement *parent)
Remove element from parent.
virtual ~REveManager()
Destructor.
void WindowDisconnect(unsigned connid)
Process disconnect of web window.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
REveViewer * SpawnNewViewer(const char *name, const char *title="")
Create a new GL viewer.
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
Bool_t InsertVizDBEntry(const TString &tag, REveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
REveScene * GetWorld() const
RExceptionHandler * GetExcHandler() const
REveViewerList * GetViewers() const
void WindowData(unsigned connid, const std::string &arg)
Process data from web window.
void Show(const RWebDisplayArgs &args="")
Show eve manager in specified browser.
void BroadcastElementsOf(REveElement::List_t &els)
REveSelection Container for selected and highlighted elements.
REveViewerList List of Viewers providing common operations on REveViewer collections.
Definition: REveViewer.hxx:53
REveViewer Reve representation of TGLViewer.
Definition: REveViewer.hxx:28
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
The manager class for any TGeo geometry.
Definition: TGeoManager.h:43
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:31
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
virtual void Remove()
Remove std::exception handler from system handler list.
virtual void Add()
Add std::exception handler to system handler list.
Basic string class.
Definition: TString.h:131
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
R__EXTERN REveManager * gEve
unsigned int ElementId_t
Definition: REveTypes.hxx:25
VSD Structures.
Definition: StringConv.hxx:21
auto * m
Definition: textangle.C:8