1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0028782: Shape sewing behavior not consistent for the same CAD file

Get rid of iterations on maps with shape key by replacing simple maps with indexed maps. So iteration is done on integer key.

The map containers have been updated to insert into them type definitions of key and value.

The new methods RemoveKey() and RemoveFromIndex() have been added to indexed [data] map to be able to remove an arbitrary key from the map.

All the code in OCCT has been updated where RemoveLast() and Substitute() methods were used to remove a key from indexed [data] map.
This commit is contained in:
msv
2017-05-25 17:02:07 +03:00
committed by bugmaster
parent 58e5d30edc
commit 3f5aa017e7
16 changed files with 268 additions and 321 deletions

View File

@@ -452,13 +452,7 @@ const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes
}
if ( !it.Value().IsSame(it.Key())) {
myMap.ChangeFromKey(it.Value()).Append(myMap.ChangeFromKey(it.Key()));
//myMap.UnBind(it.Key());
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (myMap.FindIndex(it.Key()) != 0)
myMap.Substitute(myMap.FindIndex(it.Key()), LastShape, LastList);
myMap.RemoveKey(it.Key());
}
}
if (myMap.Contains(it.Key().Reversed())) {
@@ -468,13 +462,7 @@ const TopTools_ListOfShape& BRepFill_OffsetWire::GeneratedShapes
}
if ( !it.Value().IsSame(it.Key())) {
myMap.ChangeFromKey(it.Value().Reversed()).Append(myMap.ChangeFromKey(it.Key().Reversed()));
//myMap.UnBind(it.Key().Reversed());
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (myMap.FindIndex(it.Key().Reversed()) != 0)
myMap.Substitute(myMap.FindIndex(it.Key().Reversed()), LastShape, LastList);
myMap.RemoveKey(it.Key().Reversed());
}
}
}
@@ -821,13 +809,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
if (!myMap.IsEmpty() &&
myMap.FindKey(1).ShapeType() == TopAbs_VERTEX)
{
//myMap.RemoveFirst();
TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
TopTools_ListOfShape LastList;
LastList.Append(myMap(myMap.Extent()));
myMap.RemoveLast();
if (!myMap.IsEmpty())
myMap.Substitute(1, LastShape, LastList);
myMap.RemoveFromIndex(1);
}
if (!myMap.IsEmpty() &&
myMap.FindKey(myMap.Extent()).ShapeType() == TopAbs_VERTEX)
@@ -1447,13 +1429,7 @@ void BRepFill_OffsetWire::MakeWires()
if (myIsOpenResult && MVE.FindFromKey(CV).IsEmpty())
{
//MVE.UnBind(CV);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(CV) != 0)
MVE.Substitute(MVE.FindIndex(CV), LastShape, LastList);
MVE.RemoveKey(CV);
}
@@ -1476,13 +1452,7 @@ void BRepFill_OffsetWire::MakeWires()
isClosed = VF.IsSame(CV);
// Modified by Sergey KHROMOV - Thu Mar 14 11:30:15 2002 End
End = Standard_True;
//MVE.UnBind(VF);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(VF) != 0)
MVE.Substitute(MVE.FindIndex(VF), LastShape, LastList);
MVE.RemoveKey(VF);
}
if (!End) {
@@ -1504,13 +1474,7 @@ void BRepFill_OffsetWire::MakeWires()
if (MVE.FindFromKey(CV).IsEmpty())
{
//MVE.UnBind(CV);
TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
TopTools_ListOfShape LastList;
LastList.Append(MVE(MVE.Extent()));
MVE.RemoveLast();
if (MVE.FindIndex(CV) != 0)
MVE.Substitute(MVE.FindIndex(CV), LastShape, LastList);
MVE.RemoveKey(CV);
}
}
}