Salome HOME
Boost has been removed from code
[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 std::shared_ptr<GeomAPI_Shape>& theShape);
32
33   /// Stores the generated shape (called by the execution method).
34   MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
35                                                const std::shared_ptr<GeomAPI_Shape>& theToShape);
36
37   /// Stores the modified shape (called by the execution method).
38   MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
39                                                const std::shared_ptr<GeomAPI_Shape>& theNewShape);
40
41   /// Returns the shape-result produced by this feature
42   MODEL_EXPORT virtual std::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 std::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 std::shared_ptr<GeomAPI_Shape>& theOldShape,
53     const std::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 std::shared_ptr<GeomAPI_Shape>& theOldShape,
59     const std::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 std::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                                                std::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                                                std::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                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
82                                                const int  theKindOfShape,
83                                                const int  theTag,
84                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
85   
86   /// Loads shapes of the first level (to be used during shape import)
87   MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
88   
89   /// Loads disconnected edges
90   MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
91
92   /// Loads disconnected vetexes
93   MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
94
95   /// Removes the stored builders
96   MODEL_EXPORT virtual ~Model_ResultBody();
97
98 protected:
99   /// Makes a body on the given feature
100   Model_ResultBody();
101
102   /// Removes the stored builders
103   void clean();
104
105   /// Returns (creates if necessary) the builder created on the needed tag of sub-label
106   TNaming_Builder* builder(const int theTag);
107
108 private:
109   /// Loads shapes of the next level (to be used during shape import)
110   void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
111
112   friend class Model_Document;
113 };
114
115 #endif