From: apo Date: Thu, 30 Nov 2006 12:49:35 +0000 (+0000) Subject: To handle ColoredPrs3dHolder in DeletePrs3d function X-Git-Tag: WP1_2_3_05-12-2006_cache_system~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b93edbbabea25d2c35017a6732efeee3c0a88eae;p=modules%2Fvisu.git To handle ColoredPrs3dHolder in DeletePrs3d function --- diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 17e92c7b..b3a939d3 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -39,7 +39,6 @@ #include "VISU_Table_i.hh" #include "VISU_Mesh_i.hh" #include "VISU_ViewManager_i.hh" -#include "VISU_ColoredPrs3dHolder_i.hh" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" @@ -333,8 +332,10 @@ namespace VISU GetPrs3dFromBase(Base_i* theBase) { if(theBase && theBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){ - VISU::ColoredPrs3dHolder_i* aHolder = dynamic_cast(theBase); - return aHolder->GetPrs3dDevice(); + CORBA::Object_var anObject = theBase->_this(); + VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject); + VISU::Prs3d_var aPrs3d = aHolder->GetDevice(); + return VISU::GetServantInterface(aPrs3d); } return dynamic_cast(theBase); } @@ -546,7 +547,6 @@ namespace VISU } } else { // Remove aSObject together with all its sub-objects - VISU::RemoveFromStudy(theSObject, false, // remove not only IOR attribute, but Object With Children false); // not Destroy() sub-objects @@ -560,13 +560,30 @@ namespace VISU { if (!thePrs) return; + if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return; - SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); - RemoveScalarBarPosition(theModule, vw, thePrs); - + if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) + RemoveScalarBarPosition(theModule, aViewWindow, thePrs); + + if(VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast(thePrs)){ + std::string anEntry = aColoredPrs3d->GetHolderEntry(); + if(anEntry != ""){ + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), anEntry); + if(VISU::Base_i* aBase = anObjectInfo.myBase){ + if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER){ + CORBA::Object_var anObject = aBase->_this(); + VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObject); + aRemovableObject->RemoveFromStudy(); + return; + } + } + } + } + thePrs->RemoveFromStudy(); + } //------------------------------------------------------------