]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Erase objects of cancelled Sketcher
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 30 Dec 2014 11:43:45 +0000 (14:43 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 30 Dec 2014 11:43:45 +0000 (14:43 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 2b0b5e121add5cc6b41947ac186b9c5bd742a334..074e9b686735eeb321addfcdefeb677415a3037b 100644 (file)
@@ -436,16 +436,26 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
 
 void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
 {
+  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(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<XGUI_ModuleConnector*>(myModule->workshop());
-  XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
   for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
     FeaturePtr aFeature = myCurrentSketch->subFeature(i);
     std::list<ResultPtr> aResults = aFeature->results();
index 22b76ad2eafae3bb03d009aaf614b84982cedaba..37dab67a4cf827bc490d6286f81458d49c6ecbc7 100644 (file)
@@ -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;
index 16f490e135db9342aacb7bad16c8b02d1777669d..439d254e31252b8f94aaa13afe1e20cf299c9866 100644 (file)
@@ -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: