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;
99 MODEL_EXPORT
virtual void colorConfigInfo(std::string& theSection, std::string& theName,
100 std::string& theDefault);
104 MODEL_EXPORT
virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
111 MODEL_EXPORT
virtual void setIsConcealed(
const bool theValue,
const bool theForced =
false);
117 MODEL_EXPORT
virtual void cleanCash()
override;
120 MODEL_EXPORT
virtual bool hasTexture()
override;
124 MODEL_EXPORT
virtual const std::vector<int>&
findShapeColor(
const std::wstring& theShapeName);
131 void updateSubs(
const std::shared_ptr<GeomAPI_Shape>& theThisShape,
132 const bool theShapeChanged =
true);
136 const GeomShapePtr& theThisShape,
const std::list<GeomShapePtr>& theOlds,
137 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
const bool isGenerated);
144 const std::list<GeomShapePtr>& theAllOlds, std::list<GeomShapePtr>& theOldForSub);
149 std::wstring
addShapeName(std::shared_ptr<GeomAPI_Shape>,
const std::wstring& theName)
override;
152 void addShapeColor(
const std::wstring& theName,std::vector<int>& color)
override;
156 std::shared_ptr<GeomAPI_Shape>>& theShapeName,
157 std::map< std::wstring,
158 std::vector<int>>& theColorsShape)
override;
161 std::wstring
findShapeName(std::shared_ptr<GeomAPI_Shape> theShape)
override;
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 > > myNamesShape
map with the name read in step file and shape
Definition: Model_ResultBody.h:167
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 underlaying naming d...
Definition: Model_ResultBody.cpp:171
virtual bool isConnectedTopology()
Returns true is the topology is connected.
Definition: Model_ResultBody.cpp:428
void updateConcealment()
Checks the state of children and parents to send events of creation/erase when needed.
Definition: Model_ResultBody.cpp:210
void clearShapeNameAndColor() override
Clear the map of name and color read shape in step file.
Definition: Model_ResultBody.cpp:301
virtual bool isConcealed()
The compsolid is concealed if at least one of the sub is concealed.
Definition: Model_ResultBody.cpp:180
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:306
std::map< std::wstring, std::vector< int > > myColorsShape
map from the construction name to the imported color
Definition: Model_ResultBody.h:170
Model_ResultBody()
Makes a body on the given feature.
Definition: Model_ResultBody.cpp:47
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:67
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:293
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:185
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:87
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:494
std::wstring findShapeName(std::shared_ptr< GeomAPI_Shape > theShape) override
Find the name of shape read in step file.
Definition: Model_ResultBody.cpp:268
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:284
virtual ResultBodyPtr subResult(const int theIndex, bool forTree=false) const
Returns the sub-result by zero-base index.
Definition: Model_ResultBody.cpp:146
virtual bool hasTexture() override
sets the texture file
Definition: Model_ResultBody.cpp:457
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:126
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:108
virtual void cleanCash() override
Cleans cash related to the already stored elements.
Definition: Model_ResultBody.cpp:446
void addShapeColor(const std::wstring &theName, std::vector< int > &color) override
Add color for shape Name read shape in step file.
Definition: Model_ResultBody.cpp:246
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:163
virtual int numberOfSubs(bool forTree=false) const
Returns the number of sub-elements.
Definition: Model_ResultBody.cpp:141
std::wstring addShapeName(std::shared_ptr< GeomAPI_Shape >, const std::wstring &theName) override
Add shape Name for read shape in step file.
Definition: Model_ResultBody.cpp:252
virtual void initAttributes()
Request for initialization of data model of the result body: adding all attributes.
Definition: Model_ResultBody.cpp:60
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:153
virtual ~Model_ResultBody()
Removes the stored builders.
Definition: Model_ResultBody.cpp:54