Salome HOME
27.10.2014. Naming data structure for Extrusion feature.
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultBody.h
1 // File:        ModelAPI_ResultBody.hxx
2 // Created:     07 Jul 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_ResultBody_H_
6 #define ModelAPI_ResultBody_H_
7
8 #include "ModelAPI_Result.h"
9 #include <GeomAPI_Shape.h>
10
11 #include <string>
12
13 /**\class ModelAPI_ResultBody
14 * \ingroup DataModel
15 * \brief The body (shape) result of a feature.
16 *
17 * Provides a shape that may be displayed in the viewer.
18 * May provide really huge results, so, working with this kind
19 * of result must be optimized.
20 */
21 class ModelAPI_ResultBody : public ModelAPI_Result
22 {
23 public:
24   /// Returns the group identifier of this result
25   virtual std::string groupName()
26   {
27     return group();
28   }
29
30   /// Returns the group identifier of this result
31   static std::string group()
32   {
33     static std::string MY_GROUP = "Bodies";
34     return MY_GROUP;
35   }
36
37   /// Stores the shape (called by the execution method).
38   virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape) = 0;
39
40   /// Stores the generated shape (called by the execution method).
41   virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
42                                   const boost::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
43
44   /// Stores the modified shape (called by the execution method).
45   virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
46                                   const boost::shared_ptr<GeomAPI_Shape>& theNewShape) = 0;
47
48   /// Returns the shape-result produced by this feature
49   virtual boost::shared_ptr<GeomAPI_Shape> shape() = 0;
50
51   /// To virtually destroy the fields of successors
52   virtual ~ModelAPI_ResultBody()
53   {
54   }
55
56   /// Records the subshape newShape which was generated during a topological construction.
57   /// As an example, consider the case of a face generated in construction of a box.
58   virtual void generated(
59     const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
60
61   /// Records the shape newShape which was generated from the shape oldShape during a topological 
62   /// construction. As an example, consider the case of a face generated from an edge in 
63   /// construction of a prism.
64   virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
65     const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
66
67   /// Records the shape newShape which is a modification of the shape oldShape.
68   /// As an example, consider the case of a face split or merged in a Boolean operation.
69   virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
70     const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
71
72   /// Records the shape oldShape which was deleted from the current label.
73   /// As an example, consider the case of a face removed by a Boolean operation.
74   virtual void deleted(
75     const boost::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
76
77 protected:
78   /// Use plugin manager for features creation: this method is 
79   /// defined here only for SWIG-wrapping
80   ModelAPI_ResultBody()
81   {
82   }
83 };
84
85 //! Pointer on feature object
86 typedef boost::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;
87
88 #endif