1 // Copyright (C) 2007-2011 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
22 // File: NMTTools_PaveFiller_7.cxx
23 // Author: Peter KURNEV
25 #include <NMTTools_PaveFiller.ixx>
27 #include <Basics_OCCTVersion.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>
67 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
69 #include <BOPTools_SSInterference.hxx>
70 #include <BOPTools_CArray1OfSSInterference.hxx>
71 #include <BOPTools_CArray1OfVVInterference.hxx>
72 #include <BOPTools_VVInterference.hxx>
73 #include <BOPTools_Tools.hxx>
74 #include <BOPTools_ListOfPaveBlock.hxx>
75 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
76 #include <BOPTools_PaveBlock.hxx>
77 #include <BOPTools_Pave.hxx>
78 #include <BOPTools_Tools.hxx>
80 #include <NMTDS_Iterator.hxx>
81 #include <NMTDS_ShapesDataStructure.hxx>
82 #include <NMTDS_InterfPool.hxx>
84 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
85 #include <NMTTools_MapOfPaveBlock.hxx>
88 //=======================================================================
89 // function: MakeSplitEdges
91 //=======================================================================
92 void NMTTools_PaveFiller::MakeSplitEdges()
94 myIsDone=Standard_False;
96 Standard_Boolean bIsNewVertex1, bIsNewVertex2;
97 Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex;
99 TopAbs_Orientation anOri;
100 TopoDS_Edge aE, aESplit;
101 TopoDS_Vertex aV1, aV2;
103 aNbS=myDS->NumberOfShapesOfTheObject();
104 for (i=1; i<=aNbS; ++i) {
105 if (myDS->GetShapeType(i) != TopAbs_EDGE)
109 aE=TopoDS::Edge(myDS->Shape(i));
110 if (BRep_Tool::Degenerated(aE)){
114 anOri=aE.Orientation();
115 aE.Orientation(TopAbs_FORWARD);
117 // Making Split Edges
119 // Split Set for the Original Edge i
120 BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i));
121 BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
123 aNbPaveBlocks=aSplitEdges.Extent();
125 for (; aPBIt.More(); aPBIt.Next()) {
126 BOPTools_PaveBlock& aPB=aPBIt.Value();
128 const BOPTools_Pave& aPave1=aPB.Pave1();
131 aV1=TopoDS::Vertex(myDS->GetShape(nV1));
132 aV1.Orientation(TopAbs_FORWARD);
134 const BOPTools_Pave& aPave2=aPB.Pave2();
137 aV2=TopoDS::Vertex(myDS->GetShape(nV2));
138 aV2.Orientation(TopAbs_REVERSED);
140 if (aNbPaveBlocks==1) {
141 bIsNewVertex1=myDS->IsNewShape (nV1);
142 bIsNewVertex2=myDS->IsNewShape (nV2);
143 if (!bIsNewVertex1 && !bIsNewVertex2) {
149 BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);
151 // Add Split Part of the Original Edge to the DS
152 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
154 anASSeq.SetNewSuccessor(nV1);
155 anASSeq.SetNewOrientation(aV1.Orientation());
157 anASSeq.SetNewSuccessor(nV2);
158 anASSeq.SetNewOrientation(aV2.Orientation());
160 if (anOri==TopAbs_INTERNAL) {
161 anASSeq.SetNewAncestor(i);
162 aESplit.Orientation(anOri);
165 myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
166 aNewShapeIndex=myDS->NumberOfInsertedShapes();
167 myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
169 // Fill Split Set for the Original Edge
170 aPB.SetEdge(aNewShapeIndex);
174 myIsDone=Standard_True;
176 //=======================================================================
177 // function: UpdateCommonBlocks
179 //=======================================================================
180 void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
182 Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
183 Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
184 TColStd_ListIteratorOfListOfInteger aItLI;
187 BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
188 NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
189 NMTTools_MapOfPaveBlock aMPB;
191 myIsDone=Standard_False;
193 aNbS=myDS->NumberOfShapesOfTheObject();
194 for (nE=1; nE<=aNbS; ++nE) {
195 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
199 const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
200 if (BRep_Tool::Degenerated(aE)){
204 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
205 //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
206 aNbLCB=aLCB.Extent();
211 NMTTools_ListOfCommonBlock aLCBx;
213 aItLCB.Initialize(aLCB);
214 for (; aItLCB.More(); aItLCB.Next()) {
215 NMTTools_CommonBlock aCBx;
217 NMTTools_CommonBlock& aCB=aItLCB.Value();
218 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
219 aItLPB.Initialize(aLPB);
220 for (; aItLPB.More(); aItLPB.Next()) {
221 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
222 nEx=aPBx.OriginalEdge();
223 BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
224 aItLPBS.Initialize(aLPBS);
225 for (; aItLPBS.More(); aItLPBS.Next()) {
226 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
227 if (aPBSx.IsEqual(aPBx)) {
228 aCBx.AddPaveBlock(aPBSx);
231 }// for (; aItLPBS.More(); aItLPBS.Next()) {
232 }// for (; aItLPB.More(); aItLPB.Next()) {
234 const TColStd_ListOfInteger& aLI=aCB.Faces();
235 aItLI.Initialize(aLI);
236 for (; aItLI.More(); aItLI.Next()) {
242 }//for (; aItLCB.More(); aItLCB.Next()) {
246 aItLCB.Initialize(aLCBx);
247 for (; aItLCB.More(); aItLCB.Next()) {
248 NMTTools_CommonBlock& aCBx=aItLCB.Value();
251 //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
253 aItLCB.Initialize(aLCB);
254 for (; aItLCB.More(); aItLCB.Next()) {
255 NMTTools_CommonBlock& aCB=aItLCB.Value();
257 BOPTools_PaveBlock aPBMax;
259 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
260 aItLPB.Initialize(aLPB);
261 for (; aItLPB.More(); aItLPB.Next()) {
262 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
263 nEx=aPBx.OriginalEdge();
264 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
265 aTolEx=BRep_Tool::Tolerance(aEx);
266 if (aTolEx>aTolExMax) {
274 if (aMPB.Contains(aPBMax)) {
279 nEMax=aPBMax.OriginalEdge();
280 const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange();
281 const IntTools_Range& aSRMax=aISRMax.ShrunkRange();
282 const Bnd_Box& aBoxMax=aISRMax.BndBox();
283 aSRMax.Range(aTSRMax[0], aTSRMax[1]);
284 for (j=0; j<2; ++j) {
285 BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
289 aItLPB.Initialize(aLPB);
290 for (; aItLPB.More(); aItLPB.Next()) {
291 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
292 nEx=aPBx.OriginalEdge();
297 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
298 #if OCC_VERSION_LARGE > 0x06050200
299 GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx);
301 GeomAPI_ProjectPointOnCurve& aPPCx=myContext.ProjPC(aEx);
304 for (j=0; j<2; ++j) {
305 aPPCx.Perform(aPMax[j]);
306 aNbPoints=aPPCx.NbPoints();
310 aTx[j]=aPPCx.LowerDistanceParameter();
313 // correction the range is impossible due to
314 // a projection problem
327 const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
328 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
329 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
331 pSRx->SetFirst(aTx[0]);
332 pSRx->SetLast(aTx[1]);
337 BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
338 aItLPBS.Initialize(aLPBSx);
339 for (; aItLPBS.More(); aItLPBS.Next()) {
340 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
341 if (!aPBSx.IsEqual(aPBx)) {
345 const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
346 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
347 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
349 pSRx->SetFirst(aTx[0]);
350 pSRx->SetLast(aTx[1]);
355 }//for (; aItLPB.More(); aItLPB.Next()) {
356 }//for (; aItLCB.More(); aItLCB.Next()) {
357 }//for (nE=1; nE<=aNbS; ++nE) {
359 //=======================================================================
360 // function: UpdateCommonBlocks
362 //=======================================================================
363 void NMTTools_PaveFiller::UpdateCommonBlocks()
365 myIsDone=Standard_False;
367 Standard_Integer nE, aNbS, nSp, nEx, nSpx;
368 NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
369 BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
371 aNbS=myDS->NumberOfShapesOfTheObject();
373 for (nE=1; nE<=aNbS; ++nE) {
374 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
377 if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){
381 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
382 /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
384 aCBIt.Initialize(aLCB);
385 for (; aCBIt.More(); aCBIt.Next()) {
386 NMTTools_CommonBlock& aCB=aCBIt.Value();
388 // Among all PBs of aCB the first PB will be one
389 // that have max tolerance value
391 Standard_Real aTolEx, aTolExMax;
392 BOPTools_ListOfPaveBlock *pLPB, aLPBx;
395 pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
396 aPBIt.Initialize(*pLPB);
397 for (; aPBIt.More(); aPBIt.Next()) {
398 const BOPTools_PaveBlock& aPBx=aPBIt.Value();
399 nEx=aPBx.OriginalEdge();
400 const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
401 aTolEx=BRep_Tool::Tolerance(aEx);
402 if (aTolEx>aTolExMax) {
415 BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
419 const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
420 aPBIt.Initialize(aCBLPB);
421 for (; aPBIt.More(); aPBIt.Next()) {
422 BOPTools_PaveBlock& aPBx=aPBIt.Value();
423 nEx=aPBx.OriginalEdge();
428 nSpx=SplitIndex(aPBx);
435 //=======================================================================
436 // function: SplitIndex
438 //=======================================================================
439 Standard_Integer NMTTools_PaveFiller::SplitIndex
440 (const BOPTools_PaveBlock& aPBx) const
442 Standard_Integer anOriginalEdge, anEdgeIndex=0;
444 anOriginalEdge=aPBx.OriginalEdge();
446 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
448 BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
449 for (; anIt.More(); anIt.Next()) {
450 BOPTools_PaveBlock& aPB=anIt.Value();
451 if (aPB.IsEqual(aPBx)) {
452 anEdgeIndex=aPB.Edge();
459 //=======================================================================
460 // function: UpdatePaveBlocks
462 //=======================================================================
463 void NMTTools_PaveFiller::UpdatePaveBlocks()
465 myIsDone=Standard_False;
467 Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
468 Standard_Real aT1, aT2;
469 TColStd_IndexedMapOfInteger aMF, aME;
470 TopExp_Explorer aExp;
471 TopoDS_Vertex aV1, aV2;
473 BOPTools_Pave aPave1, aPave2;
474 BOPTools_PaveBlock aPB;
476 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
478 aNbFFs=aFFs.Extent();
479 for (i=1; i<=aNbFFs; ++i) {
480 BOPTools_SSInterference& aFFi=aFFs(i);
481 aFFi.Indices(nF1, nF2);
487 for(i=1; i<=aNbF; ++i) {
489 iRankF=myDS->Rank(nF);
490 const TopoDS_Shape aF=myDS->Shape(nF);//mpv
491 aExp.Init(aF, TopAbs_EDGE);
492 for(; aExp.More(); aExp.Next()) {
493 aE=TopoDS::Edge(aExp.Current());
495 if (BRep_Tool::Degenerated(aE)) {
499 nE=myDS->ShapeIndex(aE, iRankF);
501 if (aME.Contains(nE)) {
506 BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
511 TopExp::Vertices(aE, aV1, aV2);
513 nV1=myDS->ShapeIndex(aV1, iRankF);
514 aT1=BRep_Tool::Parameter(aV1, aE);
515 aPave1.SetIndex(nV1);
516 aPave1.SetParam(aT1);
518 nV2=myDS->ShapeIndex(aV2, iRankF);
519 aT2=BRep_Tool::Parameter(aV2, aE);
520 aPave2.SetIndex(nV2);
521 aPave2.SetParam(aT2);
524 aPB.SetOriginalEdge(nE);
525 aPB.SetPave1(aPave1);
526 aPB.SetPave2(aPave2);
533 //=======================================================================
534 // function: MakeAloneVertices
536 //=======================================================================
537 void NMTTools_PaveFiller::MakeAloneVertices()
539 Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
540 Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
541 TColStd_ListIteratorOfListOfInteger aIt;
542 TColStd_ListOfInteger aLI;
544 TopoDS_Compound aCompound;
546 TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
547 TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
548 TopTools_DataMapOfShapeShape aDMVV;
549 TopTools_DataMapOfIntegerShape aDMIV;
550 TopTools_DataMapOfShapeInteger aDMVI;
551 TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
552 TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
554 aBB.MakeCompound(aCompound);
556 myAloneVertices.Clear();
558 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
560 // 1. Collect alone vertices from FFs
562 aNbFFs=aFFs.Extent();
563 for (i=1; i<=aNbFFs; ++i) {
564 BOPTools_SSInterference& aFFi=aFFs(i);
565 aFFi.Indices(nF1, nF2);
567 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
568 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
570 aTolF1=BRep_Tool::Tolerance(aF1);
571 aTolF2=BRep_Tool::Tolerance(aF2);
572 aTolSum=aTolF1+aTolF2;
578 const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
579 aNbPnts=aSeqAlonePnts.Length();
580 for (j=1; j<=aNbPnts; ++j) {
581 const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
582 BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
583 aDMVFF.Bind(aV, aLI);
584 aBB.Add(aCompound, aV);
592 // 2. Try to fuse alone vertices themselves;
593 FuseVertices(aCompound, aDMVV);
595 // if some are fused, replace them by new ones
596 aItDMVFF.Initialize(aDMVFF);
597 for (; aItDMVFF.More(); aItDMVFF.Next()) {
598 const TopoDS_Shape& aVx=aItDMVFF.Key();
599 const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
601 if (!aDMVV.IsBound(aVx)) {
602 aDMVFF1.Bind(aVx, aLIx);
605 const TopoDS_Shape& aVy=aDMVV.Find(aVx);
607 if (aDMVFF1.IsBound(aVy)) {
608 TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
609 aIt.Initialize(aLIx);
610 for(; aIt.More(); aIt.Next()) {
616 aDMVFF1.Bind(aVy, aLIx);
622 // refine lists of faces in aDMVFF1;
623 aItDMVFF.Initialize(aDMVFF1);
624 for (; aItDMVFF.More(); aItDMVFF.Next()) {
625 TColStd_MapOfInteger aMIy;
626 TColStd_ListOfInteger aLIy;
628 const TopoDS_Shape& aVx=aItDMVFF.Key();
629 TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
630 aIt.Initialize(aLIx);
631 for(; aIt.More(); aIt.Next()) {
640 //==================================
642 // 3. Collect vertices from DS
643 Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
645 aNbS=myDS->NumberOfShapesOfTheObject();
647 for (i=1; i<=aNbS; ++i) {
648 const TopoDS_Shape& aS=myDS->Shape(i);
649 if (aS.ShapeType() != TopAbs_VERTEX){
653 nVSD=FindSDVertex(i);
654 nV=(nVSD) ? nVSD : i;
655 const TopoDS_Shape& aVx=myDS->Shape(nV);
656 if (!aDMVI.IsBound(aVx)) {
661 i1=myDS->NumberOfSourceShapes()+1;
662 i2=myDS->NumberOfInsertedShapes();
663 for (i=i1; i<=i2; ++i) {
664 const TopoDS_Shape aS=myDS->Shape(i);//mpv
665 if (aS.ShapeType() != TopAbs_VERTEX){
668 if (!aDMVI.IsBound(aS)) {
673 // 4. Initialize BoundSortBox on aDMVI
675 Handle(Bnd_HArray1OfBox) aHAB;
676 Bnd_BoundSortBox aBSB;
678 aNbVDS=aDMVI.Extent();
679 aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
681 aItDMVI.Initialize(aDMVI);
682 for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
686 aV=TopoDS::Vertex(aItDMVI.Key());
687 aTolV=BRep_Tool::Tolerance(aV);
689 BRepBndLib::Add(aV, aBox);
690 aHAB->SetValue(i, aBox);
694 aBSB.Initialize(aHAB);
697 aItDMVFF.Initialize(aDMVFF1);
698 for (; aItDMVFF.More(); aItDMVFF.Next()) {
701 const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
702 aV=TopoDS::Vertex(aItDMVFF.Key());
704 aTolV=BRep_Tool::Tolerance(aV);
706 BRepBndLib::Add(aV, aBoxV);
708 const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
709 aNbVSD=aLIVSD.Extent();
711 // add new vertex in DS and update map myAloneVertices
712 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
714 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
715 nV=myDS->NumberOfInsertedShapes();
717 aIt.Initialize(aLIFF);
718 for (; aIt.More(); aIt.Next()) {
720 if (myAloneVertices.Contains(nFx)) {
721 TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
725 TColStd_IndexedMapOfInteger aMVx;
727 myAloneVertices.Add(nFx, aMVx);
734 Standard_Integer aNbF, aNbAV, nF, k;
735 NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
737 aNbF=myAloneVertices.Extent();
742 // 1. fill map Alone Vertex/Face -> aMAVF
743 for (i=1; i<=aNbF; ++i) {
744 nF=myAloneVertices.FindKey(i);
745 const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
747 for(j=1; j<=aNbAV; ++j) {
749 if (aMAVF.Contains(nV)) {
750 TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
754 TColStd_IndexedMapOfInteger aMF;
761 // 2 Obtain pairs of faces
762 aNbAV=aMAVF.Extent();
763 for (i=1; i<=aNbAV; ++i) {
764 const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
766 for(j=1; j<aNbF; ++j) {
768 for(k=j+1; k<=aNbF; ++k) {
770 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
777 //=======================================================================
778 // function: AloneVertices
780 //=======================================================================
781 const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
782 NMTTools_PaveFiller::AloneVertices()const
784 return myAloneVertices;
786 //=======================================================================
787 // function: FuseVertices
789 //=======================================================================
790 void NMTTools_PaveFiller::FuseVertices
791 (const TopoDS_Shape& aCompound,
792 TopTools_DataMapOfShapeShape& aDMVV)const
794 Standard_Integer i, aNbVV, n1, n2, nX;
795 NMTTools_PaveFiller tPF;
797 tPF.SetCompositeShape(aCompound);
802 //tPF.PerformNewVertices(); //qq
804 NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
805 NMTDS_InterfPool& tInterfPool=*(tPF.IP());
806 BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
809 for (i=1; i<=aNbVV; ++i) {
810 const BOPTools_VVInterference& aVV=aVVt(i);
814 const TopoDS_Shape& aV1=tDS.Shape(n1);
815 const TopoDS_Shape& aV2=tDS.Shape(n2);
816 const TopoDS_Shape& aVx=tDS.Shape(nX);
817 aDMVV.Bind(aV1, aVx);
818 aDMVV.Bind(aV2, aVx);