1 // Copyright (C) 2007-2012 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>
28 #include <Bnd_HArray1OfBox.hxx>
29 #include <Bnd_BoundSortBox.hxx>
30 #include <Bnd_Box.hxx>
31 #include <BRepBndLib.hxx>
33 #include <TColStd_MapOfInteger.hxx>
34 #include <TColStd_ListOfInteger.hxx>
35 #include <TColStd_IndexedMapOfInteger.hxx>
36 #include <TColStd_ListIteratorOfListOfInteger.hxx>
38 #include <GeomAPI_ProjectPointOnCurve.hxx>
40 #include <TopAbs_Orientation.hxx>
43 #include <TopoDS_Edge.hxx>
44 #include <TopoDS_Shape.hxx>
45 #include <TopoDS_Vertex.hxx>
46 #include <TopoDS_Compound.hxx>
48 #include <TopTools_DataMapOfIntegerShape.hxx>
49 #include <TopTools_DataMapOfShapeInteger.hxx>
50 #include <TopTools_DataMapOfShapeShape.hxx>
51 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
52 #include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
53 #include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
54 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger.hxx>
56 #include <BRep_Builder.hxx>
57 #include <BRep_Tool.hxx>
59 #include <TopExp_Explorer.hxx>
62 #include <IntTools_SequenceOfPntOn2Faces.hxx>
63 #include <IntTools_PntOnFace.hxx>
64 #include <IntTools_PntOn2Faces.hxx>
65 #include <IntTools_Context.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_ListOfCommonBlock.hxx>
85 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
86 #include <NMTTools_MapOfPaveBlock.hxx>
89 //=======================================================================
90 // function: MakeSplitEdges
92 //=======================================================================
93 void NMTTools_PaveFiller::MakeSplitEdges()
95 myIsDone=Standard_False;
97 Standard_Boolean bIsNewVertex1, bIsNewVertex2;
98 Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex;
100 TopAbs_Orientation anOri;
101 TopoDS_Edge aE, aESplit;
102 TopoDS_Vertex aV1, aV2;
104 aNbS=myDS->NumberOfShapesOfTheObject();
105 for (i=1; i<=aNbS; ++i) {
106 if (myDS->GetShapeType(i) != TopAbs_EDGE)
110 aE=TopoDS::Edge(myDS->Shape(i));
111 if (BRep_Tool::Degenerated(aE)){
115 anOri=aE.Orientation();
116 aE.Orientation(TopAbs_FORWARD);
118 // Making Split Edges
120 // Split Set for the Original Edge i
121 BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i));
122 BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
124 aNbPaveBlocks=aSplitEdges.Extent();
126 for (; aPBIt.More(); aPBIt.Next()) {
127 BOPTools_PaveBlock& aPB=aPBIt.Value();
129 const BOPTools_Pave& aPave1=aPB.Pave1();
132 aV1=TopoDS::Vertex(myDS->GetShape(nV1));
133 aV1.Orientation(TopAbs_FORWARD);
135 const BOPTools_Pave& aPave2=aPB.Pave2();
138 aV2=TopoDS::Vertex(myDS->GetShape(nV2));
139 aV2.Orientation(TopAbs_REVERSED);
141 if (aNbPaveBlocks==1) {
142 bIsNewVertex1=myDS->IsNewShape (nV1);
143 bIsNewVertex2=myDS->IsNewShape (nV2);
144 if (!bIsNewVertex1 && !bIsNewVertex2) {
150 BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);
152 // Add Split Part of the Original Edge to the DS
153 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
155 anASSeq.SetNewSuccessor(nV1);
156 anASSeq.SetNewOrientation(aV1.Orientation());
158 anASSeq.SetNewSuccessor(nV2);
159 anASSeq.SetNewOrientation(aV2.Orientation());
161 if (anOri==TopAbs_INTERNAL) {
162 anASSeq.SetNewAncestor(i);
163 aESplit.Orientation(anOri);
166 myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
167 aNewShapeIndex=myDS->NumberOfInsertedShapes();
168 myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
170 // Fill Split Set for the Original Edge
171 aPB.SetEdge(aNewShapeIndex);
175 myIsDone=Standard_True;
177 //=======================================================================
178 // function: UpdateCommonBlocks
180 //=======================================================================
181 void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
183 Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
184 Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
185 TColStd_ListIteratorOfListOfInteger aItLI;
188 BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
189 NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
190 NMTTools_MapOfPaveBlock aMPB;
192 myIsDone=Standard_False;
194 aNbS=myDS->NumberOfShapesOfTheObject();
195 for (nE=1; nE<=aNbS; ++nE) {
196 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
200 const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
201 if (BRep_Tool::Degenerated(aE)){
205 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
206 //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
207 aNbLCB=aLCB.Extent();
212 NMTTools_ListOfCommonBlock aLCBx;
214 aItLCB.Initialize(aLCB);
215 for (; aItLCB.More(); aItLCB.Next()) {
216 NMTTools_CommonBlock aCBx;
218 NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
219 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
220 aItLPB.Initialize(aLPB);
221 for (; aItLPB.More(); aItLPB.Next()) {
222 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
223 nEx=aPBx.OriginalEdge();
224 BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
225 aItLPBS.Initialize(aLPBS);
226 for (; aItLPBS.More(); aItLPBS.Next()) {
227 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
228 if (aPBSx.IsEqual(aPBx)) {
229 aCBx.AddPaveBlock(aPBSx);
232 }// for (; aItLPBS.More(); aItLPBS.Next()) {
233 }// for (; aItLPB.More(); aItLPB.Next()) {
235 const TColStd_ListOfInteger& aLI=aCB.Faces();
236 aItLI.Initialize(aLI);
237 for (; aItLI.More(); aItLI.Next()) {
243 }//for (; aItLCB.More(); aItLCB.Next()) {
247 aItLCB.Initialize(aLCBx);
248 for (; aItLCB.More(); aItLCB.Next()) {
249 NMTTools_CommonBlock& aCBx=aItLCB.ChangeValue();
252 //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
254 aItLCB.Initialize(aLCB);
255 for (; aItLCB.More(); aItLCB.Next()) {
256 NMTTools_CommonBlock& aCB=aItLCB.ChangeValue();
258 BOPTools_PaveBlock aPBMax;
260 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
261 aItLPB.Initialize(aLPB);
262 for (; aItLPB.More(); aItLPB.Next()) {
263 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
264 nEx=aPBx.OriginalEdge();
265 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
266 aTolEx=BRep_Tool::Tolerance(aEx);
267 if (aTolEx>aTolExMax) {
275 if (aMPB.Contains(aPBMax)) {
280 nEMax=aPBMax.OriginalEdge();
281 const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange();
282 const IntTools_Range& aSRMax=aISRMax.ShrunkRange();
283 const Bnd_Box& aBoxMax=aISRMax.BndBox();
284 aSRMax.Range(aTSRMax[0], aTSRMax[1]);
285 for (j=0; j<2; ++j) {
286 BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
290 aItLPB.Initialize(aLPB);
291 for (; aItLPB.More(); aItLPB.Next()) {
292 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
293 nEx=aPBx.OriginalEdge();
298 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
299 GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx);
301 for (j=0; j<2; ++j) {
302 aPPCx.Perform(aPMax[j]);
303 aNbPoints=aPPCx.NbPoints();
307 aTx[j]=aPPCx.LowerDistanceParameter();
310 // correction the range is impossible due to
311 // a projection problem
324 const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
325 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
326 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
328 pSRx->SetFirst(aTx[0]);
329 pSRx->SetLast(aTx[1]);
334 BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
335 aItLPBS.Initialize(aLPBSx);
336 for (; aItLPBS.More(); aItLPBS.Next()) {
337 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
338 if (!aPBSx.IsEqual(aPBx)) {
342 const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
343 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
344 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
346 pSRx->SetFirst(aTx[0]);
347 pSRx->SetLast(aTx[1]);
352 }//for (; aItLPB.More(); aItLPB.Next()) {
353 }//for (; aItLCB.More(); aItLCB.Next()) {
354 }//for (nE=1; nE<=aNbS; ++nE) {
356 //=======================================================================
357 // function: UpdateCommonBlocks
359 //=======================================================================
360 void NMTTools_PaveFiller::UpdateCommonBlocks()
362 myIsDone=Standard_False;
364 Standard_Integer nE, aNbS, nSp, nEx, nSpx;
365 NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
366 BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
368 aNbS=myDS->NumberOfShapesOfTheObject();
370 for (nE=1; nE<=aNbS; ++nE) {
371 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
374 if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){
378 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
379 /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
381 aCBIt.Initialize(aLCB);
382 for (; aCBIt.More(); aCBIt.Next()) {
383 NMTTools_CommonBlock& aCB=aCBIt.ChangeValue();
385 // Among all PBs of aCB the first PB will be one
386 // that have max tolerance value
388 Standard_Real aTolEx, aTolExMax;
389 BOPTools_ListOfPaveBlock *pLPB, aLPBx;
392 pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
393 aPBIt.Initialize(*pLPB);
394 for (; aPBIt.More(); aPBIt.Next()) {
395 const BOPTools_PaveBlock& aPBx=aPBIt.Value();
396 nEx=aPBx.OriginalEdge();
397 const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
398 aTolEx=BRep_Tool::Tolerance(aEx);
399 if (aTolEx>aTolExMax) {
412 BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
416 const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
417 aPBIt.Initialize(aCBLPB);
418 for (; aPBIt.More(); aPBIt.Next()) {
419 BOPTools_PaveBlock& aPBx=aPBIt.Value();
420 nEx=aPBx.OriginalEdge();
425 nSpx=SplitIndex(aPBx);
432 //=======================================================================
433 // function: SplitIndex
435 //=======================================================================
436 Standard_Integer NMTTools_PaveFiller::SplitIndex
437 (const BOPTools_PaveBlock& aPBx) const
439 Standard_Integer anOriginalEdge, anEdgeIndex=0;
441 anOriginalEdge=aPBx.OriginalEdge();
443 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
445 BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
446 for (; anIt.More(); anIt.Next()) {
447 BOPTools_PaveBlock& aPB=anIt.Value();
448 if (aPB.IsEqual(aPBx)) {
449 anEdgeIndex=aPB.Edge();
456 //=======================================================================
457 // function: UpdatePaveBlocks
459 //=======================================================================
460 void NMTTools_PaveFiller::UpdatePaveBlocks()
462 myIsDone=Standard_False;
464 Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
465 Standard_Real aT1, aT2;
466 TColStd_IndexedMapOfInteger aMF, aME;
467 TopExp_Explorer aExp;
468 TopoDS_Vertex aV1, aV2;
470 BOPTools_Pave aPave1, aPave2;
471 BOPTools_PaveBlock aPB;
473 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
475 aNbFFs=aFFs.Extent();
476 for (i=1; i<=aNbFFs; ++i) {
477 BOPTools_SSInterference& aFFi=aFFs(i);
478 aFFi.Indices(nF1, nF2);
484 for(i=1; i<=aNbF; ++i) {
486 iRankF=myDS->Rank(nF);
487 const TopoDS_Shape aF=myDS->Shape(nF);//mpv
488 aExp.Init(aF, TopAbs_EDGE);
489 for(; aExp.More(); aExp.Next()) {
490 aE=TopoDS::Edge(aExp.Current());
492 if (BRep_Tool::Degenerated(aE)) {
496 nE=myDS->ShapeIndex(aE, iRankF);
498 if (aME.Contains(nE)) {
503 BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
508 TopExp::Vertices(aE, aV1, aV2);
510 nV1=myDS->ShapeIndex(aV1, iRankF);
511 aT1=BRep_Tool::Parameter(aV1, aE);
512 aPave1.SetIndex(nV1);
513 aPave1.SetParam(aT1);
515 nV2=myDS->ShapeIndex(aV2, iRankF);
516 aT2=BRep_Tool::Parameter(aV2, aE);
517 aPave2.SetIndex(nV2);
518 aPave2.SetParam(aT2);
521 aPB.SetOriginalEdge(nE);
522 aPB.SetPave1(aPave1);
523 aPB.SetPave2(aPave2);
530 //=======================================================================
531 // function: MakeAloneVertices
533 //=======================================================================
534 void NMTTools_PaveFiller::MakeAloneVertices()
536 Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
537 Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
538 TColStd_ListIteratorOfListOfInteger aIt;
539 TColStd_ListOfInteger aLI;
541 TopoDS_Compound aCompound;
543 TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
544 TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
545 TopTools_DataMapOfShapeShape aDMVV;
546 TopTools_DataMapOfIntegerShape aDMIV;
547 TopTools_DataMapOfShapeInteger aDMVI;
548 TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
549 TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
551 aBB.MakeCompound(aCompound);
553 myAloneVertices.Clear();
555 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
557 // 1. Collect alone vertices from FFs
559 aNbFFs=aFFs.Extent();
560 for (i=1; i<=aNbFFs; ++i) {
561 BOPTools_SSInterference& aFFi=aFFs(i);
562 aFFi.Indices(nF1, nF2);
564 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
565 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
567 aTolF1=BRep_Tool::Tolerance(aF1);
568 aTolF2=BRep_Tool::Tolerance(aF2);
569 aTolSum=aTolF1+aTolF2;
575 const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
576 aNbPnts=aSeqAlonePnts.Length();
577 for (j=1; j<=aNbPnts; ++j) {
578 const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
579 BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
580 aDMVFF.Bind(aV, aLI);
581 aBB.Add(aCompound, aV);
589 // 2. Try to fuse alone vertices themselves;
590 FuseVertices(aCompound, aDMVV);
592 // if some are fused, replace them by new ones
593 aItDMVFF.Initialize(aDMVFF);
594 for (; aItDMVFF.More(); aItDMVFF.Next()) {
595 const TopoDS_Shape& aVx=aItDMVFF.Key();
596 const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
598 if (!aDMVV.IsBound(aVx)) {
599 aDMVFF1.Bind(aVx, aLIx);
602 const TopoDS_Shape& aVy=aDMVV.Find(aVx);
604 if (aDMVFF1.IsBound(aVy)) {
605 TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
606 aIt.Initialize(aLIx);
607 for(; aIt.More(); aIt.Next()) {
613 aDMVFF1.Bind(aVy, aLIx);
619 // refine lists of faces in aDMVFF1;
620 aItDMVFF.Initialize(aDMVFF1);
621 for (; aItDMVFF.More(); aItDMVFF.Next()) {
622 TColStd_MapOfInteger aMIy;
623 TColStd_ListOfInteger aLIy;
625 const TopoDS_Shape& aVx=aItDMVFF.Key();
626 TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
627 aIt.Initialize(aLIx);
628 for(; aIt.More(); aIt.Next()) {
637 //==================================
639 // 3. Collect vertices from DS
640 Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
642 aNbS=myDS->NumberOfShapesOfTheObject();
644 for (i=1; i<=aNbS; ++i) {
645 const TopoDS_Shape& aS=myDS->Shape(i);
646 if (aS.ShapeType() != TopAbs_VERTEX){
650 nVSD=FindSDVertex(i);
651 nV=(nVSD) ? nVSD : i;
652 const TopoDS_Shape& aVx=myDS->Shape(nV);
653 if (!aDMVI.IsBound(aVx)) {
658 i1=myDS->NumberOfSourceShapes()+1;
659 i2=myDS->NumberOfInsertedShapes();
660 for (i=i1; i<=i2; ++i) {
661 const TopoDS_Shape aS=myDS->Shape(i);//mpv
662 if (aS.ShapeType() != TopAbs_VERTEX){
665 if (!aDMVI.IsBound(aS)) {
670 // 4. Initialize BoundSortBox on aDMVI
672 Handle(Bnd_HArray1OfBox) aHAB;
673 Bnd_BoundSortBox aBSB;
675 aNbVDS=aDMVI.Extent();
676 aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
678 aItDMVI.Initialize(aDMVI);
679 for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
683 aV=TopoDS::Vertex(aItDMVI.Key());
684 aTolV=BRep_Tool::Tolerance(aV);
686 BRepBndLib::Add(aV, aBox);
687 aHAB->SetValue(i, aBox);
691 aBSB.Initialize(aHAB);
694 aItDMVFF.Initialize(aDMVFF1);
695 for (; aItDMVFF.More(); aItDMVFF.Next()) {
698 const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
699 aV=TopoDS::Vertex(aItDMVFF.Key());
701 aTolV=BRep_Tool::Tolerance(aV);
703 BRepBndLib::Add(aV, aBoxV);
705 const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
706 aNbVSD=aLIVSD.Extent();
708 // add new vertex in DS and update map myAloneVertices
709 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
711 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
712 nV=myDS->NumberOfInsertedShapes();
714 aIt.Initialize(aLIFF);
715 for (; aIt.More(); aIt.Next()) {
717 if (myAloneVertices.Contains(nFx)) {
718 TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
722 TColStd_IndexedMapOfInteger aMVx;
724 myAloneVertices.Add(nFx, aMVx);
731 Standard_Integer aNbF, aNbAV, nF, k;
732 NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
734 aNbF=myAloneVertices.Extent();
739 // 1. fill map Alone Vertex/Face -> aMAVF
740 for (i=1; i<=aNbF; ++i) {
741 nF=myAloneVertices.FindKey(i);
742 const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
744 for(j=1; j<=aNbAV; ++j) {
746 if (aMAVF.Contains(nV)) {
747 TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
751 TColStd_IndexedMapOfInteger aMF;
758 // 2 Obtain pairs of faces
759 aNbAV=aMAVF.Extent();
760 for (i=1; i<=aNbAV; ++i) {
761 const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
763 for(j=1; j<aNbF; ++j) {
765 for(k=j+1; k<=aNbF; ++k) {
767 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
774 //=======================================================================
775 // function: AloneVertices
777 //=======================================================================
778 const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
779 NMTTools_PaveFiller::AloneVertices()const
781 return myAloneVertices;
783 //=======================================================================
784 // function: FuseVertices
786 //=======================================================================
787 void NMTTools_PaveFiller::FuseVertices
788 (const TopoDS_Shape& aCompound,
789 TopTools_DataMapOfShapeShape& aDMVV)const
791 Standard_Integer i, aNbVV, n1, n2, nX;
792 NMTTools_PaveFiller tPF;
794 tPF.SetCompositeShape(aCompound);
799 //tPF.PerformNewVertices(); //qq
801 NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
802 NMTDS_InterfPool& tInterfPool=*(tPF.IP());
803 BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
806 for (i=1; i<=aNbVV; ++i) {
807 const BOPTools_VVInterference& aVV=aVVt(i);
811 const TopoDS_Shape& aV1=tDS.Shape(n1);
812 const TopoDS_Shape& aV2=tDS.Shape(n2);
813 const TopoDS_Shape& aVx=tDS.Shape(nX);
814 aDMVV.Bind(aV1, aVx);
815 aDMVV.Bind(aV2, aVx);