20 #ifndef Model_ResultBody_H_
21 #define Model_ResultBody_H_
24 #include <ModelAPI_ResultBody.h>
28 #include <TopTools_DataMapOfShapeListOfShape.hxx>
42 std::vector<ResultBodyPtr> mySubs;
44 std::map<ObjectPtr, int> mySubsMap;
48 std::shared_ptr<GeomAlgoAPI_MakeShape> myAlgo;
50 std::list<GeomShapePtr> myOlds;
54 TopTools_DataMapOfShapeListOfShape myHistoryCash;
66 MODEL_EXPORT
virtual bool generated(
const GeomShapePtr& theNewShape,
67 const std::string& theName,
const bool theCheckIsInResult =
true)
override;
72 const GeomShapePtr& theOldShape,
74 const std::string& theName =
"",
75 const bool theSaveOldIfNotInTree =
false)
override;
80 const GeomShapePtr& theOldShape,
82 const std::string& theName =
"")
override;
85 MODEL_EXPORT
virtual void loadFirstLevel(GeomShapePtr theShape,
const std::string& theName);
88 MODEL_EXPORT
virtual int numberOfSubs(
bool forTree =
false)
const;
91 MODEL_EXPORT
virtual ResultBodyPtr
subResult(
const int theIndex,
92 bool forTree =
false)
const;
96 MODEL_EXPORT
virtual bool isSub(ObjectPtr theObject,
int& theIndex)
const;
100 std::string& theName,
101 std::string& theDefault);
105 MODEL_EXPORT
virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
112 MODEL_EXPORT
virtual void setIsConcealed(
const bool theValue,
const bool theForced =
false);
118 MODEL_EXPORT
virtual void cleanCash()
override;
121 MODEL_EXPORT
virtual bool hasTexture()
override;
125 MODEL_EXPORT
virtual const std::vector<int>&
findShapeColor(
const std::wstring& theShapeName);
129 const std::shared_ptr<GeomAPI_Shape> theShape);
136 void updateSubs(
const std::shared_ptr<GeomAPI_Shape>& theThisShape,
137 const bool theShapeChanged =
true);
141 const GeomShapePtr& theThisShape,
const std::list<GeomShapePtr>& theOlds,
142 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
const bool isGenerated);
149 const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub);
154 std::wstring
addShapeName(std::shared_ptr<GeomAPI_Shape> theShape,
155 const std::wstring& theName)
override;
159 std::vector<int>& theColor)
override;
163 const std::shared_ptr<GeomAPI_Shape> theShape,
164 const std::vector<int>& theColor);
168 const std::shared_ptr<GeomAPI_Shape> theShape,
169 std::vector<int>& theColor);
173 std::map<std::shared_ptr<GeomAPI_Shape>, std::vector<int>>& theColoredShapes);
179 void setShapeName(std::map<std::wstring, std::shared_ptr<GeomAPI_Shape>>& theShapeName,
180 std::map<std::wstring, std::vector<int>>& theColorsShape)
override;
183 MODELAPI_EXPORT
virtual std::shared_ptr<ModelAPI_AttributeSelection>
selection();
186 std::wstring
findShapeName(std::shared_ptr<GeomAPI_Shape> theShape)
override;
193 int myLastEmptyNameIndex;
ShapeType
Shape type enum.
Definition: GeomAPI_Shape.h:46
The body (shape) result of a feature.
Definition: ModelAPI_ResultBody.h:43
Manager of objects of the document.
Definition: Model_Objects.h:46
The body (shape) result of a feature.
Definition: Model_ResultBody.h:40
std::map< std::wstring, std::shared_ptr< GeomAPI_Shape > > myNamesOfShapes
map with the name read in step file and shape
Definition: Model_ResultBody.h:192
void addShapeColor(const std::wstring &theName, std::vector< int > &theColor) override
Add color for shape Name read shape in step file.
Definition: Model_ResultBody.cpp:259
virtual bool setDisabled(std::shared_ptr< ModelAPI_Result > theThis, const bool theFlag)
Disables the result body: keeps the resulting shape as selection, but erases the underlying naming da...
Definition: Model_ResultBody.cpp:184
virtual bool isConnectedTopology()
Returns true is the topology is connected.
Definition: Model_ResultBody.cpp:529
void updateConcealment()
Checks the state of children and parents to send events of creation/erase when needed.
Definition: Model_ResultBody.cpp:223
void getSubShapeColor(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape, std::vector< int > &theColor)
Get color from sub shape.
Definition: Model_ResultBody.cpp:307
void clearShapeNameAndColor() override
Clear the map of name and color read shape in step file.
Definition: Model_ResultBody.cpp:401
virtual bool isConcealed()
The compsolid is concealed if at least one of the sub is concealed.
Definition: Model_ResultBody.cpp:193
void updateSubs(const std::shared_ptr< GeomAPI_Shape > &theThisShape, const bool theShapeChanged=true)
Updates the sub-bodies if shape of this object is composite-solid.
Definition: Model_ResultBody.cpp:406
std::map< std::wstring, std::vector< int > > myColorsShape
map from the construction name to the imported color
Definition: Model_ResultBody.h:196
Model_ResultBody()
Makes a body on the given feature.
Definition: Model_ResultBody.cpp:53
virtual bool generated(const GeomShapePtr &theNewShape, const std::string &theName, const bool theCheckIsInResult=true) override
Records the subshape newShape which was generated during a topological construction.
Definition: Model_ResultBody.cpp:74
void setShapeName(std::map< std::wstring, std::shared_ptr< GeomAPI_Shape >> &theShapeName, std::map< std::wstring, std::vector< int >> &theColorsShape) override
Set the map of name and color read shape in step file.
Definition: Model_ResultBody.cpp:393
virtual void setIsConcealed(const bool theValue, const bool theForced=false)
Sets all subs as concealed in the data tree (referenced by other objects)
Definition: Model_ResultBody.cpp:198
virtual void setSubShapeColorIfAny(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape)
Add color to sub shape.
Definition: Model_ResultBody.cpp:266
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) override
load generated shapes
Definition: Model_ResultBody.cpp:94
void computeOldForSub(const GeomShapePtr &theSub, const std::list< GeomShapePtr > &theAllOlds, std::list< GeomShapePtr > &theOldForSub)
Adds to theOldForSub only old shapes that where used for theSub creation.
Definition: Model_ResultBody.cpp:595
std::wstring findShapeName(std::shared_ptr< GeomAPI_Shape > theShape) override
Find the name of shape read in step file.
Definition: Model_ResultBody.cpp:368
virtual const std::vector< int > & findShapeColor(const std::wstring &theShapeName)
Find the imported color by the construction name of a shape.
Definition: Model_ResultBody.cpp:384
virtual ResultBodyPtr subResult(const int theIndex, bool forTree=false) const
Returns the sub-result by zero-base index.
Definition: Model_ResultBody.cpp:159
virtual bool hasTexture() override
sets the texture file
Definition: Model_ResultBody.cpp:558
void getColoredSubShapes(const std::shared_ptr< ModelAPI_Result > theResult, std::map< std::shared_ptr< GeomAPI_Shape >, std::vector< int >> &theColoredShapes)
Get colored shapes from result.
Definition: Model_ResultBody.cpp:321
virtual void loadFirstLevel(GeomShapePtr theShape, const std::string &theName)
load shapes of the first level (to be used during shape import)
Definition: Model_ResultBody.cpp:139
virtual void loadModifiedShapes(const std::shared_ptr< GeomAlgoAPI_MakeShape > &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const std::string &theName="") override
load modified shapes for sub-objects
Definition: Model_ResultBody.cpp:115
virtual void cleanCash() override
Cleans cash related to the already stored elements.
Definition: Model_ResultBody.cpp:547
virtual void colorConfigInfo(std::string &theSection, std::string &theName, std::string &theDefault)
Returns the parameters of color definition in the resources configuration manager.
Definition: Model_ResultBody.cpp:176
void setSubShapeColor(const std::shared_ptr< ModelAPI_Result > theResult, const std::shared_ptr< GeomAPI_Shape > theShape, const std::vector< int > &theColor)
Add color to sub shape.
Definition: Model_ResultBody.cpp:295
void removeSubShapeColors(const std::shared_ptr< ModelAPI_Result > theResult)
Forget subshape colors.
Definition: Model_ResultBody.cpp:328
virtual int numberOfSubs(bool forTree=false) const
Returns the number of sub-elements.
Definition: Model_ResultBody.cpp:154
virtual void initAttributes()
Request for initialization of data model of the result body: adding all attributes.
Definition: Model_ResultBody.cpp:67
virtual MODELAPI_EXPORT std::shared_ptr< ModelAPI_AttributeSelection > selection()
Return Attribute selection.
Definition: Model_ResultBody.cpp:334
virtual bool isSub(ObjectPtr theObject, int &theIndex) const
Returns true if feature or result belong to this composite feature as subs Returns theIndex - zero ba...
Definition: Model_ResultBody.cpp:166
virtual ~Model_ResultBody()
Removes the stored builders.
Definition: Model_ResultBody.cpp:61
std::wstring addShapeName(std::shared_ptr< GeomAPI_Shape > theShape, const std::wstring &theName) override
Add shape Name for read shape in step file.
Definition: Model_ResultBody.cpp:341