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

@@ -149,18 +149,8 @@ void Draft_Modification::Remove(const TopoDS_Face& F)
}
ltod.Initialize(conneF);
Standard_Integer IndToReplace = 0;
while (ltod.More()) {
IndToReplace = myFMap.FindIndex(TopoDS::Face(ltod.Value()));
if (IndToReplace)
{
Standard_Integer LInd = myFMap.Extent();
TopoDS_Face LF = myFMap.FindKey(LInd);
Draft_FaceInfo LFInfo = myFMap.FindFromIndex(LInd);
myFMap.RemoveLast();
if (IndToReplace != LInd)
myFMap.Substitute(IndToReplace, LF, LFInfo);
}
myFMap.RemoveKey(TopoDS::Face(ltod.Value()));
ltod.Next();
}
@@ -173,16 +163,7 @@ void Draft_Modification::Remove(const TopoDS_Face& F)
}
ltod.Initialize(conneF);
while (ltod.More()) {
IndToReplace = myFMap.FindIndex(TopoDS::Face(ltod.Value()));
if (IndToReplace)
{
Standard_Integer LInd = myEMap.Extent();
TopoDS_Edge LF = myEMap.FindKey(LInd);
Draft_EdgeInfo LFInfo = myEMap.FindFromIndex(LInd);
myEMap.RemoveLast();
if (IndToReplace != LInd)
myEMap.Substitute(IndToReplace, LF, LFInfo);
}
myEMap.RemoveKey(TopoDS::Edge(ltod.Value()));
ltod.Next();
}
}

View File

@@ -380,30 +380,11 @@ Standard_Boolean Draft_Modification::InternalAdd(const TopoDS_Face& F,
typS == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
if ( myFMap.Contains(F)) {
if ( Flag == Standard_False && !postponed) {
Standard_Integer IndToReplace = myFMap.FindIndex(F);
if (IndToReplace) {
Standard_Integer LInd = myFMap.Extent();
TopoDS_Face LF = myFMap.FindKey(LInd);
Draft_FaceInfo LFInfo = myFMap.FindFromIndex(LInd);
myFMap.RemoveLast();
if (IndToReplace != LInd)
myFMap.Substitute(IndToReplace, LF, LFInfo);
}
myFMap.RemoveKey(F);
TopTools_MapIteratorOfMapOfShape itm(MapOfE);
for ( ; itm.More(); itm.Next())
{
IndToReplace = myEMap.FindIndex(TopoDS::Edge(itm.Key()));
if ( IndToReplace )
{
Standard_Integer LInd = myEMap.Extent();
TopoDS_Edge LE = myEMap.FindKey(LInd);
Draft_EdgeInfo LEInfo = myEMap.FindFromIndex(LInd);
myEMap.RemoveLast();
if (IndToReplace != LInd)
myEMap.Substitute(IndToReplace, LE, LEInfo);
}
myEMap.RemoveKey(TopoDS::Edge(itm.Key()));
}
}
}