SHAPER  9.12.0
Selector_AlgoWithSubs Class Referenceabstract

Kind of selection algorithm: generic algorithm that contains sub-algorithms inside. More...

Inheritance diagram for Selector_AlgoWithSubs:
Inheritance graph

Public Types

enum  Selector_Type {
  SELTYPE_CONTAINER , SELTYPE_INTERSECT , SELTYPE_PRIMITIVE , SELTYPE_MODIFICATION ,
  SELTYPE_FILTER_BY_NEIGHBOR , SELTYPE_WEAK_NAMING
}
 Type of a selector algorithm: on this type depends what is stored in this label and how to restore it on update. More...
 

Public Member Functions

 Selector_AlgoWithSubs ()
 Initializes selector. More...
 
virtual ~Selector_AlgoWithSubs ()
 Destructor. More...
 
void clearSubAlgos ()
 Erases the sub-algorithms stored. More...
 
TDF_Label newSubLabel ()
 Returns the next label for a new sub-selector created. More...
 
bool append (Selector_Algo *theAlgo, const bool theEraseIfNull=true)
 Appends a new algorithm to the list, erases list if it is null (failed) More...
 
std::list< Selector_Algo * > & list ()
 Returns the stored list of sub-algorithms. More...
 
virtual void store ()=0
 Stores the name to the label and sub-labels tree. More...
 
virtual bool restore ()=0
 Restores the selected shape by the topological naming kept in the data structure Returns true if it can restore structure correctly. More...
 
virtual TDF_Label restoreByName (std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator)=0
 Restores the selected shape by the topological name string. More...
 
virtual bool solve (const TopoDS_Shape &theContext)=0
 Updates the current shape by the stored topological name. More...
 
virtual std::wstring name (Selector_NameGenerator *theNameGenerator)=0
 Returns the naming name of the selection. More...
 
TopoDS_Shape value ()
 Returns the current sub-shape value (null if can not resolve) More...
 
void setGeometricalNaming ()
 Sets geometrical naming flag to true. More...
 

Static Public Member Functions

static Selector_Algoselect (const TopoDS_Shape theContext, const TopoDS_Shape theValue, const TDF_Label theAccess, const TDF_Label theBaseDocument, const bool theGeometricalNaming=false, const bool theUseNeighbors=true, const bool theUseIntersections=true, const bool theAlwaysGeometricalNaming=false)
 Initializes the selector structure on the label. More...
 
static Selector_AlgorestoreByName (TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, Selector_NameGenerator *theNameGenerator, TDF_Label &theContextLab)
 Restores the selected sub-algorithm by the naming name. More...
 
static Selector_AlgorestoreByLab (TDF_Label theLab, TDF_Label theBaseDocLab)
 Restores sub-algorithm of a given type by the storage-label. More...
 
static bool sameGeometry (const TopoDS_Shape theShape1, const TopoDS_Shape theShape2)
 Returns true if the given shapes are based on the same geometry. More...
 
static Selector_AlgorelesectWithAllGeometry (Selector_Algo *theOldAlgo, const TopoDS_Shape theContext)
 Creates a new selection algorithm for selection of all topology based on the same geometry. More...
 

Protected Member Functions

void store (const TopoDS_Shape theShape)
 Stores result of selection at the given label. More...
 
const TDF_Label & label () const
 Returns label where this algorithm is attached to, or just an access label to the document. More...
 
void storeBaseArray (const TDF_LabelList &theRef, const TDF_Label &theLast)
 Stores the array of references to theLab: references to elements of ref-list, then the last. More...
 
bool restoreBaseArray (TDF_LabelList &theRef, TDF_Label &theLast)
 Restores references to the labels: references to elements of ref-list, then the last. More...
 
const TDF_Label & baseDocument () const
 Returns an access-label of the document that may contain initial shapes. More...
 
bool geometricalNaming () const
 Returns the geometrical naming flag. More...
 
bool alwaysGeometricalNaming () const
 Returns always geometrical naming flag. More...
 
bool useNeighbors () const
 Returns use neighbors flag. More...
 
bool useIntersections () const
 Returns use intersections flag. More...
 
void storeType (const Selector_Type theType)
 Stores the type of an algorithm in the data tree (in myLab) More...
 
bool findNewVersion (const TopoDS_Shape &theContext, TopoDS_Shape &theResult) const
 Searches the newer version of the shape in the document if the base shape does not belong to context. More...
 

Static Protected Member Functions

static const Standard_GUID & weakID ()
 Returns GUID for the weak index (integer attribute) of the sub-shape. More...
 
static const Standard_GUID & shapeTypeID ()
 Returns GUID for the type of the shape, stored in case it is intersection or container. More...
 
static const std::wstring & oldWeakNameID ()
 old string identifier of the weak name in modification or intersection types of algorithm More...
 
static const std::wstring & oldPureWeakNameID ()
 old string identifier of the pure weak name More...
 
static const std::wstring & weakNameID ()
 string identifier of the weak name in modification or intersection types of algorithm More...
 
static const std::wstring & pureWeakNameID ()
 string identifier of the pure weak name More...
 

Detailed Description

Kind of selection algorithm: generic algorithm that contains sub-algorithms inside.

It is base for Container, Intersection and FilterByNeighbours algorithms.

Member Enumeration Documentation

◆ Selector_Type

Type of a selector algorithm: on this type depends what is stored in this label and how to restore it on update.

Enumerator
SELTYPE_CONTAINER 

just a container of sub-elements, keeps the shape type of container

SELTYPE_INTERSECT 

sub-shape is intersection of higher level objects

SELTYPE_PRIMITIVE 

sub-shape found as a primitive on some label

SELTYPE_MODIFICATION 

modification of base shapes to the final label

SELTYPE_FILTER_BY_NEIGHBOR 

identification by neighbor shapes in context

SELTYPE_WEAK_NAMING 

pure weak naming by weak index in context

Constructor & Destructor Documentation

◆ Selector_AlgoWithSubs()

Selector_AlgoWithSubs::Selector_AlgoWithSubs ( )

Initializes selector.

◆ ~Selector_AlgoWithSubs()

Selector_AlgoWithSubs::~Selector_AlgoWithSubs ( )
virtual

Destructor.

Member Function Documentation

◆ clearSubAlgos()

void Selector_AlgoWithSubs::clearSubAlgos ( )

Erases the sub-algorithms stored.

◆ newSubLabel()

TDF_Label Selector_AlgoWithSubs::newSubLabel ( )

Returns the next label for a new sub-selector created.

◆ append()

bool Selector_AlgoWithSubs::append ( Selector_Algo theAlgo,
const bool  theEraseIfNull = true 
)

Appends a new algorithm to the list, erases list if it is null (failed)

◆ list()

std::list< Selector_Algo * > & Selector_AlgoWithSubs::list ( )

Returns the stored list of sub-algorithms.

◆ select()

Selector_Algo * Selector_Algo::select ( const TopoDS_Shape  theContext,
const TopoDS_Shape  theValue,
const TDF_Label  theAccess,
const TDF_Label  theBaseDocument,
const bool  theGeometricalNaming = false,
const bool  theUseNeighbors = true,
const bool  theUseIntersections = true,
const bool  theAlwaysGeometricalNaming = false 
)
staticinherited

Initializes the selector structure on the label.

Stores the name data to restore after modification.

Parameters
theContextwhole shape that contains the selected sub-shape
theValueselected subshape
theGeometricalNamingtreats selection with equal surfaces as one
theUseNeighborsenables searching algorithm by neighbors
theUseIntersectionsenables searching algorithm by intersection of higher level shapes

◆ store() [1/2]

virtual void Selector_Algo::store ( )
pure virtualinherited

Stores the name to the label and sub-labels tree.

Implemented in Selector_WeakName, Selector_Primitive, Selector_Modify, Selector_Intersect, Selector_FilterByNeighbors, and Selector_Container.

◆ store() [2/2]

void Selector_Algo::store ( const TopoDS_Shape  theShape)
protectedinherited

Stores result of selection at the given label.

◆ restore()

virtual bool Selector_Algo::restore ( )
pure virtualinherited

Restores the selected shape by the topological naming kept in the data structure Returns true if it can restore structure correctly.

Implemented in Selector_WeakName, Selector_Primitive, Selector_Modify, Selector_Intersect, Selector_FilterByNeighbors, and Selector_Container.

◆ restoreByName() [1/2]

virtual TDF_Label Selector_Algo::restoreByName ( std::wstring  theName,
const TopAbs_ShapeEnum  theShapeType,
Selector_NameGenerator theNameGenerator 
)
pure virtualinherited

Restores the selected shape by the topological name string.

Returns not empty label of the context.

Implemented in Selector_WeakName, Selector_Primitive, Selector_Modify, Selector_Intersect, Selector_FilterByNeighbors, and Selector_Container.

◆ restoreByName() [2/2]

Selector_Algo * Selector_Algo::restoreByName ( TDF_Label  theLab,
TDF_Label  theBaseDocLab,
std::wstring  theName,
const TopAbs_ShapeEnum  theShapeType,
const bool  theGeomNaming,
Selector_NameGenerator theNameGenerator,
TDF_Label &  theContextLab 
)
staticinherited

Restores the selected sub-algorithm by the naming name.

Returns not empty label of the context.

◆ solve()

virtual bool Selector_Algo::solve ( const TopoDS_Shape &  theContext)
pure virtualinherited

Updates the current shape by the stored topological name.

Implemented in Selector_WeakName, Selector_Primitive, Selector_Modify, Selector_Intersect, Selector_FilterByNeighbors, and Selector_Container.

◆ name()

virtual std::wstring Selector_Algo::name ( Selector_NameGenerator theNameGenerator)
pure virtualinherited

◆ value()

TopoDS_Shape Selector_Algo::value ( )
inherited

Returns the current sub-shape value (null if can not resolve)

◆ restoreByLab()

Selector_Algo * Selector_Algo::restoreByLab ( TDF_Label  theLab,
TDF_Label  theBaseDocLab 
)
staticinherited

Restores sub-algorithm of a given type by the storage-label.

◆ sameGeometry()

bool Selector_Algo::sameGeometry ( const TopoDS_Shape  theShape1,
const TopoDS_Shape  theShape2 
)
staticinherited

Returns true if the given shapes are based on the same geometry.

◆ relesectWithAllGeometry()

Selector_Algo * Selector_Algo::relesectWithAllGeometry ( Selector_Algo theOldAlgo,
const TopoDS_Shape  theContext 
)
staticinherited

Creates a new selection algorithm for selection of all topology based on the same geometry.

◆ setGeometricalNaming()

void Selector_Algo::setGeometricalNaming ( )
inlineinherited

Sets geometrical naming flag to true.

◆ label()

const TDF_Label& Selector_Algo::label ( ) const
inlineprotectedinherited

Returns label where this algorithm is attached to, or just an access label to the document.

◆ storeBaseArray()

void Selector_Algo::storeBaseArray ( const TDF_LabelList &  theRef,
const TDF_Label &  theLast 
)
protectedinherited

Stores the array of references to theLab: references to elements of ref-list, then the last.

◆ restoreBaseArray()

bool Selector_Algo::restoreBaseArray ( TDF_LabelList &  theRef,
TDF_Label &  theLast 
)
protectedinherited

Restores references to the labels: references to elements of ref-list, then the last.

◆ baseDocument()

const TDF_Label& Selector_Algo::baseDocument ( ) const
inlineprotectedinherited

Returns an access-label of the document that may contain initial shapes.

◆ geometricalNaming()

bool Selector_Algo::geometricalNaming ( ) const
inlineprotectedinherited

Returns the geometrical naming flag.

◆ alwaysGeometricalNaming()

bool Selector_Algo::alwaysGeometricalNaming ( ) const
inlineprotectedinherited

Returns always geometrical naming flag.

◆ useNeighbors()

bool Selector_Algo::useNeighbors ( ) const
inlineprotectedinherited

Returns use neighbors flag.

◆ useIntersections()

bool Selector_Algo::useIntersections ( ) const
inlineprotectedinherited

Returns use intersections flag.

◆ weakID()

static const Standard_GUID& Selector_Algo::weakID ( )
inlinestaticprotectedinherited

Returns GUID for the weak index (integer attribute) of the sub-shape.

◆ shapeTypeID()

static const Standard_GUID& Selector_Algo::shapeTypeID ( )
inlinestaticprotectedinherited

Returns GUID for the type of the shape, stored in case it is intersection or container.

◆ oldWeakNameID()

static const std::wstring& Selector_Algo::oldWeakNameID ( )
inlinestaticprotectedinherited

old string identifier of the weak name in modification or intersection types of algorithm

◆ oldPureWeakNameID()

static const std::wstring& Selector_Algo::oldPureWeakNameID ( )
inlinestaticprotectedinherited

old string identifier of the pure weak name

◆ weakNameID()

static const std::wstring& Selector_Algo::weakNameID ( )
inlinestaticprotectedinherited

string identifier of the weak name in modification or intersection types of algorithm

◆ pureWeakNameID()

static const std::wstring& Selector_Algo::pureWeakNameID ( )
inlinestaticprotectedinherited

string identifier of the pure weak name

◆ storeType()

void Selector_Algo::storeType ( const Selector_Type  theType)
protectedinherited

Stores the type of an algorithm in the data tree (in myLab)

◆ findNewVersion()

bool Selector_Algo::findNewVersion ( const TopoDS_Shape &  theContext,
TopoDS_Shape &  theResult 
) const
protectedinherited

Searches the newer version of the shape in the document if the base shape does not belong to context.

Returns it in theResult (if any). Returns true is theResult is changed.