// Author: Mikhail PONIKAROV
#include "ModelAPI_Object.h"
-
+#include "ModelAPI_Document.h"
+#include "ModelAPI_Data.h"
+#include "ModelAPI_Events.h"
+#include <Events_Loop.h>
bool ModelAPI_Object::isInHistory()
{
- return true;
+ if (myData->isValid()) {
+ return myData->isInHistory();
+ }
+ return true; // default value
+}
+
+void ModelAPI_Object::setInHistory(
+ const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
+{
+ if (isInHistory() != theFlag) {
+ if (myData->isValid()) {
+ myData->setIsInHistory(theFlag);
+ }
+ myDoc->updateHistory(theObject);
+ }
}
std::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const
{
}
+ModelAPI_Object::ModelAPI_Object()
+{
+}
+
ModelAPI_Object::~ModelAPI_Object()
{
}
void ModelAPI_Object::erase()
{
- if (myData) myData->erase();
- setData(DataPtr());
+ if (myData->isValid() && myData != myData->invalidPtr())
+ myData->erase();
+ setData(myData->invalidPtr());
+}
+
+bool ModelAPI_Object::isDisplayed()
+{
+ return myData->isDisplayed();
+}
+
+void ModelAPI_Object::setDisplayed(const bool theDisplay)
+{
+ myData->setDisplayed(theDisplay);
}