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,
BaseAllocator from BOPCol,
ListOfShape from BOPCol,
ListOfShape from TopTools,
MapOfShape from BOPCol,
IndexedDataMapOfShapeListOfShape from BOPCol,
Operation from BOPAlgo,
@ -97,6 +98,14 @@ is
returns Boolean from Standard
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
myNbArgs : Integer from Standard is protected;
myOperation : Operation from BOPAlgo is protected;

View File

@ -136,3 +136,45 @@
//
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
//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();
//
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;
}
//=======================================================================
@ -114,7 +68,10 @@
aIt.Initialize(aLSp);
for (; aIt.More(); aIt.Next()) {
TopoDS_Shape aSp=aIt.Value();
if (!myShapesSD.IsBound(aSp)) {
if (myShapesSD.IsBound(aSp)) {
aSp = myShapesSD.Find(aSp);
}
//
if (myMapShape.Contains(aSp)) {
//
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
@ -130,7 +87,6 @@
myHistShapes.Append(aSp);
}
}
}
//
return myHistShapes;
}
@ -201,7 +157,7 @@
return;
}
//
Standard_Boolean bHasImage, bContainsSD;
Standard_Boolean bHasImage;
TopAbs_ShapeEnum aType;
BOPCol_MapOfShape aMS;
BOPCol_ListIteratorOfListOfShape aIt;
@ -254,55 +210,19 @@
myHasDeleted=IsDeleted(aSx);
}
//
if (!myHasGenerated || !myHasModified) {
if (!myHasModified && bHasImage) {
if (aType==TopAbs_EDGE || aType==TopAbs_FACE ||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
if (bHasImage) {
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);
myHasModified = Standard_True;
}
}
//
if (!myHasGenerated) {
if (bContainsSD) {
myHasGenerated=Standard_True;
}
}
if (!myHasModified) {
if (!bContainsSD) {
myHasModified=Standard_True;
}
}
} // if (myMapShape.Contains(aSp))
}
}
if (aType==TopAbs_FACE) {
const TopTools_ListOfShape& aLG = Generated(aSx);
myHasGenerated = aLG.Extent() > 0;
}
}
}
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);
}
*/