1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029333: Boolean Operations - Prevent modification of the input shapes in case their sub-shapes have not been modified

Prevent modification of the input shapes in destructive mode in case their sub-shapes have not been modified:
1. Prevent edge splitting for the pave blocks with old vertices if it is possible to use the existing edge (*BOPAlgo_PaveFiller::MakeSplitEdges*);
2. Prevent creation of the new containers (WIRES/SHELLS/COMPSOLIDS) if non of its parts have been modified (*BOPAlgo_Builder::FillImagesContainer*);
3. Prevent creation of the new face if non of its wires have been modified (*BOPAlgo_Builder::FillImagesFaces*);
4. If possible, use the original face to be the representative for the group of SD faces (*BOPAlgo_Builder::FillSameDomainFaces*).

Cosmetic changes:
1. Documentation of the *BOPAlgo_Builder* class.
2. Making simple methods of the *BOPAlgo_Builder* class inline.
3. Getting rid of the *BOPAlgo_Builder::mySplits* field as it is excessive. *BOPAlgo_Builder::myImages* can be used instead.
3. Moving the Check Inverted option from *BOPAlgo_Options* to *BOPAlgo_Builder*.

Test cases for the issue.
Adjustment of the test case to their current behavior.
Test case *blend/complex/H2* has been deleted as duplicate of the test case *blend/simple/Z1*.
This commit is contained in:
emv
2017-11-17 16:27:36 +03:00
committed by bugmaster
parent 1155d05a06
commit 81a55a6996
31 changed files with 817 additions and 649 deletions

View File

@@ -5632,14 +5632,8 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
GetBoundsToUpdate(aLF, theOEImages, theOEOrigins, aMEB,
aLABounds, aLAValid, aBounds, theAsDes);
//
// intersect valid splits with bounds and update both
// Intersect valid splits with bounds and update both
BOPAlgo_Builder aGF;
// The order is important here, because we need to keep the
// unmodified edges from the Bounds in the resulting maps.
// In case of total coincidence of the edges with the same vertices
// the edges in the common block will not be split and no new
// edges will be created and the first pave block
// will be used as a real pave block.
aGF.AddArgument(aBounds);
aGF.AddArgument(aSplits);
aGF.Perform();
@@ -5667,18 +5661,56 @@ void UpdateValidEdges(const TopTools_IndexedDataMapOfShapeListOfShape& theFImage
}
}
//
// Rebuild the map of edges to avoid, using the intersection results
TopTools_IndexedMapOfShape aMEAvoid;
// GF's data structure
const BOPDS_PDS& pDS = aGF.PDS();
aNbE = theEdgesToAvoid.Extent();
for (i = 1; i <= aNbE; ++i) {
for (i = 1; i <= aNbE; ++i)
{
const TopoDS_Shape& aE = theEdgesToAvoid(i);
const TopTools_ListOfShape& aLEIm = aGF.Modified(aE);
TopTools_ListIteratorOfListOfShape aItLEIm(aLEIm);
for (; aItLEIm.More(); aItLEIm.Next()) {
const TopoDS_Shape& aEIm = aItLEIm.Value();
if (!aNewEdges.Contains(aEIm)) {
theEdgesToAvoid.Add(aEIm);
// Only untouched and fully coinciding edges should be kept in the avoid map
Standard_Boolean bKeep = aLEIm.IsEmpty();
if (aLEIm.Extent() == 1 && aE.IsSame(aLEIm.First()))
{
const BOPDS_ListOfPaveBlock& aLPB = pDS->PaveBlocks(pDS->Index(aE));
if (aLPB.Extent() == 1)
{
const Handle(BOPDS_PaveBlock)& aPB = aLPB.First();
const Handle(BOPDS_CommonBlock)& aCB = pDS->CommonBlock(aPB);
if (!aCB.IsNull())
{
const BOPDS_ListOfPaveBlock& aLPBCB = aCB->PaveBlocks();
BOPDS_ListIteratorOfListOfPaveBlock aItLPB(aLPBCB);
for (; aItLPB.More(); aItLPB.Next())
{
if (pDS->PaveBlocks(aItLPB.Value()->OriginalEdge()).Extent() > 1)
break;
}
bKeep = !aItLPB.More();
}
}
}
if (bKeep)
{
// keep the original edge
aMEAvoid.Add(aE);
continue;
}
TopTools_ListIteratorOfListOfShape aItLEIm(aLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
const TopoDS_Shape& aEIm = aItLEIm.Value();
if (!aNewEdges.Contains(aEIm))
aMEAvoid.Add(aEIm);
}
}
theEdgesToAvoid = aMEAvoid;
}
//=======================================================================