]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultBody.h
Salome HOME
Merge branch 'master' of newgeom:newgeom.git into BR_PYTHON_PLUGIN
[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 <GeomAlgoAPI_MakeShape.h>
11 #include <GeomAPI_DataMapOfShapeShape.h>
12 #include <vector>
13
14 class TNaming_Builder;
15
16 /**\class ModelAPI_ResultBody
17  * \ingroup DataModel
18  * \brief The body (shape) result of a feature.
19  *
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.
23  */
24 class Model_ResultBody : public ModelAPI_ResultBody
25 {
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;
30 public:
31   /// Stores the shape (called by the execution method).
32   MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
33
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);
37
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);
41
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();
46
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);
51
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);
57
58
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);
63
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);
68
69   /// load deleted shapes
70   MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
71                                                boost::shared_ptr<GeomAPI_Shape>  theShapeIn,
72                                                const int  theKindOfShape,
73                                                const int  theTag);
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,
79                                                const int  theTag,
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,
86                                                const int  theTag,
87                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
88
89   /// Removes the stored builders
90   MODEL_EXPORT virtual ~Model_ResultBody();
91
92 protected:
93   /// Makes a body on the given feature
94   Model_ResultBody();
95
96   /// Removes the stored builders
97   void clean();
98
99   /// Returns (creates if necessary) the builder created on the needed tag of sub-label
100   TNaming_Builder* builder(const int theTag);
101
102   friend class Model_Document;
103 };
104
105 #endif