MultiView.C

Go to the documentation of this file.
00001 // Multi-view (3d, rphi, rhoz) service class using EVE Window Manager.
00002 // Author: Matevz Tadel 2009
00003 
00004 #include <TEveManager.h>
00005 
00006 #include <TEveViewer.h>
00007 #include <TGLViewer.h>
00008 
00009 #include <TEveScene.h>
00010 
00011 #include <TEveProjectionManager.h>
00012 #include <TEveProjectionAxes.h>
00013 
00014 #include <TEveBrowser.h>
00015 #include <TEveWindow.h>
00016 
00017 // MultiView
00018 //
00019 // Structure encapsulating standard views: 3D, r-phi and rho-z.
00020 // Includes scenes and projection managers.
00021 //
00022 // Should be used in compiled mode.
00023 
00024 struct MultiView
00025 {
00026    TEveProjectionManager *fRPhiMgr;
00027    TEveProjectionManager *fRhoZMgr;
00028 
00029    TEveViewer            *f3DView;
00030    TEveViewer            *fRPhiView;
00031    TEveViewer            *fRhoZView;
00032 
00033    TEveScene             *fRPhiGeomScene;
00034    TEveScene             *fRhoZGeomScene;
00035    TEveScene             *fRPhiEventScene;
00036    TEveScene             *fRhoZEventScene;
00037 
00038    //---------------------------------------------------------------------------
00039 
00040    MultiView()
00041    {
00042       // Constructor --- creates required scenes, projection managers
00043       // and GL viewers.
00044 
00045       // Scenes
00046       //========
00047 
00048       fRPhiGeomScene  = gEve->SpawnNewScene("RPhi Geometry",
00049                                             "Scene holding projected geometry for the RPhi view.");
00050       fRhoZGeomScene  = gEve->SpawnNewScene("RhoZ Geometry",
00051                                             "Scene holding projected geometry for the RhoZ view.");
00052       fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data",
00053                                             "Scene holding projected event-data for the RPhi view.");
00054       fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data",
00055                                             "Scene holding projected event-data for the RhoZ view.");
00056 
00057 
00058       // Projection managers
00059       //=====================
00060 
00061       fRPhiMgr = new TEveProjectionManager(TEveProjection::kPT_RPhi);
00062       gEve->AddToListTree(fRPhiMgr, kFALSE);
00063       {
00064          TEveProjectionAxes* a = new TEveProjectionAxes(fRPhiMgr);
00065          a->SetMainColor(kWhite);
00066          a->SetTitle("R-Phi");
00067          a->SetTitleSize(0.05);
00068          a->SetTitleFont(102);
00069          a->SetLabelSize(0.025);
00070          a->SetLabelFont(102);
00071          fRPhiGeomScene->AddElement(a);
00072       }
00073 
00074       fRhoZMgr = new TEveProjectionManager(TEveProjection::kPT_RhoZ);
00075       gEve->AddToListTree(fRhoZMgr, kFALSE);
00076       {
00077          TEveProjectionAxes* a = new TEveProjectionAxes(fRhoZMgr);
00078          a->SetMainColor(kWhite);
00079          a->SetTitle("Rho-Z");
00080          a->SetTitleSize(0.05);
00081          a->SetTitleFont(102);
00082          a->SetLabelSize(0.025);
00083          a->SetLabelFont(102);
00084          fRhoZGeomScene->AddElement(a);
00085       }
00086 
00087 
00088       // Viewers
00089       //=========
00090 
00091       TEveWindowSlot *slot = 0;
00092       TEveWindowPack *pack = 0;
00093 
00094       slot = TEveWindow::CreateWindowInTab(gEve->GetBrowser()->GetTabRight());
00095       pack = slot->MakePack();
00096       pack->SetElementName("Multi View");
00097       pack->SetHorizontal();
00098       pack->SetShowTitleBar(kFALSE);
00099       pack->NewSlot()->MakeCurrent();
00100       f3DView = gEve->SpawnNewViewer("3D View", "");
00101       f3DView->AddScene(gEve->GetGlobalScene());
00102       f3DView->AddScene(gEve->GetEventScene());
00103 
00104       pack = pack->NewSlot()->MakePack();
00105       pack->SetShowTitleBar(kFALSE);
00106       pack->NewSlot()->MakeCurrent();
00107       fRPhiView = gEve->SpawnNewViewer("RPhi View", "");
00108       fRPhiView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
00109       fRPhiView->AddScene(fRPhiGeomScene);
00110       fRPhiView->AddScene(fRPhiEventScene);
00111 
00112       pack->NewSlot()->MakeCurrent();
00113       fRhoZView = gEve->SpawnNewViewer("RhoZ View", "");
00114       fRhoZView->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
00115       fRhoZView->AddScene(fRhoZGeomScene);
00116       fRhoZView->AddScene(fRhoZEventScene);
00117    }
00118 
00119    //---------------------------------------------------------------------------
00120 
00121    void SetDepth(Float_t d)
00122    {
00123       // Set current depth on all projection managers.
00124 
00125       fRPhiMgr->SetCurrentDepth(d);
00126       fRhoZMgr->SetCurrentDepth(d);
00127    }
00128 
00129    //---------------------------------------------------------------------------
00130 
00131    void ImportGeomRPhi(TEveElement* el)
00132    { 
00133       fRPhiMgr->ImportElements(el, fRPhiGeomScene);
00134    }
00135 
00136    void ImportGeomRhoZ(TEveElement* el)
00137    { 
00138       fRhoZMgr->ImportElements(el, fRhoZGeomScene);
00139    }
00140 
00141    void ImportEventRPhi(TEveElement* el)
00142    { 
00143       fRPhiMgr->ImportElements(el, fRPhiEventScene);
00144    }
00145 
00146    void ImportEventRhoZ(TEveElement* el)
00147    { 
00148       fRhoZMgr->ImportElements(el, fRhoZEventScene);
00149    }
00150 
00151    //---------------------------------------------------------------------------
00152 
00153    void DestroyEventRPhi()
00154    {
00155       fRPhiEventScene->DestroyElements();
00156    }
00157 
00158    void DestroyEventRhoZ()
00159    {
00160       fRhoZEventScene->DestroyElements();
00161    }
00162 };

Generated on Tue Jul 5 15:43:51 2011 for ROOT_528-00b_version by  doxygen 1.5.1