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);
32 /// Stores the generated shape (called by the execution method).
33 MODEL_EXPORT virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
34 const boost::shared_ptr<GeomAPI_Shape>& theToShape);
36 /// Stores the modified shape (called by the execution method).
37 MODEL_EXPORT virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
38 const boost::shared_ptr<GeomAPI_Shape>& theNewShape);
40 /// Returns the shape-result produced by this feature
41 MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
42 /// Returns the source feature of this result
43 MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
45 /// Records the subshape newShape which was generated during a topological construction.
46 /// As an example, consider the case of a face generated in construction of a box.
47 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape,
48 const int theTag = 1);
50 /// Records the shape newShape which was generated from the shape oldShape during a topological
51 /// construction. As an example, consider the case of a face generated from an edge in
52 /// construction of a prism.
53 MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
54 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
57 /// Records the shape newShape which is a modification of the shape oldShape.
58 /// As an example, consider the case of a face split or merged in a Boolean operation.
59 MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
60 const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
62 /// Records the shape oldShape which was deleted from the current label.
63 /// As an example, consider the case of a face removed by a Boolean operation.
64 MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
65 const int theTag = 1);
67 /// Removes the stored builders
68 MODEL_EXPORT virtual ~Model_ResultBody();
71 /// Makes a body on the given feature
74 /// Removes the stored builders
77 /// Returns (creates if necessary) the builder created on the needed tag of sub-label
78 TNaming_Builder* builder(const int theTag);
80 friend class Model_Document;