Salome HOME
Issue #273: Add copyright string
[modules/shaper.git] / src / Model / Model_ResultBody.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_ResultBody.h
4 // Created:     08 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_ResultBody_H_
8 #define Model_ResultBody_H_
9
10 #include "Model.h"
11 #include <ModelAPI_ResultBody.h>
12 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
14 #include <vector>
15
16 class TNaming_Builder;
17
18 /**\class ModelAPI_ResultBody
19  * \ingroup DataModel
20  * \brief The body (shape) result of a feature.
21  *
22  * Provides a shape that may be displayed in the viewer.
23  * May provide really huge results, so, working with this kind
24  * of result must be optimized.
25  */
26 class Model_ResultBody : public ModelAPI_ResultBody
27 {
28   /// builders that tores the naming history: one per label to allow store several shapes to one 
29   /// label; index in vector corresponds to the label tag
30   std::vector<TNaming_Builder*> myBuilders;
31 public:
32   /// Stores the shape (called by the execution method).
33   MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
34
35   /// Stores the generated shape (called by the execution method).
36   MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
37                                                const std::shared_ptr<GeomAPI_Shape>& theToShape);
38
39   /// Stores the modified shape (called by the execution method).
40   MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
41                                                const std::shared_ptr<GeomAPI_Shape>& theNewShape);
42
43   /// Returns the shape-result produced by this feature
44   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
45
46   /// Records the subshape newShape which was generated during a topological construction.
47   /// As an example, consider the case of a face generated in construction of a box.
48   MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape, 
49     const int theTag = 1);
50
51   /// Records the shape newShape which was generated from the shape oldShape during a topological 
52   /// construction. As an example, consider the case of a face generated from an edge in 
53   /// construction of a prism.
54   MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
55     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
56
57
58   /// Records the shape newShape which is a modification of the shape oldShape.
59   /// As an example, consider the case of a face split or merged in a Boolean operation.
60   MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
61     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
62
63   /// Records the shape oldShape which was deleted from the current label.
64   /// As an example, consider the case of a face removed by a Boolean operation.
65   MODEL_EXPORT virtual void deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
66     const int theTag = 1);
67
68   /// load deleted shapes
69   MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
70                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
71                                                const int  theKindOfShape,
72                                                const int  theTag);
73   /// load and orient modified shapes
74   MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
75                                                    GeomAlgoAPI_MakeShape* theMS,
76                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
77                                                const int  theKindOfShape,
78                                                const int  theTag,
79                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
80    /// load and orient generated shapes
81   MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
82                                                    GeomAlgoAPI_MakeShape* theMS,
83                                                std::shared_ptr<GeomAPI_Shape>  theShapeIn,
84                                                const int  theKindOfShape,
85                                                const int  theTag,
86                                                GeomAPI_DataMapOfShapeShape& theSubShapes);
87   
88   /// Loads shapes of the first level (to be used during shape import)
89   MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
90   
91   /// Loads disconnected edges
92   MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
93
94   /// Loads disconnected vetexes
95   MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
96
97   /// Removes the stored builders
98   MODEL_EXPORT virtual ~Model_ResultBody();
99
100 protected:
101   /// Makes a body on the given feature
102   Model_ResultBody();
103
104   /// Removes the stored builders
105   void clean();
106
107   /// Returns (creates if necessary) the builder created on the needed tag of sub-label
108   TNaming_Builder* builder(const int theTag);
109
110 private:
111   /// Loads shapes of the next level (to be used during shape import)
112   void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, int&  theTag);
113
114   friend class Model_Document;
115 };
116
117 #endif