X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModel%2FModel_ResultBody.h;h=d0a1f908e68c946dbf38b6859de94cb8326ef33a;hb=e05cf89c2b21303c51d9102315a82ac095eed3df;hp=721ad71f33402952dc1babfbcd68809d34efdc6d;hpb=d4b0a5cb916f4eccf4a0bce02e43a54c7a67cb93;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultBody.h b/src/Model/Model_ResultBody.h index 721ad71f3..d0a1f908e 100644 --- a/src/Model/Model_ResultBody.h +++ b/src/Model/Model_ResultBody.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef Model_ResultBody_H_ @@ -26,6 +25,8 @@ #include #include +#include + /**\class Model_ResultBody * \ingroup DataModel * \brief The body (shape) result of a feature. @@ -43,6 +44,14 @@ class Model_ResultBody : public ModelAPI_ResultBody std::map mySubsMap; /// Keeps the last state of the concealment flag in order to update it when needed. bool myLastConcealed; + /// History information for update subs + std::shared_ptr myAlgo; + /// All old shapes used for the root result construction + std::list myOlds; + /// Information about the kind of the history information: modified or generated + bool myIsGenerated; + /// Map from old shape to list of new shapes, cash for computeOldForSub method + TopTools_DataMapOfShapeListOfShape myHistoryCash; public: @@ -59,7 +68,8 @@ public: virtual void loadGeneratedShapes(const std::shared_ptr& theAlgo, const GeomShapePtr& theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = "") override; + const std::string& theName = "", + const bool theSaveOldIfNotInTree = false) override; /// load modified shapes for sub-objects MODEL_EXPORT @@ -68,6 +78,8 @@ public: const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const std::string& theName = "") override; + /// load shapes of the first level (to be used during shape import) + MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, const std::string& theName); /// Returns the number of sub-elements MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const; @@ -93,11 +105,14 @@ public: MODEL_EXPORT virtual bool isConcealed(); /// Sets all subs as concealed in the data tree (referenced by other objects) - MODEL_EXPORT virtual void setIsConcealed(const bool theValue); + MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false); /// Returns true is the topology is connected. MODEL_EXPORT virtual bool isConnectedTopology(); + /// Cleans cash related to the already stored elements + MODEL_EXPORT virtual void cleanCash() override; + protected: /// Makes a body on the given feature Model_ResultBody(); @@ -106,9 +121,18 @@ protected: void updateSubs(const std::shared_ptr& theThisShape, const bool theShapeChanged = true); + /// Updates the sub-bodies in accordance to the algorithm history information + void updateSubs( + const GeomShapePtr& theThisShape, const std::list& theOlds, + const std::shared_ptr theMakeShape, const bool isGenerated); + // Checks the state of children and parents to send events of creation/erase when needed void updateConcealment(); + /// Adds to theOldForSub only old shapes that where used for theSub creation + void computeOldForSub(const GeomShapePtr& theSub, + const std::list& theAllOlds, std::list& theOldForSub); + friend class Model_Objects; };