Logo ROOT   6.18/05
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
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
29struct 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 {
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 {
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};
#define d(i)
Definition: RSha256.hxx:102
const Bool_t kFALSE
Definition: RtypesCore.h:88
float Float_t
Definition: RtypesCore.h:53
@ kWhite
Definition: Rtypes.h:63
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
virtual void SetElementName(const char *name)
Virtual function for setting of name of an element.
Definition: TEveElement.h:453
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:34
virtual void AddElement(TEveElement *el)
Add el to the list of children.
virtual void DestroyElements()
Destroy all children of this element.
TEveScene * GetGlobalScene() const
Definition: TEveManager.h:147
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
TEveScene * GetEventScene() const
Definition: TEveManager.h:148
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
virtual TEveElement * ImportElements(TEveElement *el, TEveElement *ext_list=0)
Recursively import elements and apply projection to the newly imported objects.
void SetCurrentDepth(Float_t d)
Eve representation of TGLScene.
Definition: TEveScene.h:27
Eve representation of TGLViewer.
Definition: TEveViewer.h:31
TGLViewer * GetGLViewer() const
Definition: TEveViewer.h:51
virtual void AddScene(TEveScene *scene)
Add 'scene' to the list of scenes.
Definition: TEveViewer.cxx:261
Encapsulates TGPack into an eve-window.
Definition: TEveWindow.h:361
void SetHorizontal()
Definition: TEveWindow.h:381
virtual TEveWindowSlot * NewSlot()
Create a new frame-slot at the last position of the pack.
Description of TEveWindowSlot.
Definition: TEveWindow.h:302
TEveWindowPack * MakePack()
A pack is created in place of this window-slot.
void MakeCurrent()
Make this window current.
Definition: TEveWindow.cxx:919
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.
void SetShowTitleBar(Bool_t x)
Set display state of the title-bar.
Definition: TEveWindow.cxx:898
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
Definition: TGLViewer.cxx:1794
@ kCameraOrthoXOY
Definition: TGLViewer.h:64
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
auto * a
Definition: textangle.C:12