1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_ResultBody.h
4 // Created: 08 Jul 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef Model_BodyBuilder_H_
8 #define Model_BodyBuilder_H_
11 #include <ModelAPI_BodyBuilder.h>
13 #include <GeomAlgoAPI_MakeShape.h>
14 #include <GeomAPI_DataMapOfShapeShape.h>
17 class TNaming_Builder;
19 /**\class Model_BodyBuilder
21 * \brief The body (shape) result of a feature.
23 class Model_BodyBuilder : public ModelAPI_BodyBuilder
25 /// builders that tores the naming history: one per label to allow store several shapes to one
26 /// label; index in vector corresponds to the label tag
27 std::vector<TNaming_Builder*> myBuilders;
29 /// Stores the shape (called by the execution method).
30 MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
32 /// Stores the generated shape (called by the execution method).
33 MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
34 const std::shared_ptr<GeomAPI_Shape>& theToShape);
36 /// Stores the modified shape (called by the execution method).
37 /// \param theOldShape shape that produces result
38 /// \param theNewShape resulting shape
39 /// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
40 /// theNewShape is compound of solids, if zero it is not used
41 MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
42 const std::shared_ptr<GeomAPI_Shape>& theNewShape,
43 const int theDecomposeSolidsTag = 0);
44 /// Records the subshape newShape which was generated during a topological construction.
45 /// As an example, consider the case of a face generated in construction of a box.
46 MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
47 const std::string& theName, const int theTag = 1);
49 /// Records the shape newShape which was generated from the shape oldShape during a topological
50 /// construction. As an example, consider the case of a face generated from an edge in
51 /// construction of a prism.
52 MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
53 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1);
56 /// Records the shape newShape which is a modification of the shape oldShape.
57 /// As an example, consider the case of a face split or merged in a Boolean operation.
58 MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
59 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag = 1);
61 /// Records the shape oldShape which was deleted from the current label.
62 /// As an example, consider the case of a face removed by a Boolean operation.
63 MODEL_EXPORT virtual void deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
64 const int theTag = 1);
66 /// load deleted shapes
67 MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
68 std::shared_ptr<GeomAPI_Shape> theShapeIn,
69 const int theKindOfShape,
71 /// load and orient modified shapes
72 MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
73 GeomAlgoAPI_MakeShape* theMS,
74 std::shared_ptr<GeomAPI_Shape> theShapeIn,
75 const int theKindOfShape,
77 const std::string& theName,
78 GeomAPI_DataMapOfShapeShape& theSubShapes);
79 /// load and orient generated shapes
80 MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
81 GeomAlgoAPI_MakeShape* theMS,
82 std::shared_ptr<GeomAPI_Shape> theShapeIn,
83 const int theKindOfShape,
85 const std::string& theName,
86 GeomAPI_DataMapOfShapeShape& theSubShapes);
88 /// Loads shapes of the first level (to be used during shape import)
89 MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
91 /// Loads disconnected edges
92 MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
94 /// Loads disconnected vetexes
95 MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
97 /// Removes the stored builders
98 MODEL_EXPORT virtual ~Model_BodyBuilder();
101 Model_BodyBuilder(ModelAPI_Object* theOwner);
103 /// Removes the stored builders
106 /// Returns (creates if necessary) the builder created on the needed tag of sub-label
107 TNaming_Builder* builder(const int theTag);
110 /// Loads shapes of the next level (to be used during shape import)
111 void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag);
113 /// builds name for the shape kept at the specified tag
114 void buildName(const int theTag, const std::string& theName);
116 friend class Model_ResultBody;
117 friend class Model_ResultCompSolid;