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.
18 #include <BOPAlgo_PaveFiller.ixx>
20 #include <Precision.hxx>
21 #include <NCollection_IncAllocator.hxx>
22 #include <NCollection_UBTreeFiller.hxx>
24 #include <Bnd_Box.hxx>
26 #include <GeomAPI_ProjectPointOnCurve.hxx>
28 #include <TopoDS_Edge.hxx>
29 #include <TopoDS_Vertex.hxx>
30 #include <TopoDS_Compound.hxx>
31 #include <BRep_Tool.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepTools.hxx>
34 #include <BRepBndLib.hxx>
36 #include <IntTools_EdgeEdge.hxx>
37 #include <IntTools_Range.hxx>
38 #include <IntTools_SequenceOfCommonPrts.hxx>
39 #include <IntTools_CommonPrt.hxx>
40 #include <IntTools_SequenceOfRanges.hxx>
42 #include <BOPTools_AlgoTools.hxx>
44 #include <BOPCol_DataMapOfShapeInteger.hxx>
45 #include <BOPCol_DataMapOfShapeListOfShape.hxx>
46 #include <BOPCol_DataMapOfIntegerShape.hxx>
47 #include <BOPCol_IndexedDataMapOfShapeBox.hxx>
48 #include <BOPCol_BoxBndTree.hxx>
49 #include <BOPCol_NCVector.hxx>
50 #include <BOPCol_Parallel.hxx>
52 #include <IntTools_Context.hxx>
53 #include <IntTools_ShrunkRange.hxx>
54 #include <IntTools_Tools.hxx>
56 #include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
57 #include <BOPDS_MapOfPaveBlock.hxx>
58 #include <BOPDS_CommonBlock.hxx>
59 #include <BOPDS_CoupleOfPaveBlocks.hxx>
60 #include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
61 #include <BOPDS_Iterator.hxx>
62 #include <BOPDS_VectorOfInterfEE.hxx>
63 #include <BOPDS_Interf.hxx>
64 #include <BOPDS_Pave.hxx>
66 #include <BOPAlgo_Tools.hxx>
68 /////////////////////////////////////////////////////////////////////////
69 //=======================================================================
70 //class : BOPAlgo_EdgeEdge
72 //=======================================================================
73 class BOPAlgo_EdgeEdge :
74 public IntTools_EdgeEdge,
86 virtual ~BOPAlgo_EdgeEdge(){
89 void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& aPB) {
93 Handle(BOPDS_PaveBlock)& PaveBlock1() {
97 void SetPaveBlock2(const Handle(BOPDS_PaveBlock)& aPB) {
101 Handle(BOPDS_PaveBlock)& PaveBlock2() {
105 virtual void Perform() {
106 BOPAlgo_Algo::UserBreak();
107 IntTools_EdgeEdge::Perform();
111 Handle(BOPDS_PaveBlock) myPB1;
112 Handle(BOPDS_PaveBlock) myPB2;
115 //=======================================================================
116 typedef BOPCol_NCVector
117 <BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
119 typedef BOPCol_Functor
121 BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
124 <BOPAlgo_EdgeEdgeFunctor,
125 BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
127 /////////////////////////////////////////////////////////////////////////
128 //=======================================================================
129 //class : BOPAlgo_TNV
131 //=======================================================================
132 class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
135 : BOPCol_BoxBndTreeSelector(), myTree(NULL) {
141 void SetVertex(const TopoDS_Vertex& aV) {
145 const TopoDS_Vertex& Vertex()const {
149 void SetTree(BOPCol_BoxBndTree& aTree) {
154 myTree->Select(*this);
159 BOPCol_BoxBndTree *myTree;
162 //=======================================================================
163 typedef BOPCol_NCVector
164 <BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
166 typedef BOPCol_Functor
168 BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
172 BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
173 /////////////////////////////////////////////////////////////////////////
174 //=======================================================================
175 //class : BOPAlgo_PVE
177 //=======================================================================
181 : myIV(-1), myIE(-1), myFlag(-1), myT(-1.) {
187 void SetIndices(const Standard_Integer nV,
188 const Standard_Integer nE){
193 void Indices(Standard_Integer& nV,
194 Standard_Integer& nE) const {
199 void SetVertex(const TopoDS_Vertex& aV) {
203 const TopoDS_Vertex& Vertex()const {
207 void SetEdge(const TopoDS_Edge& aE) {
211 const TopoDS_Edge& Edge()const {
215 void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
219 Handle(BOPDS_PaveBlock)& PaveBlock() {
223 Standard_Integer Flag()const {
227 Standard_Real Parameter()const {
231 void SetContext(const Handle(IntTools_Context)& aContext) {
235 const Handle(IntTools_Context)& Context()const {
240 myFlag=myContext->ComputeVE (myV, myE, myT);
244 Standard_Integer myIV;
245 Standard_Integer myIE;
246 Standard_Integer myFlag;
250 Handle(BOPDS_PaveBlock) myPB;
251 Handle(IntTools_Context) myContext;
253 //=======================================================================
254 typedef BOPCol_NCVector
255 <BOPAlgo_PVE> BOPAlgo_VectorOfPVE;
257 typedef BOPCol_ContextFunctor
260 Handle(IntTools_Context),
261 IntTools_Context> BOPAlgo_PVEFunctor;
263 typedef BOPCol_ContextCnt
266 Handle(IntTools_Context)> BOPAlgo_PVECnt;
267 /////////////////////////////////////////////////////////////////////////
268 //=======================================================================
269 // function: PerformEE
271 //=======================================================================
272 void BOPAlgo_PaveFiller::PerformEE()
274 Standard_Integer iSize;
278 FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
280 myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
281 iSize=myIterator->ExpectedLength();
286 Standard_Boolean bJustAdd;
287 Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbFdgeEdge;
288 Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
289 TopAbs_ShapeEnum aType;
290 BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
291 Handle(NCollection_IncAllocator) aAllocator;
292 BOPDS_MapOfPaveBlock aMPBToUpdate;
293 BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
294 BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
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 aIt2.Initialize(aLPB2);
335 for (; aIt2.More(); aIt2.Next()) {
338 Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
339 if (!aPB2->HasShrunkData()) {
342 aPB2->ShrunkData(aTS21, aTS22, aBB2);
344 if (aBB1.IsOut(aBB2)) {
348 aPB1->Range(aT11, aT12);
349 aPB2->Range(aT21, aT22);
351 BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Append1();
353 anEdgeEdge.SetPaveBlock1(aPB1);
354 anEdgeEdge.SetPaveBlock2(aPB2);
356 anEdgeEdge.SetEdge1(aE1, aT11, aT12);
357 anEdgeEdge.SetEdge2(aE2, aT21, aT22);
358 anEdgeEdge.SetProgressIndicator(myProgressIndicator);
359 }//for (; aIt2.More(); aIt2.Next()) {
360 }//for (; aIt1.More(); aIt1.Next()) {
361 }//for (; myIterator->More(); myIterator->Next()) {
363 aNbFdgeEdge=aVEdgeEdge.Extent();
364 //======================================================
365 BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
366 //======================================================
368 for (k=0; k < aNbFdgeEdge; ++k) {
371 BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
372 if (!anEdgeEdge.IsDone()) {
376 //--------------------------------------------
377 Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
378 nE1=aPB1->OriginalEdge();
379 aPB1->Range(aT11, aT12);
380 aPB1->ShrunkData(aTS11, aTS12, aBB1);
382 Handle(BOPDS_PaveBlock)& aPB2=anEdgeEdge.PaveBlock2();
383 nE2=aPB2->OriginalEdge();
384 aPB2->Range(aT21, aT22);
385 aPB2->ShrunkData(aTS21, aTS22, aBB2);
387 //--------------------------------------------
388 IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
389 aR21(aT21, aTS21), aR22(aTS22, aT22);
391 const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
392 aNbCPrts=aCPrts.Length();
393 for (i=1; i<=aNbCPrts; ++i) {
394 const IntTools_CommonPrt& aCPart=aCPrts(i);
396 const TopoDS_Edge& aE1=aCPart.Edge1();
397 const TopoDS_Edge& aE2=aCPart.Edge2();
401 case TopAbs_VERTEX: {
402 Standard_Boolean bIsOnPave[4], bFlag;
403 Standard_Integer nV[4], j;
404 Standard_Real aT1, aT2, aTol;
406 IntTools_Range aCR1, aCR2;
408 IntTools_Tools::VertexParameters(aCPart, aT1, aT2);
409 aTol = Precision::Confusion();
410 aCR1 = aCPart.Range1();
411 aCR2 = aCPart.Ranges2()(1);
413 //decide to keep the pave or not
414 bIsOnPave[0] = IntTools_Tools::IsOnPave1(aT1, aR11, aTol) ||
415 IntTools_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
416 bIsOnPave[1] = IntTools_Tools::IsOnPave1(aT1, aR12, aTol) ||
417 IntTools_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
418 bIsOnPave[2] = IntTools_Tools::IsOnPave1(aT2, aR21, aTol) ||
419 IntTools_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
420 bIsOnPave[3] = IntTools_Tools::IsOnPave1(aT2, aR22, aTol) ||
421 IntTools_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
423 aPB1->Indices(nV[0], nV[1]);
424 aPB2->Indices(nV[2], nV[3]);
426 if((bIsOnPave[0] && bIsOnPave[2]) ||
427 (bIsOnPave[0] && bIsOnPave[3]) ||
428 (bIsOnPave[1] && bIsOnPave[2]) ||
429 (bIsOnPave[1] && bIsOnPave[3])) {
433 bFlag = Standard_False;
434 for (j = 0; j < 4; ++j) {
436 //add interf VE(nV[j], nE)
437 Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
438 ForceInterfVE(nV[j], aPB, aMPBToUpdate);
439 bFlag = Standard_True;
447 BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
450 Standard_Integer nVS[2], iFound, k;
451 Standard_Real aTolVx, aTolVnew, aD2, aDT2;
452 BOPCol_MapOfInteger aMV;
460 if (aMV.Contains(nV[2])) {
464 if (aMV.Contains(nV[3])) {
469 aTolVnew=BRep_Tool::Tolerance(aVnew);
470 aPnew=BRep_Tool::Pnt(aVnew);
472 for (k=0; k<=j; ++k) {
473 const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
474 aTolVx=BRep_Tool::Tolerance(aVx);
475 aPx=BRep_Tool::Pnt(aVx);
476 aD2=aPnew.SquareDistance(aPx);
478 aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
492 BOPDS_InterfEE& aEE=aEEs.Append1();
494 aEE.SetIndices(nE1, nE2);
495 aEE.SetCommonPart(aCPart);
497 myDS->AddInterf(nE1, nE2);
499 BOPDS_CoupleOfPaveBlocks aCPB;
501 aCPB.SetPaveBlocks(aPB1, aPB2);
502 aCPB.SetIndexInterf(iX);
503 aMVCPB.Add(aVnew, aCPB);
504 }//case TopAbs_VERTEX:
512 Standard_Boolean bHasSameBounds;
513 bHasSameBounds=aPB1->HasSameBounds(aPB2);
514 if (!bHasSameBounds) {
518 BOPDS_InterfEE& aEE=aEEs.Append1();
520 aEE.SetIndices(nE1, nE2);
521 aEE.SetCommonPart(aCPart);
523 myDS->AddInterf(nE1, nE2);
525 BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
531 }//for (i=1; i<=aNbCPrts; i++) {
532 }//for (k=0; k < aNbFdgeEdge; ++k) {
534 //=========================================
536 //=========================================
538 Standard_Integer aNbV;
539 Handle(BOPDS_PaveBlock) aPB1, aPB2;
541 aNbV=aMVCPB.Extent();
542 for (i=1; i<=aNbV; ++i) {
543 const BOPDS_CoupleOfPaveBlocks& aCPB=aMVCPB.FindFromIndex(i);
544 aCPB.PaveBlocks(aPB1, aPB2);
546 aMPBToUpdate.Remove(aPB1);
547 aMPBToUpdate.Remove(aPB2);
551 aItPB.Initialize(aMPBToUpdate);
552 for (; aItPB.More(); aItPB.Next()) {
553 Handle(BOPDS_PaveBlock) aPB=aItPB.Value();
554 if (!myDS->IsCommonBlock(aPB)) {
555 myDS->UpdatePaveBlock(aPB);
558 const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
559 myDS->UpdateCommonBlock(aCB);
563 BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
564 PerformVerticesEE(aMVCPB, aAllocator);
565 //-----------------------------------------------------scope t
568 aMPBToUpdate.Clear();
570 //=======================================================================
571 //function : PerformVertices
573 //=======================================================================
574 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
575 (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
576 Handle(NCollection_BaseAllocator)& theAllocator)
578 Standard_Integer aNbV, iRet;
581 aNbV=theMVCPB.Extent();
586 Standard_Integer nVx, iV, j, nE, iFlag, iX, i, aNb;
589 BOPCol_ListIteratorOfListOfShape aItLS;
590 BOPCol_ListIteratorOfListOfInteger aItLI;
591 BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
595 BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator);
596 BOPCol_ListOfShape aLS(theAllocator);
597 BOPCol_IndexedDataMapOfShapeInteger aMVI(100, theAllocator);
598 BOPCol_IndexedDataMapOfShapeListOfShape aImages;
600 aSI.SetShapeType(TopAbs_VERTEX);
601 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
603 // 1 prepare arguments
606 for (i=1; i<=aNbV; ++i) {
607 const TopoDS_Shape& aS=theMVCPB.FindKey(i);
608 const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
609 iV=aCPB.IndexInterf();
614 TreatNewVertices(aMVI, aImages);
616 // 3 Add new vertices to myDS;
617 // connect indices to CPB structure
618 aNb = aImages.Extent();
619 for (i=1; i<=aNb; ++i) {
620 const TopoDS_Vertex& aV=(*(TopoDS_Vertex*)(&aImages.FindKey(i)));
621 const BOPCol_ListOfShape& aLVSD=aImages.FindFromIndex(i);
624 iV=myDS->Append(aSI);
626 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
627 Bnd_Box& aBox=aSIDS.ChangeBox();
628 BRepBndLib::Add(aV, aBox);
630 aItLS.Initialize(aLVSD);
631 for (; aItLS.More(); aItLS.Next()) {
632 const TopoDS_Shape& aVx = aItLS.Value();
633 BOPDS_CoupleOfPaveBlocks &aCPB=theMVCPB.ChangeFromKey(aVx);
635 // update EE interference
636 iX=aCPB.IndexInterf();
637 BOPDS_InterfEE& aEE=aEEs(iX);
642 // 4 Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI
644 Handle(BOPDS_PaveBlock) aPB[2];
646 for (i=1; i<=aNbV; ++i) {
647 const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
649 aCPB.PaveBlocks(aPB[0], aPB[1]);
650 for (j=0; j<2; ++j) {
651 if (aMPBLI.Contains(aPB[j])) {
652 BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB[j]);
656 BOPCol_ListOfInteger aLI(theAllocator);
658 aMPBLI.Add(aPB[j], aLI);
664 // 5.1 Compute Extra Paves and
665 // 5.2. Add Extra Paves to the PaveBlocks
666 //-------------------------------------------------------------
667 Standard_Integer k, aNbVPVE;
668 BOPAlgo_VectorOfPVE aVPVE;
671 for(i=1; i<=aNb; ++i) {
672 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
673 nE=aPB->OriginalEdge();
674 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
676 const BOPCol_ListOfInteger& aLI=aMPBLI.FindFromIndex(i);
677 aItLI.Initialize(aLI);
678 for (; aItLI.More(); aItLI.Next()) {
680 const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
682 BOPAlgo_PVE& aPVE=aVPVE.Append1();
683 aPVE.SetIndices(nVx, nE);
686 aPVE.SetPaveBlock(aPB);
690 aNbVPVE=aVPVE.Extent();
691 //=============================================================
692 BOPAlgo_PVECnt::Perform(myRunParallel, aVPVE, myContext);
693 //=============================================================
695 for (k=0; k < aNbVPVE; ++k) {
696 BOPAlgo_PVE& aPVE=aVPVE(k);
699 aPVE.Indices(nVx, nE);
701 Handle(BOPDS_PaveBlock)& aPB=aPVE.PaveBlock();
704 aPave.SetParameter(aT);
705 aPB->AppendExtPave(aPave);
708 // 6 Split PaveBlocksa
710 for(i=1; i<=aNb; ++i) {
711 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
712 nE=aPB->OriginalEdge();
714 if (!myDS->IsCommonBlock(aPB)) {
715 myDS->UpdatePaveBlock(aPB);
718 const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
719 myDS->UpdateCommonBlock(aCB);
721 }//for (; aItMPBLI.More(); aItMPBLI.Next()) {
725 //=======================================================================
726 //function : TreatNewVertices
728 //=======================================================================
729 void BOPAlgo_PaveFiller::TreatNewVertices
730 (const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
731 BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
733 Standard_Integer i, aNbV;//, aNbVSD;
737 BOPCol_IndexedMapOfShape aMVProcessed;
738 BOPCol_MapOfInteger aMFence;
739 BOPCol_ListIteratorOfListOfInteger aIt;
740 BOPCol_DataMapOfShapeListOfShape aDMVLV;
741 BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLV;
743 BOPCol_BoxBndTreeSelector aSelector;
744 BOPCol_BoxBndTree aBBTree;
745 NCollection_UBTreeFiller <Standard_Integer,
746 Bnd_Box> aTreeFiller(aBBTree);
747 BOPAlgo_VectorOfTNV aVTNV;
749 aNbV = aMapVI.Extent();
750 for (i=1; i<=aNbV; ++i) {
751 const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMapVI.FindKey(i));
754 aTol=BRep_Tool::Tolerance(aV);
756 aBox.Add(BRep_Tool::Pnt(aV));
759 aTreeFiller.Add(i, aBox);
761 BOPAlgo_TNV& aTNV=aVTNV.Append1();
762 aTNV.SetTree(aBBTree);
769 //===========================================
770 BOPAlgo_TNVCnt::Perform(myRunParallel, aVTNV);
771 //===========================================
774 for (i=1; i<=aNbV; ++i) {
775 if (!aMFence.Add(i)) {
779 Standard_Integer aIP, aNbIP1, aIP1;
780 BOPCol_ListOfShape aLVSD;
781 BOPCol_MapIteratorOfMapOfInteger aItMI;
782 BOPCol_ListOfInteger aLIP, aLIP1, aLIPC;
783 BOPCol_ListIteratorOfListOfInteger aItLIP;
788 aItLIP.Initialize(aLIP);
789 for(; aItLIP.More(); aItLIP.Next()) {
792 BOPAlgo_TNV& aTNV=aVTNV(aIP-1);
793 const BOPCol_ListOfInteger& aLI=aTNV.Indices();
795 for (; aIt.More(); aIt.Next()) {
797 if (!aMFence.Add(aIP1)) {
801 } //for (; aIt.More(); aIt.Next()) {
802 }//for(; aIt1.More(); aIt1.Next()) {
804 aNbIP1=aLIP1.Extent();
806 break; // from for(;;)
810 aItLIP.Initialize(aLIP1);
811 for(; aItLIP.More(); aItLIP.Next()) {
819 aItLIP.Initialize(aLIPC);
820 for(; aItLIP.More(); aItLIP.Next()) {
822 const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex();
826 aDMVLV.Bind(aVF, aLVSD);
827 }// for (i=1; i<=aNbV; ++i) {
830 aItDMVLV.Initialize(aDMVLV);
831 for(; aItDMVLV.More(); aItDMVLV.Next()) {
832 const TopoDS_Shape& aV=aItDMVLV.Key();
833 const BOPCol_ListOfShape& aLVSD=aItDMVLV.Value();
834 if (aLVSD.IsEmpty()) {
835 myImages.Add(aV, aLVSD);
838 BOPCol_ListOfShape* pLVSD=(BOPCol_ListOfShape*)&aLVSD;
839 BOPTools_AlgoTools::MakeVertex(*pLVSD, aVnew);
840 myImages.Add(aVnew, aLVSD);
844 //=======================================================================
845 //function : FillShrunkData
847 //=======================================================================
848 void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
850 Standard_Integer nE, nV1, nV2, iErr;
851 Standard_Real aT1, aT2, aTS1, aTS2;
852 IntTools_ShrunkRange aSR;
857 const BOPDS_Pave& aPave1=thePB->Pave1();
859 aT1=aPave1.Parameter();
860 const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
862 const BOPDS_Pave& aPave2=thePB->Pave2();
864 aT2=aPave2.Parameter();
865 const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
867 nE=thePB->OriginalEdge();
868 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
870 aSR.SetContext(myContext);
871 aSR.SetData(aE, aT1, aT2, aV1, aV2);
874 iErr=aSR.ErrorStatus();
881 aSR.ShrunkRange(aTS1, aTS2);
882 const Bnd_Box& aBox=aSR.BndBox();
884 thePB->SetShrunkData(aTS1, aTS2, aBox);
886 //=======================================================================
887 //function : ForceInterfVE
889 //=======================================================================
890 void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
891 Handle(BOPDS_PaveBlock)& aPB,
892 BOPDS_MapOfPaveBlock& aMPBToUpdate)
894 Standard_Integer aNbPnt, nE;
897 nE = aPB->OriginalEdge();
899 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
900 if (aSIE.HasSubShape(nV)) {
904 if (myDS->HasInterf(nV, nE)) {
908 if (myDS->HasInterfShapeSubShapes(nV, nE)) {
912 if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
916 const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
917 const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
918 aP=BRep_Tool::Pnt(aV);
920 GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
921 aProjector.Perform(aP);
923 aNbPnt = aProjector.NbPoints();
925 Standard_Real aT, aDist;
926 //Standard_Integer i;
930 aDist=aProjector.LowerDistance();
931 aT=aProjector.LowerDistanceParameter();
933 BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
934 aVEs.SetIncrement(10);
935 BOPDS_InterfVE& aVE=aVEs.Append1();
936 aVE.SetIndices(nV, nE);
937 aVE.SetParameter(aT);
939 myDS->AddInterf(nV, nE);
941 aBB.UpdateVertex(aV, aDist);
942 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
943 Bnd_Box& aBox=aSIDS.ChangeBox();
944 BRepBndLib::Add(aV, aBox);
947 aPave.SetParameter(aT);
948 aPB->AppendExtPave(aPave);
950 aMPBToUpdate.Add(aPB);
959 aBBx.MakeCompound(aCx);
960 aItMVCPB.Initialize(theMVCPB);
961 for (; aItMVCPB.More(); aItMVCPB.Next()) {
962 const TopoDS_Shape& aS=aItMVCPB.Key();
965 BRepTools::Write(aCx, "cx");