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 boost::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
27 /// builders that tores the naming history: one per label to allow store several shapes to one
28 /// label; index in vector corresponds to the label tag
29 std::vector<TNaming_Builder*> myBuilders;
31 /// Stores the shape (called by the execution method).
32 MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
34 /// Stores the generated shape (called by the execution method).
35 MODEL_EXPORT virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
36 const boost::shared_ptr<GeomAPI_Shape>& theToShape);
38 /// Stores the modified shape (called by the execution method).
39 MODEL_EXPORT virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
40 const boost::shared_ptr<GeomAPI_Shape>& theNewShape);
42 /// Returns the shape-result produced by this feature
43 MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
44 /// Returns the source feature of this result
45 MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
47 /// Records the subshape newShape which was generated during a topological construction.
48 /// As an example, consider the case of a face generated in construction of a box.
49 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape,
50 const int theTag = 1);
52 /// Records the shape newShape which was generated from the shape oldShape during a topological
53 /// construction. As an example, consider the case of a face generated from an edge in
54 /// construction of a prism.
55 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
56 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
59 /// Records the shape newShape which is a modification of the shape oldShape.
60 /// As an example, consider the case of a face split or merged in a Boolean operation.
61 MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
62 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
64 /// Records the shape oldShape which was deleted from the current label.
65 /// As an example, consider the case of a face removed by a Boolean operation.
66 MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
67 const int theTag = 1);
69 /// load deleted shapes
70 MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
71 boost::shared_ptr<GeomAPI_Shape> theShapeIn,
72 const int theKindOfShape,
74 /// load and orient modified shapes
75 MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
76 GeomAlgoAPI_MakeShape* theMS,
77 boost::shared_ptr<GeomAPI_Shape> theShapeIn,
78 const int theKindOfShape,
80 GeomAPI_DataMapOfShapeShape& theSubShapes);
81 /// load and orient generated shapes
82 MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
83 GeomAlgoAPI_MakeShape* theMS,
84 boost::shared_ptr<GeomAPI_Shape> theShapeIn,
85 const int theKindOfShape,
87 GeomAPI_DataMapOfShapeShape& theSubShapes);
89 /// Removes the stored builders
90 MODEL_EXPORT virtual ~Model_ResultBody();
93 /// Makes a body on the given feature
96 /// Removes the stored builders
99 /// Returns (creates if necessary) the builder created on the needed tag of sub-label
100 TNaming_Builder* builder(const int theTag);
102 friend class Model_Document;