File indexing completed on 2025-01-18 09:14:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/Printout.h>
0016 #include <DDEve/Display.h>
0017 #include <DDEve/ContextMenu.h>
0018 #include <DDEve/EveUserContextMenu.h>
0019
0020
0021 #include <TEveGeoShape.h>
0022 #include <TEveManager.h>
0023 #include <TEveElement.h>
0024
0025
0026
0027 using namespace dd4hep;
0028
0029 ClassImp(EveUserContextMenu)
0030
0031
0032 EveUserContextMenu::EveUserContextMenu(Display* disp) : m_display(disp) {
0033 }
0034
0035
0036 EveUserContextMenu::~EveUserContextMenu() {
0037 }
0038
0039
0040 TEveManager& EveUserContextMenu::manager() const {
0041 return m_display->manager();
0042 }
0043
0044
0045 void EveUserContextMenu::VisibleAll(bool visible, TObject* target, void* ) {
0046 TEveElement* element = dynamic_cast<TEveElement*>(target);
0047 if ( element ) m_display->MakeNodesVisible(element,visible,9999);
0048 }
0049
0050
0051 void EveUserContextMenu::VisibleSelf(bool visible, TObject* target, void* ) {
0052 TEveElement* element = dynamic_cast<TEveElement*>(target);
0053 if ( element ) m_display->MakeNodesVisible(element,visible,0);
0054 }
0055
0056
0057 void EveUserContextMenu::VisibleChildren(bool visible, TObject* target, void* ) {
0058 TEveElement* element = dynamic_cast<TEveElement*>(target);
0059 if ( element ) m_display->MakeNodesVisible(element,visible,1);
0060 }
0061
0062
0063 void EveUserContextMenu::ShowAll(TObject* target, void* user_param) {
0064 VisibleAll(true,target,user_param);
0065 }
0066
0067
0068 void EveUserContextMenu::ShowSelf(TObject* target, void* user_param) {
0069 VisibleSelf(true,target,user_param);
0070 }
0071
0072
0073 void EveUserContextMenu::ShowChildren(TObject* target, void* user_param) {
0074 VisibleChildren(true,target,user_param);
0075 }
0076
0077
0078 void EveUserContextMenu::HideAll(TObject* target, void* user_param) {
0079 VisibleAll(false,target,user_param);
0080 }
0081
0082
0083 void EveUserContextMenu::HideSelf(TObject* target, void* user_param) {
0084 VisibleSelf(false,target,user_param);
0085 }
0086
0087
0088 void EveUserContextMenu::HideChildren(TObject* target, void* user_param) {
0089 VisibleChildren(false,target,user_param);
0090 }
0091
0092
0093 void EveUserContextMenu::LoadChildren(TObject* target, void* ) {
0094 TEveElement* element = dynamic_cast<TEveElement*>(target);
0095 if ( element ) m_display->LoadGeoChildren(element, 1, true);
0096 }
0097
0098
0099 void EveUserContextMenu::DeepLoadChildren(TObject* target, void* ) {
0100 TEveElement* element = dynamic_cast<TEveElement*>(target);
0101 if ( element ) m_display->LoadGeoChildren(element, 9999, true);
0102 }
0103
0104
0105 void EveUserContextMenu::InstallGeometryContextMenu(TClass* cl) {
0106 ContextMenu& menu = ContextMenu::instance(cl);
0107 menu.Clear();
0108 menu.Add("Show Children Recursive",this,&EveUserContextMenu::ShowAll);
0109 menu.Add("Hide Children Recursive",this,&EveUserContextMenu::HideAll);
0110 menu.AddSeparator();
0111 menu.Add("Show Children",this,&EveUserContextMenu::ShowChildren);
0112 menu.Add("Hide Children",this,&EveUserContextMenu::HideChildren);
0113 menu.Add("Show Self",this,&EveUserContextMenu::ShowSelf);
0114 menu.Add("Hide Self",this,&EveUserContextMenu::HideSelf);
0115 menu.AddSeparator();
0116 menu.Add("Load Children",this,&EveUserContextMenu::LoadChildren);
0117 menu.Add("Deep Load",this,&EveUserContextMenu::DeepLoadChildren);
0118 }