]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Presentation deletion
authorjfa <jfa@opencascade.com>
Fri, 10 Jun 2005 11:16:34 +0000 (11:16 +0000)
committerjfa <jfa@opencascade.com>
Fri, 10 Jun 2005 11:16:34 +0000 (11:16 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Tools.cxx

index ae46da4e21b2a2eaf2bf50658be237fe9fa58153..547a4ff412a9524f97a2f9351793ea06ce90ad9b 100644 (file)
@@ -613,6 +613,35 @@ void
 VisuGUI::
 OnDeletePrs()
 {
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy))
+    return;
+  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+  if (anIO.IsNull())
+    return;
+
+  // There is a transaction
+  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+  aStudyBuilder->NewCommand();
+
+  // is it Prs3d object ?
+  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
+  if (aPrsObject) {
+    //jfa tmp:DeletePresentation(aPrsObject);
+    DeletePrs3d(this, aPrsObject, anIO);
+  }
+
+  // is it Curve object ?
+  VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
+  if (aCurveObject) {
+    //jfa tmp:DeletePresentation(aCurveObject);
+    //DeleteCurve(this, aCurveObject, anIO);
+  }
+
+  aStudyBuilder->CommitCommand();
 }
 
 void
@@ -756,6 +785,7 @@ OnDeleteObject()
               if (CORBA::is_nil(aPrs3d)) continue;
               VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
               //jfa tmp:DeletePresentation(pPrs3d);
+              DeletePrs3d(this, pPrs3d, NULL);
            }
            break;
          }
@@ -1505,6 +1535,13 @@ createPopupMenus()
   mgr->insert( action(  4032 ), -1, -1, -1 ); // display only
   mgr->setRule( action( 4032 ), aRule.arg(""), true );
 
+  aRule = "client='ObjectBrowser' and selcount=1 and $type in {'VISU::TTABLE' "
+          "'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::TMESH' 'VISU::TSCALARMAP' "
+          "'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
+          "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+  mgr->insert( action(  4033 ), -1, -1, -1 ); // delete presentation
+  mgr->setRule( action( 4033 ), aRule.arg(""), true );
+
   // View parameters
   mgr->insert ( action( 4046 ), -1, -1, -1 ); // save view params
   //jfa tmp:mgr->setRule( action( 4046 ), "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')", true );
index 4f4fc69bf16407b86a947420ca0fb2e4e4050a9b..953a83efd1e31dce3b2e59381966ce54eb058b22 100644 (file)
@@ -453,17 +453,16 @@ namespace VISU
   Remove(SalomeApp_SelectionMgr* theSelectionMgr,
         const Handle(SALOME_InteractiveObject)& theIO)
   {
-    SALOME_ListIO aListIO;
+    SALOME_ListIO aListIO, aNewListIO;
     theSelectionMgr->selectedObjects(aListIO);
-    SALOME_ListIteratorOfListIO anIter(aListIO);
-    while(anIter.More()){
+    SALOME_ListIteratorOfListIO anIter (aListIO);
+    for (; anIter.More(); anIter.Next()) {
       Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-      if(anIO->isSame(theIO)){
-       aListIO.Remove(anIter);
+      if (!anIO->isSame(theIO)) {
+       aNewListIO.Append(theIO);
       }
-      anIter.Next();
     }
-    theSelectionMgr->setSelectedObjects(aListIO);
+    theSelectionMgr->setSelectedObjects(aNewListIO);
   }
 
   void