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>
12 class TNaming_Builder;
14 /**\class ModelAPI_ResultBody
16 * \brief The body (shape) result of a feature.
18 * Provides a shape that may be displayed in the viewer.
19 * May provide really huge results, so, working with this kind
20 * of result must be optimized.
22 class Model_ResultBody : public ModelAPI_ResultBody
24 boost::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
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 boost::shared_ptr<GeomAPI_Shape>& theShape);
31 /// Returns the shape-result produced by this feature
32 MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
33 /// Returns the source feature of this result
34 MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
36 /// Records the subshape newShape which was generated during a topological construction.
37 /// As an example, consider the case of a face generated in construction of a box.
38 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape,
39 const int theTag = 1);
41 /// Records the shape newShape which was generated from the shape oldShape during a topological
42 /// construction. As an example, consider the case of a face generated from an edge in
43 /// construction of a prism.
44 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
45 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
48 /// Records the shape newShape which is a modification of the shape oldShape.
49 /// As an example, consider the case of a face split or merged in a Boolean operation.
50 MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
51 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
53 /// Records the shape oldShape which was deleted from the current label.
54 /// As an example, consider the case of a face removed by a Boolean operation.
55 MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
56 const int theTag = 1);
58 /// Removes the stored builders
59 MODEL_EXPORT virtual ~Model_ResultBody();
62 /// Makes a body on the given feature
65 /// Removes the stored builders
68 /// Returns (creates if necessary) the builder created on the needed tag of sub-label
69 TNaming_Builder* builder(const int theTag);
71 friend class Model_Document;