SHAPER  9.12.0
Selector_NExplode Class Reference

Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9. More...

Public Member Functions

 Selector_NExplode (const TopoDS_ListOfShape &theShapes, const bool theOldOrder=false)
 Initializes the sorted list of shapes by the shapes list. More...
 
 Selector_NExplode (const TopoDS_Shape &theShape, const TopAbs_ShapeEnum theType, const bool theOldOrder=false)
 Initializes the sorted list of shapes by the context shape and type of sub-shapes. More...
 
int index (const TopoDS_Shape &theSubShape)
 Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found. More...
 
TopoDS_Shape shape (int &theIndex)
 Returns a shape by an index (started from one). More...
 

Protected Attributes

std::shared_ptr< GeomAlgoAPI_NExplodemySorted
 keep the ordered list of shapes More...
 
bool myToBeReordered
 the list has to be reordered More...
 

Detailed Description

Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9.

Algorithm is copied from GEOM module, which uses nexplode Draw command from OCCT. Used for getting index of sub0shape in WeakNaming algorithm.

Constructor & Destructor Documentation

◆ Selector_NExplode() [1/2]

Selector_NExplode::Selector_NExplode ( const TopoDS_ListOfShape &  theShapes,
const bool  theOldOrder = false 
)

Initializes the sorted list of shapes by the shapes list.

◆ Selector_NExplode() [2/2]

Selector_NExplode::Selector_NExplode ( const TopoDS_Shape &  theShape,
const TopAbs_ShapeEnum  theType,
const bool  theOldOrder = false 
)

Initializes the sorted list of shapes by the context shape and type of sub-shapes.

Member Function Documentation

◆ index()

int Selector_NExplode::index ( const TopoDS_Shape &  theSubShape)

Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found.

◆ shape()

TopoDS_Shape Selector_NExplode::shape ( int &  theIndex)

Returns a shape by an index (started from one).

Returns null if not found. Recompute the index if the old order was used. The value will contain the new ordered index.

Field Documentation

◆ mySorted

std::shared_ptr<GeomAlgoAPI_NExplode> Selector_NExplode::mySorted
protected

keep the ordered list of shapes

◆ myToBeReordered

bool Selector_NExplode::myToBeReordered
protected

the list has to be reordered