1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include "ModelAPI_Object.h"
22 #include "ModelAPI_Document.h"
23 #include "ModelAPI_Data.h"
24 #include "ModelAPI_Events.h"
25 #include <Events_Loop.h>
27 bool ModelAPI_Object::isInHistory()
29 if (myData->isValid()) {
30 return myData->isInHistory();
32 return true; // default value
35 void ModelAPI_Object::setInHistory(
36 const std::shared_ptr<ModelAPI_Object> theObject, const bool theFlag)
38 if (isInHistory() != theFlag) {
39 if (myData->isValid()) {
40 myData->setIsInHistory(theFlag);
42 myDoc->updateHistory(theObject);
46 std::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const
51 bool ModelAPI_Object::isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
53 return theObject.get() == this;
56 std::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const
61 void ModelAPI_Object::attributeChanged(const std::string& theID)
65 ModelAPI_Object::ModelAPI_Object()
69 ModelAPI_Object::~ModelAPI_Object()
73 void ModelAPI_Object::setData(std::shared_ptr<ModelAPI_Data> theData)
78 void ModelAPI_Object::setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
83 void ModelAPI_Object::erase()
85 if (myData->isValid() && myData != myData->invalidPtr())
87 setData(myData->invalidPtr());
90 bool ModelAPI_Object::isDisplayed()
92 return myData->isDisplayed();
95 void ModelAPI_Object::setDisplayed(const bool theDisplay)
97 myData->setDisplayed(theDisplay);