Logo ROOT   6.08/07
Reference Guide
TEveManager.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 ROOT_TEveManager
13 #define ROOT_TEveManager
14 
15 #include "TEveElement.h"
16 
17 #include "TSysEvtHandler.h"
18 #include "TTimer.h"
19 #include "TVirtualPad.h"
20 
21 class TMap;
22 class TExMap;
23 class TMacro;
24 class TFolder;
25 class TCanvas;
26 class TGeoManager;
27 
28 class TGTab;
29 class TGStatusBar;
30 class TGListTree;
31 class TGListTreeItem;
32 class TGStatusBar;
33 class TGWindow;
34 
35 class TGLViewer;
36 
37 class TEveSelection;
39 class TEveBrowser;
40 class TEveGedEditor;
41 
42 class TEveViewer; class TEveViewerList;
43 class TEveScene; class TEveSceneList;
44 
45 class TEveEventManager;
46 class TEveWindowManager;
47 
48 
50 {
51  TEveManager(const TEveManager&); // Not implemented
52  TEveManager& operator=(const TEveManager&); // Not implemented
53 
54 public:
56  {
57  private:
58  TRedrawDisabler(const TRedrawDisabler&); // Not implemented
59  TRedrawDisabler& operator=(const TRedrawDisabler&); // Not implemented
60 
62  public:
64  { if (fMgr) fMgr->DisableRedraw(); }
65  virtual ~TRedrawDisabler()
66  { if (fMgr) fMgr->EnableRedraw(); }
67 
68  ClassDef(TRedrawDisabler, 0); // Exception-safe EVE redraw-disabler.
69  };
70 
72  {
73  public:
75  virtual ~TExceptionHandler() { Remove(); }
76 
77  virtual EStatus Handle(std::exception& exc);
78 
79  ClassDef(TExceptionHandler, 0); // Exception handler for Eve exceptions.
80  };
81 
82 protected:
84 
88 
91 
94 
96 
100 
104 
112 
113  // Fine grained scene updates.
115 
116  // Selection / hihglight elements
119 
122 
123 public:
124  TEveManager(UInt_t w, UInt_t h, Bool_t map_window=kTRUE, Option_t* opt="FI");
125  virtual ~TEveManager();
126 
128 
129  TEveSelection* GetSelection() const { return fSelection; }
130  TEveSelection* GetHighlight() const { return fHighlight; }
131 
134  void SetUseOrphanage(Bool_t o) { fUseOrphanage = o; }
135  void ClearOrphanage();
136 
137  TEveBrowser* GetBrowser() const { return fBrowser; }
139  TEveGedEditor* GetEditor() const;
140  TGStatusBar* GetStatusBar() const;
141 
143 
144  TEveSceneList* GetScenes() const { return fScenes; }
145  TEveViewerList* GetViewers() const { return fViewers; }
146 
147  TEveScene* GetGlobalScene() const { return fGlobalScene; }
148  TEveScene* GetEventScene() const { return fEventScene; }
150 
151  void SetCurrentEvent(TEveEventManager* mgr) { fCurrentEvent = mgr; }
152 
153  TCanvas* AddCanvasTab(const char* name);
154  TGWindow* GetMainWindow() const;
155  TEveViewer* GetDefaultViewer() const;
156  TGLViewer* GetDefaultGLViewer() const;
157  TEveViewer* SpawnNewViewer(const char* name, const char* title="", Bool_t embed=kTRUE);
158  TEveScene* SpawnNewScene(const char* name, const char* title="");
159 
160  TFolder* GetMacroFolder() const { return fMacroFolder; }
161  TMacro* GetMacro(const char* name) const;
162 
163  void EditElement(TEveElement* element);
164 
166  void EnableRedraw() { --fRedrawDisabled; if (fRedrawDisabled <= 0) Redraw3D(); }
167 
168  void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
169  {
170  if (fRedrawDisabled <= 0 && !fTimerActive) RegisterRedraw3D();
171  if (resetCameras) fResetCameras = kTRUE;
172  if (dropLogicals) fDropLogicals = kTRUE;
173  }
174  void RegisterRedraw3D();
175  void DoRedraw3D();
176  void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE);
177 
179  void SetKeepEmptyCont(Bool_t k) { fKeepEmptyCont = k; }
180 
181  void ElementChanged(TEveElement* element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE);
182  void ScenesChanged(TEveElement::List_t& scenes);
183 
184  // Fine grained updates via stamping.
185  void ElementStamped(TEveElement* element);
186 
187  // These are more like TEveManager stuff.
188  TGListTree* GetListTree() const;
190  void RemoveFromListTree(TEveElement* element, TGListTree* lt, TGListTreeItem* lti);
191 
193 
194  void AddElement(TEveElement* element, TEveElement* parent=0);
195  void AddGlobalElement(TEveElement* element, TEveElement* parent=0);
196 
197  void RemoveElement(TEveElement* element, TEveElement* parent);
198  void PreDeleteElement(TEveElement* element);
199 
200  void ElementSelect(TEveElement* element);
201  Bool_t ElementPaste(TEveElement* element);
202 
203  // VizDB - Visualization-parameter data-base.
205  Bool_t replace, Bool_t update);
206  Bool_t InsertVizDBEntry(const TString& tag, TEveElement* model);
207  TEveElement* FindVizDBEntry (const TString& tag);
208 
209  void LoadVizDB(const TString& filename, Bool_t replace, Bool_t update);
210  void LoadVizDB(const TString& filename);
211  void SaveVizDB(const TString& filename);
212 
214  Bool_t GetVizDBUpdate () const { return fVizDBUpdate; }
215  void SetVizDBReplace(Bool_t r) { fVizDBReplace = r; }
216  void SetVizDBUpdate (Bool_t u) { fVizDBUpdate = u; }
217 
218 
219  // Geometry management.
220  TGeoManager* GetGeometry(const TString& filename);
221  TGeoManager* GetGeometryByAlias(const TString& alias);
223  void RegisterGeometryAlias(const TString& alias, const TString& filename);
224 
225  void SetStatusLine(const char* text);
226  void ClearROOTClassSaved();
227 
228  void CloseEveWindow();
229 
230  static TEveManager* Create(Bool_t map_window=kTRUE, Option_t* opt="FIV");
231  static void Terminate();
232 
233  // Access to internals, needed for low-level control in advanced
234  // applications.
235 
236  void EnforceTimerActive (Bool_t ta) { fTimerActive = ta; }
237 
239 
240  ClassDef(TEveManager, 0); // Eve application manager.
241 };
242 
244 
245 #endif
void ElementStamped(TEveElement *element)
Mark element as changed – it will be processed on next redraw.
TEveWindowManager * fWindowManager
Definition: TEveManager.h:97
TEveBrowser * fBrowser
Definition: TEveManager.h:92
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:32
Base class for event management and navigation.
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
void DisableRedraw()
Definition: TEveManager.h:165
Eve representation of TGLScene.
Definition: TEveScene.h:26
void DoRedraw3D()
Perform 3D redraw of scenes and viewers whose contents has changed.
List of Viewers providing common operations on TEveViewer collections.
Definition: TEveViewer.h:79
Definition: TGTab.h:66
void EditElement(TEveElement *element)
Show element in default editor.
const char Option_t
Definition: RtypesCore.h:62
Specialization of TGedEditor for proper update propagation to TEveManager.
Definition: TEveGedEditor.h:26
virtual ~TEveManager()
Destructor.
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
TEveViewerList * fViewers
Definition: TEveManager.h:98
TH1 * h
Definition: legend2.C:5
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
TEveSceneList * fScenes
Definition: TEveManager.h:99
TTimer fRedrawTimer
Definition: TEveManager.h:111
Specialization of TRootBrowser for Eve.
Definition: TEveBrowser.h:128
Class supporting a collection of lines with C++ code.
Definition: TMacro.h:33
void RegisterGeometryAlias(const TString &alias, const TString &filename)
Register &#39;name&#39; as an alias for geometry file &#39;filename&#39;.
Basic string class.
Definition: TString.h:137
Bool_t ElementPaste(TEveElement *element)
Paste has been called.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TEveElement * FindVizDBEntry(const TString &tag)
Find a visualization-parameter database entry corresponding to tag.
const Bool_t kFALSE
Definition: Rtypes.h:92
TEveScene * fEventScene
Definition: TEveManager.h:102
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
void SaveVizDB(const TString &filename)
Save visualization-parameter database to file filename.
Bool_t fResetCameras
Definition: TEveManager.h:107
void RemoveFromListTree(TEveElement *element, TGListTree *lt, TGListTreeItem *lti)
Remove top-level element from list-tree with specified tree-item.
TEveSelection * fSelection
Definition: TEveManager.h:117
TEveElementList * fOrphanage
Definition: TEveManager.h:120
Bool_t fVizDBUpdate
Definition: TEveManager.h:87
A list of TEveElements.
Definition: TEveElement.h:459
TExMap * fStampedElements
Definition: TEveManager.h:114
TGeoManager * GetDefaultGeometry()
Get the default geometry.
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
void LoadVizDB(const TString &filename, Bool_t replace, Bool_t update)
Load visualization-parameter database from file filename.
TGListTree * GetListTree() const
Get default list-tree widget.
TGeoManager * GetGeometryByAlias(const TString &alias)
Get geometry with given alias.
Bool_t fFullRedraw
Definition: TEveManager.h:106
#define ClassDef(name, id)
Definition: Rtypes.h:254
static void Terminate()
Properly terminate global TEveManager.
void SetStatusLine(const char *text)
Set the text in the right side of browser&#39;s status bar.
TCanvas * AddCanvasTab(const char *name)
Add a new canvas tab.
Bool_t fDropLogicals
Definition: TEveManager.h:108
void ClearROOTClassSaved()
Work-around uber ugly hack used in SavePrimitive and co.
void SetVizDBReplace(Bool_t r)
Definition: TEveManager.h:215
TMap * fGeometryAliases
Definition: TEveManager.h:90
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:327
TExMap * PtrToStampedElements()
Definition: TEveManager.h:238
TMap * fVizDB
Definition: TEveManager.h:85
TExceptionHandler * fExcHandler
Definition: TEveManager.h:83
TEveViewerList * GetViewers() const
Definition: TEveManager.h:145
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TRedrawDisabler(TEveManager *m)
Definition: TEveManager.h:63
TGWindow * GetMainWindow() const
Get the main window, i.e. EVE-browser.
void SetCurrentEvent(TEveEventManager *mgr)
Definition: TEveManager.h:151
TMap * fGeometries
Definition: TEveManager.h:89
void RegisterRedraw3D()
Register a request for 3D redraw.
TGeoManager * GetGeometry(const TString &filename)
Get geometry with given filename.
void ScenesChanged(TEveElement::List_t &scenes)
Mark all scenes from the given list as changed.
TFolder * fMacroFolder
Definition: TEveManager.h:95
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
void ElementChanged(TEveElement *element, Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE)
Element was changed, perform framework side action.
TGListTreeItem * AddEvent(TEveEventManager *event)
Add a new event and make it the current event.
TEveElementList * GetOrphanage() const
Definition: TEveManager.h:132
Bool_t GetVizDBReplace() const
Definition: TEveManager.h:213
TRandom2 r(17)
TMacro * GetMacro(const char *name) const
Find macro in fMacroFolder by name.
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
Bool_t fKeepEmptyCont
Definition: TEveManager.h:109
TEveSceneList * GetScenes() const
Definition: TEveManager.h:144
void CloseEveWindow()
Close button has been clicked on EVE main window (browser).
Int_t fRedrawDisabled
Definition: TEveManager.h:105
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
void ClearOrphanage()
Clear the orphanage.
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
TEveGedEditor * GetEditor() const
Returns main object editor.
TEveEventManager * fCurrentEvent
Definition: TEveManager.h:103
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
List of Scenes providing common operations on TEveScene collections.
Definition: TEveScene.h:79
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:57
TEveWindowManager * GetWindowManager() const
Definition: TEveManager.h:142
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition: TGLViewer.h:53
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
Make sure there is a SINGLE running TEveSelection for each selection type (select/highlight).
Definition: TEveSelection.h:21
TEveSelection * GetHighlight() const
Definition: TEveManager.h:130
The Canvas class.
Definition: TCanvas.h:41
void EnableRedraw()
Definition: TEveManager.h:166
std::list< TEveElement * > List_t
Definition: TEveElement.h:69
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
TEveScene * GetEventScene() const
Definition: TEveManager.h:148
TText * text
Bool_t GetKeepEmptyCont() const
Definition: TEveManager.h:178
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
TEveSelection * GetSelection() const
Definition: TEveManager.h:129
Central application manager for Eve.
Definition: TEveManager.h:49
void SetVizDBUpdate(Bool_t u)
Definition: TEveManager.h:216
TEveViewer * GetDefaultViewer() const
Returns the default viewer - the first one in the fViewers list.
Bool_t GetVizDBUpdate() const
Definition: TEveManager.h:214
TFolder * GetMacroFolder() const
Definition: TEveManager.h:160
TEveGListTreeEditorFrame * fLTEFrame
Definition: TEveManager.h:93
TEveManager & operator=(const TEveManager &)
#define R__EXTERN
Definition: DllImport.h:27
void RemoveElement(TEveElement *element, TEveElement *parent)
Remove element from parent.
Manager for EVE windows.
void EnforceTimerActive(Bool_t ta)
Definition: TEveManager.h:236
TEveEventManager * GetCurrentEvent() const
Definition: TEveManager.h:149
TEveGListTreeEditorFrame * GetLTEFrame() const
Definition: TEveManager.h:138
Bool_t fUseOrphanage
Definition: TEveManager.h:121
Bool_t GetUseOrphanage() const
Definition: TEveManager.h:133
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Bool_t InsertVizDBEntry(const TString &tag, TEveElement *model, Bool_t replace, Bool_t update)
Insert a new visualization-parameter database entry.
Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
Definition: TEveBrowser.h:81
TExceptionHandler * GetExcHandler() const
Definition: TEveManager.h:127
TEveScene * fGlobalScene
Definition: TEveManager.h:101
TEveManager(const TEveManager &)
void ElementSelect(TEveElement *element)
Select an element.
Exception handler for Eve exceptions.
Definition: TEveManager.h:71
void PreDeleteElement(TEveElement *element)
Called from TEveElement prior to its destruction so the framework components (like object editor) can...
TRedrawDisabler & operator=(const TRedrawDisabler &)
void SetKeepEmptyCont(Bool_t k)
Definition: TEveManager.h:179
const Bool_t kTRUE
Definition: Rtypes.h:91
void SetUseOrphanage(Bool_t o)
Definition: TEveManager.h:134
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
Bool_t fVizDBReplace
Definition: TEveManager.h:86
char name[80]
Definition: TGX11.cxx:109
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35
Eve representation of TGLViewer.
Definition: TEveViewer.h:30
TGStatusBar * GetStatusBar() const
Returns main window status bar.
TRedrawDisabler(const TRedrawDisabler &)
Bool_t fTimerActive
Definition: TEveManager.h:110
TEveSelection * fHighlight
Definition: TEveManager.h:118