1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: NMTTools_PaveFiller_7.cxx
24 // Author: Peter KURNEV
26 #include <NMTTools_PaveFiller.hxx>
27 #include <NMTTools_Tools.hxx>
29 #include <Bnd_HArray1OfBox.hxx>
30 #include <Bnd_BoundSortBox.hxx>
31 #include <Bnd_Box.hxx>
32 #include <BRepBndLib.hxx>
34 #include <TColStd_MapOfInteger.hxx>
35 #include <TColStd_ListOfInteger.hxx>
36 #include <TColStd_IndexedMapOfInteger.hxx>
37 #include <TColStd_ListIteratorOfListOfInteger.hxx>
39 #include <GeomAPI_ProjectPointOnCurve.hxx>
41 #include <TopAbs_Orientation.hxx>
44 #include <TopoDS_Edge.hxx>
45 #include <TopoDS_Shape.hxx>
46 #include <TopoDS_Vertex.hxx>
47 #include <TopoDS_Compound.hxx>
49 #include <TopTools_DataMapOfIntegerShape.hxx>
50 #include <TopTools_DataMapOfShapeInteger.hxx>
51 #include <TopTools_DataMapOfShapeShape.hxx>
52 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
53 #include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
54 #include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
55 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger.hxx>
57 #include <BRep_Builder.hxx>
58 #include <BRep_Tool.hxx>
60 #include <TopExp_Explorer.hxx>
63 #include <IntTools_SequenceOfPntOn2Faces.hxx>
64 #include <IntTools_PntOnFace.hxx>
65 #include <IntTools_PntOn2Faces.hxx>
66 #include <IntTools_Context.hxx>
68 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
70 #include <BOPTools_SSInterference.hxx>
71 #include <BOPTools_CArray1OfSSInterference.hxx>
72 #include <BOPTools_CArray1OfVVInterference.hxx>
73 #include <BOPTools_VVInterference.hxx>
74 #include <BOPTools_Tools.hxx>
75 #include <BOPTools_ListOfPaveBlock.hxx>
76 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
77 #include <BOPTools_PaveBlock.hxx>
78 #include <BOPTools_Pave.hxx>
79 #include <BOPTools_Tools.hxx>
81 #include <NMTDS_Iterator.hxx>
82 #include <NMTDS_ShapesDataStructure.hxx>
83 #include <NMTDS_InterfPool.hxx>
85 #include <NMTTools_ListOfCommonBlock.hxx>
86 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
87 #include <NMTTools_MapOfPaveBlock.hxx>
90 //=======================================================================
91 // function: MakeSplitEdges
93 //=======================================================================
94 void NMTTools_PaveFiller::MakeSplitEdges()
96 myIsDone=Standard_False;
98 Standard_Boolean bIsNewVertex1, bIsNewVertex2;
99 Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex;
100 Standard_Real t1, t2;
101 TopAbs_Orientation anOri;
102 TopoDS_Edge aE, aESplit;
103 TopoDS_Vertex aV1, aV2;
105 aNbS=myDS->NumberOfShapesOfTheObject();
106 for (i=1; i<=aNbS; ++i) {
107 if (myDS->GetShapeType(i) != TopAbs_EDGE)
111 aE=TopoDS::Edge(myDS->Shape(i));
112 if (NMTTools_Tools::IsDegenerated(aE)){
116 anOri=aE.Orientation();
117 aE.Orientation(TopAbs_FORWARD);
119 // Making Split Edges
121 // Split Set for the Original Edge i
122 BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i));
123 BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
125 aNbPaveBlocks=aSplitEdges.Extent();
127 for (; aPBIt.More(); aPBIt.Next()) {
128 BOPTools_PaveBlock& aPB=aPBIt.Value();
130 const BOPTools_Pave& aPave1=aPB.Pave1();
133 aV1=TopoDS::Vertex(myDS->GetShape(nV1));
134 aV1.Orientation(TopAbs_FORWARD);
136 const BOPTools_Pave& aPave2=aPB.Pave2();
139 aV2=TopoDS::Vertex(myDS->GetShape(nV2));
140 aV2.Orientation(TopAbs_REVERSED);
142 if (aNbPaveBlocks==1) {
143 bIsNewVertex1=myDS->IsNewShape (nV1);
144 bIsNewVertex2=myDS->IsNewShape (nV2);
145 if (!bIsNewVertex1 && !bIsNewVertex2) {
151 BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);
153 // Add Split Part of the Original Edge to the DS
154 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
156 anASSeq.SetNewSuccessor(nV1);
157 anASSeq.SetNewOrientation(aV1.Orientation());
159 anASSeq.SetNewSuccessor(nV2);
160 anASSeq.SetNewOrientation(aV2.Orientation());
162 if (anOri==TopAbs_INTERNAL) {
163 anASSeq.SetNewAncestor(i);
164 aESplit.Orientation(anOri);
167 myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
168 aNewShapeIndex=myDS->NumberOfInsertedShapes();
169 myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
171 // Fill Split Set for the Original Edge
172 aPB.SetEdge(aNewShapeIndex);
176 myIsDone=Standard_True;
178 //=======================================================================
179 // function: UpdateCommonBlocks
181 //=======================================================================
182 void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
184 Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
185 Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
186 TColStd_ListIteratorOfListOfInteger aItLI;
189 BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
190 NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
191 NMTTools_MapOfPaveBlock aMPB;
193 myIsDone=Standard_False;
195 aNbS=myDS->NumberOfShapesOfTheObject();
196 for (nE=1; nE<=aNbS; ++nE) {
197 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
201 const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
202 if (NMTTools_Tools::IsDegenerated(aE)){
206 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
207 //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
208 aNbLCB=aLCB.Extent();
213 NMTTools_ListOfCommonBlock aLCBx;
215 aItLCB.Initialize(aLCB);
216 for (; aItLCB.More(); aItLCB.Next()) {
217 NMTTools_CommonBlock aCBx;
219 NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
220 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
221 aItLPB.Initialize(aLPB);
222 for (; aItLPB.More(); aItLPB.Next()) {
223 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
224 nEx=aPBx.OriginalEdge();
225 BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
226 aItLPBS.Initialize(aLPBS);
227 for (; aItLPBS.More(); aItLPBS.Next()) {
228 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
229 if (aPBSx.IsEqual(aPBx)) {
230 aCBx.AddPaveBlock(aPBSx);
233 }// for (; aItLPBS.More(); aItLPBS.Next()) {
234 }// for (; aItLPB.More(); aItLPB.Next()) {
236 const TColStd_ListOfInteger& aLI=aCB.Faces();
237 aItLI.Initialize(aLI);
238 for (; aItLI.More(); aItLI.Next()) {
244 }//for (; aItLCB.More(); aItLCB.Next()) {
248 aItLCB.Initialize(aLCBx);
249 for (; aItLCB.More(); aItLCB.Next()) {
250 NMTTools_CommonBlock& aCBx=aItLCB.ChangeValue();
253 //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
255 aItLCB.Initialize(aLCB);
256 for (; aItLCB.More(); aItLCB.Next()) {
257 NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
259 BOPTools_PaveBlock aPBMax;
261 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
262 aItLPB.Initialize(aLPB);
263 for (; aItLPB.More(); aItLPB.Next()) {
264 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
265 nEx=aPBx.OriginalEdge();
266 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
267 aTolEx=BRep_Tool::Tolerance(aEx);
268 if (aTolEx>aTolExMax) {
276 if (aMPB.Contains(aPBMax)) {
281 nEMax=aPBMax.OriginalEdge();
282 const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange();
283 const IntTools_Range& aSRMax=aISRMax.ShrunkRange();
284 const Bnd_Box& aBoxMax=aISRMax.BndBox();
285 aSRMax.Range(aTSRMax[0], aTSRMax[1]);
286 for (j=0; j<2; ++j) {
287 BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
291 aItLPB.Initialize(aLPB);
292 for (; aItLPB.More(); aItLPB.Next()) {
293 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
294 nEx=aPBx.OriginalEdge();
299 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
300 GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx);
302 for (j=0; j<2; ++j) {
303 aPPCx.Perform(aPMax[j]);
304 aNbPoints=aPPCx.NbPoints();
308 aTx[j]=aPPCx.LowerDistanceParameter();
311 // correction the range is impossible due to
312 // a projection problem
325 const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
326 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
327 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
329 pSRx->SetFirst(aTx[0]);
330 pSRx->SetLast(aTx[1]);
335 BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
336 aItLPBS.Initialize(aLPBSx);
337 for (; aItLPBS.More(); aItLPBS.Next()) {
338 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
339 if (!aPBSx.IsEqual(aPBx)) {
343 const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
344 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
345 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
347 pSRx->SetFirst(aTx[0]);
348 pSRx->SetLast(aTx[1]);
353 }//for (; aItLPB.More(); aItLPB.Next()) {
354 }//for (; aItLCB.More(); aItLCB.Next()) {
355 }//for (nE=1; nE<=aNbS; ++nE) {
357 //=======================================================================
358 // function: UpdateCommonBlocks
360 //=======================================================================
361 void NMTTools_PaveFiller::UpdateCommonBlocks()
363 myIsDone=Standard_False;
365 Standard_Integer nE, aNbS, nSp, nEx, nSpx;
366 NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
367 BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
369 aNbS=myDS->NumberOfShapesOfTheObject();
371 for (nE=1; nE<=aNbS; ++nE) {
372 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
375 if (NMTTools_Tools::IsDegenerated(TopoDS::Edge(myDS->Shape(nE)))){
379 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
380 /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
382 aCBIt.Initialize(aLCB);
383 for (; aCBIt.More(); aCBIt.Next()) {
384 NMTTools_CommonBlock& aCB=aCBIt.ChangeValue();
386 // Among all PBs of aCB the first PB will be one
387 // that have max tolerance value
389 Standard_Real aTolEx, aTolExMax;
390 BOPTools_ListOfPaveBlock *pLPB, aLPBx;
393 pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
394 aPBIt.Initialize(*pLPB);
395 for (; aPBIt.More(); aPBIt.Next()) {
396 const BOPTools_PaveBlock& aPBx=aPBIt.Value();
397 nEx=aPBx.OriginalEdge();
398 const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
399 aTolEx=BRep_Tool::Tolerance(aEx);
400 if (aTolEx>aTolExMax) {
413 BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
417 const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
418 aPBIt.Initialize(aCBLPB);
419 for (; aPBIt.More(); aPBIt.Next()) {
420 BOPTools_PaveBlock& aPBx=aPBIt.Value();
421 nEx=aPBx.OriginalEdge();
426 nSpx=SplitIndex(aPBx);
433 //=======================================================================
434 // function: SplitIndex
436 //=======================================================================
437 Standard_Integer NMTTools_PaveFiller::SplitIndex
438 (const BOPTools_PaveBlock& aPBx) const
440 Standard_Integer anOriginalEdge, anEdgeIndex=0;
442 anOriginalEdge=aPBx.OriginalEdge();
444 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
446 BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
447 for (; anIt.More(); anIt.Next()) {
448 BOPTools_PaveBlock& aPB=anIt.Value();
449 if (aPB.IsEqual(aPBx)) {
450 anEdgeIndex=aPB.Edge();
457 //=======================================================================
458 // function: UpdatePaveBlocks
460 //=======================================================================
461 void NMTTools_PaveFiller::UpdatePaveBlocks()
463 myIsDone=Standard_False;
465 Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
466 Standard_Real aT1, aT2;
467 TColStd_IndexedMapOfInteger aMF, aME;
468 TopExp_Explorer aExp;
469 TopoDS_Vertex aV1, aV2;
471 BOPTools_Pave aPave1, aPave2;
472 BOPTools_PaveBlock aPB;
474 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
476 aNbFFs=aFFs.Extent();
477 for (i=1; i<=aNbFFs; ++i) {
478 BOPTools_SSInterference& aFFi=aFFs(i);
479 aFFi.Indices(nF1, nF2);
485 for(i=1; i<=aNbF; ++i) {
487 iRankF=myDS->Rank(nF);
488 const TopoDS_Shape aF=myDS->Shape(nF);//mpv
489 aExp.Init(aF, TopAbs_EDGE);
490 for(; aExp.More(); aExp.Next()) {
491 aE=TopoDS::Edge(aExp.Current());
493 if (NMTTools_Tools::IsDegenerated(aE)) {
497 nE=myDS->ShapeIndex(aE, iRankF);
499 if (aME.Contains(nE)) {
504 BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
509 TopExp::Vertices(aE, aV1, aV2);
511 nV1=myDS->ShapeIndex(aV1, iRankF);
512 aT1=BRep_Tool::Parameter(aV1, aE);
513 aPave1.SetIndex(nV1);
514 aPave1.SetParam(aT1);
516 nV2=myDS->ShapeIndex(aV2, iRankF);
517 aT2=BRep_Tool::Parameter(aV2, aE);
518 aPave2.SetIndex(nV2);
519 aPave2.SetParam(aT2);
522 aPB.SetOriginalEdge(nE);
523 aPB.SetPave1(aPave1);
524 aPB.SetPave2(aPave2);
531 //=======================================================================
532 // function: MakeAloneVertices
534 //=======================================================================
535 void NMTTools_PaveFiller::MakeAloneVertices()
537 Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
538 Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
539 TColStd_ListIteratorOfListOfInteger aIt;
540 TColStd_ListOfInteger aLI;
542 TopoDS_Compound aCompound;
544 TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
545 TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
546 TopTools_DataMapOfShapeShape aDMVV;
547 TopTools_DataMapOfIntegerShape aDMIV;
548 TopTools_DataMapOfShapeInteger aDMVI;
549 TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
550 TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
552 aBB.MakeCompound(aCompound);
554 myAloneVertices.Clear();
556 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
558 // 1. Collect alone vertices from FFs
560 aNbFFs=aFFs.Extent();
561 for (i=1; i<=aNbFFs; ++i) {
562 BOPTools_SSInterference& aFFi=aFFs(i);
563 aFFi.Indices(nF1, nF2);
565 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
566 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
568 aTolF1=BRep_Tool::Tolerance(aF1);
569 aTolF2=BRep_Tool::Tolerance(aF2);
570 aTolSum=aTolF1+aTolF2;
576 const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
577 aNbPnts=aSeqAlonePnts.Length();
578 for (j=1; j<=aNbPnts; ++j) {
579 const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
580 BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
581 aDMVFF.Bind(aV, aLI);
582 aBB.Add(aCompound, aV);
590 // 2. Try to fuse alone vertices themselves;
591 FuseVertices(aCompound, aDMVV);
593 // if some are fused, replace them by new ones
594 aItDMVFF.Initialize(aDMVFF);
595 for (; aItDMVFF.More(); aItDMVFF.Next()) {
596 const TopoDS_Shape& aVx=aItDMVFF.Key();
597 const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
599 if (!aDMVV.IsBound(aVx)) {
600 aDMVFF1.Bind(aVx, aLIx);
603 const TopoDS_Shape& aVy=aDMVV.Find(aVx);
605 if (aDMVFF1.IsBound(aVy)) {
606 TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
607 aIt.Initialize(aLIx);
608 for(; aIt.More(); aIt.Next()) {
614 aDMVFF1.Bind(aVy, aLIx);
620 // refine lists of faces in aDMVFF1;
621 aItDMVFF.Initialize(aDMVFF1);
622 for (; aItDMVFF.More(); aItDMVFF.Next()) {
623 TColStd_MapOfInteger aMIy;
624 TColStd_ListOfInteger aLIy;
626 const TopoDS_Shape& aVx=aItDMVFF.Key();
627 TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
628 aIt.Initialize(aLIx);
629 for(; aIt.More(); aIt.Next()) {
638 //==================================
640 // 3. Collect vertices from DS
641 Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
643 aNbS=myDS->NumberOfShapesOfTheObject();
645 for (i=1; i<=aNbS; ++i) {
646 const TopoDS_Shape& aS=myDS->Shape(i);
647 if (aS.ShapeType() != TopAbs_VERTEX){
651 nVSD=FindSDVertex(i);
652 nV=(nVSD) ? nVSD : i;
653 const TopoDS_Shape& aVx=myDS->Shape(nV);
654 if (!aDMVI.IsBound(aVx)) {
659 i1=myDS->NumberOfSourceShapes()+1;
660 i2=myDS->NumberOfInsertedShapes();
661 for (i=i1; i<=i2; ++i) {
662 const TopoDS_Shape aS=myDS->Shape(i);//mpv
663 if (aS.ShapeType() != TopAbs_VERTEX){
666 if (!aDMVI.IsBound(aS)) {
671 // 4. Initialize BoundSortBox on aDMVI
673 Handle(Bnd_HArray1OfBox) aHAB;
674 Bnd_BoundSortBox aBSB;
676 aNbVDS=aDMVI.Extent();
677 aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
679 aItDMVI.Initialize(aDMVI);
680 for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
684 aV=TopoDS::Vertex(aItDMVI.Key());
685 aTolV=BRep_Tool::Tolerance(aV);
687 BRepBndLib::Add(aV, aBox);
688 aHAB->SetValue(i, aBox);
692 aBSB.Initialize(aHAB);
695 aItDMVFF.Initialize(aDMVFF1);
696 for (; aItDMVFF.More(); aItDMVFF.Next()) {
699 const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
700 aV=TopoDS::Vertex(aItDMVFF.Key());
702 aTolV=BRep_Tool::Tolerance(aV);
704 BRepBndLib::Add(aV, aBoxV);
706 const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
707 aNbVSD=aLIVSD.Extent();
709 // add new vertex in DS and update map myAloneVertices
710 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
712 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
713 nV=myDS->NumberOfInsertedShapes();
715 aIt.Initialize(aLIFF);
716 for (; aIt.More(); aIt.Next()) {
718 if (myAloneVertices.Contains(nFx)) {
719 TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
723 TColStd_IndexedMapOfInteger aMVx;
725 myAloneVertices.Add(nFx, aMVx);
732 Standard_Integer aNbF, aNbAV, nF, k;
733 NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
735 aNbF=myAloneVertices.Extent();
740 // 1. fill map Alone Vertex/Face -> aMAVF
741 for (i=1; i<=aNbF; ++i) {
742 nF=myAloneVertices.FindKey(i);
743 const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
745 for(j=1; j<=aNbAV; ++j) {
747 if (aMAVF.Contains(nV)) {
748 TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
752 TColStd_IndexedMapOfInteger aMF;
759 // 2 Obtain pairs of faces
760 aNbAV=aMAVF.Extent();
761 for (i=1; i<=aNbAV; ++i) {
762 const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
764 for(j=1; j<aNbF; ++j) {
766 for(k=j+1; k<=aNbF; ++k) {
768 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
775 //=======================================================================
776 // function: AloneVertices
778 //=======================================================================
779 const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
780 NMTTools_PaveFiller::AloneVertices()const
782 return myAloneVertices;
784 //=======================================================================
785 // function: FuseVertices
787 //=======================================================================
788 void NMTTools_PaveFiller::FuseVertices
789 (const TopoDS_Shape& aCompound,
790 TopTools_DataMapOfShapeShape& aDMVV)const
792 Standard_Integer i, aNbVV, n1, n2, nX;
793 NMTTools_PaveFiller tPF;
795 tPF.SetCompositeShape(aCompound);
800 //tPF.PerformNewVertices(); //qq
802 NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
803 NMTDS_InterfPool& tInterfPool=*(tPF.IP());
804 BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
807 for (i=1; i<=aNbVV; ++i) {
808 const BOPTools_VVInterference& aVV=aVVt(i);
812 const TopoDS_Shape& aV1=tDS.Shape(n1);
813 const TopoDS_Shape& aV2=tDS.Shape(n2);
814 const TopoDS_Shape& aVx=tDS.Shape(nX);
815 aDMVV.Bind(aV1, aVx);
816 aDMVV.Bind(aV2, aVx);