1 // File: Model_ResultBody.h
2 // Created: 08 Jul 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_ResultBody_H_
6 #define Model_ResultBody_H_
9 #include <ModelAPI_ResultBody.h>
10 #include <GeomAlgoAPI_MakeShape.h>
11 #include <GeomAPI_DataMapOfShapeShape.h>
14 class TNaming_Builder;
16 /**\class ModelAPI_ResultBody
18 * \brief The body (shape) result of a feature.
20 * Provides a shape that may be displayed in the viewer.
21 * May provide really huge results, so, working with this kind
22 * of result must be optimized.
24 class Model_ResultBody : public ModelAPI_ResultBody
26 /// builders that tores the naming history: one per label to allow store several shapes to one
27 /// label; index in vector corresponds to the label tag
28 std::vector<TNaming_Builder*> myBuilders;
30 /// Stores the shape (called by the execution method).
31 MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
33 /// Stores the generated shape (called by the execution method).
34 MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
35 const std::shared_ptr<GeomAPI_Shape>& theToShape);
37 /// Stores the modified shape (called by the execution method).
38 MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
39 const std::shared_ptr<GeomAPI_Shape>& theNewShape);
41 /// Returns the shape-result produced by this feature
42 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
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 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 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 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 GeomAPI_DataMapOfShapeShape& theSubShapes);
78 /// load and orient generated shapes
79 MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
80 GeomAlgoAPI_MakeShape* theMS,
81 std::shared_ptr<GeomAPI_Shape> theShapeIn,
82 const int theKindOfShape,
84 GeomAPI_DataMapOfShapeShape& theSubShapes);
86 /// Loads shapes of the first level (to be used during shape import)
87 MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
89 /// Loads disconnected edges
90 MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
92 /// Loads disconnected vetexes
93 MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
95 /// Removes the stored builders
96 MODEL_EXPORT virtual ~Model_ResultBody();
99 /// Makes a body on the given feature
102 /// Removes the stored builders
105 /// Returns (creates if necessary) the builder created on the needed tag of sub-label
106 TNaming_Builder* builder(const int theTag);
109 /// Loads shapes of the next level (to be used during shape import)
110 void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
112 friend class Model_Document;