DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
EveUserContextMenu.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DD4hep/Printout.h>
16 #include <DDEve/Display.h>
17 #include <DDEve/ContextMenu.h>
19 
20 // ROOT include files
21 #include <TEveGeoShape.h>
22 #include <TEveManager.h>
23 #include <TEveElement.h>
24 
25 // C/C++ include files
26 
27 using namespace dd4hep;
28 
30 
31 EveUserContextMenu::EveUserContextMenu(Display* disp) : m_display(disp) {
33 }
34 
36 EveUserContextMenu::~EveUserContextMenu() {
37 }
38 
40 TEveManager& EveUserContextMenu::manager() const {
41  return m_display->manager();
42 }
43 
45 void EveUserContextMenu::VisibleAll(bool visible, TObject* target, void* /* user_param */) {
46  TEveElement* element = dynamic_cast<TEveElement*>(target);
47  if ( element ) m_display->MakeNodesVisible(element,visible,9999);
48 }
49 
51 void EveUserContextMenu::VisibleSelf(bool visible, TObject* target, void* /* user_param */) {
52  TEveElement* element = dynamic_cast<TEveElement*>(target);
53  if ( element ) m_display->MakeNodesVisible(element,visible,0);
54 }
55 
57 void EveUserContextMenu::VisibleChildren(bool visible, TObject* target, void* /* user_param */) {
58  TEveElement* element = dynamic_cast<TEveElement*>(target);
59  if ( element ) m_display->MakeNodesVisible(element,visible,1);
60 }
61 
63 void EveUserContextMenu::ShowAll(TObject* target, void* user_param) {
64  VisibleAll(true,target,user_param);
65 }
66 
68 void EveUserContextMenu::ShowSelf(TObject* target, void* user_param) {
69  VisibleSelf(true,target,user_param);
70 }
71 
73 void EveUserContextMenu::ShowChildren(TObject* target, void* user_param) {
74  VisibleChildren(true,target,user_param);
75 }
76 
78 void EveUserContextMenu::HideAll(TObject* target, void* user_param) {
79  VisibleAll(false,target,user_param);
80 }
81 
83 void EveUserContextMenu::HideSelf(TObject* target, void* user_param) {
84  VisibleSelf(false,target,user_param);
85 }
86 
88 void EveUserContextMenu::HideChildren(TObject* target, void* user_param) {
89  VisibleChildren(false,target,user_param);
90 }
91 
93 void EveUserContextMenu::LoadChildren(TObject* target, void* /* user_param */) {
94  TEveElement* element = dynamic_cast<TEveElement*>(target);
95  if ( element ) m_display->LoadGeoChildren(element, 1, true);
96 }
97 
99 void EveUserContextMenu::DeepLoadChildren(TObject* target, void* /* user_param */) {
100  TEveElement* element = dynamic_cast<TEveElement*>(target);
101  if ( element ) m_display->LoadGeoChildren(element, 9999, true);
102 }
103 
107  menu.Clear();
108  menu.Add("Show Children Recursive",this,&EveUserContextMenu::ShowAll);
109  menu.Add("Hide Children Recursive",this,&EveUserContextMenu::HideAll);
110  menu.AddSeparator();
111  menu.Add("Show Children",this,&EveUserContextMenu::ShowChildren);
112  menu.Add("Hide Children",this,&EveUserContextMenu::HideChildren);
113  menu.Add("Show Self",this,&EveUserContextMenu::ShowSelf);
114  menu.Add("Hide Self",this,&EveUserContextMenu::HideSelf);
115  menu.AddSeparator();
116  menu.Add("Load Children",this,&EveUserContextMenu::LoadChildren);
117  menu.Add("Deep Load",this,&EveUserContextMenu::DeepLoadChildren);
118 }
dd4hep::Display::MakeNodesVisible
void MakeNodesVisible(TEveElement *e, bool visible, int level)
Make a set of nodes starting from a top element (in-)visible with a given depth.
Definition: Display.cpp:591
dd4hep::Display
The main class of the DDEve display.
Definition: Display.h:56
dd4hep::EveUserContextMenu::ShowAll
void ShowAll(TObject *target, void *user_param)
Show all.
Definition: EveUserContextMenu.cpp:63
dd4hep::EveUserContextMenu::EveUserContextMenu
EveUserContextMenu(Display *m)
Initializing constructor.
dd4hep::ContextMenu
DD4hep specific TEve context menu.
Definition: ContextMenu.h:64
dd4hep::Display::LoadGeoChildren
void LoadGeoChildren(TEveElement *start, int levels, bool redraw)
Load 'levels' Children into the geometry scene.
Definition: Display.cpp:527
dd4hep::EveUserContextMenu::ShowChildren
void ShowChildren(TObject *target, void *user_param)
Show shape children.
Definition: EveUserContextMenu.cpp:73
dd4hep::EveUserContextMenu::HideAll
void HideAll(TObject *target, void *user_param)
Show all.
Definition: EveUserContextMenu.cpp:78
dd4hep::ContextMenu::Add
ContextMenu & Add(const std::string &title, Callback cb, void *ud)
Add user callback.
Definition: ContextMenu.cpp:91
dd4hep::EveUserContextMenu::manager
TEveManager & manager() const
EVE manager.
Definition: EveUserContextMenu.cpp:40
dd4hep::EveUserContextMenu::VisibleSelf
void VisibleSelf(bool yes_no, TObject *target, void *user_param)
Set self (in-) visible.
Definition: EveUserContextMenu.cpp:51
dd4hep::EveUserContextMenu::ShowSelf
void ShowSelf(TObject *target, void *user_param)
Show shape self.
Definition: EveUserContextMenu.cpp:68
Display.h
dd4hep::EveUserContextMenu::VisibleChildren
void VisibleChildren(bool yes_no, TObject *target, void *user_param)
Set the children (in-) visible.
Definition: EveUserContextMenu.cpp:57
dd4hep::EveUserContextMenu::InstallGeometryContextMenu
void InstallGeometryContextMenu(TClass *cl)
Install the geometry context menu.
Definition: EveUserContextMenu.cpp:105
dd4hep::ContextMenu::AddSeparator
ContextMenu & AddSeparator()
Add a separator.
Definition: ContextMenu.cpp:83
dd4hep::ContextMenu::Clear
ContextMenu & Clear()
Clear all existing items.
Definition: ContextMenu.cpp:75
EveUserContextMenu.h
dd4hep::EveUserContextMenu::DeepLoadChildren
void DeepLoadChildren(TObject *target, void *user_param)
Load all children and add them to all scenes.
Definition: EveUserContextMenu.cpp:99
ClassImp
ClassImp(EveUserContextMenu) EveUserContextMenu
Initializing constructor.
Definition: EveUserContextMenu.cpp:29
TObject
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::EveUserContextMenu::HideSelf
void HideSelf(TObject *target, void *user_param)
Show shape self.
Definition: EveUserContextMenu.cpp:83
dd4hep::ContextMenu::instance
static ContextMenu & instance(TClass *cl)
Instantiator.
Definition: ContextMenu.cpp:66
dd4hep::EveUserContextMenu::VisibleAll
void VisibleAll(bool yes_no, TObject *target, void *user_param)
Set everything (in-) visible.
Definition: EveUserContextMenu.cpp:45
dd4hep::EveUserContextMenu
class EveUserContextMenu EveUserContextMenu.h DDEve/EveUserContextMenu.h
Definition: EveUserContextMenu.h:34
dd4hep::EveUserContextMenu::HideChildren
void HideChildren(TObject *target, void *user_param)
Show shape children.
Definition: EveUserContextMenu.cpp:88
dd4hep::EveUserContextMenu::m_display
Display * m_display
Definition: EveUserContextMenu.h:36
Printout.h
dd4hep::EveUserContextMenu::LoadChildren
void LoadChildren(TObject *target, void *user_param)
Load next level children and add them to all scenes.
Definition: EveUserContextMenu.cpp:93
dd4hep::Display::manager
TEveManager & manager() const
Access to the EVE manager.
Definition: Display.h:131
ContextMenu.h