1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024491: Partition algorithm history bug (faces).

Modifications in history:
1. All splits of the shape are returned as Modified from that shape.
2. For SECTION operation section edges are returned as Generated from the face.
This commit is contained in:
emv 2013-12-25 16:24:57 +04:00 committed by bugmaster
parent b7357c8b55
commit b24ac89262
3 changed files with 87 additions and 116 deletions

View File

@ -20,6 +20,7 @@ uses
Shape from TopoDS, Shape from TopoDS,
BaseAllocator from BOPCol, BaseAllocator from BOPCol,
ListOfShape from BOPCol, ListOfShape from BOPCol,
ListOfShape from TopTools,
MapOfShape from BOPCol, MapOfShape from BOPCol,
IndexedDataMapOfShapeListOfShape from BOPCol, IndexedDataMapOfShapeListOfShape from BOPCol,
Operation from BOPAlgo, Operation from BOPAlgo,
@ -97,6 +98,14 @@ is
returns Boolean from Standard returns Boolean from Standard
is protected; is protected;
Generated (me:out;
theS : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the
-- shape theS.
returns ListOfShape from TopTools
is redefined;
---C++: return const &
fields fields
myNbArgs : Integer from Standard is protected; myNbArgs : Integer from Standard is protected;
myOperation : Operation from BOPAlgo is protected; myOperation : Operation from BOPAlgo is protected;

View File

@ -136,3 +136,45 @@
// //
myShape=aRC; myShape=aRC;
} }
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BOPAlgo_BOP::Generated(const TopoDS_Shape& theS)
{
myHistShapes.Clear();
if (theS.IsNull() || (myOperation != BOPAlgo_SECTION)) {
return myHistShapes;
}
//
TopAbs_ShapeEnum aType = theS.ShapeType();
if (aType != TopAbs_FACE) {
return myHistShapes;
}
//
Standard_Integer nS = myDS->Index(theS);
if (nS < 0) {
return myHistShapes;
}
//
if (!myDS->HasFaceInfo(nS)) {
return myHistShapes;
}
//
//collect section edges of the face theS
Standard_Integer i, aNb, nSp;
//
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
aNb = aMPBSc.Extent();
for (i = 1; i <= aNb; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
nSp = aPB->Edge();
const TopoDS_Shape& aSp = myDS->Shape(nSp);
myHistShapes.Append(aSp);
}
//
return myHistShapes;
}

View File

@ -29,55 +29,9 @@
//function : Generated //function : Generated
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopTools_ListOfShape& BOPAlgo_Builder::Generated(const TopoDS_Shape& theS) const TopTools_ListOfShape& BOPAlgo_Builder::Generated(const TopoDS_Shape&)
{ {
Standard_Boolean bHasImage, bToReverse;
TopAbs_ShapeEnum aType;
BOPCol_ListIteratorOfListOfShape aIt;
//
myHistShapes.Clear(); myHistShapes.Clear();
//
if (theS.IsNull()) {
return myHistShapes;
}
//
bHasImage=myImages.IsBound(theS);
if (!bHasImage) {
return myHistShapes;
}
//
aType=theS.ShapeType();
//
if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
return myHistShapes;
}
//
//PrepareHistory();
//
const BOPCol_ListOfShape& aLSp=myImages.Find(theS);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
if (myShapesSD.IsBound(aSp)) {
if (myMapShape.Contains(aSp)) {
TopoDS_Shape aSpR=myShapesSD.Find(aSp);
//
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
aSpR.Orientation(theS.Orientation());
}
else {
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSpR, theS, myContext);
if (bToReverse) {
aSpR.Reverse();
}
}
//
myHistShapes.Append(aSpR);
}
}
}
//
return myHistShapes; return myHistShapes;
} }
//======================================================================= //=======================================================================
@ -114,21 +68,23 @@
aIt.Initialize(aLSp); aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
TopoDS_Shape aSp=aIt.Value(); TopoDS_Shape aSp=aIt.Value();
if (!myShapesSD.IsBound(aSp)) { if (myShapesSD.IsBound(aSp)) {
if (myMapShape.Contains(aSp)) { aSp = myShapesSD.Find(aSp);
// }
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { //
aSp.Orientation(theS.Orientation()); if (myMapShape.Contains(aSp)) {
} //
else { if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext); aSp.Orientation(theS.Orientation());
if (bToReverse) {
aSp.Reverse();
}
}
//
myHistShapes.Append(aSp);
} }
else {
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
if (bToReverse) {
aSp.Reverse();
}
}
//
myHistShapes.Append(aSp);
} }
} }
// //
@ -175,13 +131,13 @@
// //
if (!myShapesSD.IsBound(aSp)) { if (!myShapesSD.IsBound(aSp)) {
if (myMapShape.Contains(aSp)) { if (myMapShape.Contains(aSp)) {
return bRet; //false return bRet; //false
} }
} }
else { else {
TopoDS_Shape aSpR=myShapesSD.Find(aSp); TopoDS_Shape aSpR=myShapesSD.Find(aSp);
if (myMapShape.Contains(aSpR)) { if (myMapShape.Contains(aSpR)) {
return bRet; //false return bRet; //false
} }
} }
} }
@ -201,7 +157,7 @@
return; return;
} }
// //
Standard_Boolean bHasImage, bContainsSD; Standard_Boolean bHasImage;
TopAbs_ShapeEnum aType; TopAbs_ShapeEnum aType;
BOPCol_MapOfShape aMS; BOPCol_MapOfShape aMS;
BOPCol_ListIteratorOfListOfShape aIt; BOPCol_ListIteratorOfListOfShape aIt;
@ -232,18 +188,18 @@
BOPCol_ListOfShape aLSx; BOPCol_ListOfShape aLSx;
if (!bHasImage) { if (!bHasImage) {
if (myMapShape.Contains(aSx)) { if (myMapShape.Contains(aSx)) {
aLSx.Append(aSx); aLSx.Append(aSx);
myImagesResult.Add(aSx, aLSx); myImagesResult.Add(aSx, aLSx);
} }
} }
else { else {
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx); const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
aIt.Initialize(aLSp); aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value(); const TopoDS_Shape& aSp=aIt.Value();
if (myMapShape.Contains(aSp)) { if (myMapShape.Contains(aSp)) {
aLSx.Append(aSp); aLSx.Append(aSp);
} }
} }
myImagesResult.Add(aSx, aLSx); myImagesResult.Add(aSx, aLSx);
} }
@ -254,55 +210,19 @@
myHasDeleted=IsDeleted(aSx); myHasDeleted=IsDeleted(aSx);
} }
// //
if (!myHasGenerated || !myHasModified) { if (!myHasModified && bHasImage) {
if (aType==TopAbs_EDGE || aType==TopAbs_FACE || if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) { aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
if (bHasImage) { myHasModified = Standard_True;
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
//
if (myMapShape.Contains(aSp)) {
bContainsSD=myShapesSD.IsBound(aSp);
//
if (!myHasGenerated) {
if (bContainsSD) {
myHasGenerated=Standard_True;
}
}
if (!myHasModified) {
if (!bContainsSD) {
myHasModified=Standard_True;
}
}
} // if (myMapShape.Contains(aSp))
}
}
} }
} }
//
if (!myHasGenerated) {
if (aType==TopAbs_FACE) {
const TopTools_ListOfShape& aLG = Generated(aSx);
myHasGenerated = aLG.Extent() > 0;
}
}
} }
myFlagHistory=Standard_True; myFlagHistory=Standard_True;
} }
// <- A
/*
BOPCol_ListOfShape aLSx;
if (!bHasImage) {
if (myMapShape.Contains(aSx)) {
aLSx.Append(aSx);
myImagesResult.Add(aSx, aLSx);
}
}
else {
const BOPCol_ListOfShape& aLSp=myImages.Find(aSx);
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSp=aIt.Value();
if (myMapShape.Contains(aSp)) {
aLSx.Append(aSp);
}
}
myImagesResult.Add(aSx, aLSx);
}
*/