]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_BodyBuilder.h
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ModelAPI / ModelAPI_BodyBuilder.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef ModelAPI_BodyBuilder_H_
21 #define ModelAPI_BodyBuilder_H_
22
23 #include <ModelAPI.h>
24 #include <GeomAPI_Shape.h>
25 #include <GeomAlgoAPI_MakeShape.h>
26 #include <GeomAPI_DataMapOfShapeShape.h>
27 #include <memory>
28 #include <string>
29
30 class ModelAPI_Data;
31 class ModelAPI_Document;
32 class ModelAPI_Object;
33
34 /**\class ModelAPI_BodyBuilder
35 * \ingroup DataModel
36  * \brief Extra API for the ResultBody that allows to work with naming.
37 */
38 class ModelAPI_BodyBuilder
39 {
40 public:
41   MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
42
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;
46
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;
50
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;
55
56   /// Stores the shape without naming support
57   virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
58
59   /// Returns the shape-result produced by this feature
60   virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
61
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;
67
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;
74
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;
80
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.
83   virtual void deleted(
84     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
85
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,
96                                                const int  theTag,
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,
106                                                const int  theTag,
107                                                                                            const std::string& theName,
108                                                GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
109
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;
113
114   /// load disconnected edges
115   virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
116                                      const std::string& theName, int&  theTag) = 0;
117
118   /// load disconnected vetexes
119   virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
120                                         const std::string& theName,int&  theTag) = 0;
121
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;
125
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;
129
130 protected:
131   /// Returns the data manager of this object: attributes
132   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
133
134   /// Returns document this feature belongs to
135   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
136
137 protected:
138   /// Deafult constructor accessible only from Model_Object
139   MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
140
141   ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
142 };
143
144 //! Pointer on feature object
145 typedef std::shared_ptr<ModelAPI_BodyBuilder> BodyBuilderPtr;
146
147 #endif