SHAPER  9.12.0
Model_AttributeSelection Class Reference

Attribute that contains reference to the sub-shape of some result, the selected shape. More...

Inheritance diagram for Model_AttributeSelection:
Inheritance graph

Public Types

enum  CenterType { NOT_CENTER , CIRCLE_CENTER , ELLIPSE_FIRST_FOCUS , ELLIPSE_SECOND_FOCUS }
 Type of the center of the circular of elliptic edge. More...
 

Public Member Functions

virtual bool setValue (const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theTemporarily=false)
 Defines the result and its selected sub-shape. More...
 
virtual void setValueCenter (const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Edge > &theEdge, const CenterType theCenterType, const bool theTemporarily=false)
 Same as SetValue, but it takes an edge (on circular or elliptic curve) and stores the vertex of the central point (for ellipse the first or the second focus point) More...
 
virtual void selectValue (const std::shared_ptr< ModelAPI_AttributeSelection > &theSource)
 Makes this selection attribute selects the same as in theSource selection. More...
 
virtual void removeTemporaryValues ()
 Reset temporary stored values. More...
 
virtual std::shared_ptr< GeomAPI_Shapevalue ()
 Returns the selected subshape. More...
 
virtual ResultPtr context ()
 Returns the context of the selection (the whole shape owner) More...
 
virtual FeaturePtr contextFeature ()
 Returns the context of the selection if the whole feature was selected. More...
 
virtual std::shared_ptr< ModelAPI_ObjectcontextObject ()
 Returns the context of the selection : result or feature. More...
 
virtual void setObject (const std::shared_ptr< ModelAPI_Object > &theObject)
 Sets the feature object. More...
 
virtual bool update ()
 Updates the selection due to the changes in the referenced objects. More...
 
virtual std::wstring namingName (const std::wstring &theDefaultValue=L"")
 Returns a textual string of the selection. More...
 
virtual void setId (int theID)
 Defines the sub-shape by Id. More...
 
virtual void selectSubShape (const std::string &theType, const std::wstring &theSubShapeName)
 Selects (i.e. creates Naming data structure) of sub-shape specified by textual name. More...
 
virtual void selectSubShape (const std::string &theType, const std::shared_ptr< GeomAPI_Pnt > &thePoint)
 Selects sub-shape by its inner point. More...
 
virtual void selectSubShape (const std::string &theType, const std::wstring &theContextName, const int theIndex)
 Selects sub-shape by weak naming index. More...
 
virtual bool isInitialized ()
 Returns true if attribute was initialized by some value. More...
 
virtual bool isInvalid ()
 Returns true if recompute of selection become impossible. More...
 
virtual void updateInHistory (bool &theRemove) override
 Updates the arguments of selection if something was affected by creation or reorder of features upper in the history line (issue #1757) Returns theRemove true if this attribute must be removed (become deleted) More...
 
virtual std::wstring contextName (const TDF_Label theSelectionLab) override
 This method returns the context name by the label of the sub-selected shape. More...
 
virtual bool restoreContext (std::wstring theName, TDF_Label &theContext, TDF_Label &theValue) override
 This method restores by the context and value name the context label and sub-label where the value is. More...
 
virtual bool isLater (const TDF_Label theResult1, const TDF_Label theResult2) const override
 Returns true if the first result is newer than the second one in the tree of features. More...
 
virtual std::wstring contextName (const ResultPtr &theContext) const
 Returns the name by context. Adds the part name if the context is located in other document. More...
 
virtual void combineGeometrical ()
 Makes the current local selection becomes all sub-shapes with same base geometry. More...
 
virtual void reset ()
 Resets attribute to deafult state. More...
 
virtual std::string attributeType ()
 Returns the type of this class of attributes, not static method. More...
 
const std::shared_ptr< ModelAPI_Object > & owner () const
 Returns the owner of this attribute. More...
 
void setInitialized ()
 Makes attribute initialized. More...
 
bool blockSetInitialized (const bool theBlock)
 Blocks sending "attribute updated" if theBlock is true. More...
 
void setIsArgument (const bool theFlag)
 Set this attribute is argument for result (change of this attribute requires update of result). More...
 
bool isArgument ()
 Returns true if attribute causes the result change. More...
 
bool setImmutable (const bool theFlag)
 Immutable argument can not be changed programmatically (e.g. More...
 
bool isImmutable ()
 Returns true if can not be changed programmatically. More...
 
const std::string & id () const
 ID of the attribute in Data. More...
 

Static Public Member Functions

static std::string typeId ()
 Returns the type of this class of attributes. More...
 

Protected Member Functions

 Model_AttributeSelection (TDF_Label &theLabel)
 Objects are created for features automatically. More...
 
std::shared_ptr< GeomAPI_ShapeinternalValue (CenterType &theType)
 Returns the selected subshape, internal method that works without knowledge about special selection of circle and ellipse focuses (for that the public value method calls this and makes additional processing). More...
 
virtual void selectBody (const ResultPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape)
 Performs the selection for the body result (TNaming selection) More...
 
virtual bool selectPart (const ResultPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theUpdate=false)
 Performs the selection for the part result (selection by name of body result inside of part) More...
 
TDF_Label selectionLabel ()
 Returns the label where TNaming_Selection results are stored Note: there must be no attributes stored at the same label because Selector clears this lab. More...
 
virtual void setID (const std::string theID)
 Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting. More...
 
void setParent (Model_AttributeSelectionList *theParent)
 Sets the parent attribute. More...
 
void split (ResultPtr theContext, TopoDS_Shape theNewShape, TopAbs_ShapeEnum theType)
 Splits theNewShape into sub-shapes of theType type (for the list parent of this attribute) More...
 
bool searchNewContext (std::shared_ptr< Model_Document > theDoc, const TopoDS_Shape theContShape, ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel, std::list< ResultPtr > &theResults, TopTools_ListOfShape &theValShapes)
 When group position is updated, searches the new context and new values. More...
 
ResultPtr newestContext (const ResultPtr theCurrent, const std::shared_ptr< GeomAPI_Shape > theValue)
 Searches for the newest context, modification of the current, that contains theValue. More...
 
void computeValues (ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape, TopTools_ListOfShape &theShapes)
 computes theShapes list - shapes that were generated/modified/deleted the theValShape during creation from new to old context More...
 
virtual bool isGeometricalSelection () const
 Returns true if is geometrical selection. More...
 
TDF_Label baseDocumentLab ()
 Returns the module document label if this selection attribute is not in this document. More...
 
void concealedFeature (const FeaturePtr theFeature, const FeaturePtr theStop, const bool theCheckCopy, std::list< FeaturePtr > &theConcealers, const ResultPtr theResultOfFeature, const bool theCheckWholeFeature=false)
 Returns features that conceals theFeature and located in history before theStop theResultOfFeature if not null defines exact referenced result of a feature. More...
 
virtual void reinit ()
 Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) More...
 

Protected Attributes

bool myIsInitialized
 is some value assigned to this attribute More...
 
bool mySetInitializedBlocked
 is initialized blocked More...
 
bool myIsArgument
 is this attribute used as an argument for execution More...
 
bool myIsImmutable
 is this attribute can be changed programmatically (e.g. by constraint) More...
 

Friends

class Model_Data
 
class Model_AttributeSelectionList
 

Detailed Description

Attribute that contains reference to the sub-shape of some result, the selected shape.

Member Enumeration Documentation

◆ CenterType

Type of the center of the circular of elliptic edge.

Enumerator
NOT_CENTER 

this is not a center

CIRCLE_CENTER 

center of the circle

ELLIPSE_FIRST_FOCUS 

first focus point of the ellipse

ELLIPSE_SECOND_FOCUS 

second focus point of the ellipse

Constructor & Destructor Documentation

◆ Model_AttributeSelection()

Model_AttributeSelection::Model_AttributeSelection ( TDF_Label &  theLabel)
protected

Objects are created for features automatically.

Member Function Documentation

◆ setValue()

bool Model_AttributeSelection::setValue ( const ObjectPtr &  theContext,
const std::shared_ptr< GeomAPI_Shape > &  theSubShape,
const bool  theTemporarily = false 
)
virtual

Defines the result and its selected sub-shape.

Parameters
theContextobject where the sub-shape was selected
theSubShapeselected sub-shape (if null, the whole context is selected)
theTemporarilyif it is true, do not store and name the added in the data framework (used to remove immediately, without the following updates)
Returns
true if attribute was updated

Implements ModelAPI_AttributeSelection.

◆ setValueCenter()

void Model_AttributeSelection::setValueCenter ( const ObjectPtr &  theContext,
const std::shared_ptr< GeomAPI_Edge > &  theEdge,
const CenterType  theCenterType,
const bool  theTemporarily = false 
)
virtual

Same as SetValue, but it takes an edge (on circular or elliptic curve) and stores the vertex of the central point (for ellipse the first or the second focus point)

Implements ModelAPI_AttributeSelection.

◆ selectValue()

void Model_AttributeSelection::selectValue ( const std::shared_ptr< ModelAPI_AttributeSelection > &  theSource)
virtual

Makes this selection attribute selects the same as in theSource selection.

Implements ModelAPI_AttributeSelection.

◆ removeTemporaryValues()

void Model_AttributeSelection::removeTemporaryValues ( )
virtual

Reset temporary stored values.

Implements ModelAPI_AttributeSelection.

◆ value()

std::shared_ptr< GeomAPI_Shape > Model_AttributeSelection::value ( )
virtual

Returns the selected subshape.

Implements ModelAPI_AttributeSelection.

◆ context()

ResultPtr Model_AttributeSelection::context ( )
virtual

Returns the context of the selection (the whole shape owner)

Implements ModelAPI_AttributeSelection.

◆ contextFeature()

FeaturePtr Model_AttributeSelection::contextFeature ( )
virtual

Returns the context of the selection if the whole feature was selected.

Implements ModelAPI_AttributeSelection.

◆ contextObject()

ObjectPtr Model_AttributeSelection::contextObject ( )
virtual

Returns the context of the selection : result or feature.

Implements ModelAPI_AttributeSelection.

◆ setObject()

void Model_AttributeSelection::setObject ( const std::shared_ptr< ModelAPI_Object > &  theObject)
virtual

Sets the feature object.

Reimplemented from ModelAPI_Attribute.

◆ update()

bool Model_AttributeSelection::update ( )
virtual

Updates the selection due to the changes in the referenced objects.

Returns
false if update is failed

Implements ModelAPI_AttributeSelection.

◆ namingName()

std::wstring Model_AttributeSelection::namingName ( const std::wstring &  theDefaultValue = L"")
virtual

Returns a textual string of the selection.

Parameters
theDefaultValuea name, which is returned if the naming name can not be obtained

Implements ModelAPI_AttributeSelection.

◆ setId()

void Model_AttributeSelection::setId ( int  theID)
virtual

Defines the sub-shape by Id.

Implements ModelAPI_AttributeSelection.

◆ selectSubShape() [1/3]

void Model_AttributeSelection::selectSubShape ( const std::string &  theType,
const std::wstring &  theSubShapeName 
)
virtual

Selects (i.e. creates Naming data structure) of sub-shape specified by textual name.

Implements ModelAPI_AttributeSelection.

◆ selectSubShape() [2/3]

void Model_AttributeSelection::selectSubShape ( const std::string &  theType,
const std::shared_ptr< GeomAPI_Pnt > &  thePoint 
)
virtual

Selects sub-shape by its inner point.

Implements ModelAPI_AttributeSelection.

◆ selectSubShape() [3/3]

void Model_AttributeSelection::selectSubShape ( const std::string &  theType,
const std::wstring &  theContextName,
const int  theIndex 
)
virtual

Selects sub-shape by weak naming index.

Implements ModelAPI_AttributeSelection.

◆ isInitialized()

bool Model_AttributeSelection::isInitialized ( )
virtual

Returns true if attribute was initialized by some value.

Reimplemented from ModelAPI_Attribute.

◆ isInvalid()

bool Model_AttributeSelection::isInvalid ( )
virtual

Returns true if recompute of selection become impossible.

Implements ModelAPI_AttributeSelection.

◆ updateInHistory()

void Model_AttributeSelection::updateInHistory ( bool &  theRemove)
overridevirtual

Updates the arguments of selection if something was affected by creation or reorder of features upper in the history line (issue #1757) Returns theRemove true if this attribute must be removed (become deleted)

Implements ModelAPI_AttributeSelection.

◆ contextName() [1/2]

std::wstring Model_AttributeSelection::contextName ( const TDF_Label  theSelectionLab)
overridevirtual

This method returns the context name by the label of the sub-selected shape.

Implements Selector_NameGenerator.

◆ restoreContext()

bool Model_AttributeSelection::restoreContext ( std::wstring  theName,
TDF_Label &  theContext,
TDF_Label &  theValue 
)
overridevirtual

This method restores by the context and value name the context label and sub-label where the value is.

Returns true if it is valid.

Implements Selector_NameGenerator.

◆ isLater()

bool Model_AttributeSelection::isLater ( const TDF_Label  theResult1,
const TDF_Label  theResult2 
) const
overridevirtual

Returns true if the first result is newer than the second one in the tree of features.

Implements Selector_NameGenerator.

◆ contextName() [2/2]

std::wstring Model_AttributeSelection::contextName ( const ResultPtr &  theContext) const
virtual

Returns the name by context. Adds the part name if the context is located in other document.

Implements ModelAPI_AttributeSelection.

◆ combineGeometrical()

void Model_AttributeSelection::combineGeometrical ( )
virtual

Makes the current local selection becomes all sub-shapes with same base geometry.

Implements ModelAPI_AttributeSelection.

◆ reset()

void Model_AttributeSelection::reset ( )
virtual

Resets attribute to deafult state.

Reimplemented from ModelAPI_Attribute.

◆ internalValue()

std::shared_ptr< GeomAPI_Shape > Model_AttributeSelection::internalValue ( CenterType theType)
protected

Returns the selected subshape, internal method that works without knowledge about special selection of circle and ellipse focuses (for that the public value method calls this and makes additional processing).

Returns theType type of the center, or NOT_CENTER if it is not.

◆ selectBody()

void Model_AttributeSelection::selectBody ( const ResultPtr &  theContext,
const std::shared_ptr< GeomAPI_Shape > &  theSubShape 
)
protectedvirtual

Performs the selection for the body result (TNaming selection)

◆ selectPart()

bool Model_AttributeSelection::selectPart ( const ResultPtr &  theContext,
const std::shared_ptr< GeomAPI_Shape > &  theSubShape,
const bool  theUpdate = false 
)
protectedvirtual

Performs the selection for the part result (selection by name of body result inside of part)

Parameters
theContextthe result - owner of the selection
theSubShapeselected shape
theUpdateflag that shows that it must be just update, theShape is null
Returns
true if everything is selected correctly

◆ selectionLabel()

TDF_Label Model_AttributeSelection::selectionLabel ( )
protected

Returns the label where TNaming_Selection results are stored Note: there must be no attributes stored at the same label because Selector clears this lab.

◆ setID()

void Model_AttributeSelection::setID ( const std::string  theID)
protectedvirtual

Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting.

Reimplemented from ModelAPI_Attribute.

◆ setParent()

void Model_AttributeSelection::setParent ( Model_AttributeSelectionList theParent)
protected

Sets the parent attribute.

◆ split()

void Model_AttributeSelection::split ( ResultPtr  theContext,
TopoDS_Shape  theNewShape,
TopAbs_ShapeEnum  theType 
)
protected

Splits theNewShape into sub-shapes of theType type (for the list parent of this attribute)

◆ searchNewContext()

bool Model_AttributeSelection::searchNewContext ( std::shared_ptr< Model_Document theDoc,
const TopoDS_Shape  theContShape,
ResultPtr  theContext,
TopoDS_Shape  theValShape,
TDF_Label  theAccessLabel,
std::list< ResultPtr > &  theResults,
TopTools_ListOfShape &  theValShapes 
)
protected

When group position is updated, searches the new context and new values.

◆ newestContext()

ResultPtr Model_AttributeSelection::newestContext ( const ResultPtr  theCurrent,
const std::shared_ptr< GeomAPI_Shape theValue 
)
protected

Searches for the newest context, modification of the current, that contains theValue.

◆ computeValues()

void Model_AttributeSelection::computeValues ( ResultPtr  theOldContext,
ResultPtr  theNewContext,
TopoDS_Shape  theValShape,
TopTools_ListOfShape &  theShapes 
)
protected

computes theShapes list - shapes that were generated/modified/deleted the theValShape during creation from new to old context

◆ isGeometricalSelection()

virtual bool Model_AttributeSelection::isGeometricalSelection ( ) const
inlineprotectedvirtual

Returns true if is geometrical selection.

Implements ModelAPI_AttributeSelection.

◆ baseDocumentLab()

TDF_Label Model_AttributeSelection::baseDocumentLab ( )
protected

Returns the module document label if this selection attribute is not in this document.

Returns null label otherwise.

◆ concealedFeature()

void Model_AttributeSelection::concealedFeature ( const FeaturePtr  theFeature,
const FeaturePtr  theStop,
const bool  theCheckCopy,
std::list< FeaturePtr > &  theConcealers,
const ResultPtr  theResultOfFeature,
const bool  theCheckWholeFeature = false 
)
protected

Returns features that conceals theFeature and located in history before theStop theResultOfFeature if not null defines exact referenced result of a feature.

iterate all results to find the concealment-attribute

◆ typeId()

static std::string ModelAPI_AttributeSelection::typeId ( )
inlinestaticinherited

Returns the type of this class of attributes.

◆ attributeType()

std::string ModelAPI_AttributeSelection::attributeType ( )
virtualinherited

Returns the type of this class of attributes, not static method.

Implements ModelAPI_Attribute.

◆ owner()

const std::shared_ptr< ModelAPI_Object > & ModelAPI_Attribute::owner ( ) const
inherited

Returns the owner of this attribute.

◆ setInitialized()

void ModelAPI_Attribute::setInitialized ( )
inherited

Makes attribute initialized.

◆ blockSetInitialized()

bool ModelAPI_Attribute::blockSetInitialized ( const bool  theBlock)
inherited

Blocks sending "attribute updated" if theBlock is true.

Parameters
theBlocka block value
Returns
the previous block value

◆ setIsArgument()

void ModelAPI_Attribute::setIsArgument ( const bool  theFlag)
inherited

Set this attribute is argument for result (change of this attribute requires update of result).

By default it is true.

◆ isArgument()

bool ModelAPI_Attribute::isArgument ( )
inherited

Returns true if attribute causes the result change.

◆ setImmutable()

bool ModelAPI_Attribute::setImmutable ( const bool  theFlag)
inherited

Immutable argument can not be changed programmatically (e.g.

by constraint) By default it is false. Returns the previous state of the attribute's immutability.

◆ isImmutable()

bool ModelAPI_Attribute::isImmutable ( )
inherited

Returns true if can not be changed programmatically.

◆ id()

const std::string & ModelAPI_Attribute::id ( ) const
inherited

ID of the attribute in Data.

◆ reinit()

Field Documentation

◆ myIsInitialized

bool ModelAPI_Attribute::myIsInitialized
protectedinherited

is some value assigned to this attribute

◆ mySetInitializedBlocked

bool ModelAPI_Attribute::mySetInitializedBlocked
protectedinherited

is initialized blocked

◆ myIsArgument

bool ModelAPI_Attribute::myIsArgument
protectedinherited

is this attribute used as an argument for execution

◆ myIsImmutable

bool ModelAPI_Attribute::myIsImmutable
protectedinherited

is this attribute can be changed programmatically (e.g. by constraint)