}
}
+void ModelAPI_Feature::removeResults(const int theSinceIndex)
+{
+ if (theSinceIndex == 0) {
+ eraseResults();
+ return;
+ }
+
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ 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++) {
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+ ModelAPI_EventCreator::get()->sendDeleted(document(), (*aNextIter)->groupName());
+ aECreator->sendUpdated(*aNextIter, EVENT_DISP);
+ }
+ myResults.erase(aResIter, myResults.end());
+}
+
void ModelAPI_Feature::eraseResults()
{
if (!myResults.empty()) {
// 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()