1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_Object.cpp
4 // Created: 19 May 2014
5 // Author: Mikhail PONIKAROV
7 #include "ModelAPI_Object.h"
8 #include "ModelAPI_Document.h"
9 #include "ModelAPI_Data.h"
10 #include "ModelAPI_Events.h"
11 #include <Events_Loop.h>
13 bool ModelAPI_Object::isInHistory()
15 if (myData->isValid()) {
16 return myData->isInHistory();
18 return true; // default value
21 void ModelAPI_Object::setInHistory(
22 const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
24 if (isInHistory() != theFlag) {
25 if (myData->isValid()) {
26 myData->setIsInHistory(theFlag);
28 myDoc->updateHistory(theObject);
32 std::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const
37 bool ModelAPI_Object::isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
39 return theObject.get() == this;
42 std::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const
47 void ModelAPI_Object::attributeChanged(const std::string& theID)
51 ModelAPI_Object::ModelAPI_Object()
55 ModelAPI_Object::~ModelAPI_Object()
59 void ModelAPI_Object::setData(std::shared_ptr<ModelAPI_Data> theData)
64 void ModelAPI_Object::setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
69 void ModelAPI_Object::erase()
71 if (myData->isValid() && myData != myData->invalidPtr())
73 setData(myData->invalidPtr());
76 bool ModelAPI_Object::isDisplayed()
78 return myData->isDisplayed();
81 void ModelAPI_Object::setDisplayed(const bool theDisplay)
83 myData->setDisplayed(theDisplay);