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.hxx>
27 #include <Bnd_HArray1OfBox.hxx>
28 #include <Bnd_BoundSortBox.hxx>
29 #include <Bnd_Box.hxx>
30 #include <BRepBndLib.hxx>
32 #include <TColStd_MapOfInteger.hxx>
33 #include <TColStd_ListOfInteger.hxx>
34 #include <TColStd_IndexedMapOfInteger.hxx>
35 #include <TColStd_ListIteratorOfListOfInteger.hxx>
37 #include <GeomAPI_ProjectPointOnCurve.hxx>
39 #include <TopAbs_Orientation.hxx>
42 #include <TopoDS_Edge.hxx>
43 #include <TopoDS_Shape.hxx>
44 #include <TopoDS_Vertex.hxx>
45 #include <TopoDS_Compound.hxx>
47 #include <TopTools_DataMapOfIntegerShape.hxx>
48 #include <TopTools_DataMapOfShapeInteger.hxx>
49 #include <TopTools_DataMapOfShapeShape.hxx>
50 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
51 #include <TopTools_DataMapIteratorOfDataMapOfIntegerShape.hxx>
52 #include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
53 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger.hxx>
55 #include <BRep_Builder.hxx>
56 #include <BRep_Tool.hxx>
58 #include <TopExp_Explorer.hxx>
61 #include <IntTools_SequenceOfPntOn2Faces.hxx>
62 #include <IntTools_PntOnFace.hxx>
63 #include <IntTools_PntOn2Faces.hxx>
64 #include <IntTools_Context.hxx>
66 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
68 #include <BOPTools_SSInterference.hxx>
69 #include <BOPTools_CArray1OfSSInterference.hxx>
70 #include <BOPTools_CArray1OfVVInterference.hxx>
71 #include <BOPTools_VVInterference.hxx>
72 #include <BOPTools_Tools.hxx>
73 #include <BOPTools_ListOfPaveBlock.hxx>
74 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
75 #include <BOPTools_PaveBlock.hxx>
76 #include <BOPTools_Pave.hxx>
77 #include <BOPTools_Tools.hxx>
79 #include <NMTDS_Iterator.hxx>
80 #include <NMTDS_ShapesDataStructure.hxx>
81 #include <NMTDS_InterfPool.hxx>
83 #include <NMTTools_ListOfCommonBlock.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.ChangeValue();
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.ChangeValue();
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.ChangeValue();
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 GeomAPI_ProjectPointOnCurve& aPPCx=myContext->ProjPC(aEx);
300 for (j=0; j<2; ++j) {
301 aPPCx.Perform(aPMax[j]);
302 aNbPoints=aPPCx.NbPoints();
306 aTx[j]=aPPCx.LowerDistanceParameter();
309 // correction the range is impossible due to
310 // a projection problem
323 const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
324 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
325 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
327 pSRx->SetFirst(aTx[0]);
328 pSRx->SetLast(aTx[1]);
333 BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
334 aItLPBS.Initialize(aLPBSx);
335 for (; aItLPBS.More(); aItLPBS.Next()) {
336 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
337 if (!aPBSx.IsEqual(aPBx)) {
341 const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
342 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
343 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
345 pSRx->SetFirst(aTx[0]);
346 pSRx->SetLast(aTx[1]);
351 }//for (; aItLPB.More(); aItLPB.Next()) {
352 }//for (; aItLCB.More(); aItLCB.Next()) {
353 }//for (nE=1; nE<=aNbS; ++nE) {
355 //=======================================================================
356 // function: UpdateCommonBlocks
358 //=======================================================================
359 void NMTTools_PaveFiller::UpdateCommonBlocks()
361 myIsDone=Standard_False;
363 Standard_Integer nE, aNbS, nSp, nEx, nSpx;
364 NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
365 BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
367 aNbS=myDS->NumberOfShapesOfTheObject();
369 for (nE=1; nE<=aNbS; ++nE) {
370 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
373 if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){
377 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
378 /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
380 aCBIt.Initialize(aLCB);
381 for (; aCBIt.More(); aCBIt.Next()) {
382 NMTTools_CommonBlock& aCB=aCBIt.ChangeValue();
384 // Among all PBs of aCB the first PB will be one
385 // that have max tolerance value
387 Standard_Real aTolEx, aTolExMax;
388 BOPTools_ListOfPaveBlock *pLPB, aLPBx;
391 pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
392 aPBIt.Initialize(*pLPB);
393 for (; aPBIt.More(); aPBIt.Next()) {
394 const BOPTools_PaveBlock& aPBx=aPBIt.Value();
395 nEx=aPBx.OriginalEdge();
396 const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
397 aTolEx=BRep_Tool::Tolerance(aEx);
398 if (aTolEx>aTolExMax) {
411 BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
415 const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
416 aPBIt.Initialize(aCBLPB);
417 for (; aPBIt.More(); aPBIt.Next()) {
418 BOPTools_PaveBlock& aPBx=aPBIt.Value();
419 nEx=aPBx.OriginalEdge();
424 nSpx=SplitIndex(aPBx);
431 //=======================================================================
432 // function: SplitIndex
434 //=======================================================================
435 Standard_Integer NMTTools_PaveFiller::SplitIndex
436 (const BOPTools_PaveBlock& aPBx) const
438 Standard_Integer anOriginalEdge, anEdgeIndex=0;
440 anOriginalEdge=aPBx.OriginalEdge();
442 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
444 BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
445 for (; anIt.More(); anIt.Next()) {
446 BOPTools_PaveBlock& aPB=anIt.Value();
447 if (aPB.IsEqual(aPBx)) {
448 anEdgeIndex=aPB.Edge();
455 //=======================================================================
456 // function: UpdatePaveBlocks
458 //=======================================================================
459 void NMTTools_PaveFiller::UpdatePaveBlocks()
461 myIsDone=Standard_False;
463 Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
464 Standard_Real aT1, aT2;
465 TColStd_IndexedMapOfInteger aMF, aME;
466 TopExp_Explorer aExp;
467 TopoDS_Vertex aV1, aV2;
469 BOPTools_Pave aPave1, aPave2;
470 BOPTools_PaveBlock aPB;
472 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
474 aNbFFs=aFFs.Extent();
475 for (i=1; i<=aNbFFs; ++i) {
476 BOPTools_SSInterference& aFFi=aFFs(i);
477 aFFi.Indices(nF1, nF2);
483 for(i=1; i<=aNbF; ++i) {
485 iRankF=myDS->Rank(nF);
486 const TopoDS_Shape aF=myDS->Shape(nF);//mpv
487 aExp.Init(aF, TopAbs_EDGE);
488 for(; aExp.More(); aExp.Next()) {
489 aE=TopoDS::Edge(aExp.Current());
491 if (BRep_Tool::Degenerated(aE)) {
495 nE=myDS->ShapeIndex(aE, iRankF);
497 if (aME.Contains(nE)) {
502 BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
507 TopExp::Vertices(aE, aV1, aV2);
509 nV1=myDS->ShapeIndex(aV1, iRankF);
510 aT1=BRep_Tool::Parameter(aV1, aE);
511 aPave1.SetIndex(nV1);
512 aPave1.SetParam(aT1);
514 nV2=myDS->ShapeIndex(aV2, iRankF);
515 aT2=BRep_Tool::Parameter(aV2, aE);
516 aPave2.SetIndex(nV2);
517 aPave2.SetParam(aT2);
520 aPB.SetOriginalEdge(nE);
521 aPB.SetPave1(aPave1);
522 aPB.SetPave2(aPave2);
529 //=======================================================================
530 // function: MakeAloneVertices
532 //=======================================================================
533 void NMTTools_PaveFiller::MakeAloneVertices()
535 Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
536 Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
537 TColStd_ListIteratorOfListOfInteger aIt;
538 TColStd_ListOfInteger aLI;
540 TopoDS_Compound aCompound;
542 TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
543 TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
544 TopTools_DataMapOfShapeShape aDMVV;
545 TopTools_DataMapOfIntegerShape aDMIV;
546 TopTools_DataMapOfShapeInteger aDMVI;
547 TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
548 TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
550 aBB.MakeCompound(aCompound);
552 myAloneVertices.Clear();
554 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
556 // 1. Collect alone vertices from FFs
558 aNbFFs=aFFs.Extent();
559 for (i=1; i<=aNbFFs; ++i) {
560 BOPTools_SSInterference& aFFi=aFFs(i);
561 aFFi.Indices(nF1, nF2);
563 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
564 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
566 aTolF1=BRep_Tool::Tolerance(aF1);
567 aTolF2=BRep_Tool::Tolerance(aF2);
568 aTolSum=aTolF1+aTolF2;
574 const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
575 aNbPnts=aSeqAlonePnts.Length();
576 for (j=1; j<=aNbPnts; ++j) {
577 const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
578 BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
579 aDMVFF.Bind(aV, aLI);
580 aBB.Add(aCompound, aV);
588 // 2. Try to fuse alone vertices themselves;
589 FuseVertices(aCompound, aDMVV);
591 // if some are fused, replace them by new ones
592 aItDMVFF.Initialize(aDMVFF);
593 for (; aItDMVFF.More(); aItDMVFF.Next()) {
594 const TopoDS_Shape& aVx=aItDMVFF.Key();
595 const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
597 if (!aDMVV.IsBound(aVx)) {
598 aDMVFF1.Bind(aVx, aLIx);
601 const TopoDS_Shape& aVy=aDMVV.Find(aVx);
603 if (aDMVFF1.IsBound(aVy)) {
604 TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
605 aIt.Initialize(aLIx);
606 for(; aIt.More(); aIt.Next()) {
612 aDMVFF1.Bind(aVy, aLIx);
618 // refine lists of faces in aDMVFF1;
619 aItDMVFF.Initialize(aDMVFF1);
620 for (; aItDMVFF.More(); aItDMVFF.Next()) {
621 TColStd_MapOfInteger aMIy;
622 TColStd_ListOfInteger aLIy;
624 const TopoDS_Shape& aVx=aItDMVFF.Key();
625 TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
626 aIt.Initialize(aLIx);
627 for(; aIt.More(); aIt.Next()) {
636 //==================================
638 // 3. Collect vertices from DS
639 Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
641 aNbS=myDS->NumberOfShapesOfTheObject();
643 for (i=1; i<=aNbS; ++i) {
644 const TopoDS_Shape& aS=myDS->Shape(i);
645 if (aS.ShapeType() != TopAbs_VERTEX){
649 nVSD=FindSDVertex(i);
650 nV=(nVSD) ? nVSD : i;
651 const TopoDS_Shape& aVx=myDS->Shape(nV);
652 if (!aDMVI.IsBound(aVx)) {
657 i1=myDS->NumberOfSourceShapes()+1;
658 i2=myDS->NumberOfInsertedShapes();
659 for (i=i1; i<=i2; ++i) {
660 const TopoDS_Shape aS=myDS->Shape(i);//mpv
661 if (aS.ShapeType() != TopAbs_VERTEX){
664 if (!aDMVI.IsBound(aS)) {
669 // 4. Initialize BoundSortBox on aDMVI
671 Handle(Bnd_HArray1OfBox) aHAB;
672 Bnd_BoundSortBox aBSB;
674 aNbVDS=aDMVI.Extent();
675 aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
677 aItDMVI.Initialize(aDMVI);
678 for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
682 aV=TopoDS::Vertex(aItDMVI.Key());
683 aTolV=BRep_Tool::Tolerance(aV);
685 BRepBndLib::Add(aV, aBox);
686 aHAB->SetValue(i, aBox);
690 aBSB.Initialize(aHAB);
693 aItDMVFF.Initialize(aDMVFF1);
694 for (; aItDMVFF.More(); aItDMVFF.Next()) {
697 const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
698 aV=TopoDS::Vertex(aItDMVFF.Key());
700 aTolV=BRep_Tool::Tolerance(aV);
702 BRepBndLib::Add(aV, aBoxV);
704 const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
705 aNbVSD=aLIVSD.Extent();
707 // add new vertex in DS and update map myAloneVertices
708 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
710 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
711 nV=myDS->NumberOfInsertedShapes();
713 aIt.Initialize(aLIFF);
714 for (; aIt.More(); aIt.Next()) {
716 if (myAloneVertices.Contains(nFx)) {
717 TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
721 TColStd_IndexedMapOfInteger aMVx;
723 myAloneVertices.Add(nFx, aMVx);
730 Standard_Integer aNbF, aNbAV, nF, k;
731 NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
733 aNbF=myAloneVertices.Extent();
738 // 1. fill map Alone Vertex/Face -> aMAVF
739 for (i=1; i<=aNbF; ++i) {
740 nF=myAloneVertices.FindKey(i);
741 const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
743 for(j=1; j<=aNbAV; ++j) {
745 if (aMAVF.Contains(nV)) {
746 TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
750 TColStd_IndexedMapOfInteger aMF;
757 // 2 Obtain pairs of faces
758 aNbAV=aMAVF.Extent();
759 for (i=1; i<=aNbAV; ++i) {
760 const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
762 for(j=1; j<aNbF; ++j) {
764 for(k=j+1; k<=aNbF; ++k) {
766 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
773 //=======================================================================
774 // function: AloneVertices
776 //=======================================================================
777 const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
778 NMTTools_PaveFiller::AloneVertices()const
780 return myAloneVertices;
782 //=======================================================================
783 // function: FuseVertices
785 //=======================================================================
786 void NMTTools_PaveFiller::FuseVertices
787 (const TopoDS_Shape& aCompound,
788 TopTools_DataMapOfShapeShape& aDMVV)const
790 Standard_Integer i, aNbVV, n1, n2, nX;
791 NMTTools_PaveFiller tPF;
793 tPF.SetCompositeShape(aCompound);
798 //tPF.PerformNewVertices(); //qq
800 NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
801 NMTDS_InterfPool& tInterfPool=*(tPF.IP());
802 BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
805 for (i=1; i<=aNbVV; ++i) {
806 const BOPTools_VVInterference& aVV=aVVt(i);
810 const TopoDS_Shape& aV1=tDS.Shape(n1);
811 const TopoDS_Shape& aV2=tDS.Shape(n2);
812 const TopoDS_Shape& aVx=tDS.Shape(nX);
813 aDMVV.Bind(aV1, aVx);
814 aDMVV.Bind(aV2, aVx);