X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeBoolean.cpp;h=d576a8870be398222cdac5052fae5879695467c9;hb=176403004ff97696f3c0b5f8bdf48692177fb34a;hp=3ebcaf953db0f6a17d9460084274f5cf116628dd;hpb=f1cd93fd02a54259f72e3191d037323a496b2bef;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeBoolean.cpp b/src/Model/Model_AttributeBoolean.cpp index 3ebcaf953..d576a8870 100644 --- a/src/Model/Model_AttributeBoolean.cpp +++ b/src/Model/Model_AttributeBoolean.cpp @@ -14,6 +14,8 @@ void Model_AttributeBoolean::setValue(bool theValue) { Standard_Boolean aValue = theValue ? Standard_True : Standard_False; if (!myIsInitialized || myBool->Get() != aValue) { + if (myBool.IsNull()) + myBool = TDataStd_Integer::Set(myLab, 0); myBool->Set(aValue); owner()->data()->sendAttributeUpdated(this); } @@ -21,15 +23,17 @@ void Model_AttributeBoolean::setValue(bool theValue) bool Model_AttributeBoolean::value() { - return myBool->Get() == Standard_True ; + return myIsInitialized && myBool->Get() == Standard_True ; } 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; - if (!myIsInitialized) { - // create attribute: not initialized by value yet, just zero - myBool = TDataStd_Integer::Set(theLabel, 0); - } + myIsInitialized = myLab.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True; }