+std::shared_ptr<ModelAPI_Result> ModelAPI_Feature::firstResult() const
+{
+ return myResults.empty() ? std::shared_ptr<ModelAPI_Result>() : *(myResults.begin());
+}
+
+std::shared_ptr<ModelAPI_Result> ModelAPI_Feature::lastResult()
+{
+ return myResults.empty() ? std::shared_ptr<ModelAPI_Result>() : *(myResults.rbegin());
+}
+
+void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& theResult)
+{
+ static Events_ID EVENT_UPD = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+
+ if (firstResult() == theResult) {
+ // nothing to change
+ } else if (!myResults.empty()) { // all except first become disabled
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ *aResIter = theResult;
+ aECreator->sendUpdated(theResult, EVENT_UPD);
+ for(aResIter++; aResIter != myResults.end(); aResIter++) {
+ (*aResIter)->setDisabled((*aResIter), true);
+ }
+ } else {
+ myResults.push_back(theResult);
+ }
+ // in any case result becomes enabled
+ theResult->setDisabled(theResult, false);
+}
+
+void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& theResult,
+ const int theIndex)
+{
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ for (int anIndex = 0; anIndex < theIndex; anIndex++) {
+ aResIter++;
+ }
+ if (aResIter == myResults.end()) { // append
+ myResults.push_back(theResult);
+ } else { // update
+ *aResIter = theResult;
+ }
+ theResult->setDisabled(theResult, false);
+}
+
+void ModelAPI_Feature::removeResult(const std::shared_ptr<ModelAPI_Result>& theResult)
+{
+ theResult->setDisabled(theResult, true);
+ // flush visualisation changes
+ static Events_Loop* aLoop = Events_Loop::loop();
+ static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ aLoop->flush(aRedispEvent);
+}
+
+void ModelAPI_Feature::eraseResultFromList(const std::shared_ptr<ModelAPI_Result>& theResult)