From: vsv Date: Tue, 30 Dec 2014 11:43:45 +0000 (+0300) Subject: Erase objects of cancelled Sketcher X-Git-Tag: V_0.7.0_rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d65540f1cac5fb5d417ded46be4cd38bcecd9236;p=modules%2Fshaper.git Erase objects of cancelled Sketcher --- diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 2b0b5e121..074e9b686 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -436,16 +436,26 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) { + XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); + XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); + DataPtr aData = myCurrentSketch->data(); if ((!aData) || (!aData->isValid())) { // The sketch was aborted myCurrentSketch = CompositeFeaturePtr(); myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter); + + // Erase all sketcher objects + QStringList aSketchIds = sketchOperationIdList(); + QObjectPtrList aObjects = aDisplayer->displayedObjects(); + foreach (ObjectPtr aObj, aObjects) { + DataPtr aObjData = aObj->data(); + if ((!aObjData) || (!aObjData->isValid())) + aDisplayer->erase(aObj); + } return; } // Hide all sketcher sub-Objects - XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); - XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) { FeaturePtr aFeature = myCurrentSketch->subFeature(i); std::list aResults = aFeature->results(); diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 22b76ad2e..37dab67a4 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -299,7 +299,7 @@ void XGUI_Displayer::activateObjects(const QIntList& theModes) //myUseExternalObjects = true; AIS_ListOfInteractive aPrsList; - displayedObjects(aContext, aPrsList); + ::displayedObjects(aContext, aPrsList); Handle(AIS_Trihedron) aTrihedron; AIS_ListIteratorOfListOfInteractive aLIt(aPrsList); @@ -339,7 +339,7 @@ void XGUI_Displayer::deactivateObjects() //aContext->NotUseDisplayedObjects(); AIS_ListOfInteractive aPrsList; - displayedObjects(aContext, aPrsList); + ::displayedObjects(aContext, aPrsList); AIS_ListIteratorOfListOfInteractive aLIt; //Handle(AIS_Trihedron) aTrihedron; diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 16f490e13..439d254e3 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -149,6 +149,9 @@ class XGUI_EXPORT XGUI_Displayer /// Returns number of displayed objects int objectsCount() const { return myResult2AISObjectMap.size(); } + QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); } + + /// Returns true if the given object can be shown in shaded mode bool canBeShaded(ObjectPtr theObject) const; protected: