SHAPER  9.12.0
Selector_Algo Class Referenceabstract
Inheritance diagram for Selector_Algo:
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_Algo ()
 Initializes the algorithm. 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_AlgorestoreByLab (TDF_Label theLab, TDF_Label theBaseDocLab)
 Restores sub-algorithm of a given type by the storage-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 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

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...
 
void store (const TopoDS_Shape theShape)
 Stores result of selection at the given label. 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...
 

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_Algo()

Selector_Algo::Selector_Algo ( )

Initializes the algorithm.

Member Function Documentation

◆ 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 
)
static

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 virtual

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.

◆ restore()

virtual bool Selector_Algo::restore ( )
pure virtual

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 virtual

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.

◆ solve()

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

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 virtual

◆ value()

TopoDS_Shape Selector_Algo::value ( )

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

◆ restoreByLab()

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

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

◆ 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 
)
static

Restores the selected sub-algorithm by the naming name.

Returns not empty label of the context.

◆ sameGeometry()

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

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 
)
static

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

◆ setGeometricalNaming()

void Selector_Algo::setGeometricalNaming ( )
inline

Sets geometrical naming flag to true.

◆ label()

const TDF_Label& Selector_Algo::label ( ) const
inlineprotected

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 
)
protected

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 
)
protected

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

◆ store() [2/2]

void Selector_Algo::store ( const TopoDS_Shape  theShape)
protected

Stores result of selection at the given label.

◆ baseDocument()

const TDF_Label& Selector_Algo::baseDocument ( ) const
inlineprotected

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

◆ geometricalNaming()

bool Selector_Algo::geometricalNaming ( ) const
inlineprotected

Returns the geometrical naming flag.

◆ alwaysGeometricalNaming()

bool Selector_Algo::alwaysGeometricalNaming ( ) const
inlineprotected

Returns always geometrical naming flag.

◆ useNeighbors()

bool Selector_Algo::useNeighbors ( ) const
inlineprotected

Returns use neighbors flag.

◆ useIntersections()

bool Selector_Algo::useIntersections ( ) const
inlineprotected

Returns use intersections flag.

◆ weakID()

static const Standard_GUID& Selector_Algo::weakID ( )
inlinestaticprotected

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

◆ shapeTypeID()

static const Standard_GUID& Selector_Algo::shapeTypeID ( )
inlinestaticprotected

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

◆ oldWeakNameID()

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

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

◆ oldPureWeakNameID()

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

old string identifier of the pure weak name

◆ weakNameID()

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

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

◆ pureWeakNameID()

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

string identifier of the pure weak name

◆ storeType()

void Selector_Algo::storeType ( const Selector_Type  theType)
protected

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
protected

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.