1 // File: Model_AttributeBoolean.cpp
2 // Created: 2 june 2014
3 // Author: Vitaly Smetannikov
5 #include "Model_AttributeBoolean.h"
6 #include "Model_Events.h"
7 #include <Events_Loop.h>
11 void Model_AttributeBoolean::setValue(bool theValue)
13 if (myBool->Get() != theValue) {
14 myBool->Set(theValue? 1 : 0);
15 static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
16 Model_FeatureUpdatedMessage aMsg(owner(), anEvent);
17 Events_Loop::loop()->send(aMsg);
21 bool Model_AttributeBoolean::value()
23 return (myBool->Get() == 1)? true : false;
26 Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
28 // check the attribute could be already presented in this doc (after load document)
29 if (!theLabel.FindAttribute(TDataStd_Integer::GetID(), myBool)) {
30 // create attribute: not initialized by value yet, just zero
31 myBool = TDataStd_Integer::Set(theLabel, 0);