1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
19 #include <Bnd_Box.hxx>
20 #include <BOPAlgo_PaveFiller.hxx>
21 #include <BOPAlgo_SectionAttribute.hxx>
22 #include <BOPAlgo_Tools.hxx>
23 #include <BOPCol_BoxBndTree.hxx>
24 #include <BOPCol_DataMapOfIntegerShape.hxx>
25 #include <BOPCol_DataMapOfShapeInteger.hxx>
26 #include <BOPCol_DataMapOfShapeListOfShape.hxx>
27 #include <BOPCol_IndexedDataMapOfShapeBox.hxx>
28 #include <BOPCol_NCVector.hxx>
29 #include <BOPCol_Parallel.hxx>
30 #include <BOPDS_CommonBlock.hxx>
31 #include <BOPDS_CoupleOfPaveBlocks.hxx>
32 #include <BOPDS_Curve.hxx>
33 #include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
34 #include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
35 #include <BOPDS_DS.hxx>
36 #include <BOPDS_Interf.hxx>
37 #include <BOPDS_Iterator.hxx>
38 #include <BOPDS_MapOfPaveBlock.hxx>
39 #include <BOPDS_Pave.hxx>
40 #include <BOPDS_PaveBlock.hxx>
41 #include <BOPDS_VectorOfInterfEE.hxx>
42 #include <BOPTools_AlgoTools.hxx>
44 #include <BRep_Tool.hxx>
45 #include <BRepBndLib.hxx>
46 #include <BRepTools.hxx>
47 #include <BRepAdaptor_Curve.hxx>
48 #include <GeomAPI_ProjectPointOnCurve.hxx>
50 #include <IntTools_CommonPrt.hxx>
51 #include <IntTools_Context.hxx>
52 #include <IntTools_EdgeEdge.hxx>
53 #include <IntTools_Range.hxx>
54 #include <IntTools_SequenceOfCommonPrts.hxx>
55 #include <IntTools_SequenceOfRanges.hxx>
56 #include <IntTools_ShrunkRange.hxx>
57 #include <IntTools_Tools.hxx>
58 #include <NCollection_UBTreeFiller.hxx>
59 #include <Precision.hxx>
60 #include <TopoDS_Compound.hxx>
61 #include <TopoDS_Edge.hxx>
62 #include <TopoDS_Face.hxx>
63 #include <TopoDS_Vertex.hxx>
65 /////////////////////////////////////////////////////////////////////////
66 //=======================================================================
67 //class : BOPAlgo_EdgeEdge
69 //=======================================================================
70 class BOPAlgo_EdgeEdge :
71 public IntTools_EdgeEdge,
83 virtual ~BOPAlgo_EdgeEdge(){
86 void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& aPB) {
90 Handle(BOPDS_PaveBlock)& PaveBlock1() {
94 void SetPaveBlock2(const Handle(BOPDS_PaveBlock)& aPB) {
98 Handle(BOPDS_PaveBlock)& PaveBlock2() {
102 virtual void Perform() {
103 BOPAlgo_Algo::UserBreak();
104 IntTools_EdgeEdge::Perform();
108 Handle(BOPDS_PaveBlock) myPB1;
109 Handle(BOPDS_PaveBlock) myPB2;
112 //=======================================================================
113 typedef BOPCol_NCVector
114 <BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
116 typedef BOPCol_Functor
118 BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
121 <BOPAlgo_EdgeEdgeFunctor,
122 BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
124 /////////////////////////////////////////////////////////////////////////
125 //=======================================================================
126 //class : BOPAlgo_TNV
128 //=======================================================================
129 class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
132 : BOPCol_BoxBndTreeSelector(), myTree(NULL) {
138 void SetVertex(const TopoDS_Vertex& aV) {
142 const TopoDS_Vertex& Vertex()const {
146 void SetTree(BOPCol_BoxBndTree& aTree) {
151 myTree->Select(*this);
156 BOPCol_BoxBndTree *myTree;
159 //=======================================================================
160 typedef BOPCol_NCVector
161 <BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
163 typedef BOPCol_Functor
165 BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
169 BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
170 /////////////////////////////////////////////////////////////////////////
171 //=======================================================================
172 //class : BOPAlgo_PVE
174 //=======================================================================
178 : myIV(-1), myIE(-1), myFlag(-1), myT(-1.) {
184 void SetIndices(const Standard_Integer nV,
185 const Standard_Integer nE){
190 void Indices(Standard_Integer& nV,
191 Standard_Integer& nE) const {
196 void SetVertex(const TopoDS_Vertex& aV) {
200 const TopoDS_Vertex& Vertex()const {
204 void SetEdge(const TopoDS_Edge& aE) {
208 const TopoDS_Edge& Edge()const {
212 void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
216 Handle(BOPDS_PaveBlock)& PaveBlock() {
220 Standard_Integer Flag()const {
224 Standard_Real Parameter()const {
228 void SetContext(const Handle(IntTools_Context)& aContext) {
232 const Handle(IntTools_Context)& Context()const {
238 myFlag = myContext->ComputeVE(myV, myE, myT, dummy);
242 Standard_Integer myIV;
243 Standard_Integer myIE;
244 Standard_Integer myFlag;
248 Handle(BOPDS_PaveBlock) myPB;
249 Handle(IntTools_Context) myContext;
251 //=======================================================================
252 typedef BOPCol_NCVector
253 <BOPAlgo_PVE> BOPAlgo_VectorOfPVE;
255 typedef BOPCol_ContextFunctor
258 Handle(IntTools_Context),
259 IntTools_Context> BOPAlgo_PVEFunctor;
261 typedef BOPCol_ContextCnt
264 Handle(IntTools_Context)> BOPAlgo_PVECnt;
265 /////////////////////////////////////////////////////////////////////////
266 //=======================================================================
267 // function: PerformEE
269 //=======================================================================
270 void BOPAlgo_PaveFiller::PerformEE()
272 Standard_Integer iSize;
276 FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
278 myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
279 iSize=myIterator->ExpectedLength();
284 Standard_Boolean bJustAdd, bExpressCompute;
285 Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbFdgeEdge;
286 Standard_Integer nV11, nV12, nV21, nV22;
287 Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
288 TopAbs_ShapeEnum aType;
289 BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
290 Handle(NCollection_BaseAllocator) aAllocator;
291 BOPDS_MapOfPaveBlock aMPBToUpdate;
292 BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
293 BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
295 aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
296 //-----------------------------------------------------scope f
297 BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
298 BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
300 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
301 aEEs.SetIncrement(iSize);
303 for (; myIterator->More(); myIterator->Next()) {
304 myIterator->Value(nE1, nE2, bJustAdd);
309 const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1);
310 if (aSIE1.HasFlag()){
313 const BOPDS_ShapeInfo& aSIE2=myDS->ShapeInfo(nE2);
314 if (aSIE2.HasFlag()){
318 const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.Shape()));
319 const TopoDS_Edge& aE2=(*(TopoDS_Edge *)(&aSIE2.Shape()));
321 BOPDS_ListOfPaveBlock& aLPB1=myDS->ChangePaveBlocks(nE1);
322 BOPDS_ListOfPaveBlock& aLPB2=myDS->ChangePaveBlocks(nE2);
324 aIt1.Initialize(aLPB1);
325 for (; aIt1.More(); aIt1.Next()) {
328 Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue();
329 if (!aPB1->HasShrunkData()) {
332 aPB1->ShrunkData(aTS11, aTS12, aBB1);
334 aPB1->Indices(nV11, nV12);
336 aIt2.Initialize(aLPB2);
337 for (; aIt2.More(); aIt2.Next()) {
340 Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
341 if (!aPB2->HasShrunkData()) {
344 aPB2->ShrunkData(aTS21, aTS22, aBB2);
346 if (aBB1.IsOut(aBB2)) {
350 aPB1->Range(aT11, aT12);
351 aPB2->Range(aT21, aT22);
353 aPB2->Indices(nV21, nV22);
355 bExpressCompute=((nV11==nV21 && nV12==nV22) ||
356 (nV12==nV21 && nV11==nV22));
358 BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Append1();
360 anEdgeEdge.UseQuickCoincidenceCheck(bExpressCompute);
362 anEdgeEdge.SetPaveBlock1(aPB1);
363 anEdgeEdge.SetPaveBlock2(aPB2);
365 anEdgeEdge.SetEdge1(aE1, aT11, aT12);
366 anEdgeEdge.SetEdge2(aE2, aT21, aT22);
367 anEdgeEdge.SetProgressIndicator(myProgressIndicator);
368 }//for (; aIt2.More(); aIt2.Next()) {
369 }//for (; aIt1.More(); aIt1.Next()) {
370 }//for (; myIterator->More(); myIterator->Next()) {
372 aNbFdgeEdge=aVEdgeEdge.Extent();
373 //======================================================
374 BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
375 //======================================================
377 for (k=0; k < aNbFdgeEdge; ++k) {
380 BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
381 if (!anEdgeEdge.IsDone()) {
385 //--------------------------------------------
386 Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
387 nE1=aPB1->OriginalEdge();
388 aPB1->Range(aT11, aT12);
389 aPB1->ShrunkData(aTS11, aTS12, aBB1);
391 Handle(BOPDS_PaveBlock)& aPB2=anEdgeEdge.PaveBlock2();
392 nE2=aPB2->OriginalEdge();
393 aPB2->Range(aT21, aT22);
394 aPB2->ShrunkData(aTS21, aTS22, aBB2);
396 //--------------------------------------------
397 IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
398 aR21(aT21, aTS21), aR22(aTS22, aT22);
400 const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
401 aNbCPrts = aCPrts.Length();
403 Standard_Boolean bLineLine = Standard_False;
405 const TopoDS_Edge& aOE1 = *(TopoDS_Edge*)&myDS->Shape(nE1);
406 const TopoDS_Edge& aOE2 = *(TopoDS_Edge*)&myDS->Shape(nE2);
408 BRepAdaptor_Curve aBAC1(aOE1), aBAC2(aOE2);
410 bLineLine = (aBAC1.GetType() == GeomAbs_Line &&
411 aBAC2.GetType() == GeomAbs_Line);
414 for (i=1; i<=aNbCPrts; ++i) {
415 const IntTools_CommonPrt& aCPart=aCPrts(i);
417 const TopoDS_Edge& aE1=aCPart.Edge1();
418 const TopoDS_Edge& aE2=aCPart.Edge2();
422 case TopAbs_VERTEX: {
423 Standard_Boolean bIsOnPave[4], bFlag;
424 Standard_Integer nV[4], j;
425 Standard_Real aT1, aT2, aTol;
427 IntTools_Range aCR1, aCR2;
429 IntTools_Tools::VertexParameters(aCPart, aT1, aT2);
430 aTol = Precision::Confusion();
431 aCR1 = aCPart.Range1();
432 aCR2 = aCPart.Ranges2()(1);
434 //decide to keep the pave or not
435 bIsOnPave[0] = IntTools_Tools::IsOnPave1(aT1, aR11, aTol) ||
436 IntTools_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
437 bIsOnPave[1] = IntTools_Tools::IsOnPave1(aT1, aR12, aTol) ||
438 IntTools_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
439 bIsOnPave[2] = IntTools_Tools::IsOnPave1(aT2, aR21, aTol) ||
440 IntTools_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
441 bIsOnPave[3] = IntTools_Tools::IsOnPave1(aT2, aR22, aTol) ||
442 IntTools_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
444 aPB1->Indices(nV[0], nV[1]);
445 aPB2->Indices(nV[2], nV[3]);
447 if((bIsOnPave[0] && bIsOnPave[2]) ||
448 (bIsOnPave[0] && bIsOnPave[3]) ||
449 (bIsOnPave[1] && bIsOnPave[2]) ||
450 (bIsOnPave[1] && bIsOnPave[3])) {
454 bFlag = Standard_False;
455 for (j = 0; j < 4; ++j) {
457 //add interf VE(nV[j], nE)
458 Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
459 ForceInterfVE(nV[j], aPB, aMPBToUpdate);
460 bFlag = Standard_True;
468 BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
469 Standard_Real aTolVnew = BRep_Tool::Tolerance(aVnew);
471 // increase tolerance for Line/Line intersection, but do not update
472 // the vertex till its intersection with some other shape
473 Standard_Real aTolMin = (aCR1.Last() - aCR1.First()) / 2.;
474 if (aTolMin > aTolVnew) {
480 Standard_Integer nVS[2], iFound;
481 Standard_Real aTolVx, aD2, aDT2;
482 BOPCol_MapOfInteger aMV;
490 if (aMV.Contains(nV[2])) {
494 if (aMV.Contains(nV[3])) {
499 aPnew=BRep_Tool::Pnt(aVnew);
501 for (Standard_Integer k1=0; k1<=j; ++k1) {
502 const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k1]));
503 aTolVx=BRep_Tool::Tolerance(aVx);
504 aPx=BRep_Tool::Pnt(aVx);
505 aD2=aPnew.SquareDistance(aPx);
507 aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
521 BOPDS_InterfEE& aEE=aEEs.Append1();
523 aEE.SetIndices(nE1, nE2);
524 aEE.SetCommonPart(aCPart);
526 myDS->AddInterf(nE1, nE2);
528 BOPDS_CoupleOfPaveBlocks aCPB;
530 aCPB.SetPaveBlocks(aPB1, aPB2);
531 aCPB.SetIndexInterf(iX);
532 aCPB.SetTolerance(aTolVnew);
533 aMVCPB.Add(aVnew, aCPB);
534 }//case TopAbs_VERTEX:
542 Standard_Boolean bHasSameBounds;
543 bHasSameBounds=aPB1->HasSameBounds(aPB2);
544 if (!bHasSameBounds) {
548 BOPDS_InterfEE& aEE=aEEs.Append1();
550 aEE.SetIndices(nE1, nE2);
551 aEE.SetCommonPart(aCPart);
553 myDS->AddInterf(nE1, nE2);
555 BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
561 }//for (i=1; i<=aNbCPrts; i++) {
562 }//for (k=0; k < aNbFdgeEdge; ++k) {
564 //=========================================
566 //=========================================
568 Standard_Integer aNbV;
569 Handle(BOPDS_PaveBlock) aPB1, aPB2;
571 aNbV=aMVCPB.Extent();
572 for (i=1; i<=aNbV; ++i) {
573 const BOPDS_CoupleOfPaveBlocks& aCPB=aMVCPB.FindFromIndex(i);
574 aCPB.PaveBlocks(aPB1, aPB2);
576 aMPBToUpdate.Remove(aPB1);
577 aMPBToUpdate.Remove(aPB2);
581 aItPB.Initialize(aMPBToUpdate);
582 for (; aItPB.More(); aItPB.Next()) {
583 Handle(BOPDS_PaveBlock) aPB=aItPB.Value();
584 if (!myDS->IsCommonBlock(aPB)) {
585 myDS->UpdatePaveBlock(aPB);
588 const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
589 myDS->UpdateCommonBlock(aCB);
593 BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
594 PerformVerticesEE(aMVCPB, aAllocator);
595 //-----------------------------------------------------scope t
598 aMPBToUpdate.Clear();
600 //=======================================================================
601 //function : PerformVerticesEE
603 //=======================================================================
604 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
605 (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
606 const Handle(NCollection_BaseAllocator)& theAllocator)
608 Standard_Integer aNbV, iRet;
611 aNbV=theMVCPB.Extent();
616 Standard_Integer nVx, iV, j, nE, iFlag, iX, i, aNb;
618 BOPCol_ListIteratorOfListOfShape aItLS;
619 BOPCol_ListIteratorOfListOfInteger aItLI;
620 BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
624 BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator);
625 BOPCol_ListOfShape aLS(theAllocator);
626 BOPCol_IndexedDataMapOfShapeInteger aMVI(100, theAllocator);
627 BOPCol_IndexedDataMapOfShapeListOfShape aImages;
629 aSI.SetShapeType(TopAbs_VERTEX);
630 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
632 // 1 prepare arguments
634 TreatNewVertices(theMVCPB, aImages);
636 // 3 Add new vertices to myDS;
637 // connect indices to CPB structure
638 aNb = aImages.Extent();
639 for (i=1; i<=aNb; ++i) {
640 const TopoDS_Vertex& aV=(*(TopoDS_Vertex*)(&aImages.FindKey(i)));
641 const BOPCol_ListOfShape& aLVSD=aImages.FindFromIndex(i);
644 iV=myDS->Append(aSI);
646 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
647 Bnd_Box& aBox=aSIDS.ChangeBox();
648 BRepBndLib::Add(aV, aBox);
649 aBox.SetGap(aBox.GetGap() + Precision::Confusion());
651 aItLS.Initialize(aLVSD);
652 for (; aItLS.More(); aItLS.Next()) {
653 const TopoDS_Shape& aVx = aItLS.Value();
654 BOPDS_CoupleOfPaveBlocks &aCPB=theMVCPB.ChangeFromKey(aVx);
656 // update EE interference
657 iX=aCPB.IndexInterf();
658 BOPDS_InterfEE& aEE=aEEs(iX);
663 // 4 Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI
665 Handle(BOPDS_PaveBlock) aPB[2];
667 for (i=1; i<=aNbV; ++i) {
668 const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
670 aCPB.PaveBlocks(aPB[0], aPB[1]);
671 for (j=0; j<2; ++j) {
672 if (aMPBLI.Contains(aPB[j])) {
673 BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB[j]);
677 BOPCol_ListOfInteger aLI(theAllocator);
679 aMPBLI.Add(aPB[j], aLI);
685 // 5.1 Compute Extra Paves and
686 // 5.2. Add Extra Paves to the PaveBlocks
687 //-------------------------------------------------------------
688 Standard_Integer k, aNbVPVE;
689 BOPAlgo_VectorOfPVE aVPVE;
692 for(i=1; i<=aNb; ++i) {
693 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
694 nE=aPB->OriginalEdge();
695 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
697 const BOPCol_ListOfInteger& aLI=aMPBLI.FindFromIndex(i);
698 aItLI.Initialize(aLI);
699 for (; aItLI.More(); aItLI.Next()) {
701 const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
703 BOPAlgo_PVE& aPVE=aVPVE.Append1();
704 aPVE.SetIndices(nVx, nE);
707 aPVE.SetPaveBlock(aPB);
711 aNbVPVE=aVPVE.Extent();
712 //=============================================================
713 BOPAlgo_PVECnt::Perform(myRunParallel, aVPVE, myContext);
714 //=============================================================
716 for (k=0; k < aNbVPVE; ++k) {
717 BOPAlgo_PVE& aPVE=aVPVE(k);
720 aPVE.Indices(nVx, nE);
722 Handle(BOPDS_PaveBlock)& aPB=aPVE.PaveBlock();
725 aPave.SetParameter(aT);
726 aPB->AppendExtPave(aPave);
729 // 6 Split PaveBlocksa
731 for(i=1; i<=aNb; ++i) {
732 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
733 nE=aPB->OriginalEdge();
735 if (!myDS->IsCommonBlock(aPB)) {
736 myDS->UpdatePaveBlock(aPB);
739 const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
740 myDS->UpdateCommonBlock(aCB);
742 }//for (; aItMPBLI.More(); aItMPBLI.Next()) {
746 //=======================================================================
747 //function : TreatNewVertices
749 //=======================================================================
750 void BOPAlgo_PaveFiller::TreatNewVertices
751 (const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
752 BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
754 Standard_Integer i, aNbV;//, aNbVSD;
757 BOPCol_IndexedMapOfShape aMVProcessed;
758 BOPCol_MapOfInteger aMFence;
759 BOPCol_ListIteratorOfListOfInteger aIt;
760 NCollection_Vector<BOPCol_ListOfShape> aVecOfLVSD;
762 BOPCol_BoxBndTree aBBTree;
763 NCollection_UBTreeFiller <Standard_Integer,
764 Bnd_Box> aTreeFiller(aBBTree);
765 BOPAlgo_VectorOfTNV aVTNV;
767 aNbV = theMVCPB.Extent();
768 for (i=1; i<=aNbV; ++i) {
769 const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&theMVCPB.FindKey(i));
772 aTol = theMVCPB.FindFromIndex(i).Tolerance();
773 aBox.Add(BRep_Tool::Pnt(aV));
776 aTreeFiller.Add(i, aBox);
778 BOPAlgo_TNV& aTNV=aVTNV.Append1();
779 aTNV.SetTree(aBBTree);
786 //===========================================
787 BOPAlgo_TNVCnt::Perform(myRunParallel, aVTNV);
788 //===========================================
791 for (i=1; i<=aNbV; ++i) {
792 if (!aMFence.Add(i)) {
796 Standard_Integer aIP, aNbIP1, aIP1;
797 BOPCol_ListOfShape aLVSD;
798 BOPCol_ListOfInteger aLIP, aLIP1, aLIPC;
799 BOPCol_ListIteratorOfListOfInteger aItLIP;
804 aItLIP.Initialize(aLIP);
805 for(; aItLIP.More(); aItLIP.Next()) {
808 BOPAlgo_TNV& aTNV=aVTNV(aIP-1);
809 const BOPCol_ListOfInteger& aLI=aTNV.Indices();
811 for (; aIt.More(); aIt.Next()) {
813 if (!aMFence.Add(aIP1)) {
817 } //for (; aIt.More(); aIt.Next()) {
818 }//for(; aIt1.More(); aIt1.Next()) {
820 aNbIP1=aLIP1.Extent();
822 break; // from for(;;)
826 aLIPC.Append(aLIP1); // items of aLIP1 are moved to aLIPC
829 aItLIP.Initialize(aLIPC);
830 for(; aItLIP.More(); aItLIP.Next()) {
832 const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex();
835 aVecOfLVSD.Append(aLVSD);
836 }// for (i=1; i<=aNbV; ++i) {
839 aNbV = aVecOfLVSD.Size();
840 for (i = 0; i < aNbV; ++i) {
841 const BOPCol_ListOfShape& aLVSD = aVecOfLVSD(i);
842 BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
843 myImages.Add(aVnew, aLVSD);
846 //=======================================================================
847 //function : FillShrunkData
849 //=======================================================================
850 void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
852 Standard_Integer nE, nV1, nV2, iErr;
853 Standard_Real aT1, aT2, aTS1, aTS2;
854 IntTools_ShrunkRange aSR;
859 const BOPDS_Pave& aPave1=thePB->Pave1();
861 aT1=aPave1.Parameter();
862 const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
864 const BOPDS_Pave& aPave2=thePB->Pave2();
866 aT2=aPave2.Parameter();
867 const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
869 nE=thePB->OriginalEdge();
870 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
872 aSR.SetContext(myContext);
873 aSR.SetData(aE, aT1, aT2, aV1, aV2);
876 iErr=aSR.ErrorStatus();
883 aSR.ShrunkRange(aTS1, aTS2);
884 const Bnd_Box& aBox=aSR.BndBox();
886 thePB->SetShrunkData(aTS1, aTS2, aBox);
888 //=======================================================================
889 //function : ForceInterfVE
891 //=======================================================================
892 void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
893 Handle(BOPDS_PaveBlock)& aPB,
894 BOPDS_MapOfPaveBlock& aMPBToUpdate)
896 Standard_Integer nE, nVx, nVSD, iFlag;
897 Standard_Real aT, aTolVNew;
899 nE = aPB->OriginalEdge();
901 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
902 if (aSIE.HasSubShape(nV)) {
906 if (myDS->HasInterf(nV, nE)) {
910 if (myDS->HasInterfShapeSubShapes(nV, nE)) {
914 if (aPB->Pave1().Index() == nV ||
915 aPB->Pave2().Index() == nV) {
920 if (myDS->HasShapeSD(nV, nVSD)) {
924 const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
925 const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
927 iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
928 if (iFlag == 0 || iFlag == -4) {
932 BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
933 aVEs.SetIncrement(10);
935 BOPDS_InterfVE& aVE=aVEs.Append1();
936 aVE.SetIndices(nV, nE);
937 aVE.SetParameter(aT);
939 myDS->AddInterf(nV, nE);
941 // 3 update vertex V/E if necessary
942 nVx=UpdateVertex(nV, aTolVNew);
944 if (myDS->IsNewShape(nVx)) {
945 aVE.SetIndexNew(nVx);
947 // 5 append ext pave to pave block
949 aPave.SetParameter(aT);
950 aPB->AppendExtPave(aPave);
952 aMPBToUpdate.Add(aPB);