Version: 9.12.0
GEOMAlgo_Extractor Class Reference

This class encapsulates an algorithm of extraction of sub-shapes from the main shape.

#include <GEOMAlgo_Extractor.hxx>

Inheritance diagram for GEOMAlgo_Extractor:
Inheritance graph

Public Member Functions

Standard_EXPORT GEOMAlgo_Extractor ()
 Empty constructor. More...
 
virtual Standard_EXPORT ~GEOMAlgo_Extractor ()
 Virtual destructor. More...
 
Standard_EXPORT void SetShape (const TopoDS_Shape &theShape)
 This method sets the main shape. More...
 
const TopoDS_Shape & GetShape () const
 This method returns the main shape. More...
 
Standard_EXPORT void SetShapesToRemove (const TopTools_ListOfShape &theSubShapes)
 This method sets the list of sub-shapes to be removed from the main shape. More...
 
const TopTools_ListOfShape & GetShapesToRemove () const
 This method returns the list of sub-shapes to be removed from the main shape. More...
 
virtual Standard_EXPORT void Perform ()
 This method performs computation of the extracted shape. More...
 
Standard_EXPORT const TopoDS_Shape & GetResult () const
 This method returns the result of the algorithm. More...
 
const TopTools_ListOfShape & GetRemoved () const
 This method returns the sub-shapes removed from the main shape. More...
 
const TopTools_ListOfShape & GetModified () const
 This method returns the sub-shapes modified in the main shape. More...
 
const TopTools_ListOfShape & GetNew () const
 This method returns the newly created sub-shapes in the result shape. More...
 
- Public Member Functions inherited from GEOMAlgo_Algo
Standard_EXPORT Standard_Integer ErrorStatus () const
 
Standard_EXPORT Standard_Integer WarningStatus () const
 
Standard_EXPORT void ComputeInternalShapes (const Standard_Boolean theFlag)
 Allows to omit of creation of internal shapes (manifold topology). More...
 

Protected Attributes

TopoDS_Shape myShape
 
TopoDS_Shape myResult
 
TopTools_ListOfShape mySubShapes
 
TopTools_ListOfShape myRemoved
 
TopTools_ListOfShape myModified
 
TopTools_ListOfShape myNew
 
TopTools_DataMapOfShapeListOfShape myMapShapeAnc
 
TopTools_MapOfShape myMapRemoved
 
TopTools_DataMapOfShapeListOfShape myMapModified
 
TopTools_DataMapOfShapeListOfShape myMapNewShapeAnc
 
- Protected Attributes inherited from GEOMAlgo_Algo
Standard_Integer myErrorStatus
 
Standard_Integer myWarningStatus
 
Standard_Boolean myComputeInternalShapes
 

Private Member Functions

void clear ()
 This method reinitializes the shape. More...
 
void checkData ()
 This method checks the input data. More...
 
void makeMapShapeAncestors (const TopoDS_Shape &theShape)
 This method fills the map of shapes and ancestors for the whole sub-shapes of theShape. More...
 
void markShapes ()
 This method marks shapes to be removed and to be modified. More...
 
void markRemoved (const TopoDS_Shape &theShape)
 This method marks theShape to be removed. More...
 
void markAncestorsModified (const TopoDS_Shape &theShape)
 This method marks ancestors of theShape to be modified. More...
 
void processShapes (const TopAbs_ShapeEnum &theType)
 This method performs computation of modified shapes of the provided type. More...
 
void processEdge (const TopoDS_Shape &theEdge)
 This method performs computation of a modified edge. More...
 
void processWire (const TopoDS_Shape &theWire)
 This method performs computation of a modified wire. More...
 
void processFOrSo (const TopoDS_Shape &theFOrSo)
 This method performs computation of a modified face or solid. More...
 
void processShOrCS (const TopoDS_Shape &theShOrCS)
 This method performs computation of a modified shell or comp-solid. More...
 
void processCompound (const TopoDS_Shape &theCompound)
 This method performs computation of a modified compound. More...
 
void removeBoundsOnFOrSo (const TopAbs_ShapeEnum theType)
 This method removes hanging edges (faces) built for faces (solids) if they lie on created faces (solids). More...
 
TopoDS_Shape oriented (const TopoDS_Shape &theShape, const TopoDS_Shape &theContext)
 Returns theShape with an orientation composed with theContext's orientation. More...
 
TopoDS_Shape makeShape (const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes)
 This method makes a shape as an empty copy of theShape adding subshapes to it. More...
 
TopoDS_Shape getShapeFromSubShapes (const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes)
 This method returns the shape from the list of sub-shapes if there is any shape created already with these sub-shapes. More...
 
TopoDS_Shape makeResult (const TopoDS_Shape &theShape)
 This method makes the result for the given shape. More...
 
void makeHistory (const TopoDS_Shape &theShape, TopTools_MapOfShape &theMapFence)
 This method fills the lists of shapes myRemoved, myModified and myNew with removed, modified and newly created shapes correspondingly. More...
 
Standard_Boolean removeCommonEdges (const TopoDS_Shape &theWire, const TopTools_IndexedMapOfShape &theMapEdgesToRm, TopTools_ListOfShape &theNewWires)
 This method removes edges that are in theMapEdgesToRm from theWire and re-creates one or more wires from the rest edges. More...
 
Standard_Boolean removeCommonFaces (const TopoDS_Shape &theShell, const TopTools_IndexedMapOfShape &theMapFacesToRm, TopTools_ListOfShape &theNewShells)
 This method removes faces that are in theMapFacesToRm from theShell and re-creates one or more shells from the rest faces. More...
 
void makeWires (const TopoDS_Shape &theWire, NCollection_List< TopTools_ListOfShape > &theListListEdges, TopTools_ListOfShape &theWires)
 This method creates wires from the list of list of edges. More...
 
void groupViaBounds (const TopoDS_Shape &theShape, const TopTools_ListOfShape &theSubShapes, TopTools_ListOfShape &theNewShapes)
 This method collects the shapes in theShapes via common bounds. More...
 
void getModified (const TopoDS_Shape &theShape, TopTools_ListOfShape &theModifShapes, const TopAbs_ShapeEnum theShapeType=TopAbs_SHAPE)
 This method returns the list of modified shapes obtained from theShape. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GEOMAlgo_Algo
Standard_EXPORT GEOMAlgo_Algo ()
 
virtual Standard_EXPORT ~GEOMAlgo_Algo ()
 
virtual Standard_EXPORT void CheckData ()
 
virtual Standard_EXPORT void CheckResult ()
 

Constructor & Destructor Documentation

◆ GEOMAlgo_Extractor()

GEOMAlgo_Extractor::GEOMAlgo_Extractor ( )

◆ ~GEOMAlgo_Extractor()

GEOMAlgo_Extractor::~GEOMAlgo_Extractor ( )
virtual

Member Function Documentation

◆ checkData()

void GEOMAlgo_Extractor::checkData ( )
private

◆ clear()

◆ GetModified()

const TopTools_ListOfShape& GEOMAlgo_Extractor::GetModified ( ) const
inline
Returns
the list of modified sub-shapes.

References myModified.

◆ getModified()

void GEOMAlgo_Extractor::getModified ( const TopoDS_Shape &  theShape,
TopTools_ListOfShape &  theModifShapes,
const TopAbs_ShapeEnum  theShapeType = TopAbs_SHAPE 
)
private

It performs recursive search in myMapModified. theModifShapes is not cleared at first. If theShapeType filter is equal to TopAbs_SHAPE (default value) all modified shapes will be returned, otherwise shapes of particular type will only be returned.

Parameters
theShapethe shape examined.
theModifShapesthe list of modified shapes. Output parameter.
theShapeTypethe shape type filter.

References myMapModified.

◆ GetNew()

const TopTools_ListOfShape& GEOMAlgo_Extractor::GetNew ( ) const
inline
Returns
the list of new sub-shapes in result.

References myNew.

◆ GetRemoved()

const TopTools_ListOfShape& GEOMAlgo_Extractor::GetRemoved ( ) const
inline
Returns
the list of removed sub-shapes.

References myRemoved.

◆ GetResult()

const TopoDS_Shape & GEOMAlgo_Extractor::GetResult ( ) const
Returns
the result of the operation.

References myResult.

◆ GetShape()

const TopoDS_Shape& GEOMAlgo_Extractor::GetShape ( ) const
inline
Returns
the main shape.

References myShape.

◆ getShapeFromSubShapes()

TopoDS_Shape GEOMAlgo_Extractor::getShapeFromSubShapes ( const TopoDS_Shape &  theShape,
const TopTools_ListOfShape &  theSubShapes 
)
private

If there is no such shape, null shape is returned.

Parameters
theShapethe shape to be copied (should be forward).
theSubShapesthe sub-shapes (should be oriented correctly).
Returns
the modified shape (or null if it is not found).

References aResult, and myMapNewShapeAnc.

◆ GetShapesToRemove()

const TopTools_ListOfShape& GEOMAlgo_Extractor::GetShapesToRemove ( ) const
inline
Returns
the list of sub-shapes to be removed.

References mySubShapes.

◆ groupViaBounds()

void GEOMAlgo_Extractor::groupViaBounds ( const TopoDS_Shape &  theShape,
const TopTools_ListOfShape &  theSubShapes,
TopTools_ListOfShape &  theNewShapes 
)
private

This method is used to group faces into shells via common edges or solids into compsolids via common faces. Collected lists of shapes are used to create new shapes from theShape that are returned in theNewShapes. theNewShapes is not cleared at first.

Parameters
theShapethe original shape.
theSubShapesthe list of shapes to be connected.
theNewShapesthe list of newly created shapes. Output parameter.

References makeShape().

◆ makeHistory()

void GEOMAlgo_Extractor::makeHistory ( const TopoDS_Shape &  theShape,
TopTools_MapOfShape &  theMapFence 
)
private

This method is called recursively for sub-shapes of the shape.

Parameters
theShapethe shape.
theMapFencethe map of already treated shapes.

References getModified(), myMapModified, myMapRemoved, myModified, myNew, and myRemoved.

◆ makeMapShapeAncestors()

void GEOMAlgo_Extractor::makeMapShapeAncestors ( const TopoDS_Shape &  theShape)
private

This method is recursively called up to the lowest level of sub-shapes i.e. vertices.

Parameters
theShapethe shape.

References myMapShapeAnc.

◆ makeResult()

TopoDS_Shape GEOMAlgo_Extractor::makeResult ( const TopoDS_Shape &  theShape)
private

If it is removed the result is a compound of its modified sub-shapes (or a single modified sub-shape if it in only one).

Parameters
theShapethe shape.
Returns
the result.

References aResult, getModified(), myMapModified, myMapRemoved, and oriented().

◆ makeShape()

TopoDS_Shape GEOMAlgo_Extractor::makeShape ( const TopoDS_Shape &  theShape,
const TopTools_ListOfShape &  theSubShapes 
)
private
Parameters
theShapethe shape to be copied (should be forward).
theSubShapesthe sub-shapes (should be oriented correctly).
Returns
the modified shape.

References aResult, getShapeFromSubShapes(), and myMapNewShapeAnc.

◆ makeWires()

void GEOMAlgo_Extractor::makeWires ( const TopoDS_Shape &  theWire,
NCollection_List< TopTools_ListOfShape > &  theListListEdges,
TopTools_ListOfShape &  theWires 
)
private
Parameters
theWirethe input wire.
theListListEdgesthe list of list of edges. Can be modified on output.
theWiresthe list of created wires. Output parameter.

References makeShape(), and GEOM::Vertices.

◆ markAncestorsModified()

void GEOMAlgo_Extractor::markAncestorsModified ( const TopoDS_Shape &  theShape)
private

It is recursively called up to the level of main shape.

Parameters
theShapethe shape.

References myMapModified, myMapRemoved, and myMapShapeAnc.

◆ markRemoved()

void GEOMAlgo_Extractor::markRemoved ( const TopoDS_Shape &  theShape)
private

If it is required, it recursively marks its sub-shapes to be removed.

Parameters
theShapethe shape.

References myMapRemoved, and myMapShapeAnc.

◆ markShapes()

void GEOMAlgo_Extractor::markShapes ( )
private

◆ oriented()

TopoDS_Shape GEOMAlgo_Extractor::oriented ( const TopoDS_Shape &  theShape,
const TopoDS_Shape &  theContext 
)
private
Parameters
theShapethe shape to be re-oriented.
theContextthe context shape.

References aResult.

◆ Perform()

◆ processCompound()

void GEOMAlgo_Extractor::processCompound ( const TopoDS_Shape &  theCompound)
private
Parameters
theCompoundthe modified compound (should be forward).

References getModified(), makeShape(), myMapModified, myMapRemoved, and oriented().

◆ processEdge()

void GEOMAlgo_Extractor::processEdge ( const TopoDS_Shape &  theEdge)
private
Parameters
theEdgethe modified edge (should be forward).

References makeShape(), myMapModified, and myMapRemoved.

◆ processFOrSo()

void GEOMAlgo_Extractor::processFOrSo ( const TopoDS_Shape &  theFOrSo)
private
Parameters
theFOrSothe modified face or solid (should be forward).

References getModified(), makeShape(), myMapModified, myMapRemoved, and oriented().

◆ processShapes()

void GEOMAlgo_Extractor::processShapes ( const TopAbs_ShapeEnum &  theType)
private

◆ processShOrCS()

void GEOMAlgo_Extractor::processShOrCS ( const TopoDS_Shape &  theShOrCS)
private
Parameters
theShOrCSthe modified shell or comp-solid (should be forward).

References getModified(), groupViaBounds(), myMapModified, myMapRemoved, and oriented().

◆ processWire()

void GEOMAlgo_Extractor::processWire ( const TopoDS_Shape &  theWire)
private
Parameters
theWirethe modified wire (should be forward).

References getModified(), makeWires(), myMapModified, myMapRemoved, myMapShapeAnc, and oriented().

◆ removeBoundsOnFOrSo()

void GEOMAlgo_Extractor::removeBoundsOnFOrSo ( const TopAbs_ShapeEnum  theType)
private
Parameters
theTypethe shape type. Should be either face or solid.

References getModified(), myMapModified, myMapRemoved, myShape, removeCommonEdges(), and removeCommonFaces().

◆ removeCommonEdges()

Standard_Boolean GEOMAlgo_Extractor::removeCommonEdges ( const TopoDS_Shape &  theWire,
const TopTools_IndexedMapOfShape &  theMapEdgesToRm,
TopTools_ListOfShape &  theNewWires 
)
private

theNewWires contains the modified wire(s).

Parameters
theWirethe input wire.
theMapEdgesToRmthe map of edges to be extracted from theWire.
theNewWiresis the list of new wires. Output parameter.
Returns
Standard_True if theWire is modified; Standard_False otherwise.

References makeWires(), and GEOM::Vertices.

◆ removeCommonFaces()

Standard_Boolean GEOMAlgo_Extractor::removeCommonFaces ( const TopoDS_Shape &  theShell,
const TopTools_IndexedMapOfShape &  theMapFacesToRm,
TopTools_ListOfShape &  theNewShells 
)
private

theNewShells contains the modified shell(s).

Parameters
theShellthe input shell.
theMapFacesToRmthe map of faces to be extracted from theShell.
theNewShellsis the list of new shells. Output parameter.
Returns
Standard_True if theShell is modified; Standard_False otherwise.

References groupViaBounds().

◆ SetShape()

void GEOMAlgo_Extractor::SetShape ( const TopoDS_Shape &  theShape)
Parameters
theShapethe main shape.

References clear(), myMapShapeAnc, and myShape.

◆ SetShapesToRemove()

void GEOMAlgo_Extractor::SetShapesToRemove ( const TopTools_ListOfShape &  theSubShapes)
Parameters
theSubShapesthe sub-shapes to be removed.

References clear(), and mySubShapes.

Member Data Documentation

◆ myMapModified

TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapModified
protected

◆ myMapNewShapeAnc

TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapNewShapeAnc
protected

◆ myMapRemoved

TopTools_MapOfShape GEOMAlgo_Extractor::myMapRemoved
protected

◆ myMapShapeAnc

TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapShapeAnc
protected

◆ myModified

TopTools_ListOfShape GEOMAlgo_Extractor::myModified
protected

◆ myNew

TopTools_ListOfShape GEOMAlgo_Extractor::myNew
protected

◆ myRemoved

TopTools_ListOfShape GEOMAlgo_Extractor::myRemoved
protected

◆ myResult

TopoDS_Shape GEOMAlgo_Extractor::myResult
protected

◆ myShape

TopoDS_Shape GEOMAlgo_Extractor::myShape
protected

◆ mySubShapes

TopTools_ListOfShape GEOMAlgo_Extractor::mySubShapes
protected

The documentation for this class was generated from the following files: