1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_ResultBody.hxx
4 // Created: 07 Jul 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef ModelAPI_ResultBody_H_
8 #define ModelAPI_ResultBody_H_
10 #include "ModelAPI_Result.h"
11 #include <GeomAPI_Shape.h>
12 #include <GeomAPI_DataMapOfShapeShape.h>
15 class ModelAPI_BodyBuilder;
16 class GeomAlgoAPI_MakeShape;
18 /**\class ModelAPI_ResultBody
20 * \brief The body (shape) result of a feature.
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.
26 class ModelAPI_ResultBody : public ModelAPI_Result
29 MODELAPI_EXPORT virtual ~ModelAPI_ResultBody();
30 /// Returns the group identifier of this result
31 MODELAPI_EXPORT virtual std::string groupName();
33 /// Returns the group identifier of this result
34 inline static std::string group()
36 static std::string MY_GROUP = "Bodies";
40 /// default color for a result body
41 inline static const std::string& DEFAULT_COLOR()
43 static const std::string RESULT_BODY_COLOR("200,200,230");
44 return RESULT_BODY_COLOR;
47 /// Stores the shape (called by the execution method).
48 MODELAPI_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
50 /// Stores the generated shape (called by the execution method).
51 MODELAPI_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
52 const std::shared_ptr<GeomAPI_Shape>& theToShape);
54 /// Stores the modified shape (called by the execution method).
55 MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
56 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
58 /// Stores the shape without naming support
59 MODELAPI_EXPORT virtual void storeWithoutNaming(
60 const std::shared_ptr<GeomAPI_Shape>& theShape);
62 /// Returns the shape-result produced by this feature
63 MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
65 /// Records the subshape newShape which was generated during a topological construction.
66 /// As an example, consider the case of a face generated in construction of a box.
67 MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
68 const std::string& theName, const int theTag = 1);
70 /// Records the shape newShape which was generated from the shape oldShape during a topological
71 /// construction. As an example, consider the case of a face generated from an edge in
72 /// construction of a prism.
73 MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
74 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
75 const int theTag = 1);
77 /// Records the shape newShape which is a modification of the shape oldShape.
78 /// As an example, consider the case of a face split or merged in a Boolean operation.
79 MODELAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
80 const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
81 const int theTag = 1);
83 /// Records the shape oldShape which was deleted from the current label.
84 /// As an example, consider the case of a face removed by a Boolean operation.
85 MODELAPI_EXPORT virtual void deleted(
86 const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1);
88 /// load deleted shapes
89 MODELAPI_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
90 std::shared_ptr<GeomAPI_Shape> theShapeIn,
91 const int theKindOfShape,
93 /// load and orient modified shapes
94 MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
95 std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
96 const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
97 /// load and orient generated shapes
98 MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
99 std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape,
100 const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
102 /// load shapes of the first level (to be used during shape import)
103 MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
104 const std::string& theName, int& theTag);
106 /// load disconnected edges
107 MODELAPI_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
108 const std::string& theName, int& theTag);
110 /// load disconnected vetexes
111 MODELAPI_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
112 const std::string& theName,int& theTag);
114 /// Returns true if the latest modification of this body in the naming history
115 // is equal to the given shape
116 MODELAPI_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
119 /// Default constructor accessible only from Model_Objects
120 MODELAPI_EXPORT ModelAPI_ResultBody();
122 ModelAPI_BodyBuilder* myBuilder; ///< provides the body processing in naming shape
125 //! Pointer on feature object
126 typedef std::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;