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

0025712: Non-deterministic behavior of ShapeFix_Solid

Test-case for issue #25712
This commit is contained in:
Roman Lygin
2015-01-29 13:56:53 +03:00
committed by bugmaster
parent c7806cb6e6
commit a70f58235a
4 changed files with 54 additions and 16 deletions

View File

@@ -39,27 +39,31 @@ is
Create returns ReShape from BRepTools;
---Purpose: Returns an empty Reshape
Clear (me: mutable);
Clear (me: mutable) is virtual;
---Purpose: Clears all substitutions requests
Remove (me: mutable; shape: Shape from TopoDS;
oriented: Boolean = Standard_False);
oriented: Boolean = Standard_False)
is virtual;
---Purpose: Sets a request to Remove a Shape
-- If <oriented> is True, only for a shape with the SAME
-- orientation. Else, whatever the orientation
Replace (me: mutable; shape, newshape: Shape from TopoDS;
oriented: Boolean = Standard_False);
oriented: Boolean = Standard_False)
is virtual;
---Purpose: Sets a request to Replace a Shape by a new one
-- If <oriented> is True, only if the orientation is the same
-- Else, whatever the orientation, and the new shape takes the
-- same orientation as <newshape> if the replaced one has the
-- same as <shape>, else it is reversed
IsRecorded (me; shape: Shape from TopoDS) returns Boolean;
IsRecorded (me; shape: Shape from TopoDS)
returns Boolean is virtual;
---Purpose: Tells if a shape is recorded for Replace/Remove
Value (me; shape: Shape from TopoDS) returns Shape from TopoDS;
Value (me; shape: Shape from TopoDS)
returns Shape from TopoDS is virtual;
---Purpose: Returns the new value for an individual shape
-- If not recorded, returns the original shape itself
-- If to be Removed, returns a Null Shape
@@ -107,12 +111,14 @@ is
-- If incompatible shape type is encountered, it is ignored
-- and flag FAIL1 is set in Status.
ModeConsiderLocation(me: mutable) returns Boolean;
ModeConsiderLocation(me: mutable)
returns Boolean is virtual;
---C++: return &
---Purpose:Returns (modifiable) the flag which defines whether Location of shape take into account
-- during replacing shapes.
ModeConsiderOrientation(me: mutable) returns Boolean;
ModeConsiderOrientation(me: mutable)
returns Boolean is virtual;
---C++: return &
---Purpose:Returns (modifiable) the flag which defines whether Orientation of shape take into account
-- during replacing shapes.

View File

@@ -81,7 +81,7 @@ is
-- the map directly for the shape, if True and status > 0 then
-- recursively searches for the last status and new shape.
Status (me; status: Status from ShapeExtend) returns Boolean;
Status (me; status: Status from ShapeExtend) returns Boolean is virtual;
---Purpose: Queries the status of last call to Apply(shape,enum)
-- OK : no (sub)shapes replaced or removed
-- DONE1: source (starting) shape replaced

View File

@@ -140,10 +140,11 @@ static void GetMiddlePoint(const TopoDS_Shape& aShape, gp_Pnt& pmid)
//purpose :
//=======================================================================
static void CollectSolids(const TopTools_SequenceOfShape& aSeqShells ,
TopTools_DataMapOfShapeListOfShape& aMapShellHoles,
TopTools_IndexedDataMapOfShapeListOfShape& anIndexedMapShellHoles,
TopTools_DataMapOfShapeInteger& theMapStatus)
{
TopTools_MapOfShape aMapHoles;
TopTools_DataMapOfShapeListOfShape aMapShellHoles;
for ( Standard_Integer i1 = 1; i1 <= aSeqShells.Length(); i1++ ) {
TopoDS_Shell aShell1 = TopoDS::Shell(aSeqShells.Value(i1));
TopTools_ListOfShape lshells;
@@ -244,8 +245,15 @@ static void CollectSolids(const TopTools_SequenceOfShape& aSeqShells ,
}
}
for(TopTools_MapIteratorOfMapOfShape aIterHoles(aMapHoles);aIterHoles.More(); aIterHoles.Next())
aMapShellHoles.UnBind(aIterHoles.Key());
aMapShellHoles.UnBind (aIterHoles.Key());
for (Standard_Integer i = 1; i <= aSeqShells.Length(); ++i) {
const TopoDS_Shape& aShell1 = aSeqShells.Value (i);
if (aMapShellHoles.IsBound (aShell1)) {
const TopTools_ListOfShape& ls = aMapShellHoles.Find (aShell1);
anIndexedMapShellHoles.Add (aShell1, ls);
}
}
}
//=======================================================================
//function : CreateSolids
@@ -260,14 +268,13 @@ static Standard_Boolean CreateSolids(const TopoDS_Shape aShape,TopTools_IndexedM
for(TopExp_Explorer aExpShell(aShape,TopAbs_SHELL); aExpShell.More(); aExpShell.Next()) {
aSeqShells.Append(aExpShell.Current());
}
TopTools_DataMapOfShapeListOfShape aMapShellHoles;
TopTools_IndexedDataMapOfShapeListOfShape aMapShellHoles;
TopTools_DataMapOfShapeInteger aMapStatus;
CollectSolids(aSeqShells,aMapShellHoles,aMapStatus);
TopTools_IndexedDataMapOfShapeShape ShellSolid;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItShellHoles( aMapShellHoles);
//Defines correct orientation of shells
for(; aItShellHoles.More();aItShellHoles.Next()) {
TopoDS_Shell aShell = TopoDS::Shell(aItShellHoles.Key());
for (Standard_Integer i = 1; i <= aMapShellHoles.Extent(); ++i) {
TopoDS_Shell aShell = TopoDS::Shell(aMapShellHoles.FindKey(i));
TopExp_Explorer aExpEdges(aShell,TopAbs_EDGE);
if(!BRep_Tool::IsClosed(aShell) || !aExpEdges.More()) {
ShellSolid.Add(aShell,aShell);
@@ -311,7 +318,7 @@ static Standard_Boolean CreateSolids(const TopoDS_Shape aShape,TopTools_IndexedM
aSolid = aTmpSolid;
}
const TopTools_ListOfShape& lHoles = aItShellHoles.Value();
const TopTools_ListOfShape& lHoles = aMapShellHoles (i);
for(TopTools_ListIteratorOfListOfShape lItHoles(lHoles); lItHoles.More();lItHoles.Next()) {
TopoDS_Shell aShellHole = TopoDS::Shell(lItHoles.Value());
if(aMapStatus.IsBound(aShellHole)) {