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

@@ -126,27 +126,11 @@ static void EdgeAnalyse(const TopoDS_Edge& E,
//=======================================================================
static void BuildAncestors (const TopoDS_Shape& S,
TopTools_IndexedDataMapOfShapeListOfShape& MA)
TopTools_IndexedDataMapOfShapeListOfShape& MA)
{
MA.Clear();
TopExp::MapShapesAndAncestors(S,TopAbs_VERTEX,TopAbs_EDGE,MA);
TopExp::MapShapesAndAncestors(S,TopAbs_EDGE ,TopAbs_FACE,MA);
// Purge ancestors.
TopTools_MapOfShape Map;
for (Standard_Integer i = 1; i <= MA.Extent(); i++) {
Map.Clear();
TopTools_ListOfShape& L = MA(i);
TopTools_ListIteratorOfListOfShape it(L);
while (it.More()) {
if (!Map.Add(it.Value())) {
L.Remove(it);
}
else {
it.Next();
}
}
}
TopExp::MapShapesAndUniqueAncestors(S,TopAbs_VERTEX,TopAbs_EDGE,MA);
TopExp::MapShapesAndUniqueAncestors(S,TopAbs_EDGE ,TopAbs_FACE,MA);
}
//=======================================================================

View File

@@ -445,33 +445,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
TopExp::MapShapes(SI, TopAbs_VERTEX, VEmap);
//
// make vertex-faces connexity map with unique ancestors
// TopExp::MapShapesAndAncestors(SI, TopAbs_VERTEX, TopAbs_FACE, aMVF);
TopExp_Explorer aExpF(SI, TopAbs_FACE);
for (; aExpF.More(); aExpF.Next()) {
const TopoDS_Shape& aF = aExpF.Current();
//
TopExp_Explorer aExpV(aF, TopAbs_VERTEX);
for (; aExpV.More(); aExpV.Next()) {
const TopoDS_Shape& aV = aExpV.Current();
//
TopTools_ListOfShape *pLF = aMVF.ChangeSeek(aV);
if (!pLF) {
pLF = &aMVF(aMVF.Add(aV, TopTools_ListOfShape()));
pLF->Append(aF);
continue;
}
//
TopTools_ListIteratorOfListOfShape aItLF(*pLF);
for (; aItLF.More(); aItLF.Next()) {
if (aItLF.Value().IsSame(aF)) {
break;
}
}
if (!aItLF.More()) {
pLF->Append(aF);
}
}
}
TopExp::MapShapesAndUniqueAncestors(SI, TopAbs_VERTEX, TopAbs_FACE, aMVF);
}
//
TopTools_DataMapOfShapeListOfShape aDMVLF1, aDMVLF2, aDMIntFF;