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 <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>
65 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
67 #include <BOPTools_SSInterference.hxx>
68 #include <BOPTools_CArray1OfSSInterference.hxx>
69 #include <BOPTools_CArray1OfVVInterference.hxx>
70 #include <BOPTools_VVInterference.hxx>
71 #include <BOPTools_Tools.hxx>
72 #include <BOPTools_ListOfPaveBlock.hxx>
73 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
74 #include <BOPTools_PaveBlock.hxx>
75 #include <BOPTools_Pave.hxx>
76 #include <BOPTools_Tools.hxx>
78 #include <NMTDS_Iterator.hxx>
79 #include <NMTDS_ShapesDataStructure.hxx>
80 #include <NMTDS_InterfPool.hxx>
82 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
83 #include <NMTTools_MapOfPaveBlock.hxx>
86 //=======================================================================
87 // function: MakeSplitEdges
89 //=======================================================================
90 void NMTTools_PaveFiller::MakeSplitEdges()
92 myIsDone=Standard_False;
94 Standard_Boolean bIsNewVertex1, bIsNewVertex2;
95 Standard_Integer i, aNbS, nV1, nV2, aNbPaveBlocks, aNewShapeIndex;
97 TopAbs_Orientation anOri;
98 TopoDS_Edge aE, aESplit;
99 TopoDS_Vertex aV1, aV2;
101 aNbS=myDS->NumberOfShapesOfTheObject();
102 for (i=1; i<=aNbS; ++i) {
103 if (myDS->GetShapeType(i) != TopAbs_EDGE)
107 aE=TopoDS::Edge(myDS->Shape(i));
108 if (BRep_Tool::Degenerated(aE)){
112 anOri=aE.Orientation();
113 aE.Orientation(TopAbs_FORWARD);
115 // Making Split Edges
117 // Split Set for the Original Edge i
118 BOPTools_ListOfPaveBlock& aSplitEdges=mySplitShapesPool(myDS->RefEdge(i));
119 BOPTools_ListIteratorOfListOfPaveBlock aPBIt(aSplitEdges);
121 aNbPaveBlocks=aSplitEdges.Extent();
123 for (; aPBIt.More(); aPBIt.Next()) {
124 BOPTools_PaveBlock& aPB=aPBIt.Value();
126 const BOPTools_Pave& aPave1=aPB.Pave1();
129 aV1=TopoDS::Vertex(myDS->GetShape(nV1));
130 aV1.Orientation(TopAbs_FORWARD);
132 const BOPTools_Pave& aPave2=aPB.Pave2();
135 aV2=TopoDS::Vertex(myDS->GetShape(nV2));
136 aV2.Orientation(TopAbs_REVERSED);
138 if (aNbPaveBlocks==1) {
139 bIsNewVertex1=myDS->IsNewShape (nV1);
140 bIsNewVertex2=myDS->IsNewShape (nV2);
141 if (!bIsNewVertex1 && !bIsNewVertex2) {
147 BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);
149 // Add Split Part of the Original Edge to the DS
150 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
152 anASSeq.SetNewSuccessor(nV1);
153 anASSeq.SetNewOrientation(aV1.Orientation());
155 anASSeq.SetNewSuccessor(nV2);
156 anASSeq.SetNewOrientation(aV2.Orientation());
158 if (anOri==TopAbs_INTERNAL) {
159 anASSeq.SetNewAncestor(i);
160 aESplit.Orientation(anOri);
163 myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
164 aNewShapeIndex=myDS->NumberOfInsertedShapes();
165 myDS->SetState(aNewShapeIndex, BooleanOperations_UNKNOWN);
167 // Fill Split Set for the Original Edge
168 aPB.SetEdge(aNewShapeIndex);
172 myIsDone=Standard_True;
174 //=======================================================================
175 // function: UpdateCommonBlocks
177 //=======================================================================
178 void NMTTools_PaveFiller::UpdateCommonBlocks(const Standard_Integer)
180 Standard_Integer nE, aNbS, nEx, nEMax, j, aNbPoints, aNbLCB, nF;
181 Standard_Real aTolEx, aTolExMax, aTSRMax[2], aTx[2], aTmp;
182 TColStd_ListIteratorOfListOfInteger aItLI;
185 BOPTools_ListIteratorOfListOfPaveBlock aItLPB, aItLPBS;
186 NMTTools_ListIteratorOfListOfCommonBlock aItLCB;
187 NMTTools_MapOfPaveBlock aMPB;
189 myIsDone=Standard_False;
191 aNbS=myDS->NumberOfShapesOfTheObject();
192 for (nE=1; nE<=aNbS; ++nE) {
193 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
197 const TopoDS_Edge& aE=*((TopoDS_Edge*)&myDS->Shape(nE));
198 if (BRep_Tool::Degenerated(aE)){
202 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
203 //modified by NIZNHY-PKV Thu Jan 19 09:03:19 2012f
204 aNbLCB=aLCB.Extent();
209 NMTTools_ListOfCommonBlock aLCBx;
211 aItLCB.Initialize(aLCB);
212 for (; aItLCB.More(); aItLCB.Next()) {
213 NMTTools_CommonBlock aCBx;
215 NMTTools_CommonBlock& aCB=aItLCB.Value();
216 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
217 aItLPB.Initialize(aLPB);
218 for (; aItLPB.More(); aItLPB.Next()) {
219 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
220 nEx=aPBx.OriginalEdge();
221 BOPTools_ListOfPaveBlock& aLPBS=mySplitShapesPool(myDS->RefEdge(nEx));
222 aItLPBS.Initialize(aLPBS);
223 for (; aItLPBS.More(); aItLPBS.Next()) {
224 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
225 if (aPBSx.IsEqual(aPBx)) {
226 aCBx.AddPaveBlock(aPBSx);
229 }// for (; aItLPBS.More(); aItLPBS.Next()) {
230 }// for (; aItLPB.More(); aItLPB.Next()) {
232 const TColStd_ListOfInteger& aLI=aCB.Faces();
233 aItLI.Initialize(aLI);
234 for (; aItLI.More(); aItLI.Next()) {
240 }//for (; aItLCB.More(); aItLCB.Next()) {
244 aItLCB.Initialize(aLCBx);
245 for (; aItLCB.More(); aItLCB.Next()) {
246 NMTTools_CommonBlock& aCBx=aItLCB.Value();
249 //modified by NIZNHY-PKV Thu Jan 19 09:03:30 2012t
251 aItLCB.Initialize(aLCB);
252 for (; aItLCB.More(); aItLCB.Next()) {
253 NMTTools_CommonBlock& aCB=aItLCB.Value();
255 BOPTools_PaveBlock aPBMax;
257 const BOPTools_ListOfPaveBlock &aLPB=aCB.PaveBlocks();
258 aItLPB.Initialize(aLPB);
259 for (; aItLPB.More(); aItLPB.Next()) {
260 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
261 nEx=aPBx.OriginalEdge();
262 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
263 aTolEx=BRep_Tool::Tolerance(aEx);
264 if (aTolEx>aTolExMax) {
272 if (aMPB.Contains(aPBMax)) {
277 nEMax=aPBMax.OriginalEdge();
278 const IntTools_ShrunkRange& aISRMax=aPBMax.ShrunkRange();
279 const IntTools_Range& aSRMax=aISRMax.ShrunkRange();
280 const Bnd_Box& aBoxMax=aISRMax.BndBox();
281 aSRMax.Range(aTSRMax[0], aTSRMax[1]);
282 for (j=0; j<2; ++j) {
283 BOPTools_Tools::PointOnEdge(aEMax, aTSRMax[j], aPMax[j]);
287 aItLPB.Initialize(aLPB);
288 for (; aItLPB.More(); aItLPB.Next()) {
289 const BOPTools_PaveBlock& aPBx=aItLPB.Value();
290 nEx=aPBx.OriginalEdge();
295 const TopoDS_Edge& aEx=*((TopoDS_Edge*)&myDS->Shape(nEx));
296 GeomAPI_ProjectPointOnCurve& aPPCx=myContext.ProjPC(aEx);
298 for (j=0; j<2; ++j) {
299 aPPCx.Perform(aPMax[j]);
300 aNbPoints=aPPCx.NbPoints();
304 aTx[j]=aPPCx.LowerDistanceParameter();
307 // correction the range is impossible due to
308 // a projection problem
321 const IntTools_ShrunkRange& aISRx=aPBx.ShrunkRange();
322 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
323 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
325 pSRx->SetFirst(aTx[0]);
326 pSRx->SetLast(aTx[1]);
331 BOPTools_ListOfPaveBlock& aLPBSx=mySplitShapesPool(myDS->RefEdge(nEx));
332 aItLPBS.Initialize(aLPBSx);
333 for (; aItLPBS.More(); aItLPBS.Next()) {
334 const BOPTools_PaveBlock& aPBSx=aItLPBS.Value();
335 if (!aPBSx.IsEqual(aPBx)) {
339 const IntTools_ShrunkRange& aISRx=aPBSx.ShrunkRange();
340 IntTools_Range *pSRx=(IntTools_Range *)(&aISRx.ShrunkRange());
341 Bnd_Box *pBoxx=(Bnd_Box *)(&aISRx.BndBox());
343 pSRx->SetFirst(aTx[0]);
344 pSRx->SetLast(aTx[1]);
349 }//for (; aItLPB.More(); aItLPB.Next()) {
350 }//for (; aItLCB.More(); aItLCB.Next()) {
351 }//for (nE=1; nE<=aNbS; ++nE) {
353 //=======================================================================
354 // function: UpdateCommonBlocks
356 //=======================================================================
357 void NMTTools_PaveFiller::UpdateCommonBlocks()
359 myIsDone=Standard_False;
361 Standard_Integer nE, aNbS, nSp, nEx, nSpx;
362 NMTTools_ListIteratorOfListOfCommonBlock aCBIt;
363 BOPTools_ListIteratorOfListOfPaveBlock aPBIt;
365 aNbS=myDS->NumberOfShapesOfTheObject();
367 for (nE=1; nE<=aNbS; ++nE) {
368 if (myDS->GetShapeType(nE)!=TopAbs_EDGE){
371 if (BRep_Tool::Degenerated(TopoDS::Edge(myDS->Shape(nE)))){
375 NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE));
376 /*BOPTools_ListOfPaveBlock& aLPB=*/mySplitShapesPool (myDS->RefEdge(nE));
378 aCBIt.Initialize(aLCB);
379 for (; aCBIt.More(); aCBIt.Next()) {
380 NMTTools_CommonBlock& aCB=aCBIt.Value();
382 // Among all PBs of aCB the first PB will be one
383 // that have max tolerance value
385 Standard_Real aTolEx, aTolExMax;
386 BOPTools_ListOfPaveBlock *pLPB, aLPBx;
389 pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
390 aPBIt.Initialize(*pLPB);
391 for (; aPBIt.More(); aPBIt.Next()) {
392 const BOPTools_PaveBlock& aPBx=aPBIt.Value();
393 nEx=aPBx.OriginalEdge();
394 const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
395 aTolEx=BRep_Tool::Tolerance(aEx);
396 if (aTolEx>aTolExMax) {
409 BOPTools_PaveBlock& aPB=aCB.PaveBlock1(nE);
413 const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
414 aPBIt.Initialize(aCBLPB);
415 for (; aPBIt.More(); aPBIt.Next()) {
416 BOPTools_PaveBlock& aPBx=aPBIt.Value();
417 nEx=aPBx.OriginalEdge();
422 nSpx=SplitIndex(aPBx);
429 //=======================================================================
430 // function: SplitIndex
432 //=======================================================================
433 Standard_Integer NMTTools_PaveFiller::SplitIndex
434 (const BOPTools_PaveBlock& aPBx) const
436 Standard_Integer anOriginalEdge, anEdgeIndex=0;
438 anOriginalEdge=aPBx.OriginalEdge();
440 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(anOriginalEdge));
442 BOPTools_ListIteratorOfListOfPaveBlock anIt(aLPB);
443 for (; anIt.More(); anIt.Next()) {
444 BOPTools_PaveBlock& aPB=anIt.Value();
445 if (aPB.IsEqual(aPBx)) {
446 anEdgeIndex=aPB.Edge();
453 //=======================================================================
454 // function: UpdatePaveBlocks
456 //=======================================================================
457 void NMTTools_PaveFiller::UpdatePaveBlocks()
459 myIsDone=Standard_False;
461 Standard_Integer i, aNbFFs, nF1, nF2, aNbF, nF, iRankF, nE, nV1, nV2, aNbPB;
462 Standard_Real aT1, aT2;
463 TColStd_IndexedMapOfInteger aMF, aME;
464 TopExp_Explorer aExp;
465 TopoDS_Vertex aV1, aV2;
467 BOPTools_Pave aPave1, aPave2;
468 BOPTools_PaveBlock aPB;
470 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
472 aNbFFs=aFFs.Extent();
473 for (i=1; i<=aNbFFs; ++i) {
474 BOPTools_SSInterference& aFFi=aFFs(i);
475 aFFi.Indices(nF1, nF2);
481 for(i=1; i<=aNbF; ++i) {
483 iRankF=myDS->Rank(nF);
484 const TopoDS_Shape aF=myDS->Shape(nF);//mpv
485 aExp.Init(aF, TopAbs_EDGE);
486 for(; aExp.More(); aExp.Next()) {
487 aE=TopoDS::Edge(aExp.Current());
489 if (BRep_Tool::Degenerated(aE)) {
493 nE=myDS->ShapeIndex(aE, iRankF);
495 if (aME.Contains(nE)) {
500 BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
505 TopExp::Vertices(aE, aV1, aV2);
507 nV1=myDS->ShapeIndex(aV1, iRankF);
508 aT1=BRep_Tool::Parameter(aV1, aE);
509 aPave1.SetIndex(nV1);
510 aPave1.SetParam(aT1);
512 nV2=myDS->ShapeIndex(aV2, iRankF);
513 aT2=BRep_Tool::Parameter(aV2, aE);
514 aPave2.SetIndex(nV2);
515 aPave2.SetParam(aT2);
518 aPB.SetOriginalEdge(nE);
519 aPB.SetPave1(aPave1);
520 aPB.SetPave2(aPave2);
527 //=======================================================================
528 // function: MakeAloneVertices
530 //=======================================================================
531 void NMTTools_PaveFiller::MakeAloneVertices()
533 Standard_Integer i, aNbFFs, nF1, nF2, j, aNbPnts, nFx, aNbV;
534 Standard_Real aTolF1, aTolF2, aTolSum, aTolV;
535 TColStd_ListIteratorOfListOfInteger aIt;
536 TColStd_ListOfInteger aLI;
538 TopoDS_Compound aCompound;
540 TopTools_DataMapOfShapeListOfInteger aDMVFF, aDMVFF1;
541 TopTools_DataMapIteratorOfDataMapOfShapeListOfInteger aItDMVFF;
542 TopTools_DataMapOfShapeShape aDMVV;
543 TopTools_DataMapOfIntegerShape aDMIV;
544 TopTools_DataMapOfShapeInteger aDMVI;
545 TopTools_DataMapIteratorOfDataMapOfShapeInteger aItDMVI;
546 TopTools_DataMapIteratorOfDataMapOfIntegerShape aItDMIV;
548 aBB.MakeCompound(aCompound);
550 myAloneVertices.Clear();
552 BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences();
554 // 1. Collect alone vertices from FFs
556 aNbFFs=aFFs.Extent();
557 for (i=1; i<=aNbFFs; ++i) {
558 BOPTools_SSInterference& aFFi=aFFs(i);
559 aFFi.Indices(nF1, nF2);
561 const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv
562 const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv
564 aTolF1=BRep_Tool::Tolerance(aF1);
565 aTolF2=BRep_Tool::Tolerance(aF2);
566 aTolSum=aTolF1+aTolF2;
572 const IntTools_SequenceOfPntOn2Faces& aSeqAlonePnts=aFFi.AlonePnts();
573 aNbPnts=aSeqAlonePnts.Length();
574 for (j=1; j<=aNbPnts; ++j) {
575 const gp_Pnt& aP=aSeqAlonePnts(j).P1().Pnt();
576 BOPTools_Tools::MakeNewVertex(aP, aTolSum, aV);
577 aDMVFF.Bind(aV, aLI);
578 aBB.Add(aCompound, aV);
586 // 2. Try to fuse alone vertices themselves;
587 FuseVertices(aCompound, aDMVV);
589 // if some are fused, replace them by new ones
590 aItDMVFF.Initialize(aDMVFF);
591 for (; aItDMVFF.More(); aItDMVFF.Next()) {
592 const TopoDS_Shape& aVx=aItDMVFF.Key();
593 const TColStd_ListOfInteger& aLIx=aItDMVFF.Value();
595 if (!aDMVV.IsBound(aVx)) {
596 aDMVFF1.Bind(aVx, aLIx);
599 const TopoDS_Shape& aVy=aDMVV.Find(aVx);
601 if (aDMVFF1.IsBound(aVy)) {
602 TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
603 aIt.Initialize(aLIx);
604 for(; aIt.More(); aIt.Next()) {
610 aDMVFF1.Bind(aVy, aLIx);
616 // refine lists of faces in aDMVFF1;
617 aItDMVFF.Initialize(aDMVFF1);
618 for (; aItDMVFF.More(); aItDMVFF.Next()) {
619 TColStd_MapOfInteger aMIy;
620 TColStd_ListOfInteger aLIy;
622 const TopoDS_Shape& aVx=aItDMVFF.Key();
623 TColStd_ListOfInteger& aLIx=aDMVFF1.ChangeFind(aVx);
624 aIt.Initialize(aLIx);
625 for(; aIt.More(); aIt.Next()) {
634 //==================================
636 // 3. Collect vertices from DS
637 Standard_Integer aNbS, nV, nVSD, aNbVDS, i1, i2, aNbVSD;
639 aNbS=myDS->NumberOfShapesOfTheObject();
641 for (i=1; i<=aNbS; ++i) {
642 const TopoDS_Shape& aS=myDS->Shape(i);
643 if (aS.ShapeType() != TopAbs_VERTEX){
647 nVSD=FindSDVertex(i);
648 nV=(nVSD) ? nVSD : i;
649 const TopoDS_Shape& aVx=myDS->Shape(nV);
650 if (!aDMVI.IsBound(aVx)) {
655 i1=myDS->NumberOfSourceShapes()+1;
656 i2=myDS->NumberOfInsertedShapes();
657 for (i=i1; i<=i2; ++i) {
658 const TopoDS_Shape aS=myDS->Shape(i);//mpv
659 if (aS.ShapeType() != TopAbs_VERTEX){
662 if (!aDMVI.IsBound(aS)) {
667 // 4. Initialize BoundSortBox on aDMVI
669 Handle(Bnd_HArray1OfBox) aHAB;
670 Bnd_BoundSortBox aBSB;
672 aNbVDS=aDMVI.Extent();
673 aHAB=new Bnd_HArray1OfBox(1, aNbVDS);
675 aItDMVI.Initialize(aDMVI);
676 for (i=1; aItDMVI.More(); aItDMVI.Next(), ++i) {
680 aV=TopoDS::Vertex(aItDMVI.Key());
681 aTolV=BRep_Tool::Tolerance(aV);
683 BRepBndLib::Add(aV, aBox);
684 aHAB->SetValue(i, aBox);
688 aBSB.Initialize(aHAB);
691 aItDMVFF.Initialize(aDMVFF1);
692 for (; aItDMVFF.More(); aItDMVFF.Next()) {
695 const TColStd_ListOfInteger& aLIFF=aItDMVFF.Value();
696 aV=TopoDS::Vertex(aItDMVFF.Key());
698 aTolV=BRep_Tool::Tolerance(aV);
700 BRepBndLib::Add(aV, aBoxV);
702 const TColStd_ListOfInteger& aLIVSD=aBSB.Compare(aBoxV);
703 aNbVSD=aLIVSD.Extent();
705 // add new vertex in DS and update map myAloneVertices
706 BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
708 myDS->InsertShapeAndAncestorsSuccessors(aV, anASSeq);
709 nV=myDS->NumberOfInsertedShapes();
711 aIt.Initialize(aLIFF);
712 for (; aIt.More(); aIt.Next()) {
714 if (myAloneVertices.Contains(nFx)) {
715 TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
719 TColStd_IndexedMapOfInteger aMVx;
721 myAloneVertices.Add(nFx, aMVx);
728 Standard_Integer aNbF, aNbAV, nF, k;
729 NMTTools_IndexedDataMapOfIndexedMapOfInteger aMAVF;
731 aNbF=myAloneVertices.Extent();
736 // 1. fill map Alone Vertex/Face -> aMAVF
737 for (i=1; i<=aNbF; ++i) {
738 nF=myAloneVertices.FindKey(i);
739 const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
741 for(j=1; j<=aNbAV; ++j) {
743 if (aMAVF.Contains(nV)) {
744 TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
748 TColStd_IndexedMapOfInteger aMF;
755 // 2 Obtain pairs of faces
756 aNbAV=aMAVF.Extent();
757 for (i=1; i<=aNbAV; ++i) {
758 const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
760 for(j=1; j<aNbF; ++j) {
762 for(k=j+1; k<=aNbF; ++k) {
764 myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
771 //=======================================================================
772 // function: AloneVertices
774 //=======================================================================
775 const NMTTools_IndexedDataMapOfIndexedMapOfInteger&
776 NMTTools_PaveFiller::AloneVertices()const
778 return myAloneVertices;
780 //=======================================================================
781 // function: FuseVertices
783 //=======================================================================
784 void NMTTools_PaveFiller::FuseVertices
785 (const TopoDS_Shape& aCompound,
786 TopTools_DataMapOfShapeShape& aDMVV)const
788 Standard_Integer i, aNbVV, n1, n2, nX;
789 NMTTools_PaveFiller tPF;
791 tPF.SetCompositeShape(aCompound);
796 //tPF.PerformNewVertices(); //qq
798 NMTDS_ShapesDataStructure& tDS=*(tPF.DS());
799 NMTDS_InterfPool& tInterfPool=*(tPF.IP());
800 BOPTools_CArray1OfVVInterference& aVVt=tInterfPool.VVInterferences();
803 for (i=1; i<=aNbVV; ++i) {
804 const BOPTools_VVInterference& aVV=aVVt(i);
808 const TopoDS_Shape& aV1=tDS.Shape(n1);
809 const TopoDS_Shape& aV2=tDS.Shape(n2);
810 const TopoDS_Shape& aVx=tDS.Shape(nX);
811 aDMVV.Bind(aV1, aVx);
812 aDMVV.Bind(aV2, aVx);