]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_ResultBody.h
Salome HOME
Merge branch 'master' of newgeom:newgeom
[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   /// builders that tores the naming history: one per label to allow store several shapes to one 
27   /// label; index in vector corresponds to the label tag
28   std::vector<TNaming_Builder*> myBuilders;
29 public:
30   /// Stores the shape (called by the execution method).
31   MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
32
33   /// Stores the generated shape (called by the execution method).
34   MODEL_EXPORT virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
35                                                const boost::shared_ptr<GeomAPI_Shape>& theToShape);
36
37   /// Stores the modified shape (called by the execution method).
38   MODEL_EXPORT virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
39                                                const boost::shared_ptr<GeomAPI_Shape>& theNewShape);
40
41   /// Returns the shape-result produced by this feature
42   MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
43
44   /// Records the subshape newShape which was generated during a topological construction.
45   /// As an example, consider the case of a face generated in construction of a box.
46   MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape, 
47     const int theTag = 1);
48
49   /// Records the shape newShape which was generated from the shape oldShape during a topological 
50   /// construction. As an example, consider the case of a face generated from an edge in 
51   /// construction of a prism.
52   MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
53     const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
54
55
56   /// Records the shape newShape which is a modification of the shape oldShape.
57   /// As an example, consider the case of a face split or merged in a Boolean operation.
58   MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
59     const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
60
61   /// Records the shape oldShape which was deleted from the current label.
62   /// As an example, consider the case of a face removed by a Boolean operation.
63   MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
64     const int theTag = 1);
65
66   /// load deleted shapes
67   MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
68                                                boost::shared_ptr<GeomAPI_Shape>  theShapeIn,
69                                                const int  theKindOfShape,
70                                                const int  theTag);
71   /// load and orient modified shapes
72   MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
73                                                    GeomAlgoAPI_MakeShape* theMS,
74                                                boost::shared_ptr<GeomAPI_Shape>  theShapeIn,
75                                                const int  theKindOfShape,
76                                                const int  theTag,
77                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
78    /// load and orient generated shapes
79   MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
80                                                    GeomAlgoAPI_MakeShape* theMS,
81                                                boost::shared_ptr<GeomAPI_Shape>  theShapeIn,
82                                                const int  theKindOfShape,
83                                                const int  theTag,
84                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
85
86   /// Removes the stored builders
87   MODEL_EXPORT virtual ~Model_ResultBody();
88
89 protected:
90   /// Makes a body on the given feature
91   Model_ResultBody();
92
93   /// Removes the stored builders
94   void clean();
95
96   /// Returns (creates if necessary) the builder created on the needed tag of sub-label
97   TNaming_Builder* builder(const int theTag);
98
99   friend class Model_Document;
100 };
101
102 #endif