]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To handle ColoredPrs3dHolder in DeletePrs3d function
authorapo <apo@opencascade.com>
Thu, 30 Nov 2006 12:49:35 +0000 (12:49 +0000)
committerapo <apo@opencascade.com>
Thu, 30 Nov 2006 12:49:35 +0000 (12:49 +0000)
src/VISUGUI/VisuGUI_Tools.cxx

index 17e92c7bdf40bdd5f8f60bbfdb49d6a3ec91067d..b3a939d32b4ad971763265bcb8b6e641f08bdf5b 100644 (file)
@@ -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<VISU::ColoredPrs3dHolder_i*>(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<VISU::Prs3d_i>(aPrs3d);
     }
     return dynamic_cast<VISU::Prs3d_i*>(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<SVTK_ViewWindow>(theModule);
-    RemoveScalarBarPosition(theModule, vw, thePrs);
-
+    if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule))
+      RemoveScalarBarPosition(theModule, aViewWindow, thePrs);
+
+    if(VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(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();
+      
   }
 
   //------------------------------------------------------------