Salome HOME
Simplification of "Update" algorithm and "Macro" flag implementation for the box...
[modules/shaper.git] / src / ModelAPI / ModelAPI_Feature.cpp
index e158d48a0853f3b6f9603d39fbbd4469515d8fe3..8a5d93cbdc04eee1933bc77bb1c1be2ba9dfc6f6 100644 (file)
@@ -97,7 +97,7 @@ void ModelAPI_Feature::removeResults(const int theSinceIndex)
   }
 
   std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
-  for(int anIndex = 0; anIndex < theSinceIndex; anIndex++)
+  for(int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end(); anIndex++)
     aResIter++;
   std::list<std::shared_ptr<ModelAPI_Result> >::iterator aNextIter = aResIter;
   for(; aNextIter != myResults.end(); aNextIter++) {
@@ -128,13 +128,15 @@ void ModelAPI_Feature::eraseResults()
     // flush it to avoid left presentations after input of invalid arguments (radius=0)
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
     Events_Loop::loop()->flush(anEvent);
+    Events_Loop::loop()->flush(EVENT_DISP);
   }
 }
 
-std::shared_ptr<ModelAPI_Document> ModelAPI_Feature::documentToAdd()
+const std::string& ModelAPI_Feature::documentToAdd()
 {
-  // null pointer t ouse the current document
-  return std::shared_ptr<ModelAPI_Document>();
+  // empty to use the current document
+  static const std::string anEmpty;
+  return anEmpty;
 }
 
 void ModelAPI_Feature::erase()
@@ -169,3 +171,9 @@ FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject)
   }
   return aFeature;
 }
+
+
+bool ModelAPI_Feature::isMacro() const
+{
+  return false;
+}