12 #ifndef ROOT7_REveManager
13 #define ROOT7_REveManager
23 #include <unordered_map>
32 namespace Experimental {
45 REveManager(
const REveManager&);
46 REveManager& operator=(
const REveManager&);
49 class RRedrawDisabler {
51 RRedrawDisabler(
const RRedrawDisabler &);
52 RRedrawDisabler &operator=(
const RRedrawDisabler &);
54 REveManager *fMgr{
nullptr};
57 RRedrawDisabler(REveManager *m) : fMgr(m)
60 fMgr->DisableRedraw();
62 virtual ~RRedrawDisabler()
69 class RExceptionHandler :
public TStdExceptionHandler {
71 RExceptionHandler() : TStdExceptionHandler() { Add(); }
72 virtual ~RExceptionHandler() { Remove(); }
74 virtual EStatus Handle(std::exception& exc);
76 ClassDef(RExceptionHandler, 0);
84 Conn(
unsigned int cId) : fId(cId) {}
88 RExceptionHandler *fExcHandler{
nullptr};
90 TMap *fVizDB{
nullptr};
91 Bool_t fVizDBReplace{kFALSE};
92 Bool_t fVizDBUpdate{kFALSE};
94 TMap *fGeometries{
nullptr};
95 TMap *fGeometryAliases{
nullptr};
97 TFolder *fMacroFolder{
nullptr};
99 REveScene *fWorld{
nullptr};
101 REveViewerList *fViewers{
nullptr};
102 REveSceneList *fScenes{
nullptr};
104 REveScene *fGlobalScene{
nullptr};
105 REveScene *fEventScene{
nullptr};
107 Int_t fRedrawDisabled{0};
108 Bool_t fFullRedraw{kFALSE};
109 Bool_t fResetCameras{kFALSE};
110 Bool_t fDropLogicals{kFALSE};
111 Bool_t fKeepEmptyCont{kFALSE};
112 Bool_t fTimerActive{kFALSE};
116 std::unordered_map<ElementId_t, REveElement*> fElementIdMap;
117 ElementId_t fLastElementId{0};
118 ElementId_t fNumElementIds{0};
119 ElementId_t fMaxElementIds{std::numeric_limits<ElementId_t>::max()};
122 REveElement *fSelectionList{
nullptr};
123 REveSelection *fSelection{
nullptr};
124 REveSelection *fHighlight{
nullptr};
126 std::shared_ptr<ROOT::Experimental::RWebWindow> fWebWindow;
127 std::vector<Conn> fConnList;
129 void WindowConnect(
unsigned connid);
130 void WindowData(
unsigned connid,
const std::string &arg);
131 void WindowDisconnect(
unsigned connid);
135 virtual ~REveManager();
137 RExceptionHandler *GetExcHandler()
const {
return fExcHandler; }
139 REveSelection *GetSelection()
const {
return fSelection; }
140 REveSelection *GetHighlight()
const {
return fHighlight; }
142 REveSceneList *GetScenes()
const {
return fScenes; }
143 REveViewerList *GetViewers()
const {
return fViewers; }
145 REveScene *GetGlobalScene()
const {
return fGlobalScene; }
146 REveScene *GetEventScene()
const {
return fEventScene; }
148 REveScene *GetWorld()
const {
return fWorld; }
150 REveViewer *SpawnNewViewer(
const char *name,
const char *title =
"");
151 REveScene *SpawnNewScene(
const char *name,
const char *title =
"");
153 TFolder *GetMacroFolder()
const {
return fMacroFolder; }
154 TMacro *GetMacro(
const char *name)
const;
156 void DisableRedraw() { ++fRedrawDisabled; }
157 void EnableRedraw() { --fRedrawDisabled;
if (fRedrawDisabled <= 0) Redraw3D(); }
159 void Redraw3D(Bool_t resetCameras = kFALSE, Bool_t dropLogicals = kFALSE)
161 if (fRedrawDisabled <= 0 && !fTimerActive) RegisterRedraw3D();
162 if (resetCameras) fResetCameras = kTRUE;
163 if (dropLogicals) fDropLogicals = kTRUE;
165 void RegisterRedraw3D();
167 void FullRedraw3D(Bool_t resetCameras = kFALSE, Bool_t dropLogicals = kFALSE);
169 void ClearAllSelections();
171 Bool_t GetKeepEmptyCont()
const {
return fKeepEmptyCont; }
172 void SetKeepEmptyCont(Bool_t k) { fKeepEmptyCont = k; }
174 void AddElement(REveElement *element, REveElement* parent =
nullptr);
175 void AddGlobalElement(REveElement *element, REveElement* parent =
nullptr);
177 void RemoveElement(REveElement* element, REveElement* parent);
179 REveElement* FindElementById (ElementId_t
id)
const;
180 void AssignElementId (REveElement* element);
181 void PreDeleteElement(REveElement* element);
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);
189 void LoadVizDB(
const TString& filename, Bool_t replace, Bool_t update);
190 void LoadVizDB(
const TString& filename);
191 void SaveVizDB(
const TString& filename);
193 Bool_t GetVizDBReplace()
const {
return fVizDBReplace; }
194 Bool_t GetVizDBUpdate ()
const {
return fVizDBUpdate; }
195 void SetVizDBReplace(Bool_t r) { fVizDBReplace = r; }
196 void SetVizDBUpdate (Bool_t u) { fVizDBUpdate = u; }
200 TGeoManager* GetGeometry(
const TString& filename);
201 TGeoManager* GetGeometryByAlias(
const TString& alias);
202 TGeoManager* GetDefaultGeometry();
203 void RegisterGeometryAlias(
const TString& alias,
const TString& filename);
205 void ClearROOTClassSaved();
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);
211 static REveManager* Create();
212 static void Terminate();
217 void EnforceTimerActive (Bool_t ta) { fTimerActive = ta; }
220 void Send(
unsigned connid,
const std::string &data);
221 void SendBinary(
unsigned connid,
const void *data, std::size_t len);
223 void DestroyElementsOf(REveElement::List_t &els);
225 void BroadcastElementsOf(REveElement::List_t &els);
227 void Show(
const RWebDisplayArgs &args =
"");
229 std::shared_ptr<REveGeomViewer> ShowGeometry(
const RWebDisplayArgs &args =
"");
232 R__EXTERN REveManager* gEve;