Salome HOME
Issue #1343 Fixes for creating extrusion on vertex
[modules/shaper.git] / src / Model / Model_Data.cpp
index 530293b7e7061a9d5ae53833766eb8d3b7b9adf2..e9d808ade039cee5c7f934664bdfa7817b73b81e 100644 (file)
@@ -116,22 +116,22 @@ void Model_Data::setName(const std::string& theName)
 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);
@@ -154,22 +154,26 @@ AttributePtr Model_Data::addAttribute(const std::string& theID, const std::strin
   } 
   // 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) {