1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "ModelAPI_Object.h"
21 #include "ModelAPI_Document.h"
22 #include "ModelAPI_Data.h"
23 #include "ModelAPI_Events.h"
24 #include <Events_Loop.h>
26 bool ModelAPI_Object::isInHistory()
28 if (myData->isValid()) {
29 return myData->isInHistory();
31 return true; // default value
34 void ModelAPI_Object::setInHistory(
35 const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
37 if (isInHistory() != theFlag) {
38 if (myData->isValid()) {
39 myData->setIsInHistory(theFlag);
41 myDoc->updateHistory(theObject);
45 std::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const
50 bool ModelAPI_Object::isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
52 return theObject.get() == this;
55 std::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const
60 void ModelAPI_Object::attributeChanged(const std::string& theID)
64 ModelAPI_Object::ModelAPI_Object()
68 ModelAPI_Object::~ModelAPI_Object()
72 void ModelAPI_Object::setData(std::shared_ptr<ModelAPI_Data> theData)
77 void ModelAPI_Object::setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
82 void ModelAPI_Object::erase()
84 if (myData->isValid() && myData != myData->invalidPtr())
86 setData(myData->invalidPtr());
89 bool ModelAPI_Object::isDisplayed()
91 return myData->isDisplayed();
94 void ModelAPI_Object::setDisplayed(const bool theDisplay)
96 myData->setDisplayed(theDisplay);