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:
parent
b7357c8b55
commit
b24ac89262
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,21 +68,23 @@
|
||||
aIt.Initialize(aLSp);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
TopoDS_Shape aSp=aIt.Value();
|
||||
if (!myShapesSD.IsBound(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
if (myShapesSD.IsBound(aSp)) {
|
||||
aSp = myShapesSD.Find(aSp);
|
||||
}
|
||||
//
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
//
|
||||
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
aSp.Orientation(theS.Orientation());
|
||||
}
|
||||
else {
|
||||
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSp, theS, myContext);
|
||||
if (bToReverse) {
|
||||
aSp.Reverse();
|
||||
}
|
||||
}
|
||||
//
|
||||
myHistShapes.Append(aSp);
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -175,13 +131,13 @@
|
||||
//
|
||||
if (!myShapesSD.IsBound(aSp)) {
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
return bRet; //false
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape aSpR=myShapesSD.Find(aSp);
|
||||
if (myMapShape.Contains(aSpR)) {
|
||||
return bRet; //false
|
||||
return bRet; //false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -201,7 +157,7 @@
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bHasImage, bContainsSD;
|
||||
Standard_Boolean bHasImage;
|
||||
TopAbs_ShapeEnum aType;
|
||||
BOPCol_MapOfShape aMS;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
@ -232,18 +188,18 @@
|
||||
BOPCol_ListOfShape aLSx;
|
||||
if (!bHasImage) {
|
||||
if (myMapShape.Contains(aSx)) {
|
||||
aLSx.Append(aSx);
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
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);
|
||||
}
|
||||
const TopoDS_Shape& aSp=aIt.Value();
|
||||
if (myMapShape.Contains(aSp)) {
|
||||
aLSx.Append(aSp);
|
||||
}
|
||||
}
|
||||
myImagesResult.Add(aSx, aLSx);
|
||||
}
|
||||
@ -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);
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
if (bContainsSD) {
|
||||
myHasGenerated=Standard_True;
|
||||
}
|
||||
}
|
||||
if (!myHasModified) {
|
||||
if (!bContainsSD) {
|
||||
myHasModified=Standard_True;
|
||||
}
|
||||
}
|
||||
} // if (myMapShape.Contains(aSp))
|
||||
}
|
||||
}
|
||||
aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||
myHasModified = Standard_True;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!myHasGenerated) {
|
||||
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);
|
||||
}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user