From f79591baacfa9cb4cfce5e3bf203a343e87b42d5 Mon Sep 17 00:00:00 2001 From: ptv Date: Wed, 17 Nov 2010 08:49:30 +0000 Subject: [PATCH] 0020830: EDF 1357 GUI : Hide/Show Icon --- src/VISUGUI/VisuGUI.cxx | 30 ++++++++++++++++++++++++++++++ src/VISUGUI/VisuGUI.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index fd8d1557..6fe7725d 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -99,6 +99,7 @@ #include "VISU_View_i.hh" #include "VISU_ViewManager_i.hh" #include "VISU_Plot3D_i.hh" +#include "VISU_PrsObject_i.hh" #include "VISU_Actor.h" @@ -4803,3 +4804,32 @@ void VisuGUI::OnArcQuadMode(){ void VisuGUI::OnLineQuadMode(){ ChangeQuadratic2DRepresentation(this,VISU::LINES); } + +/*! + * \brief Virtual public slot + * + * This method updates visibility state + * Redefined to make visible geometry objects + */ +void VisuGUI::initVisibilityState( SUIT_DataObject* theObject ) +{ + // in fact, here we assume that all geometry objects presentable + LightApp_DataObject* anObj = dynamic_cast(theObject); + if (!anObj) + return; + + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if( !app ) + return; + + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + if( !appStudy ) + return; + + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(SObject) aSObject( aStudy->FindObjectID( anObj->entry().toLatin1().data() ) ); + VISU::PrsObject_var aPrs = VISU::PrsObject::_narrow( ClientSObjectToObject(aSObject) ); + if ( !aPrs->_is_nil() && anObj->visibilityState() == SUIT_DataObject::Unpresentable ) + anObj->setVisibilityState( SUIT_DataObject::Hidden ); +} diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 0dd29a45..2831b011 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -215,6 +215,8 @@ protected: void OnTimeAnimation(VISU::Animation::AnimationMode theMode); + virtual void initVisibilityState( SUIT_DataObject* ); + private: void createActions(); void createMenus(); -- 2.39.2