initData(aFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS);
// keep the feature ID to restore document later correctly
TDataStd_Comment::Set(aFeatureLab, aFeature->getKind().c_str());
+ setUniqueName(aFeature);
myObjs[ModelAPI_Feature::group()].push_back(aFeature);
// store feature in the history of features array
if (aFeature->isInHistory()) {
AddToRefArray(aFeaturesLab, aFeatureLab);
}
}
- setUniqueName(aFeature);
if (!aFeature->isAction()) {// do not add action to the data model
// event: feature is added
static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
theResult->setDoc(aThis);
initData(theResult, boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->
label().Father().FindChild(TAG_FEATURE_RESULTS), theResultIndex);
- theResult->data()->setName(theFeatureData->name());
+ if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
+ ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
+ theResult->data()->setName(theFeatureData->name());
+ }
}
boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
virtual boost::shared_ptr<ModelAPI_ResultPart> createPart(
const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
- //! Allows to store the result in the data tree of the document (attaches 'data' of result to tree)
- virtual void storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData,
- boost::shared_ptr<ModelAPI_Result> theResult, const int theResultIndex = 0) = 0;
-
//! Returns a feature by result (owner of result)
virtual boost::shared_ptr<ModelAPI_Feature> feature(
const boost::shared_ptr<ModelAPI_Result>& theResult) = 0;
// create a result only once
if (results().empty()) {
boost::shared_ptr<ModelAPI_ResultPart> aResult = document()->createPart(data());
- document()->storeResult(data(), aResult);
- if (aResult->data()->name().empty())
- aResult->data()->setName(data()->name());
+ setResult(aResult);
}
}