Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:12

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DD4hep/Printout.h>
0016 #include <DDEve/Display.h>
0017 #include <DDEve/ContextMenu.h>
0018 #include <DDEve/EveUserContextMenu.h>
0019 
0020 // ROOT include files
0021 #include <TEveGeoShape.h>
0022 #include <TEveManager.h>
0023 #include <TEveElement.h>
0024 
0025 // C/C++ include files
0026 
0027 using namespace dd4hep;
0028 
0029 ClassImp(EveUserContextMenu)
0030 
0031 /// Initializing constructor
0032 EveUserContextMenu::EveUserContextMenu(Display* disp) : m_display(disp)  {
0033 }
0034 
0035 /// Default destructor
0036 EveUserContextMenu::~EveUserContextMenu()  {
0037 }
0038 
0039 /// EVE manager
0040 TEveManager& EveUserContextMenu::manager() const   {
0041   return m_display->manager();
0042 }
0043 
0044 /// Set everything (in-) visible
0045 void EveUserContextMenu::VisibleAll(bool visible, TObject* target, void* /* user_param */)   {
0046   TEveElement* element = dynamic_cast<TEveElement*>(target);
0047   if ( element ) m_display->MakeNodesVisible(element,visible,9999);
0048 }
0049 
0050 /// Set self (in-) visible
0051 void EveUserContextMenu::VisibleSelf(bool visible, TObject* target, void* /* user_param */)  {
0052   TEveElement* element = dynamic_cast<TEveElement*>(target);
0053   if ( element ) m_display->MakeNodesVisible(element,visible,0);
0054 }
0055 
0056 /// Set the children (in-) visible
0057 void EveUserContextMenu::VisibleChildren(bool visible, TObject* target, void* /* user_param */)  {
0058   TEveElement* element = dynamic_cast<TEveElement*>(target);
0059   if ( element ) m_display->MakeNodesVisible(element,visible,1);
0060 }
0061 
0062 /// Show all
0063 void EveUserContextMenu::ShowAll(TObject* target, void* user_param)   {
0064   VisibleAll(true,target,user_param);
0065 }
0066 
0067 /// Show shape self
0068 void EveUserContextMenu::ShowSelf(TObject* target, void* user_param)   {
0069   VisibleSelf(true,target,user_param);
0070 }
0071 
0072 /// Show shape children
0073 void EveUserContextMenu::ShowChildren(TObject* target, void* user_param)   {
0074   VisibleChildren(true,target,user_param);
0075 }
0076 
0077 /// Hide all
0078 void EveUserContextMenu::HideAll(TObject* target, void* user_param)   {
0079   VisibleAll(false,target,user_param);
0080 }
0081 
0082 /// Hide shape self
0083 void EveUserContextMenu::HideSelf(TObject* target, void* user_param)   {
0084   VisibleSelf(false,target,user_param);
0085 }
0086 
0087 /// Hide shape children
0088 void EveUserContextMenu::HideChildren(TObject* target, void* user_param)   {
0089   VisibleChildren(false,target,user_param);
0090 }
0091 
0092 /// Load next level children and add them to all scenes
0093 void EveUserContextMenu::LoadChildren(TObject* target, void* /* user_param */)   {
0094   TEveElement* element = dynamic_cast<TEveElement*>(target);
0095   if ( element ) m_display->LoadGeoChildren(element, 1, true);
0096 }
0097 
0098 /// Load all children and add them to all scenes
0099 void EveUserContextMenu::DeepLoadChildren(TObject* target, void* /* user_param */)   {
0100   TEveElement* element = dynamic_cast<TEveElement*>(target);
0101   if ( element ) m_display->LoadGeoChildren(element, 9999, true);
0102 }
0103 
0104 /// Install the geometry context menu
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 }