Salome HOME
refs #30 - Sketch base GUI: create, draw lines
authornds <natalia.donis@opencascade.com>
Fri, 16 May 2014 06:15:52 +0000 (10:15 +0400)
committernds <natalia.donis@opencascade.com>
Fri, 16 May 2014 06:15:52 +0000 (10:15 +0400)
Remove temporary call of the EraseAll method. Use instead of the EraseDeletedFeatures() if the listener catch Feature_Deleted event.

src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_Displayer.cpp

index 0deb7fb74359fd6823902a7b9e3571abcf687b9b..b97b34f8ef4857039f2ae1adee119cd9f30da82a 100644 (file)
@@ -50,7 +50,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
 
     std::string aGroup = aDelMsg->group();
     if (aDelMsg->group().compare("Sketch") == 0) { // Update only Sketch group
-      //myModule->workshop()->displayer()->EraseDeletedFeatures();
+      myModule->workshop()->displayer()->EraseDeletedFeatures();
       myModule->updateCurrentPreview(aGroup);
     }
   }
index 9e47626c8a02a42220e26e1315d41ccebdf1e15f..17998703c234ef06343493c59074509beaaf792f 100644 (file)
@@ -330,7 +330,6 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
 
   std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
                                                          anIt = aList.begin(), aLast = aList.end();
-  aDisplayer->EraseAll(false);
   for (; anIt != aLast; anIt++) {
     boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).first;
     boost::shared_ptr<GeomAPI_Shape> aPreview = (*anIt).second;
index a01a311291b73009ab8556a5441caf7aa0e83f06..8daeaa9ed808efd4c3aeae18401926ebb719fa55 100644 (file)
@@ -8,6 +8,7 @@
 #include "XGUI_ViewerProxy.h"
 
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Data.h>
 
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_ListOfInteractive.hxx>
@@ -171,7 +172,7 @@ void XGUI_Displayer::EraseDeletedFeatures(const bool isUpdateViewer)
   for (; aFIt != aFLast; aFIt++)
   {
     boost::shared_ptr<ModelAPI_Feature> aFeature = (*aFIt).first;
-    if (!aFeature) {
+    if (!aFeature || !aFeature->data()->isValid()) {
       Handle(AIS_InteractiveObject) anAIS = (*aFIt).second;
       if (!anAIS.IsNull()) {
         aContext->Erase(anAIS, false);