Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 ( )
virtual

Member Function Documentation

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

References myModified.

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.

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

References myNew.

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

References myRemoved.

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

References myResult.

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

References myShape.

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 anIter(), and aResult.

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

References mySubShapes.

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.
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 anIter(), getModified(), myMapModified, myMapRemoved, myModified, myNew, and myRemoved.

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 anIter(), and myMapShapeAnc.

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 anIter(), aResult, getModified(), myMapModified, myMapRemoved, and oriented().

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 anIter(), and aResult.

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 anIter(), and GEOM::Vertices.

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.

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 anIter(), myMapRemoved, and myMapShapeAnc.

void GEOMAlgo_Extractor::markShapes ( )
private
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.

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

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

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

References anIter(), makeShape(), myMapModified, and myMapRemoved.

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

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

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

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

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

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

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

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

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 anEdge, and GEOM::Vertices.

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.
void GEOMAlgo_Extractor::SetShape ( const TopoDS_Shape &  theShape)
Parameters
theShapethe main shape.

References clear(), myMapShapeAnc, and myShape.

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

Member Data Documentation

TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapModified
protected
TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapNewShapeAnc
protected
TopTools_MapOfShape GEOMAlgo_Extractor::myMapRemoved
protected
TopTools_DataMapOfShapeListOfShape GEOMAlgo_Extractor::myMapShapeAnc
protected
TopTools_ListOfShape GEOMAlgo_Extractor::myModified
protected
TopTools_ListOfShape GEOMAlgo_Extractor::myNew
protected
TopTools_ListOfShape GEOMAlgo_Extractor::myRemoved
protected
TopoDS_Shape GEOMAlgo_Extractor::myResult
protected
TopoDS_Shape GEOMAlgo_Extractor::myShape
protected
TopTools_ListOfShape GEOMAlgo_Extractor::mySubShapes
protected

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