X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISUGUI%2FVisuGUI_Tools.cxx;h=030fdd0677e4ea2bcadc047c07b92a6ebc4a979d;hb=f9285199fc082b113c36db6c2ca4b3ea39731314;hp=4606134bce3fa591e69b75e922ec4b656bd2a48e;hpb=c88d3b912d1bf052c1011a97dd250185d35dde8d;p=modules%2Fvisu.git diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 4606134b..030fdd06 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -162,7 +162,7 @@ namespace VISU return aStr; } - //************************************************************ + //------------------------------------------------------------ // Selection CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy, @@ -206,6 +206,25 @@ namespace VISU return CORBA::Object::_nil(); } + VISU::Prs3d_i* + GetPrsToModify(const SalomeApp_Module* theModule, + Handle(SALOME_InteractiveObject)* theIO, + VISU::Storable::TRestoringMap* theMap) + { + if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + return NULL; + + CORBA::Object_var anObject = GetSelectedObj(theModule, theIO); + if (CORBA::is_nil(anObject)) + return NULL; + + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); + if (!aServant.in()) + return NULL; + + return dynamic_cast(aServant.in()); + } + void Add(SalomeApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO) @@ -372,9 +391,13 @@ namespace VISU _PTR(Study) theStudy, _PTR(SObject) theSObject) { + SalomeApp_Study* study = GetAppStudy( theModule ); + study->deleteReferencesTo( theSObject ); + _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject); for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { _PTR(SObject) aChildSObject = aChildIter->Value(); + study->deleteReferencesTo( aChildSObject ); CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); ErasePrs(theModule, aChildObj); } @@ -389,6 +412,7 @@ 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 @@ -438,13 +462,19 @@ namespace VISU ChangeRepresentation (const SalomeApp_Module* theModule, VISU::PresentationType theType) { - SUIT_ViewWindow* aView = GetActiveView(theModule, VTKViewer_Viewer::Type()); + SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type()); if (!aView) return; - SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView; + SVTK_ViewWindow* vw = dynamic_cast( aView ); + if( !vw ) + return; Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); if (CORBA::is_nil(anObject)) return; + + VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); + if (CORBA::is_nil(aVisuObj)) return; + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return;