AttributePtr Model_Data::addAttribute(const std::string& theID, const std::string theAttrType)
{
AttributePtr aResult;
- TDF_Label anAttrLab = myLab.FindChild(myAttrs.size() + 1);
+ TDF_Label anAttrLab = myLab.FindChild(int(myAttrs.size()) + 1);
ModelAPI_Attribute* anAttr = 0;
if (theAttrType == ModelAPI_AttributeDocRef::typeId()) {
anAttr = new Model_AttributeDocRef(anAttrLab);
} else if (theAttrType == Model_AttributeInteger::typeId()) {
- Model_AttributeInteger* anAttribute = new Model_AttributeInteger(anAttrLab);
+ Model_AttributeInteger* anAttribute = new Model_AttributeInteger();
// Expression should use the same label to support backward compatibility
TDF_Label anExpressionLab = anAttrLab;
anAttribute->myExpression.reset(new Model_ExpressionInteger(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression->isInitialized();
+ anAttribute->myIsInitialized = anAttribute->myExpression->isInitialized();
anAttr = anAttribute;
} else if (theAttrType == ModelAPI_AttributeDouble::typeId()) {
- Model_AttributeDouble* anAttribute = new Model_AttributeDouble(anAttrLab);
+ Model_AttributeDouble* anAttribute = new Model_AttributeDouble();
TDF_Label anExpressionLab = anAttrLab.FindChild(1);
anAttribute->myExpression.reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression->isInitialized();
+ anAttribute->myIsInitialized = anAttribute->myExpression->isInitialized();
anAttr = anAttribute;
} else if (theAttrType == Model_AttributeBoolean::typeId()) {
anAttr = new Model_AttributeBoolean(anAttrLab);
}
// create also GeomData attributes here because only here the OCAF structure is known
else if (theAttrType == GeomData_Point::typeId()) {
- GeomData_Point* anAttribute = new GeomData_Point(anAttrLab);
+ GeomData_Point* anAttribute = new GeomData_Point();
+ bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS; ++aComponent) {
TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1);
anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression[aComponent]->isInitialized();
+ anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized();
}
+ anAttribute->myIsInitialized = anAllInitialized;
anAttr = anAttribute;
} else if (theAttrType == GeomData_Dir::typeId()) {
anAttr = new GeomData_Dir(anAttrLab);
} else if (theAttrType == GeomData_Point2D::typeId()) {
- GeomData_Point2D* anAttribute = new GeomData_Point2D(anAttrLab);
+ GeomData_Point2D* anAttribute = new GeomData_Point2D();
+ bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS; ++aComponent) {
TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1);
anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression[aComponent]->isInitialized();
+ anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized();
}
+ anAttribute->myIsInitialized = anAllInitialized;
anAttr = anAttribute;
}
if (anAttr) {