Mantis issue 0020853: EDF 1394 GEOM: Partition fails between 2 faces. A patch by PKV.

This commit is contained in:
jfa 2010-06-17 07:19:16 +00:00
parent 882ddc2548
commit 22b9c99081

View File

@ -1,4 +1,4 @@
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
// //
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -19,14 +19,12 @@
// //
// 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: NMTTools_PaveFiller_4.cxx
// Created: Mon Dec 8 17:08:58 2003
// Author: Peter KURNEV
// File: NMTTools_PaveFiller_4.cxx
// Created: Mon Dec 8 17:08:58 2003
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTTools_PaveFiller.ixx> #include <NMTTools_PaveFiller.ixx>
//
#include <stdio.h> #include <stdio.h>
#include <Precision.hxx> #include <Precision.hxx>
@ -99,7 +97,6 @@
#include <NMTTools_CommonBlock.hxx> #include <NMTTools_CommonBlock.hxx>
#include <NMTTools_ListIteratorOfListOfCommonBlock.hxx> #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
@ -108,25 +105,25 @@
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
static static
void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
TopTools_DataMapOfShapeListOfShape& myImages, TopTools_DataMapOfShapeListOfShape& myImages,
TopTools_DataMapOfShapeShape& myOrigins); TopTools_DataMapOfShapeShape& myOrigins);
static static
void MakeNewVertex(const TopTools_ListOfShape& aLV, void MakeNewVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex& aNewVertex); TopoDS_Vertex& aNewVertex);
static
static
void VertexParameters(const IntTools_CommonPrt& aCPart, void VertexParameters(const IntTools_CommonPrt& aCPart,
Standard_Real& aT1, Standard_Real& aT1,
Standard_Real& aT2); Standard_Real& aT2);
static static
Standard_Boolean IsOnPave(const Standard_Real& aT1, Standard_Boolean IsOnPave(const Standard_Real& aT1,
const IntTools_Range& aRange, const IntTools_Range& aRange,
const Standard_Real& aTolerance); const Standard_Real& aTolerance);
static static
void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB); void EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB);
@ -135,15 +132,16 @@ static
const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
BOPTools_IMapOfPaveBlock& aProcessedBlocks, BOPTools_IMapOfPaveBlock& aProcessedBlocks,
BOPTools_IMapOfPaveBlock& aChain); BOPTools_IMapOfPaveBlock& aChain);
static static
void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
NMTTools_ListOfCommonBlock& aLCB); NMTTools_ListOfCommonBlock& aLCB);
//======================================================================= //=======================================================================
// function: PerformEE // function: PerformEE
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::PerformEE() void NMTTools_PaveFiller::PerformEE()
{ {
myIsDone=Standard_False; myIsDone=Standard_False;
// //
@ -153,7 +151,7 @@ static
Standard_Integer aNbLPB1, aNbLPB2; Standard_Integer aNbLPB1, aNbLPB2;
Standard_Real aTolE1, aTolE2, aDeflection=0.01; Standard_Real aTolE1, aTolE2, aDeflection=0.01;
BOPTools_ListIteratorOfListOfPaveBlock anIt1, anIt2; BOPTools_ListIteratorOfListOfPaveBlock anIt1, anIt2;
TopoDS_Edge aEWhat, aEWith; TopoDS_Edge aEWhat, aEWith;
TopoDS_Vertex aNewVertex; TopoDS_Vertex aNewVertex;
BooleanOperations_IndexedDataMapOfShapeInteger aMapVI; BooleanOperations_IndexedDataMapOfShapeInteger aMapVI;
BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB; BOPTools_IDMapOfPaveBlockIMapOfPaveBlock aMapCB;
@ -177,8 +175,8 @@ static
// continue; // continue;
//} //}
// //
nE1=n1; nE1=n1;
nE2=n2; nE2=n2;
// //
if(bJustAdd) { if(bJustAdd) {
//myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn); //myIntrPool->AddInterference (nE1, nE2, BooleanOperations_EdgeEdge, anIndexIn);
@ -187,7 +185,6 @@ static
// //
const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv const TopoDS_Edge aE1=TopoDS::Edge(myDS->Shape(nE1));//mpv
const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv const TopoDS_Edge aE2=TopoDS::Edge(myDS->Shape(nE2));//mpv
// //
if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){ if (BRep_Tool::Degenerated(aE1) || BRep_Tool::Degenerated(aE2)){
continue; continue;
@ -199,12 +196,12 @@ static
BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1)); BOPTools_ListOfPaveBlock& aLPB1=mySplitShapesPool(myDS->RefEdge(nE1));
BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2)); BOPTools_ListOfPaveBlock& aLPB2=mySplitShapesPool(myDS->RefEdge(nE2));
// //
// Modified Thu Sep 14 14:35:18 2006 // Modified Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
aNbLPB1=aLPB1.Extent(); aNbLPB1=aLPB1.Extent();
aNbLPB2=aLPB2.Extent(); aNbLPB2=aLPB2.Extent();
//
//if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) { //if (aE1.IsSame(aE2) && aNbLPB1==1 && aNbLPB2==1) {
// continue; // continue;
//} //}
// Contribution of Samtech www.samcef.com END // Contribution of Samtech www.samcef.com END
@ -219,14 +216,14 @@ static
for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) { for (anIt2.Initialize(aLPB2); anIt2.More(); anIt2.Next()) {
BOPTools_PaveBlock& aPB2=anIt2.Value(); BOPTools_PaveBlock& aPB2=anIt2.Value();
const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange(); const IntTools_ShrunkRange& aShrunkRange2=aPB2.ShrunkRange();
//
const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange(); const IntTools_Range& aSR2=aShrunkRange2.ShrunkRange();
const Bnd_Box& aBB2=aShrunkRange2.BndBox(); const Bnd_Box& aBB2=aShrunkRange2.BndBox();
// //
if (aBB1.IsOut (aBB2)) { if (aBB1.IsOut (aBB2)) {
continue; continue;
} }
// //
// EE // EE
IntTools_EdgeEdge aEE; IntTools_EdgeEdge aEE;
aEE.SetEdge1 (aE1); aEE.SetEdge1 (aE1);
@ -244,7 +241,7 @@ static
// //
aEE.SetRange1(anewSR1); aEE.SetRange1(anewSR1);
aEE.SetRange2(anewSR2); aEE.SetRange2(anewSR2);
//
aEE.Perform(); aEE.Perform();
// //
anIndexIn=0; anIndexIn=0;
@ -279,11 +276,14 @@ static
IntTools_Range aR1, aR2; IntTools_Range aR1, aR2;
// //
VertexParameters(aCPart, aT1, aT2); VertexParameters(aCPart, aT1, aT2);
// //
//decide to keep the pave or not //decide to keep the pave or not
aR1 = (aEE.Order()) ? anewSR2 : anewSR1; aR1 = (aEE.Order()) ? anewSR2 : anewSR1;
aR2 = (aEE.Order()) ? anewSR1 : anewSR2; aR2 = (aEE.Order()) ? anewSR1 : anewSR2;
// //
//modified by NIZNHY-PKV Mon Jun 07 11:01:40 2010f
aTol=0.8*aTol;
//modified by NIZNHY-PKV Mon Jun 07 11:01:43 2010t
bIsOnPave1=IsOnPave(aT1, aR1, aTol); bIsOnPave1=IsOnPave(aT1, aR1, aTol);
bIsOnPave2=IsOnPave(aT2, aR2, aTol); bIsOnPave2=IsOnPave(aT2, aR2, aTol);
// //
@ -353,7 +353,7 @@ static
aMapVI.Add(aNewVertex, anIndexIn); aMapVI.Add(aNewVertex, anIndexIn);
} }
break; break;
case TopAbs_EDGE: { case TopAbs_EDGE: {
Standard_Integer aNbComPrt2; Standard_Integer aNbComPrt2;
Standard_Boolean aCoinsideFlag; Standard_Boolean aCoinsideFlag;
@ -369,25 +369,25 @@ static
// Fill aMapCB // Fill aMapCB
if (aMapCB.Contains(aPB1)) { if (aMapCB.Contains(aPB1)) {
BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1); BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB1);
aMapPB.Add(aPB1); aMapPB.Add(aPB1);
aMapPB.Add(aPB2); aMapPB.Add(aPB2);
} }
else { else {
BOPTools_IMapOfPaveBlock aMapPB; BOPTools_IMapOfPaveBlock aMapPB;
aMapPB.Add(aPB1); aMapPB.Add(aPB1);
aMapPB.Add(aPB2); aMapPB.Add(aPB2);
aMapCB.Add(aPB1, aMapPB); aMapCB.Add(aPB1, aMapPB);
} }
// //
if (aMapCB.Contains(aPB2)) { if (aMapCB.Contains(aPB2)) {
BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2); BOPTools_IMapOfPaveBlock& aMapPB=aMapCB.ChangeFromKey(aPB2);
aMapPB.Add(aPB1); aMapPB.Add(aPB1);
aMapPB.Add(aPB2); aMapPB.Add(aPB2);
} }
else { else {
BOPTools_IMapOfPaveBlock aMapPB; BOPTools_IMapOfPaveBlock aMapPB;
aMapPB.Add(aPB1); aMapPB.Add(aPB1);
aMapPB.Add(aPB2); aMapPB.Add(aPB2);
aMapCB.Add(aPB2, aMapPB); aMapCB.Add(aPB2, aMapPB);
} }
// qqf // qqf
@ -399,18 +399,13 @@ static
break; break;
default: default:
break; break;
} // switch (aType) } // switch (aType)
} // for (i=1; i<=aNbCPrts; i++) } // for (i=1; i<=aNbCPrts; i++)
}// if (aEE.IsDone()) }// if (aEE.IsDone())
} // for (; anIt2.More(); anIt2.Next()) } // for (; anIt2.More(); anIt2.Next())
} // for (; anIt1.More(); anIt1.Next()) } // for (; anIt1.More(); anIt1.Next())
}// for (; myDSIt.More(); myDSIt.Next()) }// for (; myDSIt.More(); myDSIt.Next())
// //
//modified by NIZNHY-PKV Thu Mar 19 14:13:34 2009f
//
//EENewVertices (aMapVI);
//EECommonBlocks(aMapCB);
{ {
NMTTools_ListOfCommonBlock aLCB; NMTTools_ListOfCommonBlock aLCB;
// //
@ -420,18 +415,17 @@ static
TreatPaveBlocks(aLCB); TreatPaveBlocks(aLCB);
ReplaceCommonBlocks(aLCB); ReplaceCommonBlocks(aLCB);
} }
//modified by NIZNHY-PKV Thu Mar 19 14:13:42 2009t
// //
PerformVF1(); PerformVF1();
// //
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//modified by NIZNHY-PKV Thu Mar 19 14:13:52 2009f
//======================================================================= //=======================================================================
// function:TreatPaveBlocks // function:TreatPaveBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::TreatPaveBlocks (NMTTools_ListOfCommonBlock& theLCB) void NMTTools_PaveFiller::TreatPaveBlocks (NMTTools_ListOfCommonBlock& theLCB)
{ {
Standard_Boolean bFound; Standard_Boolean bFound;
Standard_Integer nE, nV, nVp, iFlag; Standard_Integer nE, nV, nVp, iFlag;
@ -506,27 +500,28 @@ static
}//for (; anItLPB.More(); anItLPB.Next()) { }//for (; anItLPB.More(); anItLPB.Next()) {
} }
} }
//modified by NIZNHY-PKV Thu Mar 19 14:14:13 2009t
//======================================================================= //=======================================================================
// function:EECommonBlocks // function:EECommonBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB) void NMTTools_PaveFiller::EECommonBlocks(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB)
{ {
NMTTools_ListOfCommonBlock aLCB; NMTTools_ListOfCommonBlock aLCB;
// //
FindChains(aMapCB, aLCB); FindChains(aMapCB, aLCB);
ReplaceCommonBlocks(aLCB); ReplaceCommonBlocks(aLCB);
} }
//======================================================================= //=======================================================================
// function:EENewVertices // function:EENewVertices
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) void NMTTools_PaveFiller::EENewVertices (const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
{ {
Standard_Integer aNb, aNbVSD, nVnew, nIEE, nE[2], j, iFlag; Standard_Integer aNb, aNbVSD, nVnew, nIEE, nE[2], j, iFlag;
Standard_Real aT; Standard_Real aT;
TopoDS_Edge aE; TopoDS_Edge aE;
TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins; TopTools_DataMapOfShapeShape myOrigins;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
@ -538,11 +533,11 @@ static
BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
// //
aNb=aMapVI.Extent(); aNb=aMapVI.Extent();
if (!aNb) { // no new vertices, no new problems if (!aNb) { // no new vertices, no new problems
return; return;
} }
// //
// 0. // 0.
if (aNb==1) { if (aNb==1) {
TopoDS_Vertex aV1=TopoDS::Vertex(aMapVI.FindKey(1)); TopoDS_Vertex aV1=TopoDS::Vertex(aMapVI.FindKey(1));
EENewVertices(aV1, aMapVI); EENewVertices(aV1, aMapVI);
@ -600,11 +595,11 @@ static
// completely rewritten // completely rewritten
//======================================================================= //=======================================================================
//function : TreatNewVertices //function : TreatNewVertices
//purpose : //purpose :
//======================================================================= //=======================================================================
void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI, void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI,
TopTools_DataMapOfShapeListOfShape& myImages, TopTools_DataMapOfShapeListOfShape& myImages,
TopTools_DataMapOfShapeShape& myOrigins) TopTools_DataMapOfShapeShape& myOrigins)
{ {
Standard_Integer j, i, aNbV, aNbVSD; Standard_Integer j, i, aNbV, aNbVSD;
Standard_Real aTol; Standard_Real aTol;
@ -636,13 +631,13 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap
Bnd_Box aBox; Bnd_Box aBox;
// //
aTol=BRep_Tool::Tolerance(TopoDS::Vertex(aV)); aTol=BRep_Tool::Tolerance(TopoDS::Vertex(aV));
aBox.SetGap(aTol); aBox.SetGap(aTol);
BRepBndLib::Add(aV, aBox); BRepBndLib::Add(aV, aBox);
// //
aTreeFiller.Add(i, aBox); aTreeFiller.Add(i, aBox);
// //
aMIS.Add(i, aV); aMIS.Add(i, aV);
aMSB.Add(aV, aBox); aMSB.Add(aV, aBox);
} }
// //
aTreeFiller.Fill(); aTreeFiller.Fill();
@ -678,7 +673,7 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap
// //
aNbVSD=aBBTree.Select(aSelector); aNbVSD=aBBTree.Select(aSelector);
if (!aNbVSD) { if (!aNbVSD) {
continue; // it must not be continue; // it must not be
} }
// //
const TColStd_ListOfInteger& aLI=aSelector.Indices(); const TColStd_ListOfInteger& aLI=aSelector.Indices();
@ -775,12 +770,12 @@ void TreatNewVertices(const BooleanOperations_IndexedDataMapOfShapeInteger& aMap
} }
} }
} }
//
//======================================================================= //=======================================================================
//function : MakeNewVertex //function : MakeNewVertex
//purpose : //purpose :
//======================================================================= //=======================================================================
void MakeNewVertex(const TopTools_ListOfShape& aLV, void MakeNewVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex& aNewVertex) TopoDS_Vertex& aNewVertex)
{ {
Standard_Integer aNbV; Standard_Integer aNbV;
@ -822,16 +817,17 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
// //
aBB.MakeVertex (aNewVertex, aPGC, aDmax); aBB.MakeVertex (aNewVertex, aPGC, aDmax);
} }
//======================================================================= //=======================================================================
// function:EENewVertices // function:EENewVertices
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex, void NMTTools_PaveFiller::EENewVertices (const TopoDS_Vertex& aNewVertex,
const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI) const BooleanOperations_IndexedDataMapOfShapeInteger& aMapVI)
{ {
Standard_Integer i, aNewShape, nE1, nE2; Standard_Integer i, aNewShape, nE1, nE2;
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
BOPTools_Pave aPave; BOPTools_Pave aPave;
// //
BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences(); BOPTools_CArray1OfEEInterference& aEEs=myIP->EEInterferences();
@ -864,11 +860,12 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2)); BOPTools_PaveSet& aPaveSet2=myPavePoolNew(myDS->RefEdge(nE2));
aPaveSet2.Append(aPave); aPaveSet2.Append(aPave);
} }
//======================================================================= //=======================================================================
// function: RefinePavePool // function: RefinePavePool
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::RefinePavePool() void NMTTools_PaveFiller::RefinePavePool()
{ {
Standard_Integer i, aNbNew; Standard_Integer i, aNbNew;
@ -897,19 +894,20 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: PreparePaveBlocks // function: PreparePaveBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1, void NMTTools_PaveFiller::PreparePaveBlocks(const TopAbs_ShapeEnum aType1,
const TopAbs_ShapeEnum aType2) const TopAbs_ShapeEnum aType2)
{ {
myIsDone=Standard_False; myIsDone=Standard_False;
// //
Standard_Boolean bOk1, bOk2, bOk3, bFlag; Standard_Boolean bOk1, bOk2, bOk3, bFlag;
Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits; Standard_Integer i, aNb, nE[2], n1, n2, aNbSplits;
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
//
bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ; bOk1= (aType1==TopAbs_VERTEX) && (aType2==TopAbs_EDGE) ;
bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ; bOk2= (aType1==TopAbs_EDGE) && (aType2==TopAbs_EDGE) ;
bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ; bOk3= (aType1==TopAbs_EDGE) && (aType2==TopAbs_FACE) ;
@ -923,10 +921,10 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
for (; myDSIt->More(); myDSIt->Next()) { for (; myDSIt->More(); myDSIt->Next()) {
myDSIt->Current(n1, n2, bFlag); myDSIt->Current(n1, n2, bFlag);
// //
nE[0]=n1; nE[0]=n1;
nE[1]=n2; nE[1]=n2;
if (myDS->GetShapeType(n1)!=TopAbs_EDGE) { if (myDS->GetShapeType(n1)!=TopAbs_EDGE) {
nE[0]=n2; nE[0]=n2;
nE[1]=n1; nE[1]=n1;
} }
// //
@ -934,7 +932,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE[i])); BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE[i]));
aNbSplits=aLPB.Extent(); aNbSplits=aLPB.Extent();
if (!aNbSplits) { if (!aNbSplits) {
if (aMap.Add(nE[i])) { if (aMap.Add(nE[i])) {
PreparePaveBlocks(nE[i]); PreparePaveBlocks(nE[i]);
if (!myIsDone) { if (!myIsDone) {
return; return;
@ -942,14 +940,15 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
}// for (; myDSIt.More(); myDSIt.Next()) }// for (; myDSIt.More(); myDSIt.Next())
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//======================================================================= //=======================================================================
// function: PreparePaveBlocks // function: PreparePaveBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE) void NMTTools_PaveFiller::PreparePaveBlocks(const Standard_Integer nE)
{ {
myIsDone=Standard_False; myIsDone=Standard_False;
// //
@ -959,7 +958,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex aV1, aV2; TopoDS_Vertex aV1, aV2;
// //
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE)); BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
// Edge // Edge
aE=TopoDS::Edge(myDS->Shape(nE)); aE=TopoDS::Edge(myDS->Shape(nE));
if (BRep_Tool::Degenerated(aE)) { if (BRep_Tool::Degenerated(aE)) {
myIsDone=Standard_True; myIsDone=Standard_True;
@ -967,7 +966,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
// //
BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE)); BOPTools_PaveSet& aPS=myPavePool(myDS->RefEdge(nE));
//
BOPTools_PaveBlockIterator aPBIt(nE, aPS); BOPTools_PaveBlockIterator aPBIt(nE, aPS);
for (; aPBIt.More(); aPBIt.Next()) { for (; aPBIt.More(); aPBIt.Next()) {
BOPTools_PaveBlock& aPB=aPBIt.Value(); BOPTools_PaveBlock& aPB=aPBIt.Value();
@ -988,7 +987,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE); sprintf (buf, "Can not obtain ShrunkRange for Edge %d\n", nE);
BOPTColStd_Dump::PrintMessage(buf); BOPTColStd_Dump::PrintMessage(buf);
sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE); sprintf (buf, "Can not obtain ShrunkRange for Edge %d", nE);
throw throw
BOPTColStd_Failure(buf) ; BOPTColStd_Failure(buf) ;
} }
// //
@ -1005,16 +1004,17 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
// //
aPB.SetShrunkRange(aSR); aPB.SetShrunkRange(aSR);
aLPB.Append(aPB); aLPB.Append(aPB);
} //for (; aPBIt.More(); aPBIt.Next()) } //for (; aPBIt.More(); aPBIt.Next())
myIsDone=Standard_True; myIsDone=Standard_True;
} }
//======================================================================= //=======================================================================
// function: CorrectShrunkRanges // function: CorrectShrunkRanges
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide, void NMTTools_PaveFiller::CorrectShrunkRanges(const Standard_Integer aSide,
const BOPTools_Pave& aPave, const BOPTools_Pave& aPave,
IntTools_ShrunkRange& aShrunkRange) IntTools_ShrunkRange& aShrunkRange)
{ {
BooleanOperations_KindOfInterference aType; BooleanOperations_KindOfInterference aType;
Standard_Integer anIndexInterf ; Standard_Integer anIndexInterf ;
@ -1039,7 +1039,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
const IntTools_Range& aSR=aShrunkRange.ShrunkRange(); const IntTools_Range& aSR=aShrunkRange.ShrunkRange();
const TopoDS_Edge& aE=aShrunkRange.Edge(); const TopoDS_Edge& aE=aShrunkRange.Edge();
IntTools_Range aNewRange; IntTools_Range aNewRange;
IntTools_Range aCPRange; IntTools_Range aCPRange;
@ -1079,13 +1079,13 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: IsBlocksCoinside // function: IsBlocksCoinside
// purpose: // purpose:
//======================================================================= //=======================================================================
Standard_Boolean Standard_Boolean NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1,
NMTTools_PaveFiller::IsBlocksCoinside(const BOPTools_PaveBlock& aPB1, const BOPTools_PaveBlock& aPB2) const
const BOPTools_PaveBlock& aPB2) const
{ {
Standard_Boolean bRetFlag=Standard_True; Standard_Boolean bRetFlag=Standard_True;
Standard_Real aTolV11, aTolV12, aTolV21, aTolV22; Standard_Real aTolV11, aTolV12, aTolV21, aTolV22;
@ -1101,7 +1101,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
aTolV12=BRep_Tool::Tolerance(aV12); aTolV12=BRep_Tool::Tolerance(aV12);
aTolV21=BRep_Tool::Tolerance(aV21); aTolV21=BRep_Tool::Tolerance(aV21);
aTolV22=BRep_Tool::Tolerance(aV22); aTolV22=BRep_Tool::Tolerance(aV22);
aP11=BRep_Tool::Pnt(aV11); aP11=BRep_Tool::Pnt(aV11);
aP12=BRep_Tool::Pnt(aV12); aP12=BRep_Tool::Pnt(aV12);
aP21=BRep_Tool::Pnt(aV21); aP21=BRep_Tool::Pnt(aV21);
@ -1128,20 +1128,22 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
return !bRetFlag; return !bRetFlag;
} }
//======================================================================= //=======================================================================
// function: ReplaceCommonBlocks // function: ReplaceCommonBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) void NMTTools_PaveFiller::ReplaceCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
{ {
RemoveCommonBlocks(aLCB); RemoveCommonBlocks(aLCB);
SplitCommonBlocks(aLCB); SplitCommonBlocks(aLCB);
} }
//======================================================================= //=======================================================================
// function: SplitCommonBlocks // function: SplitCommonBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) void NMTTools_PaveFiller::SplitCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
{ {
Standard_Integer nE; Standard_Integer nE;
NMTTools_ListOfCommonBlock aLCBx; NMTTools_ListOfCommonBlock aLCBx;
@ -1171,10 +1173,10 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
// Modified to provide the order of edges // Modified to provide the order of edges
// in common block where the edge with max // in common block where the edge with max
// tolerance value will be the first // tolerance value will be the first
// Thu Sep 14 14:35:18 2006 // Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
Standard_Integer i, iMax, aNb, aNbCB, nSp; Standard_Integer i, iMax, aNb, aNbCB, nSp;
Standard_Real aTolSp, aTolMax; Standard_Real aTolSp, aTolMax;
@ -1231,11 +1233,12 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
}//for (nE=1; nE<=aNb; ++nE) { }//for (nE=1; nE<=aNb; ++nE) {
// Contribution of Samtech www.samcef.com END // Contribution of Samtech www.samcef.com END
} }
//======================================================================= //=======================================================================
// function: RemoveCommonBlocks // function: RemoveCommonBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB) void NMTTools_PaveFiller::RemoveCommonBlocks(const NMTTools_ListOfCommonBlock& aLCB)
{ {
Standard_Integer nE; Standard_Integer nE;
NMTTools_ListOfCommonBlock aLCBx; NMTTools_ListOfCommonBlock aLCBx;
@ -1247,7 +1250,7 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
const NMTTools_CommonBlock& aCB=anItCB.Value(); const NMTTools_CommonBlock& aCB=anItCB.Value();
const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
// //
// Remove aCB from each edge // Remove aCB from each edge
anItLPB.Initialize(aLPB); anItLPB.Initialize(aLPB);
for (; anItLPB.More(); anItLPB.Next()) { for (; anItLPB.More(); anItLPB.Next()) {
const BOPTools_PaveBlock& aPB=anItLPB.Value(); const BOPTools_PaveBlock& aPB=anItLPB.Value();
@ -1265,24 +1268,24 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
} }
//======================================================================= //=======================================================================
// function: SplitCommonBlock // function: SplitCommonBlock
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB, void NMTTools_PaveFiller::SplitCommonBlock(const NMTTools_CommonBlock& aCB,
NMTTools_ListOfCommonBlock& aLCBx) NMTTools_ListOfCommonBlock& aLCBx)
{ {
Standard_Integer i, j, k, nE, aNbE, aNbSPBx, aNbPB; Standard_Integer i, j,nE, aNbE, aNbSPBx, aNbPB, k;
BOPTools_SequenceOfPaveBlock aSPBx; BOPTools_SequenceOfPaveBlock aSPBx;
BOPTools_ListIteratorOfListOfPaveBlock anItLPB; BOPTools_ListIteratorOfListOfPaveBlock anItLPB;
BOPTools_ListIteratorOfListOfPave anIt; BOPTools_ListIteratorOfListOfPave anIt;
BOPTools_PaveBlockIterator anPBIt;
BOPTools_PaveBlockIterator anPBIt;
// //
const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks(); const BOPTools_ListOfPaveBlock& aLPB=aCB.PaveBlocks();
aNbE=aLPB.Extent(); aNbE=aLPB.Extent();
// //
// 1. Whether we realy need to split the common block ? // 1. Checking: Whether we realy need to split the common block ?
anItLPB.Initialize(aLPB); anItLPB.Initialize(aLPB);
for (; anItLPB.More(); anItLPB.Next()) { for (; anItLPB.More(); anItLPB.Next()) {
const BOPTools_PaveBlock& aPB=anItLPB.Value(); const BOPTools_PaveBlock& aPB=anItLPB.Value();
@ -1346,12 +1349,43 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
} }
// //
// 3. Do new common blocks // 3. Do new common blocks
// //
const TColStd_ListOfInteger& aLF=aCB.Faces(); const TColStd_ListOfInteger& aLF=aCB.Faces();
aNbSPBx=aSPBx.Length(); aNbSPBx=aSPBx.Length();
aNbPB=aNbSPBx/aNbE; aNbPB=aNbSPBx/aNbE;
// //
//modified by NIZNHY-PKV Fri Jun 04 14:07:37 2010f
//
Standard_Integer k1, k2, n11, n12, n21, n22;
//
for (i=1; i<=aNbPB; ++i) {
NMTTools_CommonBlock aCBx;
//
aCBx.AddFaces(aLF);
//
const BOPTools_PaveBlock& aPB1=aSPBx(i);
n11=aPB1.Pave1().Index();
n12=aPB1.Pave2().Index();
//
aCBx.AddPaveBlock(aPB1);
//
for (j=2; j<=aNbE; ++j) {
k1=(j-1)*aNbPB+1;
k2=k1+aNbPB-1;
for(k=k1; k<=k2; ++k) {
const BOPTools_PaveBlock& aPB2=aSPBx(k);
n21=aPB2.Pave1().Index();
n22=aPB2.Pave2().Index();
if ((n21==n11 && n22==n12) || (n21==n12 && n22==n11)) {
aCBx.AddPaveBlock(aPB2);
break;
}
}
}
aLCBx.Append(aCBx);
}
/*
for (i=1; i<=aNbPB; ++i) { for (i=1; i<=aNbPB; ++i) {
NMTTools_CommonBlock aCBx; NMTTools_CommonBlock aCBx;
// //
@ -1364,14 +1398,16 @@ void MakeNewVertex(const TopTools_ListOfShape& aLV,
} }
aLCBx.Append(aCBx); aLCBx.Append(aCBx);
} }
*/
//modified by NIZNHY-PKV Fri Jun 04 14:07:42 2010t
} }
//======================================================================= //=======================================================================
// function: VertexParameters // function: VertexParameters
// purpose: // purpose:
//======================================================================= //=======================================================================
void VertexParameters(const IntTools_CommonPrt& aCPart, void VertexParameters(const IntTools_CommonPrt& aCPart,
Standard_Real& aT1, Standard_Real& aT1,
Standard_Real& aT2) Standard_Real& aT2)
{ {
const IntTools_Range& aR1=aCPart.Range1(); const IntTools_Range& aR1=aCPart.Range1();
@ -1391,9 +1427,10 @@ void VertexParameters(const IntTools_CommonPrt& aCPart,
aT2 = aCPart.VertexParameter2(); aT2 = aCPart.VertexParameter2();
} }
} }
//======================================================================= //=======================================================================
// function: KeepPave // function: KeepPave
// purpose: // purpose:
//======================================================================= //=======================================================================
Standard_Boolean IsOnPave(const Standard_Real& aT1, Standard_Boolean IsOnPave(const Standard_Real& aT1,
const IntTools_Range& aRange, const IntTools_Range& aRange,
@ -1409,7 +1446,7 @@ Standard_Boolean IsOnPave(const Standard_Real& aT1,
//======================================================================= //=======================================================================
// function:FindChains // function:FindChains
// purpose: // purpose:
//======================================================================= //=======================================================================
void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
NMTTools_ListOfCommonBlock& aLCB) NMTTools_ListOfCommonBlock& aLCB)
@ -1445,9 +1482,10 @@ void FindChains(const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
aChain.Clear(); aChain.Clear();
} }
} }
//======================================================================= //=======================================================================
// function:ProcessBlock // function:ProcessBlock
// purpose: // purpose:
//======================================================================= //=======================================================================
void ProcessBlock(const BOPTools_PaveBlock& aPB, void ProcessBlock(const BOPTools_PaveBlock& aPB,
const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB, const BOPTools_IDMapOfPaveBlockIMapOfPaveBlock& aMapCB,
@ -1469,13 +1507,14 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB,
ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain); ProcessBlock(aPBx, aMapCB, aProcessedBlocks, aChain);
} }
} }
// Modified to provide VS interference between // Modified to provide VS interference between
// vertex as result of EE and a Face of argument // vertex as result of EE and a Face of argument
// Thu Sep 14 14:35:18 2006 // Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN // Contribution of Samtech www.samcef.com BEGIN
//======================================================================= //=======================================================================
// function: PerformVF1 // function: PerformVF1
// purpose: // purpose:
//======================================================================= //=======================================================================
void NMTTools_PaveFiller::PerformVF1() void NMTTools_PaveFiller::PerformVF1()
{ {
@ -1511,7 +1550,7 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB,
const TopoDS_Shape& aSnew=myDS->Shape(nNewShape); const TopoDS_Shape& aSnew=myDS->Shape(nNewShape);
if (aSnew.ShapeType()!=TopAbs_VERTEX) { if (aSnew.ShapeType()!=TopAbs_VERTEX) {
continue; continue;
} }
// //
const TopoDS_Vertex& aVnew=TopoDS::Vertex(aSnew); const TopoDS_Vertex& aVnew=TopoDS::Vertex(aSnew);
// //
@ -1540,5 +1579,5 @@ void ProcessBlock(const BOPTools_PaveBlock& aPB,
} }
} }
} }
} }
// Contribution of Samtech www.samcef.com END // Contribution of Samtech www.samcef.com END