1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_BodyBuilder.hxx
4 // Created: 07 Jul 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef ModelAPI_BodyBuilder_H_
8 #define ModelAPI_BodyBuilder_H_
11 #include <GeomAPI_Shape.h>
12 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
18 class ModelAPI_Document;
19 class ModelAPI_Object;
21 /**\class ModelAPI_BodyBuilder
23 * \brief Extra API for the ResultBody that allows to work with naming.
25 class ModelAPI_BodyBuilder
28 MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
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;
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;
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;
43 /// Stores the shape without naming support
44 virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
46 /// Returns the shape-result produced by this feature
47 virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
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, const int theTag = 1) = 0;
54 /// Records the shape newShape which was generated from the shape oldShape during a topological
55 /// construction. As an example, consider the case of a face generated from an edge in
56 /// construction of a prism.
57 virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
58 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1) = 0;
60 /// Records the shape newShape which is a modification of the shape oldShape.
61 /// As an example, consider the case of a face split or merged in a Boolean operation.
62 virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
63 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1) = 0;
65 /// Records the shape oldShape which was deleted from the current label.
66 /// As an example, consider the case of a face removed by a Boolean operation.
68 const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
70 /// load deleted shapes
71 virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
72 std::shared_ptr<GeomAPI_Shape> theShapeIn,
73 const int theKindOfShape,
74 const int theTag) = 0;
75 /// load and orient modified shapes
76 virtual void loadAndOrientModifiedShapes (
77 GeomAlgoAPI_MakeShape* theMS,
78 std::shared_ptr<GeomAPI_Shape> theShapeIn,
79 const int theKindOfShape,
81 const std::string& theName,
82 GeomAPI_DataMapOfShapeShape& theSubShapes,
83 const bool theIsStoreSeparate = false) = 0;
84 /// load and orient generated shapes
85 virtual void loadAndOrientGeneratedShapes (
86 GeomAlgoAPI_MakeShape* theMS,
87 std::shared_ptr<GeomAPI_Shape> theShapeIn,
88 const int theKindOfShape,
90 const std::string& theName,
91 GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
93 /// load shapes of the first level (to be used during shape import)
94 virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag) = 0;
96 /// load disconnected edges
97 virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag) = 0;
99 /// load disconnected vetexes
100 virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName,int& theTag) = 0;
102 /// Converts evolution of sub-shapes stored in naming structure to selection
103 /// (theFlag = true) and back (theFlag = false)
104 virtual void evolutionToSelection(const bool theFlag) = 0;
106 /// Returns true if the latest modification of this body in the naming history
107 // is equal to the given shape
108 virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
111 /// Returns the data manager of this object: attributes
112 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
114 /// Returns document this feature belongs to
115 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
118 /// Deafult constructor accessible only from Model_Object
119 MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
121 ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
124 //! Pointer on feature object
125 typedef std::shared_ptr<ModelAPI_BodyBuilder> BodyBuilderPtr;