]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_BodyBuilder.h
Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[modules/shaper.git] / src / ModelAPI / ModelAPI_BodyBuilder.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_BodyBuilder.hxx
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_BodyBuilder_H_
8 #define ModelAPI_BodyBuilder_H_
9
10 #include <ModelAPI.h>
11 #include <GeomAPI_Shape.h>
12 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
14 #include <memory>
15 #include <string>
16
17 class ModelAPI_Data;
18 class ModelAPI_Document;
19 class ModelAPI_Object;
20
21 /**\class ModelAPI_BodyBuilder
22 * \ingroup DataModel
23  * \brief Extra API for the ResultBody that allows to work with naming.
24 */
25 class ModelAPI_BodyBuilder
26 {
27 public:
28   MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
29
30   /// Stores the shape (called by the execution method).
31   virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
32                      const bool theIsStoreSameShapes = true) = 0;
33
34   /// Stores the generated shape (called by the execution method).
35   virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
36                                   const std::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
37
38   /// Stores the modified shape (called by the execution method).
39   virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
40                                   const std::shared_ptr<GeomAPI_Shape>& theNewShape,
41                             const int theDecomposeSolidsTag = 0) = 0;
42
43   /// Stores the shape without naming support
44   virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
45
46   /// Returns the shape-result produced by this feature
47   virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
48
49   /// Records the subshape newShape which was generated during a topological construction.
50   /// As an example, consider the case of a face generated in construction of a box.
51   virtual void generated(
52     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
53     const int theTag = 1) = 0;
54
55   /// Records the shape newShape which was generated from the shape oldShape during a topological
56   /// construction. As an example, consider the case of a face generated from an edge in
57   /// construction of a prism.
58   virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
59     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
60     const int theTag = 1) = 0;
61
62   /// Records the shape newShape which is a modification of the shape oldShape.
63   /// As an example, consider the case of a face split or merged in a Boolean operation.
64   virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
65     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
66     const int theTag = 1) = 0;
67
68   /// Records the shape oldShape which was deleted from the current label.
69   /// As an example, consider the case of a face removed by a Boolean operation.
70   virtual void deleted(
71     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
72
73   /// load deleted shapes
74   virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
75                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
76                                                const int  theKindOfShape,
77                                                const int  theTag) = 0;
78   /// load and orient modified shapes
79   virtual void loadAndOrientModifiedShapes (
80                                                    GeomAlgoAPI_MakeShape* theMS,
81                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
82                                                const int  theKindOfShape,
83                                                const int  theTag,
84                                                                                            const std::string& theName,
85                                                GeomAPI_DataMapOfShapeShape& theSubShapes,
86                                                const bool theIsStoreSeparate = false,
87                                                const bool theIsStoreAsGenerated = false) = 0;
88   /// load and orient generated shapes
89   virtual void loadAndOrientGeneratedShapes (
90                                                    GeomAlgoAPI_MakeShape* theMS,
91                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
92                                                const int  theKindOfShape,
93                                                const int  theTag,
94                                                                                            const std::string& theName,
95                                                GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
96
97   /// load shapes of the first level (to be used during shape import)
98   virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
99                               const std::string& theName, int&  theTag) = 0;
100
101   /// load disconnected edges
102   virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
103                                      const std::string& theName, int&  theTag) = 0;
104
105   /// load disconnected vetexes
106   virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
107                                         const std::string& theName,int&  theTag) = 0;
108
109   /// Converts evolution of sub-shapes stored in naming structure to selection
110   /// (theFlag = true) and back (theFlag = false)
111   virtual void evolutionToSelection(const bool theFlag) = 0;
112
113   /// Returns true if the latest modification of this body in the naming history
114   // is equal to the given shape
115   virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
116
117 protected:
118   /// Returns the data manager of this object: attributes
119   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
120
121   /// Returns document this feature belongs to
122   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
123
124 protected:
125   /// Deafult constructor accessible only from Model_Object
126   MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
127
128   ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
129 };
130
131 //! Pointer on feature object
132 typedef std::shared_ptr<ModelAPI_BodyBuilder> BodyBuilderPtr;
133
134 #endif