Mantis issue 0021200: A fix by PKV v2 (fixed regression)

This commit is contained in:
jfa 2011-03-29 08:47:52 +00:00
parent 5f39f63cba
commit 8598f0fe49

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_Builder_2.cxx // File: GEOMAlgo_Builder_2.cxx
// Author: Peter KURNEV // Author: Peter KURNEV
@ -411,11 +410,11 @@ static
//======================================================================= //=======================================================================
void GEOMAlgo_Builder::FillSameDomainFaces() void GEOMAlgo_Builder::FillSameDomainFaces()
{ {
Standard_Boolean bIsSDF, bHasImage1, bHasImage2; Standard_Boolean bIsSDF, bHasImage1, bHasImage2, bForward;
Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE; Standard_Integer i, j, aNbFF, nF1, nF2, aNbPBInOn, aNbC, aNbSE;
Standard_Integer aNbF1, aNbF2, i2s, aNbSD; Standard_Integer aNbF1, aNbF2, i2s, aNbSD;
TopTools_MapOfShape aMFence; TopTools_MapOfShape aMFence;
TopTools_ListOfShape aLSempty; TopTools_ListOfShape aLX1, aLX2;
TopTools_ListIteratorOfListOfShape aItF1, aItF2; TopTools_ListIteratorOfListOfShape aItF1, aItF2;
NMTTools_ListOfCoupleOfShape aLCS; NMTTools_ListOfCoupleOfShape aLCS;
// //
@ -463,12 +462,22 @@ static
// Try to find SDF among images of nF1, nF2 // Try to find SDF among images of nF1, nF2
aMFence.Clear(); aMFence.Clear();
// //
//XXXXXXXXXXXXXf //--------------------------------------------------------
bHasImage1=mySplitFaces.HasImage(aF1); bHasImage1=mySplitFaces.HasImage(aF1);
bHasImage2=mySplitFaces.HasImage(aF2); bHasImage2=mySplitFaces.HasImage(aF2);
// //
const TopTools_ListOfShape& aLF1r=(bHasImage1)? mySplitFaces.Image(aF1) : aLSempty; aLX1.Clear();
const TopTools_ListOfShape& aLF2r=(bHasImage2)? mySplitFaces.Image(aF2) : aLSempty; if (!bHasImage1) {
aLX1.Append(aF1);
}
//
aLX2.Clear();
if (!bHasImage2) {
aLX2.Append(aF2);
}
//
const TopTools_ListOfShape& aLF1r=(bHasImage1)? mySplitFaces.Image(aF1) : aLX1;
const TopTools_ListOfShape& aLF2r=(bHasImage2)? mySplitFaces.Image(aF2) : aLX2;
// //
TopTools_DataMapOfIntegerShape aMIS; TopTools_DataMapOfIntegerShape aMIS;
TColStd_ListIteratorOfListOfInteger aItLI; TColStd_ListIteratorOfListOfInteger aItLI;
@ -478,8 +487,10 @@ static
// //
aNbF1=aLF1r.Extent(); aNbF1=aLF1r.Extent();
aNbF2=aLF2r.Extent(); aNbF2=aLF2r.Extent();
const TopTools_ListOfShape& aLF1=(aNbF1<aNbF2)? aLF1r : aLF2r; bForward=(aNbF1<aNbF2);
const TopTools_ListOfShape& aLF2=(aNbF1<aNbF2)? aLF2r : aLF1r; //
const TopTools_ListOfShape& aLF1=bForward ? aLF1r : aLF2r;
const TopTools_ListOfShape& aLF2=bForward ? aLF2r : aLF1r;
// //
// 1. aTreeFiller // 1. aTreeFiller
aItF2.Initialize(aLF2); aItF2.Initialize(aLF2);
@ -518,10 +529,10 @@ static
for (; aItLI.More(); aItLI.Next()) { for (; aItLI.More(); aItLI.Next()) {
i2s=aItLI.Value(); i2s=aItLI.Value();
const TopoDS_Face& aF2y=*((TopoDS_Face*)(&aMIS.Find(i2s))); const TopoDS_Face& aF2y=*((TopoDS_Face*)(&aMIS.Find(i2s)));
//
bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx); bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx);
if (bIsSDF) { if (bIsSDF) {
if (aMFence.Contains(aF1x) || if (aMFence.Contains(aF1x) || aMFence.Contains(aF2y)) {
aMFence.Contains(aF2y)) {
continue; continue;
} }
aMFence.Add(aF1x); aMFence.Add(aF1x);
@ -533,22 +544,37 @@ static
aCS.SetShape2(aF2y); aCS.SetShape2(aF2y);
aLCS.Append(aCS); aLCS.Append(aCS);
// //
if (aF1x==aF1) { if (bForward) {
if (!mySplitFaces.HasImage(aF1)) { if (aF1x==aF1) {
mySplitFaces.Bind(aF1, aF1); if (!mySplitFaces.HasImage(aF1)) {
mySplitFaces.Bind(aF1, aF1);
}
}
if (aF2y==aF2) {
if (!mySplitFaces.HasImage(aF2)) {
mySplitFaces.Bind(aF2, aF2);
}
} }
} }
if (aF2y==aF2) { else {
if (!mySplitFaces.HasImage(aF2)) { if (aF1x==aF2) {
mySplitFaces.Bind(aF2, aF2); if (!mySplitFaces.HasImage(aF2)) {
mySplitFaces.Bind(aF2, aF2);
}
}
if (aF2y==aF1) {
if (!mySplitFaces.HasImage(aF1)) {
mySplitFaces.Bind(aF1, aF1);
}
} }
} }
//
break; break;
}//if (bIsSDF) { }//if (bIsSDF) {
}//for (; aItLI.More(); aItLI.Next()) { }//for (; aItLI.More(); aItLI.Next()) {
}//for (; aItF1.More(); aItF1.Next()) { }//for (; aItF1.More(); aItF1.Next()) {
}//for (i=1; i<=aNbFF; ++i) }//for (i=1; i<=aNbFF; ++i)
//XXXXXXXXXXXXXt //-------------------------------------------------------------
aNbC=aLCS.Extent(); aNbC=aLCS.Extent();
if (!aNbC) { if (!aNbC) {
return; return;
@ -598,19 +624,19 @@ static
continue; continue;
} }
// //
aF=TopoDS::Face(aS); aF=*((TopoDS_Face*)&aS);
// //
aLFx.Clear(); aLFx.Clear();
const TopTools_ListOfShape& aLF=mySplitFaces.Image(aF); const TopTools_ListOfShape& aLF=mySplitFaces.Image(aF);
aIt.Initialize(aLF); aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
aFSp=TopoDS::Face(aIt.Value()); aFSp=*((TopoDS_Face*)(&aIt.Value()));
if (!mySameDomainShapes.Contains(aFSp)) { if (!mySameDomainShapes.Contains(aFSp)) {
aLFx.Append(aFSp); aLFx.Append(aFSp);
} }
else { else {
const TopoDS_Shape& aSx=mySameDomainShapes.FindFromKey(aFSp); const TopoDS_Shape& aSx=mySameDomainShapes.FindFromKey(aFSp);
aFSD=TopoDS::Face(aSx); aFSD=*((TopoDS_Face*)(&aSx));
iSense=GEOMAlgo_Tools3D::Sense(aFSp, aFSD); iSense=GEOMAlgo_Tools3D::Sense(aFSp, aFSD);
if (iSense<0) { if (iSense<0) {
aFSD.Reverse(); aFSD.Reverse();
@ -618,6 +644,7 @@ static
aLFx.Append(aFSD); aLFx.Append(aFSD);
} }
} }
//
if (!myImages.HasImage(aF)) { if (!myImages.HasImage(aF)) {
aNbLFx=aLFx.Extent(); aNbLFx=aLFx.Extent();
if (aNbLFx==1) { if (aNbLFx==1) {