Logo ROOT   6.12/07
Reference Guide
MultiView.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_eve
3 /// Multi-view (3d, rphi, rhoz) service class using EVE Window Manager.
4 ///
5 /// \macro_code
6 ///
7 /// \author Matevz Tadel
8 
9 #include <TEveManager.h>
10 
11 #include <TEveViewer.h>
12 #include <TGLViewer.h>
13 
14 #include <TEveScene.h>
15 
16 #include <TEveProjectionManager.h>
17 #include <TEveProjectionAxes.h>
18 
19 #include <TEveBrowser.h>
20 #include <TEveWindow.h>
21 
22 // MultiView
23 //
24 // Structure encapsulating standard views: 3D, r-phi and rho-z.
25 // Includes scenes and projection managers.
26 //
27 // Should be used in compiled mode.
28 
29 struct MultiView
30 {
31  TEveProjectionManager *fRPhiMgr;
32  TEveProjectionManager *fRhoZMgr;
33 
34  TEveViewer *f3DView;
35  TEveViewer *fRPhiView;
36  TEveViewer *fRhoZView;
37 
38  TEveScene *fRPhiGeomScene;
39  TEveScene *fRhoZGeomScene;
40  TEveScene *fRPhiEventScene;
41  TEveScene *fRhoZEventScene;
42 
43  //---------------------------------------------------------------------------
44 
45  MultiView()
46  {
47  // Constructor --- creates required scenes, projection managers
48  // and GL viewers.
49 
50  // Scenes
51  //========
52 
53  fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry",
54  "Scene holding projected geometry for the RPhi view.");
55  fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry",
56  "Scene holding projected geometry for the RhoZ view.");
57  fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
58  "Scene holding projected event-data for the RPhi view.");
59  fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
60  "Scene holding projected event-data for the RhoZ view.");
61 
62 
63  // Projection managers
64  //=====================
65 
67  gEve->AddToListTree(fRPhiMgr, kFALSE);
68  {
69  TEveProjectionAxes* a = new TEveProjectionAxes(fRPhiMgr);
70  a->SetMainColor(kWhite);
71  a->SetTitle("R-Phi");
72  a->SetTitleSize(0.05);
73  a->SetTitleFont(102);
74  a->SetLabelSize(0.025);
75  a->SetLabelFont(102);
76  fRPhiGeomScene->AddElement(a);
77  }
78 
80  gEve->AddToListTree(fRhoZMgr, kFALSE);
81  {
82  TEveProjectionAxes* a = new TEveProjectionAxes(fRhoZMgr);
83  a->SetMainColor(kWhite);
84  a->SetTitle("Rho-Z");
85  a->SetTitleSize(0.05);
86  a->SetTitleFont(102);
87  a->SetLabelSize(0.025);
88  a->SetLabelFont(102);
89  fRhoZGeomScene->AddElement(a);
90  }
91 
92 
93  // Viewers
94  //=========
95 
96  TEveWindowSlot *slot = 0;
97  TEveWindowPack *pack = 0;
98 
100  pack = slot->MakePack();
101  pack->SetElementName("Multi View");
102  pack->SetHorizontal();
103  pack->SetShowTitleBar(kFALSE);
104  pack->NewSlot()->MakeCurrent();
105  f3DView = gEve->SpawnNewViewer("3D View", "");
106  f3DView->AddScene(gEve->GetGlobalScene());
107  f3DView->AddScene(gEve->GetEventScene());
108 
109  pack = pack->NewSlot()->MakePack();
110  pack->SetShowTitleBar(kFALSE);
111  pack->NewSlot()->MakeCurrent();
112  fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
114  fRPhiView->AddScene(fRPhiGeomScene);
115  fRPhiView->AddScene(fRPhiEventScene);
116 
117  pack->NewSlot()->MakeCurrent();
118  fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
120  fRhoZView->AddScene(fRhoZGeomScene);
121  fRhoZView->AddScene(fRhoZEventScene);
122  }
123 
124  //---------------------------------------------------------------------------
125 
126  void SetDepth(Float_t d)
127  {
128  // Set current depth on all projection managers.
129 
130  fRPhiMgr->SetCurrentDepth(d);
131  fRhoZMgr->SetCurrentDepth(d);
132  }
133 
134  //---------------------------------------------------------------------------
135 
136  void ImportGeomRPhi(TEveElement* el)
137  {
138  fRPhiMgr->ImportElements(el, fRPhiGeomScene);
139  }
140 
141  void ImportGeomRhoZ(TEveElement* el)
142  {
143  fRhoZMgr->ImportElements(el, fRhoZGeomScene);
144  }
145 
146  void ImportEventRPhi(TEveElement* el)
147  {
148  fRPhiMgr->ImportElements(el, fRPhiEventScene);
149  }
150 
151  void ImportEventRhoZ(TEveElement* el)
152  {
153  fRhoZMgr->ImportElements(el, fRhoZEventScene);
154  }
155 
156  //---------------------------------------------------------------------------
157 
158  void DestroyEventRPhi()
159  {
160  fRPhiEventScene->DestroyElements();
161  }
162 
163  void DestroyEventRhoZ()
164  {
165  fRhoZEventScene->DestroyElements();
166  }
167 };
Encapsulates TGPack into an eve-window.
Definition: TEveWindow.h:360
Eve representation of TGLScene.
Definition: TEveScene.h:26
static TEveWindowSlot * CreateWindowInTab(TGTab *tab, TEveWindow *eve_parent=0)
Create a new tab in a given tab-widget and populate it with a default window-slot.
float Float_t
Definition: RtypesCore.h:53
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
Description of TEveWindowSlot.
Definition: TEveWindow.h:301
virtual void SetTitleFont(Style_t font=62)
Set the title font.
Definition: TAttAxis.cxx:322
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
Axes for non-linear projections.
virtual void SetLabelFont(Style_t font=62)
Set labels&#39; font.
Definition: TAttAxis.cxx:183
virtual TEveElement * ImportElements(TEveElement *el, TEveElement *ext_list=0)
Recursively import elements and apply projection to the newly imported objects.
virtual void DestroyElements()
Destroy all children of this element.
virtual void SetElementName(const char *name)
Virtual function for setting of name of an element.
Definition: TEveElement.h:484
Manager class for steering of projections and managing projected objects.
Definition: Rtypes.h:58
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
auto * a
Definition: textangle.C:12
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void SetMainColor(Color_t color)
Set main color of the element.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:204
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:304
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
const Bool_t kFALSE
Definition: RtypesCore.h:88
void SetCurrentDepth(Float_t d)
TGLViewer * GetGLViewer() const
Definition: TEveViewer.h:51
TEveWindowPack * MakePack()
A pack is created in place of this window-slot.
TEveScene * GetEventScene() const
Definition: TEveManager.h:148
void SetCurrentCamera(ECameraType camera)
Set current active camera - &#39;cameraType&#39; one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ, kCameraOrthoXOY, kCameraOrthoXOZ, kCameraOrthoZOY, kCameraOrthoXnOY, kCameraOrthoXnOZ, kCameraOrthoZnOY.
Definition: TGLViewer.cxx:1794
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
Eve representation of TGLViewer.
Definition: TEveViewer.h:30
virtual void AddScene(TEveScene *scene)
Add &#39;scene&#39; to the list of scenes.
Definition: TEveViewer.cxx:261