From b93edbbabea25d2c35017a6732efeee3c0a88eae Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 30 Nov 2006 12:49:35 +0000 Subject: [PATCH] To handle ColoredPrs3dHolder in DeletePrs3d function --- src/VISUGUI/VisuGUI_Tools.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) 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(); + } //------------------------------------------------------------ -- 2.39.2