SHAPER  9.12.0
ModelAPI_ResultBody Class Referenceabstract

The body (shape) result of a feature. More...

Inheritance diagram for ModelAPI_ResultBody:
Inheritance graph

Public Types

enum  ConnectedTopologyFlag { ConnectionNotComputed , IsConnected , IsNotConnected }
 Internal enumeration for storage the information of connected topology flag. More...
 

Public Member Functions

virtual std::string groupName ()
 Returns the group identifier of this result. More...
 
virtual int numberOfSubs (bool forTree=false) const =0
 Returns the number of sub-elements. More...
 
virtual std::shared_ptr< ModelAPI_ResultBodysubResult (const int theIndex, bool forTree=false) const =0
 Returns the sub-result by zero-base index. More...
 
virtual bool isSub (ObjectPtr theResult, int &theIndex) const =0
 Returns true if theResult belong to this composite result as sub. More...
 
virtual void store (const GeomShapePtr &theShape, const bool theIsStoreSameShapes=true)
 Stores the shape (called by the execution method). More...
 
virtual void storeGenerated (const GeomShapePtr &theFromShape, const GeomShapePtr &theToShape)
 Stores the generated shape (called by the execution method). More...
 
virtual void storeGenerated (const std::list< GeomShapePtr > &theFromShapes, const GeomShapePtr &theToShape, const std::shared_ptr< GeomAlgoAPI_MakeShape > theMakeShape)
 Stores the root modified shapes (called by the execution method). More...
 
virtual void storeModified (const GeomShapePtr &theOldShape, const GeomShapePtr &theNewShape, const bool theIsCleanStored=true)
 Stores the modified shape (called by the execution method). More...
 
virtual void storeModified (const std::list< GeomShapePtr > &theOldShapes, const GeomShapePtr &theNewShape, const std::shared_ptr< GeomAlgoAPI_MakeShape > theMakeShape)
 Stores the root modified shapes (called by the execution method). More...
 
virtual GeomShapePtr shape ()
 Returns the shape-result produced by this feature. More...
 
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. More...
 
virtual void generated (const GeomShapePtr &theOldShape, const GeomShapePtr &theNewShape, const std::string &theName="")
 Records the shape newShape which was generated from the shape oldShape during a topological construction. More...
 
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. More...
 
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 More...
 
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 More...
 
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 More...
 
virtual void loadFirstLevel (GeomShapePtr theShape, const std::string &theName)=0
 load shapes of the first level (to be used during shape import) More...
 
virtual bool isConnectedTopology ()=0
 Returns true is the topology is connected. More...
 
virtual void setDisplayed (const bool theDisplay)
 Set displayed flag to the result and all sub results. More...
 
virtual void updateSubs (const GeomShapePtr &theThisShape, const bool theShapeChanged=true)=0
 Updates the sub-bodies if shape of this object is compsolid or compound. More...
 
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. More...
 
virtual void cleanCash ()=0
 Cleans cash related to the already stored elements. More...
 
virtual std::wstring addShapeName (std::shared_ptr< GeomAPI_Shape >, const std::wstring &theName)=0
 Add shape Name for read shape in step file. More...
 
virtual void addShapeColor (const std::wstring &theName, std::vector< int > &theColor)=0
 Add color for shape Name read shape in step file. More...
 
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. More...
 
virtual void clearShapeNameAndColor ()=0
 Clear the map of name and color read shape in step file. More...
 
virtual std::wstring findShapeName (std::shared_ptr< GeomAPI_Shape > theShape)=0
 Find the name of shape read in step file. More...
 
virtual const std::vector< int > & findShapeColor (const std::wstring &theShapeName)=0
 Find the imported color by the construction name of a shape. More...
 
virtual bool isConcealed ()
 Returns true if the result is concealed from the data tree (referenced by other objects) More...
 
virtual void setIsConcealed (const bool theValue, const bool theForced=false)
 Sets the result as concealed in the data tree (referenced by other objects) More...
 
virtual bool setDisabled (std::shared_ptr< ModelAPI_Result > theThis, const bool theFlag)
 Enables/disables the result. More...
 
virtual bool isDisabled ()
 Returns the result is disabled or not. More...
 
virtual void initAttributes ()
 Request for initialization of data model of the result: adding all attributes. More...
 
virtual void attributeChanged (const std::string &theID)
 On change of attribute of the result update presentation of this result: for the current moment there are only presentation attributes assigned to results. More...
 
virtual bool isInHistory ()
 By default object is displayed in the object browser. More...
 
virtual void setInHistory (const std::shared_ptr< ModelAPI_Object > theObject, const bool theFlag)
 Makes object presented or not in the history of the created objects. More...
 
virtual std::shared_ptr< ModelAPI_Datadata () const
 Returns the data manager of this object: attributes. More...
 
virtual bool isSame (const std::shared_ptr< ModelAPI_Object > &theObject)
 Returns true if object refers to the same data model instance. More...
 
virtual std::shared_ptr< ModelAPI_Documentdocument () const
 Returns document this feature belongs to. More...
 
virtual void colorConfigInfo (std::string &, std::string &, std::string &)
 Returns the parameters of color definition in the resources config manager. More...
 
virtual bool isDisplayed ()
 Returns true if object must be displayed in the viewer: flag is stored in the data model, so on undo/redo, open/save or recreation of object by history-playing it keeps the original state in the current transaction. More...
 
virtual bool hasTexture ()
 
virtual void emptyFunction () const
 Empty function which is added for virtualiation of the interface. More...
 

Static Public Member Functions

static const std::string & IMAGE_ID ()
 Reference to the image attribute of the result body. More...
 
static std::string group ()
 Returns the group identifier of this result. More...
 
static const std::string & DEFAULT_COLOR ()
 default color for a result body More...
 
static const std::string DEFAULT_DEFLECTION ()
 default deflection for a result body More...
 
static const std::string & COLOR_ID ()
 Reference to the color of the result. More...
 
static const std::string & DEFLECTION_ID ()
 Reference to the deflection of the result. More...
 
static const std::string & TRANSPARENCY_ID ()
 Reference to the transparency of the result. More...
 
static const std::string & ISO_LINES_ID ()
 Reference to the transparency of the result. More...
 
static const std::string & SHOW_ISO_LINES_ID ()
 Reference to the transparency of the result. More...
 
static const std::string & SHOW_EDGES_DIRECTION_ID ()
 Reference to the transparency of the result. More...
 
static const std::string & BRING_TO_FRONT_ID ()
 Reference to the BringToFront flag of the result. More...
 

Protected Member Functions

 ModelAPI_ResultBody ()
 Default constructor accessible only from Model_Objects. More...
 
virtual void init ()
 This method is called just after creation of the object: it must initialize all fields, normally initialized in the constructor. More...
 
virtual void setData (std::shared_ptr< ModelAPI_Data > theData)
 Sets the data manager of an object (document does) More...
 
virtual void setDoc (std::shared_ptr< ModelAPI_Document > theDoc)
 Sets the data manager of an object (document does) More...
 
virtual void erase ()
 removes all fields from this feature More...
 

Protected Attributes

ConnectedTopologyFlag myConnect
 Keeps (not persistently) the connected topology flag. More...
 
ModelAPI_BodyBuildermyBuilder
 provides the body processing in naming shape More...
 
bool myIsDisabled
 the result is disabled: removed for the user, but keeps the general info More...
 

Detailed Description

The body (shape) result of a feature.

Provides a shape that may be displayed in the viewer. May provide really huge results, so, working with this kind of result must be optimized. Also provides a container of sub-body result in case it is compound or compsolid.

Member Enumeration Documentation

◆ ConnectedTopologyFlag

Internal enumeration for storage the information of connected topology flag.

Enumerator
ConnectionNotComputed 

not yet computed

IsConnected 

the topology is connected

IsNotConnected 

the topology is connected

Constructor & Destructor Documentation

◆ ModelAPI_ResultBody()

ModelAPI_ResultBody::ModelAPI_ResultBody ( )
protected

Default constructor accessible only from Model_Objects.

Member Function Documentation

◆ IMAGE_ID()

static const std::string& ModelAPI_ResultBody::IMAGE_ID ( )
inlinestatic

Reference to the image attribute of the result body.

◆ groupName()

std::string ModelAPI_ResultBody::groupName ( )
virtual

Returns the group identifier of this result.

Implements ModelAPI_Object.

◆ group()

static std::string ModelAPI_ResultBody::group ( )
inlinestatic

Returns the group identifier of this result.

◆ DEFAULT_COLOR()

static const std::string& ModelAPI_ResultBody::DEFAULT_COLOR ( )
inlinestatic

default color for a result body

◆ DEFAULT_DEFLECTION()

static const std::string ModelAPI_ResultBody::DEFAULT_DEFLECTION ( )
inlinestatic

default deflection for a result body

◆ numberOfSubs()

virtual int ModelAPI_ResultBody::numberOfSubs ( bool  forTree = false) const
pure virtual

Returns the number of sub-elements.

Implemented in Model_ResultBody.

◆ subResult()

virtual std::shared_ptr<ModelAPI_ResultBody> ModelAPI_ResultBody::subResult ( const int  theIndex,
bool  forTree = false 
) const
pure virtual

Returns the sub-result by zero-base index.

Implemented in Model_ResultBody.

◆ isSub()

virtual bool ModelAPI_ResultBody::isSub ( ObjectPtr  theResult,
int &  theIndex 
) const
pure virtual

Returns true if theResult belong to this composite result as sub.

Returns theIndex - zero based index of sub if found

Implemented in Model_ResultBody.

◆ store()

void ModelAPI_ResultBody::store ( const GeomShapePtr &  theShape,
const bool  theIsStoreSameShapes = true 
)
virtual

Stores the shape (called by the execution method).

param[in] theShape shape to store. param[in] theIsStoreSameShapes if false stores reference to the same shape if it is already in document.

◆ storeGenerated() [1/2]

void ModelAPI_ResultBody::storeGenerated ( const GeomShapePtr &  theFromShape,
const GeomShapePtr &  theToShape 
)
virtual

Stores the generated shape (called by the execution method).

◆ storeGenerated() [2/2]

void ModelAPI_ResultBody::storeGenerated ( const std::list< GeomShapePtr > &  theFromShapes,
const GeomShapePtr &  theToShape,
const std::shared_ptr< GeomAlgoAPI_MakeShape theMakeShape 
)
virtual

Stores the root modified shapes (called by the execution method).

◆ storeModified() [1/2]

void ModelAPI_ResultBody::storeModified ( const GeomShapePtr &  theOldShape,
const GeomShapePtr &  theNewShape,
const bool  theIsCleanStored = true 
)
virtual

Stores the modified shape (called by the execution method).

◆ storeModified() [2/2]

void ModelAPI_ResultBody::storeModified ( const std::list< GeomShapePtr > &  theOldShapes,
const GeomShapePtr &  theNewShape,
const std::shared_ptr< GeomAlgoAPI_MakeShape theMakeShape 
)
virtual

Stores the root modified shapes (called by the execution method).

◆ shape()

GeomShapePtr ModelAPI_ResultBody::shape ( )
virtual

Returns the shape-result produced by this feature.

Reimplemented from ModelAPI_Result.

◆ generated() [1/2]

virtual bool ModelAPI_ResultBody::generated ( const GeomShapePtr &  theNewShape,
const std::string &  theName,
const bool  theCheckIsInResult = true 
)
pure virtual

Records the subshape newShape which was generated during a topological construction.

As an example, consider the case of a face generated in construction of a box. Returns true if it is stored correctly (the final shape contains this new sub-shape)

Implemented in Model_ResultBody.

◆ generated() [2/2]

void ModelAPI_ResultBody::generated ( const GeomShapePtr &  theOldShape,
const GeomShapePtr &  theNewShape,
const std::string &  theName = "" 
)
virtual

Records the shape newShape which was generated from the shape oldShape during a topological construction.

As an example, consider the case of a face generated from an edge in construction of a prism.

◆ modified()

void ModelAPI_ResultBody::modified ( const GeomShapePtr &  theOldShape,
const GeomShapePtr &  theNewShape,
const std::string &  theName = "" 
)
virtual

Records the shape newShape which is a modification of the shape oldShape.

As an example, consider the case of a face split or merged in a Boolean operation.

◆ loadDeletedShapes()

void ModelAPI_ResultBody::loadDeletedShapes ( const std::shared_ptr< GeomAlgoAPI_MakeShape > &  theAlgo,
const GeomShapePtr &  theOldShape,
const GeomAPI_Shape::ShapeType  theShapeTypeToExplore,
const GeomShapePtr &  theShapesToExclude = GeomShapePtr() 
)
virtual

load deleted shapes

◆ loadModifiedShapes()

virtual void ModelAPI_ResultBody::loadModifiedShapes ( const std::shared_ptr< GeomAlgoAPI_MakeShape > &  theAlgo,
const GeomShapePtr &  theOldShape,
const GeomAPI_Shape::ShapeType  theShapeTypeToExplore,
const std::string &  theName = "" 
)
pure virtual

load and orient modified shapes

Implemented in Model_ResultBody.

◆ loadGeneratedShapes()

virtual void ModelAPI_ResultBody::loadGeneratedShapes ( const std::shared_ptr< GeomAlgoAPI_MakeShape > &  theAlgo,
const GeomShapePtr &  theOldShape,
const GeomAPI_Shape::ShapeType  theShapeTypeToExplore,
const std::string &  theName = "",
const bool  theSaveOldIfNotInTree = false 
)
pure virtual

load and orient generated shapes

Implemented in Model_ResultBody.

◆ loadFirstLevel()

virtual void ModelAPI_ResultBody::loadFirstLevel ( GeomShapePtr  theShape,
const std::string &  theName 
)
pure virtual

load shapes of the first level (to be used during shape import)

Implemented in Model_ResultBody.

◆ isConnectedTopology()

bool ModelAPI_ResultBody::isConnectedTopology ( )
pure virtual

Returns true is the topology is connected.

Implemented in Model_ResultBody.

◆ setDisplayed()

void ModelAPI_ResultBody::setDisplayed ( const bool  theDisplay)
virtual

Set displayed flag to the result and all sub results.

Parameters
theDisplaya boolean value

Reimplemented from ModelAPI_Object.

◆ updateSubs() [1/2]

virtual void ModelAPI_ResultBody::updateSubs ( const GeomShapePtr &  theThisShape,
const bool  theShapeChanged = true 
)
pure virtual

Updates the sub-bodies if shape of this object is compsolid or compound.

Implemented in Model_ResultBody.

◆ updateSubs() [2/2]

virtual void ModelAPI_ResultBody::updateSubs ( const GeomShapePtr &  theThisShape,
const std::list< GeomShapePtr > &  theOlds,
const std::shared_ptr< GeomAlgoAPI_MakeShape theMakeShape,
const bool  isGenerated 
)
pure virtual

Updates the sub-bodies in accordance to the algorithm history information.

Implemented in Model_ResultBody.

◆ cleanCash()

virtual void ModelAPI_ResultBody::cleanCash ( )
pure virtual

Cleans cash related to the already stored elements.

Implemented in Model_ResultBody.

◆ addShapeName()

virtual std::wstring ModelAPI_ResultBody::addShapeName ( std::shared_ptr< GeomAPI_Shape ,
const std::wstring &  theName 
)
pure virtual

Add shape Name for read shape in step file.

Implemented in Model_ResultBody.

◆ addShapeColor()

virtual void ModelAPI_ResultBody::addShapeColor ( const std::wstring &  theName,
std::vector< int > &  theColor 
)
pure virtual

Add color for shape Name read shape in step file.

Implemented in Model_ResultBody.

◆ setShapeName()

virtual void ModelAPI_ResultBody::setShapeName ( std::map< std::wstring, std::shared_ptr< GeomAPI_Shape > > &  theShapeName,
std::map< std::wstring, std::vector< int >> &  theColorsShape 
)
pure virtual

Set the map of name and color read shape in step file.

◆ clearShapeNameAndColor()

virtual void ModelAPI_ResultBody::clearShapeNameAndColor ( )
pure virtual

Clear the map of name and color read shape in step file.

Implemented in Model_ResultBody.

◆ findShapeName()

virtual std::wstring ModelAPI_ResultBody::findShapeName ( std::shared_ptr< GeomAPI_Shape theShape)
pure virtual

Find the name of shape read in step file.

Implemented in Model_ResultBody.

◆ findShapeColor()

virtual const std::vector<int>& ModelAPI_ResultBody::findShapeColor ( const std::wstring &  theShapeName)
pure virtual

Find the imported color by the construction name of a shape.

Returns empty vector if not found.

Implemented in Model_ResultBody.

◆ COLOR_ID()

static const std::string& ModelAPI_Result::COLOR_ID ( )
inlinestaticinherited

Reference to the color of the result.

The integer array is used. It contains three values for red, green and blue values. The values are in [0, 255] range

◆ DEFLECTION_ID()

static const std::string& ModelAPI_Result::DEFLECTION_ID ( )
inlinestaticinherited

Reference to the deflection of the result.

The double value is used. The value is in [0, 1] range

◆ TRANSPARENCY_ID()

static const std::string& ModelAPI_Result::TRANSPARENCY_ID ( )
inlinestaticinherited

Reference to the transparency of the result.

The double value is used. The value is in [0, 1] range

◆ ISO_LINES_ID()

static const std::string& ModelAPI_Result::ISO_LINES_ID ( )
inlinestaticinherited

Reference to the transparency of the result.

The double value is used. The value is in [0, 1] range

◆ SHOW_ISO_LINES_ID()

static const std::string& ModelAPI_Result::SHOW_ISO_LINES_ID ( )
inlinestaticinherited

Reference to the transparency of the result.

The double value is used. The value is in [0, 1] range

◆ SHOW_EDGES_DIRECTION_ID()

static const std::string& ModelAPI_Result::SHOW_EDGES_DIRECTION_ID ( )
inlinestaticinherited

Reference to the transparency of the result.

The double value is used. The value is in [0, 1] range

◆ BRING_TO_FRONT_ID()

static const std::string& ModelAPI_Result::BRING_TO_FRONT_ID ( )
inlinestaticinherited

Reference to the BringToFront flag of the result.

The bool value is used.

◆ isConcealed()

bool ModelAPI_Result::isConcealed ( )
virtualinherited

Returns true if the result is concealed from the data tree (referenced by other objects)

Reimplemented in Model_ResultBody.

◆ setIsConcealed()

void ModelAPI_Result::setIsConcealed ( const bool  theValue,
const bool  theForced = false 
)
virtualinherited

Sets the result as concealed in the data tree (referenced by other objects)

Reimplemented in Model_ResultConstruction, and Model_ResultBody.

◆ setDisabled()

bool ModelAPI_Result::setDisabled ( std::shared_ptr< ModelAPI_Result theThis,
const bool  theFlag 
)
virtualinherited

Enables/disables the result.

The disabled result does not participate in any calculation and visualization: like it was removed. But it keeps the general parameters: colors, visibility, etc.

Parameters
theThispointer to this object, needed to generate all events if it is necessary
theFlagmakes disabled if it is true
Returns
true if state is really changed

Reimplemented in Model_ResultPart, and Model_ResultBody.

◆ isDisabled()

bool ModelAPI_Result::isDisabled ( )
virtualinherited

Returns the result is disabled or not.

Implements ModelAPI_Object.

◆ initAttributes()

void ModelAPI_Result::initAttributes ( )
virtualinherited

Request for initialization of data model of the result: adding all attributes.

Implements ModelAPI_Object.

Reimplemented in ModelAPI_ResultParameter, Model_ResultPart, Model_ResultParameter, and Model_ResultBody.

◆ attributeChanged()

void ModelAPI_Result::attributeChanged ( const std::string &  theID)
virtualinherited

On change of attribute of the result update presentation of this result: for the current moment there are only presentation attributes assigned to results.

Reimplemented from ModelAPI_Object.

◆ init()

void ModelAPI_Result::init ( )
protectedvirtualinherited

This method is called just after creation of the object: it must initialize all fields, normally initialized in the constructor.

Implements ModelAPI_Object.

◆ isInHistory()

bool ModelAPI_Object::isInHistory ( )
virtualinherited

◆ setInHistory()

void ModelAPI_Object::setInHistory ( const std::shared_ptr< ModelAPI_Object theObject,
const bool  theFlag 
)
virtualinherited

Makes object presented or not in the history of the created objects.

Parameters
theObjectis shared pointer to "this"
theFlagis boolean value: to add or remove from the history

◆ data()

std::shared_ptr< ModelAPI_Data > ModelAPI_Object::data ( ) const
virtualinherited

Returns the data manager of this object: attributes.

◆ isSame()

bool ModelAPI_Object::isSame ( const std::shared_ptr< ModelAPI_Object > &  theObject)
virtualinherited

Returns true if object refers to the same data model instance.

◆ document()

std::shared_ptr< ModelAPI_Document > ModelAPI_Object::document ( ) const
virtualinherited

Returns document this feature belongs to.

Reimplemented in ModelAPI_Feature, and Model_ResultField::Model_FieldStep.

◆ colorConfigInfo()

virtual void ModelAPI_Object::colorConfigInfo ( std::string &  ,
std::string &  ,
std::string &   
)
inlinevirtualinherited

◆ isDisplayed()

bool ModelAPI_Object::isDisplayed ( )
virtualinherited

Returns true if object must be displayed in the viewer: flag is stored in the data model, so on undo/redo, open/save or recreation of object by history-playing it keeps the original state in the current transaction.

Reimplemented in ModelAPI_ResultField::ModelAPI_FieldStep.

◆ setData()

void ModelAPI_Object::setData ( std::shared_ptr< ModelAPI_Data theData)
protectedvirtualinherited

Sets the data manager of an object (document does)

◆ setDoc()

void ModelAPI_Object::setDoc ( std::shared_ptr< ModelAPI_Document theDoc)
protectedvirtualinherited

Sets the data manager of an object (document does)

◆ erase()

void ModelAPI_Object::erase ( )
protectedvirtualinherited

◆ emptyFunction()

virtual void ModelAPI_Entity::emptyFunction ( ) const
inlinevirtualinherited

Empty function which is added for virtualiation of the interface.

Field Documentation

◆ myConnect

ConnectedTopologyFlag ModelAPI_ResultBody::myConnect
protected

Keeps (not persistently) the connected topology flag.

◆ myBuilder

ModelAPI_BodyBuilder* ModelAPI_ResultBody::myBuilder
protected

provides the body processing in naming shape

◆ myIsDisabled

bool ModelAPI_Result::myIsDisabled
protectedinherited

the result is disabled: removed for the user, but keeps the general info