Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove extra files
[modules/shaper.git]
/
src
/
Model
/
Model_AttributeBoolean.cpp
diff --git
a/src/Model/Model_AttributeBoolean.cpp
b/src/Model/Model_AttributeBoolean.cpp
index 3ebcaf953db0f6a17d9460084274f5cf116628dd..d576a8870be398222cdac5052fae5879695467c9 100644
(file)
--- 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) {
{
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);
}
myBool->Set(aValue);
owner()->data()->sendAttributeUpdated(this);
}
@@
-21,15
+23,17
@@
void Model_AttributeBoolean::setValue(bool theValue)
bool Model_AttributeBoolean::value()
{
bool Model_AttributeBoolean::value()
{
- return myBool->Get() == Standard_True ;
+ return my
IsInitialized && my
Bool->Get() == Standard_True ;
}
Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
}
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)
{
// 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;
}
}