]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultBody.h
Salome HOME
27.10.2014. Naming data structure for Extrusion feature.
[modules/shaper.git] / src / Model / Model_ResultBody.h
1 // File:        Model_ResultBody.h
2 // Created:     08 Jul 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef Model_ResultBody_H_
6 #define Model_ResultBody_H_
7
8 #include "Model.h"
9 #include <ModelAPI_ResultBody.h>
10 #include <vector>
11
12 class TNaming_Builder;
13
14 /**\class ModelAPI_ResultBody
15  * \ingroup DataModel
16  * \brief The body (shape) result of a feature.
17  *
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.
21  */
22 class Model_ResultBody : public ModelAPI_ResultBody
23 {
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;
28 public:
29   /// Stores the shape (called by the execution method).
30   MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
31
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);
35
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);
39
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();
44
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);
49
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);
55
56
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);
61
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);
66
67   /// Removes the stored builders
68   MODEL_EXPORT virtual ~Model_ResultBody();
69
70 protected:
71   /// Makes a body on the given feature
72   Model_ResultBody();
73
74   /// Removes the stored builders
75   void clean();
76
77   /// Returns (creates if necessary) the builder created on the needed tag of sub-label
78   TNaming_Builder* builder(const int theTag);
79
80   friend class Model_Document;
81 };
82
83 #endif