using namespace std;
-bool Model_AttributeRefAttr::isFeature()
+bool Model_AttributeRefAttr::isObject()
{
return myID->Get().Length() == 0;
}
boost::shared_ptr<Model_Data> aData =
boost::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data());
string anID = aData->id(theAttr);
- if (myIsInitialized && feature() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
+ 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);
}
boost::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
{
- FeaturePtr aFeature = feature();
- if (aFeature) {
+ ObjectPtr anObj = object();
+ if (anObj) {
boost::shared_ptr<Model_Data> aData =
- boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
+ boost::dynamic_pointer_cast<Model_Data>(anObj->data());
return aData->attribute(TCollection_AsciiString(myID->Get()).ToCString());
}
// not initialized
return boost::shared_ptr<ModelAPI_Attribute>();
}
-void Model_AttributeRefAttr::setFeature(FeaturePtr theFeature)
+void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
{
- if (!myIsInitialized || myID->Get().Length() != 0 || feature() != theFeature) {
+ if (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject) {
boost::shared_ptr<Model_Data> aData =
- boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
- myRef->Set(aData->label());
+ boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+ myRef->Set(aData->label().Father());
myID->Set(""); // feature is identified by the empty ID
owner()->data()->sendAttributeUpdated(this);
}
}
-FeaturePtr Model_AttributeRefAttr::feature()
+ObjectPtr Model_AttributeRefAttr::object()
{
if (myRef->Get() != myRef->Label()) { // initialized
boost::shared_ptr<Model_Document> aDoc =
boost::dynamic_pointer_cast<Model_Document>(owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
- TDF_Label aFeatureLab = aRefLab.Father();
- return aDoc->feature(aRefLab);
+ return aDoc->object(aRefLab);
}
}
// not initialized
- return FeaturePtr();
+ return ObjectPtr();
}
Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)