From: jfa Date: Fri, 10 Jun 2005 11:16:34 +0000 (+0000) Subject: Presentation deletion X-Git-Tag: T3_0_0_a3~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b937b71058430328e08ab6e1fbf5652a6ec5a6b;p=modules%2Fvisu.git Presentation deletion --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index ae46da4e..547a4ff4 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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::GetServant(anObject).in()); + if (aPrsObject) { + //jfa tmp:DeletePresentation(aPrsObject); + DeletePrs3d(this, aPrsObject, anIO); + } + + // is it Curve object ? + VISU::Curve_i* aCurveObject = dynamic_cast(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::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 ); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 4f4fc69b..953a83ef 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -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