File indexing completed on 2025-01-18 10:11:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TEveManager
0013 #define ROOT_TEveManager
0014
0015 #include "TEveElement.h"
0016
0017 #include "TSysEvtHandler.h"
0018 #include "TTimer.h"
0019 #include "TVirtualPad.h"
0020
0021 class TMap;
0022 class TExMap;
0023 class TMacro;
0024 class TFolder;
0025 class TCanvas;
0026 class TGeoManager;
0027
0028 class TGTab;
0029 class TGStatusBar;
0030 class TGListTree;
0031 class TGListTreeItem;
0032 class TGStatusBar;
0033 class TGWindow;
0034
0035 class TGLViewer;
0036
0037 class TEveSelection;
0038 class TEveGListTreeEditorFrame;
0039 class TEveBrowser;
0040 class TEveGedEditor;
0041
0042 class TEveViewer; class TEveViewerList;
0043 class TEveScene; class TEveSceneList;
0044
0045 class TEveEventManager;
0046 class TEveWindowManager;
0047
0048
0049 class TEveManager
0050 {
0051 TEveManager(const TEveManager&);
0052 TEveManager& operator=(const TEveManager&);
0053
0054 public:
0055 class TRedrawDisabler
0056 {
0057 private:
0058 TRedrawDisabler(const TRedrawDisabler&);
0059 TRedrawDisabler& operator=(const TRedrawDisabler&);
0060
0061 TEveManager* fMgr;
0062 public:
0063 TRedrawDisabler(TEveManager* m) : fMgr(m)
0064 { if (fMgr) fMgr->DisableRedraw(); }
0065 virtual ~TRedrawDisabler()
0066 { if (fMgr) fMgr->EnableRedraw(); }
0067
0068 ClassDef(TRedrawDisabler, 0);
0069 };
0070
0071 class TExceptionHandler : public TStdExceptionHandler
0072 {
0073 public:
0074 TExceptionHandler() : TStdExceptionHandler() { Add(); }
0075 ~TExceptionHandler() override { Remove(); }
0076
0077 EStatus Handle(std::exception& exc) override;
0078
0079 ClassDefOverride(TExceptionHandler, 0);
0080 };
0081
0082 protected:
0083 TExceptionHandler *fExcHandler;
0084
0085 TMap *fVizDB;
0086 Bool_t fVizDBReplace;
0087 Bool_t fVizDBUpdate;
0088
0089 TMap *fGeometries;
0090 TMap *fGeometryAliases;
0091
0092 TEveBrowser *fBrowser;
0093 TEveGListTreeEditorFrame *fLTEFrame;
0094
0095 TFolder *fMacroFolder;
0096
0097 TEveWindowManager *fWindowManager;
0098 TEveViewerList *fViewers;
0099 TEveSceneList *fScenes;
0100
0101 TEveScene *fGlobalScene;
0102 TEveScene *fEventScene;
0103 TEveEventManager *fCurrentEvent;
0104
0105 Int_t fRedrawDisabled;
0106 Bool_t fFullRedraw;
0107 Bool_t fResetCameras;
0108 Bool_t fDropLogicals;
0109 Bool_t fKeepEmptyCont;
0110 Bool_t fTimerActive;
0111 TTimer fRedrawTimer;
0112
0113
0114 TExMap *fStampedElements;
0115
0116
0117 TEveSelection *fSelection;
0118 TEveSelection *fHighlight;
0119
0120 TEveElementList *fOrphanage;
0121 Bool_t fUseOrphanage;
0122
0123 public:
0124 TEveManager(UInt_t w, UInt_t h, Bool_t map_window=kTRUE, Option_t* opt="FI");
0125 virtual ~TEveManager();
0126
0127 TExceptionHandler* GetExcHandler() const { return fExcHandler; }
0128
0129 TEveSelection* GetSelection() const { return fSelection; }
0130 TEveSelection* GetHighlight() const { return fHighlight; }
0131
0132 TEveElementList* GetOrphanage() const { return fOrphanage; }
0133 Bool_t GetUseOrphanage() const { return fUseOrphanage; }
0134 void SetUseOrphanage(Bool_t o) { fUseOrphanage = o; }
0135 void ClearOrphanage();
0136
0137 TEveBrowser* GetBrowser() const { return fBrowser; }
0138 TEveGListTreeEditorFrame* GetLTEFrame() const { return fLTEFrame; }
0139 TEveGedEditor* GetEditor() const;
0140 TGStatusBar* GetStatusBar() const;
0141
0142 TEveWindowManager* GetWindowManager() const { return fWindowManager; }
0143
0144 TEveSceneList* GetScenes() const { return fScenes; }
0145 TEveViewerList* GetViewers() const { return fViewers; }
0146
0147 TEveScene* GetGlobalScene() const { return fGlobalScene; }
0148 TEveScene* GetEventScene() const { return fEventScene; }
0149 TEveEventManager* GetCurrentEvent() const { return fCurrentEvent; }
0150
0151 void SetCurrentEvent(TEveEventManager* mgr) { fCurrentEvent = mgr; }
0152
0153 TCanvas* AddCanvasTab(const char* name);
0154 TGWindow* GetMainWindow() const;
0155 TEveViewer* GetDefaultViewer() const;
0156 TGLViewer* GetDefaultGLViewer() const;
0157 TEveViewer* SpawnNewViewer(const char* name, const char* title="", Bool_t embed=kTRUE);
0158 TEveScene* SpawnNewScene(const char* name, const char* title="");
0159
0160 TFolder* GetMacroFolder() const { return fMacroFolder; }
0161 TMacro* GetMacro(const char* name) const;
0162
0163 void EditElement(TEveElement* element);
0164
0165 void DisableRedraw() { ++fRedrawDisabled; }
0166 void EnableRedraw() { --fRedrawDisabled; if (fRedrawDisabled <= 0) Redraw3D(); }
0167
0168 void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
0169 {
0170 if (fRedrawDisabled <= 0 && !fTimerActive) RegisterRedraw3D();
0171 if (resetCameras) fResetCameras = kTRUE;
0172 if (dropLogicals) fDropLogicals = kTRUE;
0173 }
0174 void RegisterRedraw3D();
0175 void DoRedraw3D();
0176 void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE);
0177
0178 Bool_t GetKeepEmptyCont() const { return fKeepEmptyCont; }
0179 void SetKeepEmptyCont(Bool_t k) { fKeepEmptyCont = k; }
0180
0181 void ElementChanged(TEveElement* element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE);
0182 void ScenesChanged(TEveElement::List_t& scenes);
0183
0184
0185 void ElementStamped(TEveElement* element);
0186
0187
0188 TGListTree* GetListTree() const;
0189 TGListTreeItem* AddToListTree(TEveElement* re, Bool_t open, TGListTree* lt=nullptr);
0190 void RemoveFromListTree(TEveElement* element, TGListTree* lt, TGListTreeItem* lti);
0191
0192 TGListTreeItem* AddEvent(TEveEventManager* event);
0193
0194 void AddElement(TEveElement* element, TEveElement* parent=nullptr);
0195 void AddGlobalElement(TEveElement* element, TEveElement* parent=nullptr);
0196
0197 void RemoveElement(TEveElement* element, TEveElement* parent);
0198 void PreDeleteElement(TEveElement* element);
0199
0200 void ElementSelect(TEveElement* element);
0201 Bool_t ElementPaste(TEveElement* element);
0202
0203
0204 Bool_t InsertVizDBEntry(const TString& tag, TEveElement* model,
0205 Bool_t replace, Bool_t update);
0206 Bool_t InsertVizDBEntry(const TString& tag, TEveElement* model);
0207 TEveElement* FindVizDBEntry (const TString& tag);
0208
0209 void LoadVizDB(const TString& filename, Bool_t replace, Bool_t update);
0210 void LoadVizDB(const TString& filename);
0211 void SaveVizDB(const TString& filename);
0212
0213 Bool_t GetVizDBReplace() const { return fVizDBReplace; }
0214 Bool_t GetVizDBUpdate () const { return fVizDBUpdate; }
0215 void SetVizDBReplace(Bool_t r) { fVizDBReplace = r; }
0216 void SetVizDBUpdate (Bool_t u) { fVizDBUpdate = u; }
0217
0218
0219
0220 TGeoManager* GetGeometry(const TString& filename);
0221 TGeoManager* GetGeometryByAlias(const TString& alias);
0222 TGeoManager* GetDefaultGeometry();
0223 void RegisterGeometryAlias(const TString& alias, const TString& filename);
0224
0225 void SetStatusLine(const char* text);
0226 void ClearROOTClassSaved();
0227
0228 void CloseEveWindow();
0229
0230 static TEveManager* Create(Bool_t map_window=kTRUE, Option_t* opt="FIV");
0231 static void Terminate();
0232
0233
0234
0235
0236 void EnforceTimerActive (Bool_t ta) { fTimerActive = ta; }
0237
0238 TExMap* PtrToStampedElements() { return fStampedElements; }
0239
0240 ClassDef(TEveManager, 0);
0241 };
0242
0243 R__EXTERN TEveManager* gEve;
0244
0245 #endif