X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_ResultBody.h;h=ec323ac28d3cc32c090cfa2912f2ba6ce833c6da;hb=21b49d1cb352330d2221dbe397a1621ef9b04a01;hp=e7d13c8f8763e9d8e1e5ac1f230e48625650386e;hpb=31cb13c6f72349480240ab828a4befc0ef45baed;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index e7d13c8f8..ec323ac28 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 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 ModelAPI_ResultBody_H_ @@ -25,6 +24,8 @@ #include #include #include +#include +#include class ModelAPI_BodyBuilder; class GeomAlgoAPI_MakeShape; @@ -36,12 +37,12 @@ class GeomAlgoAPI_MakeShape; * Provides a shape that may be displayed in the viewer. * May provide really huge results, so, working with this kind * of result must be optimized. -* Also provides a conainer of sub-body result in case it is compound or compsolid. +* Also provides a container of sub-body result in case it is compound or compsolid. */ class ModelAPI_ResultBody : public ModelAPI_Result { public: - /// Iternal enumeration for storage the information of connected topology flag + /// Internal enumeration for storage the information of connected topology flag enum ConnectedTopologyFlag { ConnectionNotComputed, ///< not yet computed IsConnected, ///< the topology is connected @@ -57,6 +58,13 @@ protected: public: MODELAPI_EXPORT virtual ~ModelAPI_ResultBody(); + /// Reference to the image attribute of the result body. + inline static const std::string& IMAGE_ID() + { + static const std::string MY_IMAGE_ID("Image"); + return MY_IMAGE_ID; + } + /// Returns the group identifier of this result MODELAPI_EXPORT virtual std::string groupName(); @@ -87,9 +95,9 @@ public: MODELAPI_EXPORT virtual std::shared_ptr subResult( const int theIndex, bool forTree = false) const = 0; - /// Returns true if feature or reuslt belong to this composite feature as subs + /// Returns true if theResult belong to this composite result as sub. /// Returns theIndex - zero based index of sub if found - MODELAPI_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const = 0; + MODELAPI_EXPORT virtual bool isSub(ObjectPtr theResult, int& theIndex) const = 0; /// \brief Stores the shape (called by the execution method). /// param[in] theShape shape to store. @@ -102,21 +110,29 @@ public: MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape, const GeomShapePtr& theToShape); + /// Stores the root modified shapes (called by the execution method). + MODELAPI_EXPORT virtual void storeGenerated( + const std::list& theFromShapes, const GeomShapePtr& theToShape, + const std::shared_ptr theMakeShape); + /// Stores the modified shape (called by the execution method). MODELAPI_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape, const GeomShapePtr& theNewShape, const bool theIsCleanStored = true); - /// Stores the shape without naming support - MODELAPI_EXPORT virtual void storeWithoutNaming(const GeomShapePtr& theShape); + /// Stores the root modified shapes (called by the execution method). + MODELAPI_EXPORT virtual void storeModified( + const std::list& theOldShapes, const GeomShapePtr& theNewShape, + const std::shared_ptr theMakeShape); /// Returns the shape-result produced by this feature MODELAPI_EXPORT virtual GeomShapePtr shape(); /// Records the subshape newShape which was generated during a topological construction. /// As an example, consider the case of a face generated in construction of a box. - MODELAPI_EXPORT virtual void generated(const GeomShapePtr& theNewShape, - const std::string& theName); + /// Returns true if it is stored correctly (the final shape contains this new sub-shape) + MODELAPI_EXPORT virtual bool generated(const GeomShapePtr& theNewShape, + const std::string& theName, const bool theCheckIsInResult = true) = 0; /// Records the shape newShape which was generated from the shape oldShape during a topological /// construction. As an example, consider the case of a face generated from an edge in @@ -131,10 +147,6 @@ public: const GeomShapePtr& theNewShape, const std::string& theName = ""); - /// Records the shape oldShape which was deleted from the current label. - /// As an example, consider the case of a face removed by a Boolean operation. - MODELAPI_EXPORT virtual void deleted(const GeomShapePtr& theOldShape); - /// load deleted shapes MODELAPI_EXPORT virtual void loadDeletedShapes(const std::shared_ptr& theAlgo, @@ -147,33 +159,19 @@ public: virtual void loadModifiedShapes(const std::shared_ptr& theAlgo, const GeomShapePtr& theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = ""); + const std::string& theName = "") = 0; /// load and orient generated shapes MODELAPI_EXPORT virtual void loadGeneratedShapes(const std::shared_ptr& theAlgo, const GeomShapePtr& theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string& theName = ""); + const std::string& theName = "", + const bool theSaveOldIfNotInTree = false) = 0; /// load shapes of the first level (to be used during shape import) MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string& theName, - int& theTag); - - /// load disconnected edges - MODELAPI_EXPORT virtual void loadDisconnectedEdges(GeomShapePtr theShape, - const std::string& theName, - int& theTag); - - /// load disconnected vetexes - MODELAPI_EXPORT virtual void loadDisconnectedVertexes(GeomShapePtr theShape, - const std::string& theName, - int& theTag); - - /// Returns true if the latest modification of this body in the naming history - // is equal to the given shape - MODELAPI_EXPORT virtual bool isLatestEqual(const GeomShapePtr& theShape) = 0; + const std::string& theName) = 0; /// Returns true is the topology is connected. MODELAPI_EXPORT virtual bool isConnectedTopology() = 0; @@ -186,6 +184,34 @@ public: MODELAPI_EXPORT virtual void updateSubs(const GeomShapePtr& theThisShape, const bool theShapeChanged = true) = 0; + /// Updates the sub-bodies in accordance to the algorithm history information + MODELAPI_EXPORT virtual void updateSubs( + const GeomShapePtr& theThisShape, const std::list& theOlds, + const std::shared_ptr theMakeShape, const bool isGenerated) = 0; + + /// Cleans cash related to the already stored elements + MODELAPI_EXPORT virtual void cleanCash() = 0; + + /// Add shape Name for read shape in step file + MODELAPI_EXPORT virtual std::wstring addShapeName + (std::shared_ptr,const std::wstring& theName) = 0; + + /// Add color for shape Name read shape in step file + MODELAPI_EXPORT virtual void addShapeColor + (const std::wstring& theName,std::vector& theColor) = 0; + + /// Set the map of name and color read shape in step file + MODELAPI_EXPORT virtual void setShapeName + (std::map< std::wstring, std::shared_ptr > &theShapeName, + std::map< std::wstring, std::vector> & theColorsShape) = 0; + + /// Clear the map of name and color read shape in step file + MODELAPI_EXPORT virtual void clearShapeNameAndColor() = 0; + + /// find the name of shapp read in step file + MODELAPI_EXPORT virtual std::wstring findShapeName(std::shared_ptr theShape) = 0; + + protected: /// Default constructor accessible only from Model_Objects MODELAPI_EXPORT ModelAPI_ResultBody();