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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef ModelAPI_BodyBuilder_H_
21 #define ModelAPI_BodyBuilder_H_
24 #include <GeomAPI_Shape.h>
25 #include <GeomAlgoAPI_MakeShape.h>
26 #include <GeomAPI_DataMapOfShapeShape.h>
31 class ModelAPI_Document;
32 class ModelAPI_Object;
34 /**\class ModelAPI_BodyBuilder
36 * \brief Extra API for the ResultBody that allows to work with naming.
38 class ModelAPI_BodyBuilder
41 MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
43 /// Stores the shape (called by the execution method).
44 virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
45 const bool theIsStoreSameShapes = true) = 0;
47 /// Stores the generated shape (called by the execution method).
48 virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
49 const std::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
51 /// Stores the modified shape (called by the execution method).
52 virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
53 const std::shared_ptr<GeomAPI_Shape>& theNewShape,
54 const int theDecomposeSolidsTag = 0) = 0;
56 /// Stores the shape without naming support
57 virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
59 /// Returns the shape-result produced by this feature
60 virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
62 /// Records the subshape newShape which was generated during a topological construction.
63 /// As an example, consider the case of a face generated in construction of a box.
64 virtual void generated(
65 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
66 const int theTag = 1) = 0;
68 /// Records the shape newShape which was generated from the shape oldShape during a topological
69 /// construction. As an example, consider the case of a face generated from an edge in
70 /// construction of a prism.
71 virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
72 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
73 const int theTag = 1) = 0;
75 /// Records the shape newShape which is a modification of the shape oldShape.
76 /// As an example, consider the case of a face split or merged in a Boolean operation.
77 virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
78 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
79 const int theTag = 1) = 0;
81 /// Records the shape oldShape which was deleted from the current label.
82 /// As an example, consider the case of a face removed by a Boolean operation.
84 const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
86 /// load deleted shapes
87 virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
88 std::shared_ptr<GeomAPI_Shape> theShapeIn,
89 const int theKindOfShape,
90 const int theTag) = 0;
91 /// load and orient modified shapes
92 virtual void loadAndOrientModifiedShapes (
93 GeomAlgoAPI_MakeShape* theMS,
94 std::shared_ptr<GeomAPI_Shape> theShapeIn,
95 const int theKindOfShape,
97 const std::string& theName,
98 GeomAPI_DataMapOfShapeShape& theSubShapes,
99 const bool theIsStoreSeparate = false,
100 const bool theIsStoreAsGenerated = false) = 0;
101 /// load and orient generated shapes
102 virtual void loadAndOrientGeneratedShapes (
103 GeomAlgoAPI_MakeShape* theMS,
104 std::shared_ptr<GeomAPI_Shape> theShapeIn,
105 const int theKindOfShape,
107 const std::string& theName,
108 GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
110 /// load shapes of the first level (to be used during shape import)
111 virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
112 const std::string& theName, int& theTag) = 0;
114 /// load disconnected edges
115 virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
116 const std::string& theName, int& theTag) = 0;
118 /// load disconnected vetexes
119 virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
120 const std::string& theName,int& theTag) = 0;
122 /// Converts evolution of sub-shapes stored in naming structure to selection
123 /// (theFlag = true) and back (theFlag = false)
124 virtual void evolutionToSelection(const bool theFlag) = 0;
126 /// Returns true if the latest modification of this body in the naming history
127 // is equal to the given shape
128 virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
131 /// Returns the data manager of this object: attributes
132 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
134 /// Returns document this feature belongs to
135 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
138 /// Deafult constructor accessible only from Model_Object
139 MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
141 ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
144 //! Pointer on feature object
145 typedef std::shared_ptr<ModelAPI_BodyBuilder> BodyBuilderPtr;