if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
return; // nothing is changed
- myRef->Set(aData->label());
+ myRef->Set(aData->label().Father());
myID->Set(aData->id(theAttr).c_str());
owner()->data()->sendAttributeUpdated(this);
}
if (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject) {
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theObject->data());
- myRef->Set(aData->label());
+ myRef->Set(aData->label().Father());
myID->Set(""); // feature is identified by the empty ID
owner()->data()->sendAttributeUpdated(this);
}
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
- TDF_Label anObjLab = aRefLab.Father();
return aDoc->object(aRefLab);
}
}
{
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theObject->data());
- myRef->Append(aData->label());
+ myRef->Append(aData->label().Father()); // store label of the object
owner()->data()->sendAttributeUpdated(this);
}
{
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theObject->data());
- myRef->Remove(aData->label());
+ myRef->Remove(aData->label().Father());
owner()->data()->sendAttributeUpdated(this);
}
const TDF_LabelList& aList = myRef->List();
for(TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
ObjectPtr anObj = aDoc->object(aLIter.Value());
- if (!anObj) { // try to use father (for feature)
- anObj = aDoc->object(aLIter.Value().Father());
- }
aResult.push_back(anObj);
}
}
if (myRef.IsNull()) {
boost::shared_ptr<Model_Data> aMyData =
boost::dynamic_pointer_cast<Model_Data>(owner()->data());
- myRef = TDF_Reference::Set(aMyData->label(), aData->label());
+ myRef = TDF_Reference::Set(aMyData->label(), aData->label().Father());
} else {
myRef->Set(aData->label());
}
ObjectPtr Model_Document::object(TDF_Label theLabel)
{
- if (feature(theLabel)) // feature by label
+ // try feature by label
+ FeaturePtr aFeature = feature(theLabel);
+ if (aFeature)
return feature(theLabel);
TDF_Label aFeatureLabel = theLabel.Father().Father(); // let's suppose it is result
- FeaturePtr aFeature = feature(aFeatureLabel);
+ aFeature = feature(aFeatureLabel);
if (aFeature) {
const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
boost::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
theResult->setDoc(aThis);
- initData(theResult, boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->
- label().Father().FindChild(TAG_FEATURE_RESULTS), theResultIndex + 1);
+ initData(theResult, boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().
+ Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1), TAG_FEATURE_ARGUMENTS);
if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name
theResult->data()->setName(theFeatureData->name());
}