Mantis issue 0021453: EDF GEOM: (regression). A fix by PKV.

This commit is contained in:
jfa 2012-01-19 13:06:39 +00:00
parent fa5949562b
commit 2c478ddf44

View File

@ -18,13 +18,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: NMTTools_PaveFiller_7.cxx
// Created:
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTTools_PaveFiller.ixx>
#include <Bnd_HArray1OfBox.hxx>
@ -33,28 +30,27 @@
#include <BRepBndLib.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TopTools_DataMapOfShapeListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfInteger.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
@ -175,16 +171,15 @@ void NMTTools_PaveFiller::MakeSplitEdges()
}
myIsDone=Standard_True;
}
//modified by NIZNHY-PKV Mon Dec 12 09:16:37 2011f
//=======================================================================
// function: UpdateCommonBlocks
// purpose:
//=======================================================================
void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
{
Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints;
Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
TColStd_ListIteratorOfListOfInteger aItLI;
gp_Pnt aPMax[2];
TopoDS_Edge aEMax;
BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
@ -205,7 +200,53 @@ void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
}
//
NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
//modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
aNbLCB=aLCB.Extent();
if (!aNbLCB) {
continue;
}
// 0
NMTTools_ListOfCommonBlock aLCBx;
//
aItLCB.Initialize(aLCB);
for (; aItLCB.More(); aItLCB.Next()) {
NMTTools_CommonBlock aCBx;
//
NMTTools_CommonBlock& aCB=aItLCB.Value();
const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const BOPTools_PaveBlock& aPBx=aItLPB.Value();
nEx=aPBx.OriginalEdge();
BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
aItLPBS.Initialize(aLPBS);
for (; aItLPBS.More(); aItLPBS.Next()) {
const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
if (aPBSx.IsEqual(aPBx)) {
aCBx.AddPaveBlock(aPBSx);
break;
}
}// for (; aItLPBS.More(); aItLPBS.Next()) {
}// for (; aItLPB.More(); aItLPB.Next()) {
//
const TColStd_ListOfInteger& aLI=aCB.Faces();
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
nF=aItLI.Value();
aCBx.AddFace(nF);
}
//
aLCBx.Append(aCBx);
}//for (; aItLCB.More(); aItLCB.Next()) {
//
aLCB.Clear();
//
aItLCB.Initialize(aLCBx);
for (; aItLCB.More(); aItLCB.Next()) {
NMTTools_CommonBlock& aCBx=aItLCB.Value();
aLCB.Append(aCBx);
}
//modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
// 1
aItLCB.Initialize(aLCB);
for (; aItLCB.More(); aItLCB.Next()) {
@ -216,20 +257,20 @@ void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const BOPTools_PaveBlock& aPBx=aItLPB.Value();
nEx=aPBx.OriginalEdge();
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
aTolEx=BRep_Tool::Tolerance(aEx);
if (aTolEx>aTolExMax) {
aTolExMax=aTolEx;
aEMax=aEx;
aPBMax=aPBx;
}
const BOPTools_PaveBlock& aPBx=aItLPB.Value();
nEx=aPBx.OriginalEdge();
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
aTolEx=BRep_Tool::Tolerance(aEx);
if (aTolEx>aTolExMax) {
aTolExMax=aTolEx;
aEMax=aEx;
aPBMax=aPBx;
}
}
//
// 2
if (aMPB.Contains(aPBMax)) {
continue;
continue;
}
aMPB.Add(aPBMax);
//
@ -239,77 +280,76 @@ void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
const Bnd_Box& aBoxMax=aISRMax.BndBox();
aSRMax.Range(aTSRMax[0], aTSRMax[1]);
for (j=0; j<2; ++j) {
BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
}
//
// 3
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const BOPTools_PaveBlock& aPBx=aItLPB.Value();
nEx=aPBx.OriginalEdge();
if (nEx==nEMax) {
continue;
}
//
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
GeomAPI_ProjectPointOnCurve& aPPCx=myContext.ProjPC(aEx);
//
for (j=0; j<2; ++j) {
aPPCx.Perform(aPMax[j]);
aNbPoints=aPPCx.NbPoints();
if (!aNbPoints) {
break;
}
aTx[j]=aPPCx.LowerDistanceParameter();
}
if (!aNbPoints) {
// correction the range is impossible due to
// a projection problem
continue;
}
//
if (aTx[0]>aTx[1]){
aTmp=aTx[0];
aTx[0]=aTx[1];
aTx[1]=aTmp;
}
//
// 4 Correction
// 4.1 aPBx
{
const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
//
pSRx->SetFirst(aTx[0]);
pSRx->SetLast(aTx[1]);
*pBoxx=aBoxMax;
}
//
// 4.2 aPBSx
BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
aItLPBS.Initialize(aLPBSx);
for (; aItLPBS.More(); aItLPBS.Next()) {
const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
if (!aPBSx.IsEqual(aPBx)) {
continue;
}
//
const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
//
pSRx->SetFirst(aTx[0]);
pSRx->SetLast(aTx[1]);
*pBoxx=aBoxMax;
}
//
//
const BOPTools_PaveBlock& aPBx=aItLPB.Value();
nEx=aPBx.OriginalEdge();
if (nEx==nEMax) {
continue;
}
//
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
GeomAPI_ProjectPointOnCurve& aPPCx=myContext.ProjPC(aEx);
//
for (j=0; j<2; ++j) {
aPPCx.Perform(aPMax[j]);
aNbPoints=aPPCx.NbPoints();
if (!aNbPoints) {
break;
}
aTx[j]=aPPCx.LowerDistanceParameter();
}
if (!aNbPoints) {
// correction the range is impossible due to
// a projection problem
continue;
}
//
if (aTx[0]>aTx[1]){
aTmp=aTx[0];
aTx[0]=aTx[1];
aTx[1]=aTmp;
}
//
// 4 Correction
// 4.1 aPBx
{
const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
//
pSRx->SetFirst(aTx[0]);
pSRx->SetLast(aTx[1]);
*pBoxx=aBoxMax;
}
//
// 4.2 aPBSx
BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
aItLPBS.Initialize(aLPBSx);
for (; aItLPBS.More(); aItLPBS.Next()) {
const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
if (!aPBSx.IsEqual(aPBx)) {
continue;
}
//
const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
//
pSRx->SetFirst(aTx[0]);
pSRx->SetLast(aTx[1]);
*pBoxx=aBoxMax;
}
//
//
}//for (; aItLPB.More(); aItLPB.Next()) {
}//for (; aItLCB.More(); aItLCB.Next()) {
}//for (nE=1; nE<=aNbS; ++nE) {
}
//modified by NIZNHY-PKV Mon Dec 12 09:16:44 2011t
//=======================================================================
// function: UpdateCommonBlocks
// purpose:
@ -391,7 +431,7 @@ void NMTTools_PaveFiller::UpdateCommonBlocks()
// purpose:
//=======================================================================
Standard_Integer NMTTools_PaveFiller::SplitIndex
(const BOPTools_PaveBlock& aPBx)const
(const BOPTools_PaveBlock& aPBx) const
{
Standard_Integer anOriginalEdge, anEdgeIndex=0;
@ -409,6 +449,7 @@ Standard_Integer NMTTools_PaveFiller::SplitIndex
}
return anEdgeIndex;
}
//=======================================================================
// function: UpdatePaveBlocks
// purpose:
@ -417,7 +458,6 @@ void NMTTools_PaveFiller::UpdatePaveBlocks()
{
myIsDone=Standard_False;
//
Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
Standard_Real aT1, aT2;
TColStd_IndexedMapOfInteger aMF, aME;
@ -483,6 +523,7 @@ void NMTTools_PaveFiller::UpdatePaveBlocks()
}
}
}
//=======================================================================
// function: MakeAloneVertices
// purpose: