1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026682: TopExp::MapShapesAndAncestors() will build map with duplicated ancestors.

The new method TopExp::MapShapesAndUniqueAncestors has been implemented, which excludes duplication of ancestors in the list items. The optional Boolean argument 'useOrientation' of this method points whether two same shapes with different orientation will be considered equal.
OCCT code has been inspected and MapShapesAndAncestors has been replaced with MapShapesAndUniqueAncestors where it is necessary.
This commit is contained in:
mpa
2017-03-03 13:57:36 +03:00
committed by mkv
parent 4d597f3e2f
commit f1191d3099
13 changed files with 93 additions and 241 deletions

View File

@@ -380,7 +380,7 @@ void BRepLib_FuseEdges::BuildListEdges()
myMapVerLstEdg.Clear();
myMapEdgLstFac.Clear();
BuildAncestors(myShape,TopAbs_VERTEX,TopAbs_EDGE,myMapVerLstEdg);
TopExp::MapShapesAndUniqueAncestors(myShape,TopAbs_VERTEX,TopAbs_EDGE,myMapVerLstEdg);
TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,myMapEdgLstFac);
Standard_Integer iEdg;
@@ -1000,49 +1000,6 @@ Standard_Boolean BRepLib_FuseEdges::SameSupport(const TopoDS_Edge& E1,
return Standard_False;
}
//=======================================================================
//function : BuildAncestors
//purpose : This function is like TopExp::MapShapesAndAncestors except
// that in the list of shape we do not want duplicate shapes.
// if this is useful for other purpose we should create a new method in
// TopExp
//=======================================================================
void BRepLib_FuseEdges::BuildAncestors
(const TopoDS_Shape& S,
const TopAbs_ShapeEnum TS,
const TopAbs_ShapeEnum TA,
TopTools_IndexedDataMapOfShapeListOfShape& M) const
{
TopTools_MapOfShape mapDuplicate;
TopTools_ListIteratorOfListOfShape it;
Standard_Integer iSh;
TopExp::MapShapesAndAncestors(S,TS,TA,M);
// for each shape of M
for (iSh = 1; iSh <= M.Extent(); iSh++) {
TopTools_ListOfShape& Lsh = M(iSh);
mapDuplicate.Clear();
// we check for duplicate in the list of Shape
it.Initialize(Lsh);
while (it.More() ) {
if (!mapDuplicate.Contains(it.Value())) {
mapDuplicate.Add(it.Value());
it.Next();
}
else {
Lsh.Remove(it);
}
}
}
}
//=======================================================================
//function : UpdatePCurve
//purpose :