Salome HOME
Fixed crash on when creating circle by 3 points.
[modules/shaper.git] / src / Model / Model_AttributeBoolean.cpp
index f603def2d681f8ffbea1fa3b2cf146d286fce82c..666b8bb232cbfb5be1e174d33039a3de8f804bab 100644 (file)
@@ -8,11 +8,9 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
 
-using namespace std;
-
 void Model_AttributeBoolean::setValue(bool theValue)
 {
-  Standard_Boolean aValue = theValue ? Standard_True : Standard_False;
+  Standard_Integer aValue = theValue ? 1 : 0;
   if (!myIsInitialized || myBool->Get() != aValue) {
     if (myBool.IsNull())
       myBool = TDataStd_Integer::Set(myLab, 0);
@@ -23,12 +21,17 @@ void Model_AttributeBoolean::setValue(bool theValue)
 
 bool Model_AttributeBoolean::value()
 {
-  return myIsInitialized && myBool->Get() == Standard_True ;
+  return myIsInitialized && myBool->Get() == 1;
 }
 
 Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
 {
   myLab = theLabel;
+  reinit();
+}
+
+void Model_AttributeBoolean::reinit()
+{
   // check the attribute could be already presented in this doc (after load document)
-  myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True;
+  myIsInitialized = myLab.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True;
 }