//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BOPAlgo_PaveFiller.ixx>
-
-#include <Precision.hxx>
-#include <NCollection_IncAllocator.hxx>
-#include <NCollection_UBTreeFiller.hxx>
#include <Bnd_Box.hxx>
-
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Compound.hxx>
-#include <BRep_Tool.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_SectionAttribute.hxx>
+#include <BOPAlgo_Tools.hxx>
+#include <BOPCol_BoxBndTree.hxx>
+#include <BOPCol_DataMapOfIntegerShape.hxx>
+#include <BOPCol_DataMapOfShapeInteger.hxx>
+#include <BOPCol_DataMapOfShapeListOfShape.hxx>
+#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
+#include <BOPCol_NCVector.hxx>
+#include <BOPCol_Parallel.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_CoupleOfPaveBlocks.hxx>
+#include <BOPDS_Curve.hxx>
+#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
+#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
+#include <BOPDS_DS.hxx>
+#include <BOPDS_Interf.hxx>
+#include <BOPDS_Iterator.hxx>
+#include <BOPDS_MapOfPaveBlock.hxx>
+#include <BOPDS_Pave.hxx>
+#include <BOPDS_PaveBlock.hxx>
+#include <BOPDS_VectorOfInterfEE.hxx>
+#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
+#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
-//
+#include <BRepTools.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <gp_Pnt.hxx>
+#include <IntTools_CommonPrt.hxx>
+#include <IntTools_Context.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_Range.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
-#include <IntTools_CommonPrt.hxx>
#include <IntTools_SequenceOfRanges.hxx>
+#include <IntTools_ShrunkRange.hxx>
+#include <IntTools_Tools.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <NCollection_UBTreeFiller.hxx>
+#include <Precision.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Vertex.hxx>
+
//
-#include <BOPTools_AlgoTools.hxx>
//
-#include <BOPCol_DataMapOfShapeInteger.hxx>
-#include <BOPCol_DataMapOfIntegerShape.hxx>
-#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
-#include <BOPCol_BoxBndTree.hxx>
//
-#include <BOPInt_Context.hxx>
-#include <BOPInt_ShrunkRange.hxx>
-#include <BOPInt_Tools.hxx>
//
-#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
-#include <BOPDS_MapOfPaveBlock.hxx>
-#include <BOPDS_CommonBlock.hxx>
-#include <BOPDS_CoupleOfPaveBlocks.hxx>
-#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
-#include <BOPDS_Iterator.hxx>
-#include <BOPDS_VectorOfInterfEE.hxx>
-#include <BOPDS_Interf.hxx>
-#include <BOPDS_Pave.hxx>
//
-#include <BOPAlgo_Tools.hxx>
-
+//
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_EdgeEdge
+//purpose :
+//=======================================================================
+class BOPAlgo_EdgeEdge :
+ public IntTools_EdgeEdge,
+ public BOPAlgo_Algo {
+
+ public:
+ DEFINE_STANDARD_ALLOC
+ //
+ BOPAlgo_EdgeEdge():
+ IntTools_EdgeEdge(),
+ BOPAlgo_Algo() {
+ };
+ //
+ virtual ~BOPAlgo_EdgeEdge(){
+ };
+ //
+ void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& aPB) {
+ myPB1=aPB;
+ }
+ //
+ Handle(BOPDS_PaveBlock)& PaveBlock1() {
+ return myPB1;
+ }
+ //
+ void SetPaveBlock2(const Handle(BOPDS_PaveBlock)& aPB) {
+ myPB2=aPB;
+ }
+ //
+ Handle(BOPDS_PaveBlock)& PaveBlock2() {
+ return myPB2;
+ }
+ //
+ virtual void Perform() {
+ BOPAlgo_Algo::UserBreak();
+ IntTools_EdgeEdge::Perform();
+ }
+ //
+ protected:
+ Handle(BOPDS_PaveBlock) myPB1;
+ Handle(BOPDS_PaveBlock) myPB2;
+};
+//
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
+//
+typedef BOPCol_Functor
+ <BOPAlgo_EdgeEdge,
+ BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
+//
+typedef BOPCol_Cnt
+ <BOPAlgo_EdgeEdgeFunctor,
+ BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
+//
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_TNV
+//purpose :
+//=======================================================================
+class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
+ public:
+ BOPAlgo_TNV()
+ : BOPCol_BoxBndTreeSelector(), myTree(NULL) {
+ };
+ //
+ ~BOPAlgo_TNV(){
+ };
+ //
+ void SetVertex(const TopoDS_Vertex& aV) {
+ myV=aV;
+ }
+ //
+ const TopoDS_Vertex& Vertex()const {
+ return myV;
+ }
+ //
+ void SetTree(BOPCol_BoxBndTree& aTree) {
+ myTree=&aTree;
+ }
+ //
+ void Perform() {
+ myTree->Select(*this);
+ }
+ //
+ protected:
+ TopoDS_Vertex myV;
+ BOPCol_BoxBndTree *myTree;
+};
+//
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
+//
+typedef BOPCol_Functor
+ <BOPAlgo_TNV,
+ BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
+//
+typedef BOPCol_Cnt
+ <BOPAlgo_TNVFunctor,
+ BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_PVE
+//purpose :
+//=======================================================================
+class BOPAlgo_PVE {
+ public:
+ BOPAlgo_PVE()
+ : myIV(-1), myIE(-1), myFlag(-1), myT(-1.) {
+ };
+ //
+ ~BOPAlgo_PVE(){
+ };
+ //
+ void SetIndices(const Standard_Integer nV,
+ const Standard_Integer nE){
+ myIV=nV;
+ myIE=nE;
+ }
+ //
+ void Indices(Standard_Integer& nV,
+ Standard_Integer& nE) const {
+ nV=myIV;
+ nE=myIE;
+ }
+ //
+ void SetVertex(const TopoDS_Vertex& aV) {
+ myV=aV;
+ }
+ //
+ const TopoDS_Vertex& Vertex()const {
+ return myV;
+ }
+ //
+ void SetEdge(const TopoDS_Edge& aE) {
+ myE=aE;
+ }
+ //
+ const TopoDS_Edge& Edge()const {
+ return myE;
+ }
+ //
+ void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
+ myPB=aPB;
+ }
+ //
+ Handle(BOPDS_PaveBlock)& PaveBlock() {
+ return myPB;
+ }
+ //
+ Standard_Integer Flag()const {
+ return myFlag;
+ }
+ //
+ Standard_Real Parameter()const {
+ return myT;
+ }
+ //
+ void SetContext(const Handle(IntTools_Context)& aContext) {
+ myContext=aContext;
+ }
+ //
+ const Handle(IntTools_Context)& Context()const {
+ return myContext;
+ }
+ //
+ void Perform() {
+ myFlag=myContext->ComputeVE (myV, myE, myT);
+ };
+ //
+ protected:
+ Standard_Integer myIV;
+ Standard_Integer myIE;
+ Standard_Integer myFlag;
+ Standard_Real myT;
+ TopoDS_Vertex myV;
+ TopoDS_Edge myE;
+ Handle(BOPDS_PaveBlock) myPB;
+ Handle(IntTools_Context) myContext;
+};
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_PVE> BOPAlgo_VectorOfPVE;
+//
+typedef BOPCol_ContextFunctor
+ <BOPAlgo_PVE,
+ BOPAlgo_VectorOfPVE,
+ Handle(IntTools_Context),
+ IntTools_Context> BOPAlgo_PVEFunctor;
+//
+typedef BOPCol_ContextCnt
+ <BOPAlgo_PVEFunctor,
+ BOPAlgo_VectorOfPVE,
+ Handle(IntTools_Context)> BOPAlgo_PVECnt;
+/////////////////////////////////////////////////////////////////////////
//=======================================================================
// function: PerformEE
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformEE()
{
- Standard_Boolean bJustAdd;
- Standard_Integer i, iX, iSize, nE1, nE2;
- Standard_Integer aNbCPrts;
- Standard_Real aTS11, aTS12, aTS21, aTS22,
- aT11, aT12, aT21, aT22;
- TopAbs_ShapeEnum aType;
- BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
- Handle(NCollection_IncAllocator) aAllocator;
- BOPDS_MapOfPaveBlock aMPBToUpdate;
- BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
+ Standard_Integer iSize;
//
myErrorStatus=0;
//
+ FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
+ //
myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
+ Standard_Boolean bJustAdd;
+ Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbFdgeEdge;
+ Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
+ TopAbs_ShapeEnum aType;
+ BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
+ Handle(NCollection_IncAllocator) aAllocator;
+ BOPDS_MapOfPaveBlock aMPBToUpdate;
+ BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
+ BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
+ //
//-----------------------------------------------------scope f
- aAllocator=new NCollection_IncAllocator();
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
- aEEs.SetStartSize(iSize);
aEEs.SetIncrement(iSize);
- aEEs.Init();
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nE1, nE2, bJustAdd);
//
Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue();
if (!aPB1->HasShrunkData()) {
- FillShrunkData(aPB1);
- if (myWarningStatus) {
- continue;
- }
+ continue;
}
aPB1->ShrunkData(aTS11, aTS12, aBB1);
//
//
Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
if (!aPB2->HasShrunkData()) {
- FillShrunkData(aPB2);
- if (myWarningStatus) {
- continue;
- }
+ continue;
}
aPB2->ShrunkData(aTS21, aTS22, aBB2);
//
continue;
}
//
- IntTools_EdgeEdge anEdgeEdge;
- //
aPB1->Range(aT11, aT12);
aPB2->Range(aT21, aT22);
//
+ BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Append1();
+ //
+ anEdgeEdge.SetPaveBlock1(aPB1);
+ anEdgeEdge.SetPaveBlock2(aPB2);
+ //
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
- //
- anEdgeEdge.Perform();
- if (!anEdgeEdge.IsDone()) {
- continue;
- }
- //
- IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
- aR21(aT21, aTS21), aR22(aTS22, aT22);
- //
- const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
- aNbCPrts=aCPrts.Length();
- for (i=1; i<=aNbCPrts; ++i) {
- const IntTools_CommonPrt& aCPart=aCPrts(i);
- aType=aCPart.Type();
- switch (aType) {
- case TopAbs_VERTEX: {
- Standard_Boolean bIsOnPave[4], bFlag;
- Standard_Integer nV[4], j;
- Standard_Real aT1, aT2, aTol;
- TopoDS_Vertex aVnew;
- IntTools_Range aCR1, aCR2;
- //
- BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
- aTol = Precision::Confusion();
- aCR1 = aCPart.Range1();
- aCR2 = aCPart.Ranges2()(1);
- //
- //decide to keep the pave or not
- bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) ||
- BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
- bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol) ||
- BOPInt_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
- bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol) ||
- BOPInt_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
- bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol) ||
- BOPInt_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
- //
- aPB1->Indices(nV[0], nV[1]);
- aPB2->Indices(nV[2], nV[3]);
- //
- if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) ||
- (bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) {
- continue;
- }
- //
- bFlag = Standard_False;
- for (j = 0; j < 4; ++j) {
- if (bIsOnPave[j]) {
- //add interf VE(nV[j], nE)
- Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
- ForceInterfVE(nV[j], aPB, aMPBToUpdate);
- bFlag = Standard_True;
- break;
- }
- }
- if (bFlag) {
- continue;
- }
- //
- BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
- // <-LXBR
- {
- Standard_Integer nVS[2], iFound, k;
- Standard_Real aTolVx, aTolVnew, aD2, aDT2;
- BOPCol_MapOfInteger aMV;
- gp_Pnt aPnew, aPx;
- //
- iFound=0;
- j=-1;
- aMV.Add(nV[0]);
- aMV.Add(nV[1]);
- //
- if (aMV.Contains(nV[2])) {
- ++j;
- nVS[j]=nV[2];
- }
- if (aMV.Contains(nV[3])) {
- ++j;
- nVS[j]=nV[3];
- }
- //
- aTolVnew=BRep_Tool::Tolerance(aVnew);
- aPnew=BRep_Tool::Pnt(aVnew);
- //
- for (k=0; k<=j; ++k) {
- const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
- aTolVx=BRep_Tool::Tolerance(aVx);
- aPx=BRep_Tool::Pnt(aVx);
- aD2=aPnew.SquareDistance(aPx);
- //
- aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
- //
- if (aD2<aDT2) {
- iFound=1;
- break;
- }
- }
- //
- if (iFound) {
- continue;
- }
- }
-
- // 1
- iX=aEEs.Append()-1;
- BOPDS_InterfEE& aEE=aEEs(iX);
- aEE.SetIndices(nE1, nE2);
- aEE.SetCommonPart(aCPart);
- // 2
- myDS->AddInterf(nE1, nE2);
- //
- BOPDS_CoupleOfPaveBlocks aCPB;
- //
- aCPB.SetPaveBlocks(aPB1, aPB2);
- aCPB.SetIndexInterf(iX);
- aMVCPB.Add(aVnew, aCPB);
- }//case TopAbs_VERTEX:
- break;
+ anEdgeEdge.SetProgressIndicator(myProgressIndicator);
+ }//for (; aIt2.More(); aIt2.Next()) {
+ }//for (; aIt1.More(); aIt1.Next()) {
+ }//for (; myIterator->More(); myIterator->Next()) {
+ //
+ aNbFdgeEdge=aVEdgeEdge.Extent();
+ //======================================================
+ BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
+ //======================================================
+ //
+ for (k=0; k < aNbFdgeEdge; ++k) {
+ Bnd_Box aBB1, aBB2;
+ //
+ BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
+ if (!anEdgeEdge.IsDone()) {
+ continue;
+ }
+ //
+ //--------------------------------------------
+ Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
+ nE1=aPB1->OriginalEdge();
+ aPB1->Range(aT11, aT12);
+ aPB1->ShrunkData(aTS11, aTS12, aBB1);
+ //
+ Handle(BOPDS_PaveBlock)& aPB2=anEdgeEdge.PaveBlock2();
+ nE2=aPB2->OriginalEdge();
+ aPB2->Range(aT21, aT22);
+ aPB2->ShrunkData(aTS21, aTS22, aBB2);
+ //
+ //--------------------------------------------
+ IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
+ aR21(aT21, aTS21), aR22(aTS22, aT22);
+ //
+ const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
+ aNbCPrts=aCPrts.Length();
+ for (i=1; i<=aNbCPrts; ++i) {
+ const IntTools_CommonPrt& aCPart=aCPrts(i);
+ //
+ const TopoDS_Edge& aE1=aCPart.Edge1();
+ const TopoDS_Edge& aE2=aCPart.Edge2();
+ //
+ aType=aCPart.Type();
+ switch (aType) {
+ case TopAbs_VERTEX: {
+ Standard_Boolean bIsOnPave[4], bFlag;
+ Standard_Integer nV[4], j;
+ Standard_Real aT1, aT2, aTol;
+ TopoDS_Vertex aVnew;
+ IntTools_Range aCR1, aCR2;
+ //
+ IntTools_Tools::VertexParameters(aCPart, aT1, aT2);
+ aTol = Precision::Confusion();
+ aCR1 = aCPart.Range1();
+ aCR2 = aCPart.Ranges2()(1);
+ //
+ //decide to keep the pave or not
+ bIsOnPave[0] = IntTools_Tools::IsOnPave1(aT1, aR11, aTol) ||
+ IntTools_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
+ bIsOnPave[1] = IntTools_Tools::IsOnPave1(aT1, aR12, aTol) ||
+ IntTools_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
+ bIsOnPave[2] = IntTools_Tools::IsOnPave1(aT2, aR21, aTol) ||
+ IntTools_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
+ bIsOnPave[3] = IntTools_Tools::IsOnPave1(aT2, aR22, aTol) ||
+ IntTools_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
+ //
+ aPB1->Indices(nV[0], nV[1]);
+ aPB2->Indices(nV[2], nV[3]);
+ //
+ if((bIsOnPave[0] && bIsOnPave[2]) ||
+ (bIsOnPave[0] && bIsOnPave[3]) ||
+ (bIsOnPave[1] && bIsOnPave[2]) ||
+ (bIsOnPave[1] && bIsOnPave[3])) {
+ continue;
+ }
+ //
+ bFlag = Standard_False;
+ for (j = 0; j < 4; ++j) {
+ if (bIsOnPave[j]) {
+ //add interf VE(nV[j], nE)
+ Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
+ ForceInterfVE(nV[j], aPB, aMPBToUpdate);
+ bFlag = Standard_True;
+ break;
+ }
+ }
+ if (bFlag) {
+ continue;
+ }
+ //
+ BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
+ // <-LXBR
+ {
+ Standard_Integer nVS[2], iFound, k;
+ Standard_Real aTolVx, aTolVnew, aD2, aDT2;
+ BOPCol_MapOfInteger aMV;
+ gp_Pnt aPnew, aPx;
//
- case TopAbs_EDGE: {
- if (aNbCPrts > 1) {
- break;
- }
+ iFound=0;
+ j=-1;
+ aMV.Add(nV[0]);
+ aMV.Add(nV[1]);
+ //
+ if (aMV.Contains(nV[2])) {
+ ++j;
+ nVS[j]=nV[2];
+ }
+ if (aMV.Contains(nV[3])) {
+ ++j;
+ nVS[j]=nV[3];
+ }
+ //
+ aTolVnew=BRep_Tool::Tolerance(aVnew);
+ aPnew=BRep_Tool::Pnt(aVnew);
+ //
+ for (k=0; k<=j; ++k) {
+ const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
+ aTolVx=BRep_Tool::Tolerance(aVx);
+ aPx=BRep_Tool::Pnt(aVx);
+ aD2=aPnew.SquareDistance(aPx);
//
- Standard_Boolean bHasSameBounds;
- bHasSameBounds=aPB1->HasSameBounds(aPB2);
- if (!bHasSameBounds) {
+ aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
+ //
+ if (aD2<aDT2) {
+ iFound=1;
break;
}
- // 1
- iX=aEEs.Append()-1;
- BOPDS_InterfEE& aEE=aEEs(iX);
- aEE.SetIndices(nE1, nE2);
- aEE.SetCommonPart(aCPart);
- // 2
- myDS->AddInterf(nE1, nE2);
- //
- BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
- }//case TopAbs_EDGE
+ }
+ //
+ if (iFound) {
+ continue;
+ }
+ }
+ //
+ // 1
+ BOPDS_InterfEE& aEE=aEEs.Append1();
+ iX=aEEs.Extent()-1;
+ aEE.SetIndices(nE1, nE2);
+ aEE.SetCommonPart(aCPart);
+ // 2
+ myDS->AddInterf(nE1, nE2);
+ //
+ BOPDS_CoupleOfPaveBlocks aCPB;
+ //
+ aCPB.SetPaveBlocks(aPB1, aPB2);
+ aCPB.SetIndexInterf(iX);
+ aMVCPB.Add(aVnew, aCPB);
+ }//case TopAbs_VERTEX:
+ break;
+ //
+ case TopAbs_EDGE: {
+ if (aNbCPrts > 1) {
break;
- default:
- break;
- }//switch (aType) {
- }//for (i=1; i<=aNbCPrts; i++) {
- // -----------t
- //
- }// for (; aIt2.More(); aIt2.Next()) {
- }// for (; aIt1.More(); aIt1.Next()) {
- }
+ }
+ //
+ Standard_Boolean bHasSameBounds;
+ bHasSameBounds=aPB1->HasSameBounds(aPB2);
+ if (!bHasSameBounds) {
+ break;
+ }
+ // 1
+ BOPDS_InterfEE& aEE=aEEs.Append1();
+ iX=aEEs.Extent()-1;
+ aEE.SetIndices(nE1, nE2);
+ aEE.SetCommonPart(aCPart);
+ // 2
+ myDS->AddInterf(nE1, nE2);
+ //
+ BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
+ }//case TopAbs_EDGE
+ break;
+ default:
+ break;
+ }//switch (aType) {
+ }//for (i=1; i<=aNbCPrts; i++) {
+ }//for (k=0; k < aNbFdgeEdge; ++k) {
//
//=========================================
// post treatment
//=========================================
+ {
+ Standard_Integer aNbV;
+ Handle(BOPDS_PaveBlock) aPB1, aPB2;
+ //
+ aNbV=aMVCPB.Extent();
+ for (i=1; i<=aNbV; ++i) {
+ const BOPDS_CoupleOfPaveBlocks& aCPB=aMVCPB.FindFromIndex(i);
+ aCPB.PaveBlocks(aPB1, aPB2);
+ //
+ aMPBToUpdate.Remove(aPB1);
+ aMPBToUpdate.Remove(aPB2);
+ }
+ }
+ //
aItPB.Initialize(aMPBToUpdate);
for (; aItPB.More(); aItPB.Next()) {
Handle(BOPDS_PaveBlock) aPB=aItPB.Value();
aMPBLPB.Clear();
aMVCPB.Clear();
aMPBToUpdate.Clear();
- aAllocator.Nullify();
}
//=======================================================================
//function : PerformVertices
}
}
}
- //
// 5
// 5.1 Compute Extra Paves and
// 5.2. Add Extra Paves to the PaveBlocks
+ //-------------------------------------------------------------
+ Standard_Integer k, aNbVPVE;
+ BOPAlgo_VectorOfPVE aVPVE;
+ //
aNb=aMPBLI.Extent();
for(i=1; i<=aNb; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nVx=aItLI.Value();
const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
- iFlag=myContext->ComputeVE (aVx, aE, aT);
- if (!iFlag) {
- aPave.SetIndex(nVx);
- aPave.SetParameter(aT);
- aPB->AppendExtPave(aPave);
- }
+ BOPAlgo_PVE& aPVE=aVPVE.Append1();
+ aPVE.SetIndices(nVx, nE);
+ aPVE.SetVertex(aVx);
+ aPVE.SetEdge(aE);
+ aPVE.SetPaveBlock(aPB);
+ }
+ }
+ //
+ aNbVPVE=aVPVE.Extent();
+ //=============================================================
+ BOPAlgo_PVECnt::Perform(myRunParallel, aVPVE, myContext);
+ //=============================================================
+ //
+ for (k=0; k < aNbVPVE; ++k) {
+ BOPAlgo_PVE& aPVE=aVPVE(k);
+ iFlag=aPVE.Flag();
+ if (!iFlag) {
+ aPVE.Indices(nVx, nE);
+ aT=aPVE.Parameter();
+ Handle(BOPDS_PaveBlock)& aPB=aPVE.PaveBlock();
+ //
+ aPave.SetIndex(nVx);
+ aPave.SetParameter(aT);
+ aPB->AppendExtPave(aPave);
}
}
// 6 Split PaveBlocksa
//
return iRet;
}
-
//=======================================================================
//function : TreatNewVertices
//purpose :
(const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
{
- Standard_Integer j, i, aNbV, aNbVSD;
+ Standard_Integer i, aNbV;//, aNbVSD;
Standard_Real aTol;
- TopoDS_Shape aVF;
TopoDS_Vertex aVnew;
+ TopoDS_Shape aVF;
BOPCol_IndexedMapOfShape aMVProcessed;
-
+ BOPCol_MapOfInteger aMFence;
BOPCol_ListIteratorOfListOfInteger aIt;
- BOPCol_IndexedDataMapOfShapeListOfShape aMVLV;
- BOPCol_DataMapOfIntegerShape aMIS;
- BOPCol_IndexedDataMapOfShapeBox aMSB;
+ BOPCol_DataMapOfShapeListOfShape aDMVLV;
+ BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLV;
//
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
+ NCollection_UBTreeFiller <Standard_Integer,
+ Bnd_Box> aTreeFiller(aBBTree);
+ BOPAlgo_VectorOfTNV aVTNV;
//
aNbV = aMapVI.Extent();
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMapVI.FindKey(i));
Bnd_Box aBox;
//
- aTol=BRep_Tool::Tolerance(*(TopoDS_Vertex*)(&aV));
+ aTol=BRep_Tool::Tolerance(aV);
aBox.SetGap(aTol);
- BRepBndLib::Add(aV, aBox);
+ aBox.Add(BRep_Tool::Pnt(aV));
+ aBox.Enlarge(aTol);
//
aTreeFiller.Add(i, aBox);
//
- aMIS.Bind(i, aV);
- aMSB.Add(aV, aBox);
+ BOPAlgo_TNV& aTNV=aVTNV.Append1();
+ aTNV.SetTree(aBBTree);
+ aTNV.SetBox(aBox);
+ aTNV.SetVertex(aV);
}
//
aTreeFiller.Fill();
-
+ //
+ //===========================================
+ BOPAlgo_TNVCnt::Perform(myRunParallel, aVTNV);
+ //===========================================
+ //
// Chains
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
- //
- if (aMVProcessed.Contains(aV)) {
+ if (!aMFence.Add(i)) {
continue;
}
//
- Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
+ Standard_Integer aIP, aNbIP1, aIP1;
BOPCol_ListOfShape aLVSD;
- BOPCol_MapOfInteger aMIP, aMIP1, aMIPC;
- BOPCol_MapIteratorOfMapOfInteger aIt1;
+ BOPCol_MapIteratorOfMapOfInteger aItMI;
+ BOPCol_ListOfInteger aLIP, aLIP1, aLIPC;
+ BOPCol_ListIteratorOfListOfInteger aItLIP;
//
- aMIP.Add(i);
+ aLIPC.Append(i);
+ aLIP.Append(i);
for(;;) {
- aNbIP=aMIP.Extent();
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- const TopoDS_Shape& aVP=aMIS.Find(aIP);
- const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
+ aItLIP.Initialize(aLIP);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
//
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- const BOPCol_ListOfInteger& aLI=aSelector.Indices();
+ BOPAlgo_TNV& aTNV=aVTNV(aIP-1);
+ const BOPCol_ListOfInteger& aLI=aTNV.Indices();
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
+ if (!aMFence.Add(aIP1)) {
continue;
}
- aMIP1.Add(aIP1);
+ aLIP1.Append(aIP1);
} //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
- aNbIP1=aMIP1.Extent();
+ aNbIP1=aLIP1.Extent();
if (!aNbIP1) {
- break; // from while(1)
- }
- //
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
+ break; // from for(;;)
}
//
- aMIP.Clear();
- aIt1.Initialize(aMIP1);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
+ aLIP.Clear();
+ aItLIP.Initialize(aLIP1);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
+ aLIP.Append(aIP);
+ aLIPC.Append(aIP);
}
- aMIP1.Clear();
- }// while(1)
- //...
- aNbIP=aMIPC.Extent();
- if (!aNbIP) {
- aMIPC.Add(i);
- }
+ aLIP1.Clear();
+ }// for(;;) {
//
- aIt1.Initialize(aMIPC);
- for(j=0; aIt1.More(); aIt1.Next(), ++j) {
- aIP=aIt1.Key();
- const TopoDS_Shape& aVP=aMIS.Find(aIP);
- if (!j) {
- aVF=aVP;
- }
+ aItLIP.Initialize(aLIPC);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
+ const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex();
aLVSD.Append(aVP);
- aMVProcessed.Add(aVP);
}
- aMVLV.Add(aVF, aLVSD);
+ aVF=aLVSD.First();
+ aDMVLV.Bind(aVF, aLVSD);
}// for (i=1; i<=aNbV; ++i) {
// Make new vertices
- aNbV=aMVLV.Extent();
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMVLV.FindKey(i);
- BOPCol_ListOfShape& aLVSD=aMVLV.ChangeFromIndex(i);
- aNbVSD=aLVSD.Extent();
- if (aNbVSD>1) {
- BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
- myImages.Add(aVnew, aLVSD);
- } else {
+ aItDMVLV.Initialize(aDMVLV);
+ for(; aItDMVLV.More(); aItDMVLV.Next()) {
+ const TopoDS_Shape& aV=aItDMVLV.Key();
+ const BOPCol_ListOfShape& aLVSD=aItDMVLV.Value();
+ if (aLVSD.IsEmpty()) {
myImages.Add(aV, aLVSD);
}
+ else {
+ BOPCol_ListOfShape* pLVSD=(BOPCol_ListOfShape*)&aLVSD;
+ BOPTools_AlgoTools::MakeVertex(*pLVSD, aVnew);
+ myImages.Add(aVnew, aLVSD);
+ }
}
}
-
//=======================================================================
//function : FillShrunkData
//purpose :
{
Standard_Integer nE, nV1, nV2, iErr;
Standard_Real aT1, aT2, aTS1, aTS2;
- BOPInt_ShrunkRange aSR;
+ IntTools_ShrunkRange aSR;
//
myErrorStatus=0;
myWarningStatus = 0;
nE=thePB->OriginalEdge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
- aSR.SetData(aE, aT1, aT2, aV1, aV2, myContext);
+ aSR.SetContext(myContext);
+ aSR.SetData(aE, aT1, aT2, aV1, aV2);
//
aSR.Perform();
iErr=aSR.ErrorStatus();
aNbPnt = aProjector.NbPoints();
if (aNbPnt) {
Standard_Real aT, aDist;
- Standard_Integer i;
+ //Standard_Integer i;
BRep_Builder aBB;
BOPDS_Pave aPave;
//
aT=aProjector.LowerDistanceParameter();
//
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
- i=aVEs.Append()-1;
- BOPDS_InterfVE& aVE=aVEs(i);
+ aVEs.SetIncrement(10);
+ BOPDS_InterfVE& aVE=aVEs.Append1();
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
//