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:
@@ -1470,20 +1470,17 @@ void BRepLib::UpdateTolerances(const TopoDS_Shape& aShape,
|
||||
//Vertices are processed
|
||||
const Standard_Real BigTol = 1.e10;
|
||||
parents.Clear();
|
||||
TopExp::MapShapesAndAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, parents);
|
||||
TopExp::MapShapesAndUniqueAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, parents);
|
||||
TColStd_MapOfTransient Initialized;
|
||||
TopTools_MapOfShape Done;
|
||||
Standard_Integer nbV = parents.Extent();
|
||||
for (iCur=1; iCur<=nbV; iCur++) {
|
||||
tol=0;
|
||||
Done.Clear();
|
||||
const TopoDS_Vertex& V = TopoDS::Vertex(parents.FindKey(iCur));
|
||||
Bnd_Box box;
|
||||
box.Add(BRep_Tool::Pnt(V));
|
||||
gp_Pnt p3d;
|
||||
for (lConx.Initialize(parents(iCur)); lConx.More(); lConx.Next()) {
|
||||
const TopoDS_Edge& E = TopoDS::Edge(lConx.Value());
|
||||
if(!Done.Add(E)) continue;
|
||||
tol=Max(tol, BRep_Tool::Tolerance(E));
|
||||
if(tol > BigTol) continue;
|
||||
if(!BRep_Tool::SameRange(E)) continue;
|
||||
|
@@ -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 :
|
||||
|
@@ -101,12 +101,6 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! build a map of shapes and ancestors, like
|
||||
//! TopExp.MapShapesAndAncestors, but we remove duplicate
|
||||
//! shapes in list of shapes.
|
||||
Standard_EXPORT void BuildAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape& M) const;
|
||||
|
||||
//! Build the all the lists of edges that are to be fused
|
||||
Standard_EXPORT void BuildListEdges();
|
||||
|
Reference in New Issue
Block a user