Salome HOME
Issue #1305: Make different gray color for selectable and non-selectable items
[modules/shaper.git] / src / ModelAPI / ModelAPI_ResultBody.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_ResultBody.hxx
4 // Created:     07 Jul 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_ResultBody_H_
8 #define ModelAPI_ResultBody_H_
9
10 #include "ModelAPI_Result.h"
11 #include <GeomAPI_Shape.h>
12 #include <GeomAPI_DataMapOfShapeShape.h>
13 #include <string>
14
15 class ModelAPI_BodyBuilder;
16 class GeomAlgoAPI_MakeShape;
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 ModelAPI_ResultBody : public ModelAPI_Result
27 {
28 public:
29   MODELAPI_EXPORT virtual ~ModelAPI_ResultBody();
30   /// Returns the group identifier of this result
31   MODELAPI_EXPORT virtual std::string groupName();
32
33   /// Returns the group identifier of this result
34   inline static std::string group()
35   {
36     static std::string MY_GROUP = "Bodies";
37     return MY_GROUP;
38   }
39
40   /// default color for a result body
41   inline static const std::string& DEFAULT_COLOR()
42   {
43     static const std::string RESULT_BODY_COLOR("200,200,230");
44     return RESULT_BODY_COLOR;
45   }
46
47   /// \brief Stores the shape (called by the execution method).
48   /// param[in] theShape shape to store.
49   /// param[in] theIsStoreSameShapes if false stores reference to the same shape if it is already in document.
50   MODELAPI_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
51                                      const bool theIsStoreSameShapes = true);
52
53   /// Stores the generated shape (called by the execution method).
54   MODELAPI_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
55     const std::shared_ptr<GeomAPI_Shape>& theToShape);
56
57   /// Stores the modified shape (called by the execution method).
58   MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
59     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
60
61   /// Stores the shape without naming support
62   MODELAPI_EXPORT virtual void storeWithoutNaming(
63     const std::shared_ptr<GeomAPI_Shape>& theShape);
64
65   /// Returns the shape-result produced by this feature
66   MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
67
68   /// Records the subshape newShape which was generated during a topological construction.
69   /// As an example, consider the case of a face generated in construction of a box.
70   MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
71     const std::string& theName, const int theTag = 1);
72
73   /// Records the shape newShape which was generated from the shape oldShape during a topological 
74   /// construction. As an example, consider the case of a face generated from an edge in 
75   /// construction of a prism.
76   MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
77     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, 
78     const int theTag = 1);
79
80   /// Records the shape newShape which is a modification of the shape oldShape.
81   /// As an example, consider the case of a face split or merged in a Boolean operation.
82   MODELAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
83     const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
84     const int theTag = 1);
85
86   /// Records the shape oldShape which was deleted from the current label.
87   /// As an example, consider the case of a face removed by a Boolean operation.
88   MODELAPI_EXPORT virtual void deleted(
89     const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1);
90   
91   /// load deleted shapes
92   MODELAPI_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
93                                   std::shared_ptr<GeomAPI_Shape>  theShapeIn,
94                                   const int  theKindOfShape,
95                                   const int  theTag);
96   /// load and orient modified shapes
97   MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
98     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape, const int  theTag,
99     const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate = false);
100   /// load and orient generated shapes
101   MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
102     std::shared_ptr<GeomAPI_Shape>  theShapeIn, const int  theKindOfShape,
103     const int  theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
104
105   /// load shapes of the first level (to be used during shape import)
106   MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, 
107     const std::string& theName, int&  theTag);
108   
109   /// load disconnected edges
110   MODELAPI_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
111     const std::string& theName, int&  theTag);
112
113   /// load disconnected vetexes
114   MODELAPI_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
115     const std::string& theName,int&  theTag);
116
117   /// Returns true if the latest modification of this body in the naming history
118   // is equal to the given shape
119   MODELAPI_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
120
121 protected:
122   /// Default constructor accessible only from Model_Objects
123   MODELAPI_EXPORT ModelAPI_ResultBody();
124
125   ModelAPI_BodyBuilder* myBuilder; ///< provides the body processing in naming shape
126 };
127
128 //! Pointer on feature object
129 typedef std::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;
130
131 #endif