20 #ifndef ModelAPI_ResultBody_H_
21 #define ModelAPI_ResultBody_H_
23 #include "ModelAPI_Result.h"
24 #include <GeomAPI_Shape.h>
25 #include <GeomAPI_DataMapOfShapeShape.h>
64 static const std::string MY_IMAGE_ID(
"Image");
69 MODELAPI_EXPORT
virtual std::string
groupName();
72 inline static std::string
group()
74 static std::string MY_GROUP =
"Bodies";
81 static const std::string RESULT_BODY_COLOR(
"200,200,230");
82 return RESULT_BODY_COLOR;
92 MODELAPI_EXPORT
virtual int numberOfSubs(
bool forTree =
false)
const = 0;
95 MODELAPI_EXPORT
virtual std::shared_ptr<ModelAPI_ResultBody>
subResult(
96 const int theIndex,
bool forTree =
false)
const = 0;
100 MODELAPI_EXPORT
virtual bool isSub(ObjectPtr theResult,
int& theIndex)
const = 0;
106 MODELAPI_EXPORT
virtual void store(
const GeomShapePtr& theShape,
107 const bool theIsStoreSameShapes =
true);
110 MODELAPI_EXPORT
virtual void storeGenerated(
const GeomShapePtr& theFromShape,
111 const GeomShapePtr& theToShape);
115 const std::list<GeomShapePtr>& theFromShapes,
const GeomShapePtr& theToShape,
116 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
119 MODELAPI_EXPORT
virtual void storeModified(
const GeomShapePtr& theOldShape,
120 const GeomShapePtr& theNewShape,
121 const bool theIsCleanStored =
true);
125 const std::list<GeomShapePtr>& theOldShapes,
const GeomShapePtr& theNewShape,
126 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
129 MODELAPI_EXPORT
virtual GeomShapePtr
shape();
134 MODELAPI_EXPORT
virtual bool generated(
const GeomShapePtr& theNewShape,
135 const std::string& theName,
const bool theCheckIsInResult =
true) = 0;
140 MODELAPI_EXPORT
virtual void generated(
const GeomShapePtr& theOldShape,
141 const GeomShapePtr& theNewShape,
142 const std::string& theName =
"");
146 MODELAPI_EXPORT
virtual void modified(
const GeomShapePtr& theOldShape,
147 const GeomShapePtr& theNewShape,
148 const std::string& theName =
"");
152 virtual void loadDeletedShapes(
const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
153 const GeomShapePtr& theOldShape,
155 const GeomShapePtr& theShapesToExclude = GeomShapePtr());
160 const GeomShapePtr& theOldShape,
162 const std::string& theName =
"") = 0;
167 const GeomShapePtr& theOldShape,
169 const std::string& theName =
"",
170 const bool theSaveOldIfNotInTree =
false) = 0;
174 const std::string& theName) = 0;
181 MODELAPI_EXPORT
virtual void setDisplayed(
const bool theDisplay);
184 MODELAPI_EXPORT
virtual void updateSubs(
const GeomShapePtr& theThisShape,
185 const bool theShapeChanged =
true) = 0;
189 const GeomShapePtr& theThisShape,
const std::list<GeomShapePtr>& theOlds,
190 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
const bool isGenerated) = 0;
197 (std::shared_ptr<GeomAPI_Shape> theShape,
198 const std::wstring& theName) = 0;
202 (
const std::wstring& theName,
203 std::vector<int>& theColor) = 0;
206 MODELAPI_EXPORT
virtual void setSubShapeColor(
const std::shared_ptr<ModelAPI_Result> theResult,
207 const std::shared_ptr<GeomAPI_Shape> theShape,
208 const std::vector<int>& theColor) = 0;
211 MODELAPI_EXPORT
virtual void getSubShapeColor(
const std::shared_ptr<ModelAPI_Result> theResult,
212 const std::shared_ptr<GeomAPI_Shape> theShape,
213 std::vector<int>& theColor) = 0;
217 std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>& theColoredShapes) = 0;
223 MODELAPI_EXPORT
virtual std::shared_ptr<ModelAPI_AttributeSelection>
selection() = 0;
227 (std::map< std::wstring, std::shared_ptr<GeomAPI_Shape> > &theShapeName,
228 std::map< std::wstring, std::vector<int>> & theColorsShape) = 0;
234 MODELAPI_EXPORT
virtual std::wstring
findShapeName(std::shared_ptr<GeomAPI_Shape> theShape) = 0;
239 const std::wstring& theShapeName) = 0;
243 const std::shared_ptr<GeomAPI_Shape> theShape) = 0;
253 typedef std::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;
ShapeType
Shape type enum.
Definition: GeomAPI_Shape.h:46
Interface to the root class of all topological shapes constructions.
Definition: GeomAlgoAPI_MakeShape.h:35
Extra API for the ResultBody that allows to work with naming.
Definition: ModelAPI_BodyBuilder.h:39
The body (shape) result of a feature.
Definition: ModelAPI_ResultBody.h:43
virtual std::wstring addShapeName(std::shared_ptr< GeomAPI_Shape > theShape, const std::wstring &theName)=0
Add shape Name for read shape in step file.
virtual void updateSubs(const GeomShapePtr &theThisShape, const bool theShapeChanged=true)=0
Updates the sub-bodies if shape of this object is compsolid or compound.
virtual void setShapeName(std::map< std::wstring, std::shared_ptr< GeomAPI_Shape > > &theShapeName, std::map< std::wstring, std::vector< int >> &theColorsShape)=0
Set the map of name and color read shape in step file.
static const std::string DEFAULT_DEFLECTION()
default deflection for a result body
Definition: ModelAPI_ResultBody.h:86
virtual bool isSub(ObjectPtr theResult, int &theIndex) const =0
Returns true if theResult belong to this composite result as sub.
virtual std::wstring findShapeName(std::shared_ptr< GeomAPI_Shape > theShape)=0
Find the name of shape read in step file.
virtual std::shared_ptr< ModelAPI_AttributeSelection > selection()=0
Return Attribute selection.
virtual std::shared_ptr< ModelAPI_ResultBody > subResult(const int theIndex, bool forTree=false) const =0
Returns the sub-result by zero-base index.
static const std::string & IMAGE_ID()
Reference to the image attribute of the result body.
Definition: ModelAPI_ResultBody.h:62
static const std::string & DEFAULT_COLOR()
default color for a result body
Definition: ModelAPI_ResultBody.h:79
virtual void removeSubShapeColors(const std::shared_ptr< ModelAPI_Result > theResult)=0
Forget subshape colors.
virtual void loadFirstLevel(GeomShapePtr theShape, const std::string &theName)=0
load shapes of the first level (to be used during shape import)
virtual bool generated(const GeomShapePtr &theNewShape, const std::string &theName, const bool theCheckIsInResult=true)=0
Records the subshape newShape which was generated during a topological construction.
ModelAPI_BodyBuilder * myBuilder
provides the body processing in naming shape
Definition: ModelAPI_ResultBody.h:56
virtual void getColoredSubShapes(const std::shared_ptr< ModelAPI_Result > theResult, std::map< std::shared_ptr< GeomAPI_Shape >, std::vector< int >> &theColoredShapes)=0
Get colored shapes from result.
virtual const std::vector< int > & findShapeColor(const std::wstring &theShapeName)=0
Find the imported color by the construction name of a shape.
virtual void updateSubs(const GeomShapePtr &theThisShape, const std::list< GeomShapePtr > &theOlds, const std::shared_ptr< GeomAlgoAPI_MakeShape > theMakeShape, const bool isGenerated)=0
Updates the sub-bodies in accordance to the algorithm history information.
ConnectedTopologyFlag myConnect
Keeps (not persistently) the connected topology flag.
Definition: ModelAPI_ResultBody.h:54
virtual bool isConnectedTopology()=0
Returns true is the topology is connected.
Definition: ModelAPI_ResultBody.cpp:143
virtual void loadGeneratedShapes(const std::shared_ptr< GeomAlgoAPI_MakeShape > &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const std::string &theName="", const bool theSaveOldIfNotInTree=false)=0
load and orient generated shapes
virtual void setSubShapeColorIfAny(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape)=0
Add color to sub shape.
static std::string group()
Returns the group identifier of this result.
Definition: ModelAPI_ResultBody.h:72
virtual void addShapeColor(const std::wstring &theName, std::vector< int > &theColor)=0
Add color for shape Name read shape in step file.
virtual void store(const GeomShapePtr &theShape, const bool theIsStoreSameShapes=true)
Stores the shape (called by the execution method).
Definition: ModelAPI_ResultBody.cpp:41
virtual void storeModified(const GeomShapePtr &theOldShape, const GeomShapePtr &theNewShape, const bool theIsCleanStored=true)
Stores the modified shape (called by the execution method).
Definition: ModelAPI_ResultBody.cpp:84
virtual void getSubShapeColor(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape, std::vector< int > &theColor)=0
Get color from sub shape.
virtual std::string groupName()
Returns the group identifier of this result.
Definition: ModelAPI_ResultBody.cpp:36
virtual void cleanCash()=0
Cleans cash related to the already stored elements.
virtual void setSubShapeColor(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape, const std::vector< int > &theColor)=0
Add color to sub shape.
virtual void loadDeletedShapes(const std::shared_ptr< GeomAlgoAPI_MakeShape > &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const GeomShapePtr &theShapesToExclude=GeomShapePtr())
load deleted shapes
Definition: ModelAPI_ResultBody.cpp:134
virtual void setDisplayed(const bool theDisplay)
Set displayed flag to the result and all sub results.
Definition: ModelAPI_ResultBody.cpp:151
virtual void storeGenerated(const GeomShapePtr &theFromShape, const GeomShapePtr &theToShape)
Stores the generated shape (called by the execution method).
Definition: ModelAPI_ResultBody.cpp:55
virtual void modified(const GeomShapePtr &theOldShape, const GeomShapePtr &theNewShape, const std::string &theName="")
Records the shape newShape which is a modification of the shape oldShape.
Definition: ModelAPI_ResultBody.cpp:126
virtual void loadModifiedShapes(const std::shared_ptr< GeomAlgoAPI_MakeShape > &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const std::string &theName="")=0
load and orient modified shapes
virtual void clearShapeNameAndColor()=0
Clear the map of name and color read shape in step file.
ConnectedTopologyFlag
Internal enumeration for storage the information of connected topology flag.
Definition: ModelAPI_ResultBody.h:46
@ IsConnected
the topology is connected
Definition: ModelAPI_ResultBody.h:48
@ IsNotConnected
the topology is connected
Definition: ModelAPI_ResultBody.h:49
@ ConnectionNotComputed
not yet computed
Definition: ModelAPI_ResultBody.h:47
virtual int numberOfSubs(bool forTree=false) const =0
Returns the number of sub-elements.
ModelAPI_ResultBody()
Default constructor accessible only from Model_Objects.
Definition: ModelAPI_ResultBody.cpp:26
virtual GeomShapePtr shape()
Returns the shape-result produced by this feature.
Definition: ModelAPI_ResultBody.cpp:114
The result of a feature.
Definition: ModelAPI_Result.h:37