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_8.cxx
24 // Created: Fri Dec 19 11:15:53 2003
25 // Author: Peter KURNEV
28 #include <NMTTools_PaveFiller.hxx>
30 #include <TColStd_MapOfInteger.hxx>
31 #include <TColStd_ListOfInteger.hxx>
32 #include <TColStd_ListIteratorOfListOfInteger.hxx>
34 #include <TopTools_ListOfShape.hxx>
36 #include <BooleanOperations_ShapesDataStructure.hxx>
37 #include <BooleanOperations_OnceExplorer.hxx>
39 #include <BOPTools_PaveBlock.hxx>
40 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
41 #include <BOPTools_ListOfPaveBlock.hxx>
43 #include <NMTDS_ShapesDataStructure.hxx>
45 #include <NMTTools_ListOfCommonBlock.hxx>
46 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
47 #include <NMTTools_CommonBlock.hxx>
48 #include <NMTTools_CommonBlockAPI.hxx>
51 // Modified to add new method Thu Sep 14 14:35:18 2006
52 // Contribution of Samtech www.samcef.com BEGIN
53 //=======================================================================
54 // function: SharedEdges
56 //=======================================================================
57 void NMTTools_PaveFiller::SharedEdges(const Standard_Integer nF1,
58 const Standard_Integer nF2,
59 TColStd_ListOfInteger& aLNE,
60 TopTools_ListOfShape& aLSE)
62 Standard_Integer nE1, nE2;
63 TColStd_MapOfInteger aM1;
65 BooleanOperations_ShapesDataStructure *pDS=myDS;
66 BooleanOperations_OnceExplorer aExp(*pDS);
68 aExp.Init(nF1, TopAbs_EDGE);
69 for (; aExp.More(); aExp.Next()) {
74 aExp.Init(nF2, TopAbs_EDGE);
75 for (; aExp.More(); aExp.Next()) {
77 if (aM1.Contains(nE2)) {
79 const TopoDS_Shape& aE2=myDS->Shape(nE2);
84 // Contribution of Samtech www.samcef.com END
86 //=======================================================================
87 // function: RealPaveBlock
89 //=======================================================================
90 const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock
91 (const BOPTools_PaveBlock& aPB,
92 TColStd_ListOfInteger& aLB,
93 Standard_Integer& aIsCommonBlock)
95 Standard_Integer nE, nSpx;
96 BOPTools_ListIteratorOfListOfPaveBlock aItPBx;
100 nE=aPB.OriginalEdge();
101 const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
102 NMTTools_CommonBlockAPI aCBAPI(aLCBE);
103 if (aCBAPI.IsCommonBlock(aPB)) {
104 NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
108 const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
109 aItPBx.Initialize(aLPBx);
110 for (; aItPBx.More(); aItPBx.Next()) {
111 const BOPTools_PaveBlock& aPBx=aItPBx.Value();
116 const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1();
122 //=======================================================================
123 // function: RealPaveBlock
125 //=======================================================================
126 const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock(const BOPTools_PaveBlock& aPB)
130 nE=aPB.OriginalEdge();
131 const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
132 NMTTools_CommonBlockAPI aCBAPI(aLCBE);
133 if (aCBAPI.IsCommonBlock(aPB)) {
134 NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
135 const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1();
140 //=======================================================================
141 // function: CommonBlocksFace
143 //=======================================================================
144 Standard_Integer NMTTools_PaveFiller::CommonBlocksFace(const Standard_Integer nF,
145 NMTTools_ListOfCommonBlock& aLCB)
149 NMTTools_ListIteratorOfListOfCommonBlock anIt;
151 aT=myDS->GetShapeType(nF);
153 if (aT!=TopAbs_FACE) {
154 return 1; // Type mismatch
157 BooleanOperations_ShapesDataStructure *pDS=myDS;
158 BooleanOperations_OnceExplorer aExp(*pDS);
160 aExp.Init(nF, TopAbs_EDGE);
161 for (; aExp.More(); aExp.Next()) {
163 const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
164 anIt.Initialize(aLCBE);
165 for (; anIt.More(); anIt.Next()) {
166 const NMTTools_CommonBlock& aCBE=anIt.Value();
176 //=======================================================================
177 // function: RealSplitsFace
179 //=======================================================================
180 void NMTTools_PaveFiller::RealSplitsFace(const Standard_Integer nF,
181 BOPTools_ListOfPaveBlock& aLPB)
184 BOPTools_ListIteratorOfListOfPaveBlock anIt;
186 BooleanOperations_ShapesDataStructure *pDS=myDS;
187 BooleanOperations_OnceExplorer aExp(*pDS);
189 aExp.Init(nF, TopAbs_EDGE);
190 for (; aExp.More(); aExp.Next()) {
192 const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
193 anIt.Initialize(aLPBE);
194 for (; anIt.More(); anIt.Next()) {
195 const BOPTools_PaveBlock& aPB=anIt.Value();
196 const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
201 //=======================================================================
202 // function: HasRealSplitsInOnFace
204 //=======================================================================
205 Standard_Boolean NMTTools_PaveFiller::HasRealSplitsInOnFace(const Standard_Integer nF1,
206 const Standard_Integer nF2)
208 Standard_Boolean bFlag;
209 BOPTools_ListOfPaveBlock aLPB;
211 RealSplitsInFace(0, nF1, nF2, aLPB);
213 bFlag=!aLPB.IsEmpty();
218 RealSplitsInFace(0, nF1, nF2, aLPB);
220 bFlag=!aLPB.IsEmpty();
223 //=======================================================================
224 // function: RealSplitsInFace
226 //=======================================================================
227 void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer ,//for overriding
228 const Standard_Integer nF1,
229 const Standard_Integer nF2,
230 BOPTools_ListOfPaveBlock& aLPB)
232 Standard_Integer nE1;
234 BooleanOperations_ShapesDataStructure *pDS=myDS;
235 BooleanOperations_OnceExplorer aExp(*pDS);
236 aExp.Init(nF1, TopAbs_EDGE);
237 for (; aExp.More(); aExp.Next()) {
239 RealSplitsInFace (nE1, nF2, aLPB);
242 //=======================================================================
243 // function: RealSplitsInFace
245 //=======================================================================
246 void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nE1,
247 const Standard_Integer nF2,
248 BOPTools_ListOfPaveBlock& aLPB)
250 Standard_Integer nF1;
252 TColStd_ListIteratorOfListOfInteger anItLFCB;
253 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
255 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
257 anItCB.Initialize(aLCB);
258 for (; anItCB.More(); anItCB.Next()) {
259 NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
260 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
261 const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
263 const TColStd_ListOfInteger& aLFCB=aCB.Faces();
264 anItLFCB.Initialize(aLFCB);
265 for (; anItLFCB.More(); anItLFCB.Next()) {
266 nF1=anItLFCB.Value();
273 //=======================================================================
274 // function: RealSplitsOnEdge
276 //=======================================================================
277 void NMTTools_PaveFiller::RealSplitsOnEdge(const Standard_Integer nE1,
278 const Standard_Integer nE2,
279 BOPTools_ListOfPaveBlock& aLPB)
283 BOPTools_ListIteratorOfListOfPaveBlock anIt;
284 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
286 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
288 anItCB.Initialize(aLCB);
289 for (; anItCB.More(); anItCB.Next()) {
290 NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
291 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
292 const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
294 const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
295 anIt.Initialize(aLPBx);
296 for (; anIt.More(); anIt.Next()) {
297 const BOPTools_PaveBlock& aPB2=anIt.Value();
298 nE=aPB2.OriginalEdge();
305 //=======================================================================
306 // function: RealSplitsOnFace
308 //=======================================================================
309 void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer nE1,
310 const Standard_Integer nF2,
311 BOPTools_ListOfPaveBlock& aLPB)
313 Standard_Integer nE2;
315 BooleanOperations_ShapesDataStructure *pDS=myDS;
316 BooleanOperations_OnceExplorer aExp(*pDS);
317 aExp.Init(nF2, TopAbs_EDGE);
318 for (; aExp.More(); aExp.Next()) {
320 RealSplitsOnEdge(nE1, nE2, aLPB);
323 //=======================================================================
324 // function: RealSplitsOnFace
326 //=======================================================================
327 void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer ,//for overriding
328 const Standard_Integer nF1,
329 const Standard_Integer nF2,
330 BOPTools_ListOfPaveBlock& aLPB)
332 Standard_Integer nE1;
334 // BooleanOperations_ShapesDataStructure *pDS=myDS;
335 BooleanOperations_OnceExplorer aExp(*myDS);
336 aExp.Init(nF1, TopAbs_EDGE);
337 for (; aExp.More(); aExp.Next()) {
339 RealSplitsOnFace(nE1, nF2, aLPB);
344 //=======================================================================
345 // function: SplitsFace
347 //=======================================================================
348 Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
349 BOPTools_ListOfPaveBlock& aLPB)
353 BOPTools_ListIteratorOfListOfPaveBlock anIt;
355 aT=myDS->GetShapeType(nF);
357 if (aT!=TopAbs_FACE) {
358 return 1; // Type mismatch
361 BooleanOperations_ShapesDataStructure *pDS=myDS;
362 BooleanOperations_OnceExplorer aExp(*pDS);
364 aExp.Init(nF, TopAbs_EDGE);
365 for (; aExp.More(); aExp.Next()) {
367 const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
368 anIt.Initialize(aLPBE);
369 for (; anIt.More(); anIt.Next()) {
370 const BOPTools_PaveBlock& aPBE=anIt.Value();
377 //=======================================================================
378 // function: SplitsInFace
379 // purpose: splits of edges from nF1 in nF2
380 //=======================================================================
381 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
382 const Standard_Integer nF1,
383 const Standard_Integer nF2,
384 BOPTools_ListOfPaveBlock& aLPB)
386 Standard_Integer nE1;
387 TopAbs_ShapeEnum aT1, aT2;
389 aT1=myDS->GetShapeType(nF1);
390 aT2=myDS->GetShapeType(nF2);
392 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
393 return 1; // Type mismatch
395 BooleanOperations_ShapesDataStructure *pDS=myDS;
396 BooleanOperations_OnceExplorer aExp(*pDS);
397 aExp.Init(nF1, TopAbs_EDGE);
398 for (; aExp.More(); aExp.Next()) {
400 SplitsInFace (nE1, nF2, aLPB);
404 //=======================================================================
405 // function: SplitsInFace
406 // purpose: splits of edge nE1 in aFace2
407 //=======================================================================
408 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
409 const Standard_Integer nF2,
410 BOPTools_ListOfPaveBlock& aLPB)
412 Standard_Integer nF1;
413 TopAbs_ShapeEnum aT1, aT2;
415 aT1=myDS->GetShapeType(nE1);
416 aT2=myDS->GetShapeType(nF2);
418 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
419 return 1; // Type mismatch
422 TColStd_ListIteratorOfListOfInteger anItLFCB;
423 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
425 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
427 anItCB.Initialize(aLCB);
428 for (; anItCB.More(); anItCB.Next()) {
429 NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
430 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
432 const TColStd_ListOfInteger& aLFCB=aCB.Faces();
433 anItLFCB.Initialize(aLFCB);
434 for (; anItLFCB.More(); anItLFCB.Next()) {
435 nF1=anItLFCB.Value();
443 //=======================================================================
444 // function: SplitsOnEdge
445 // purpose: splits of edge nE1 on nE2
446 //=======================================================================
447 Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
448 const Standard_Integer nE2,
449 BOPTools_ListOfPaveBlock& aLPB)
452 TopAbs_ShapeEnum aT1, aT2;
454 aT1=myDS->GetShapeType(nE1);
455 aT2=myDS->GetShapeType(nE2);
457 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
458 return 1; // Type mismatch
461 BOPTools_ListIteratorOfListOfPaveBlock anIt;
462 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
464 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
466 anItCB.Initialize(aLCB);
467 for (; anItCB.More(); anItCB.Next()) {
468 NMTTools_CommonBlock& aCB=anItCB.ChangeValue();
469 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);//XXX
471 const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
472 anIt.Initialize(aLPBx);
473 for (; anIt.More(); anIt.Next()) {
474 const BOPTools_PaveBlock& aPB2=anIt.Value();
475 nE=aPB2.OriginalEdge();
483 //=======================================================================
484 // function: SplitsOnFace
485 // purpose: splits of edge nE1 on face nF2
486 //=======================================================================
487 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
488 const Standard_Integer nF2,
489 BOPTools_ListOfPaveBlock& aLPB)
491 Standard_Integer nE2, ip;
492 TopAbs_ShapeEnum aT1, aT2;
494 aT1=myDS->GetShapeType(nE1);
495 aT2=myDS->GetShapeType(nF2);
497 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
498 return 1; // Type mismatch
500 BooleanOperations_ShapesDataStructure *pDS=myDS;
501 BooleanOperations_OnceExplorer aExp(*pDS);
502 aExp.Init(nF2, TopAbs_EDGE);
503 for (; aExp.More(); aExp.Next()) {
505 ip=SplitsOnEdge(nE1, nE2, aLPB);
512 //=======================================================================
513 // function: SplitsOnFace
514 // purpose: splits of edges from face nF1 on face nF2
515 //=======================================================================
516 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
517 const Standard_Integer nF1,
518 const Standard_Integer nF2,
519 BOPTools_ListOfPaveBlock& aLPB)
521 Standard_Integer nE1, ip;
522 TopAbs_ShapeEnum aT1, aT2;
524 aT1=myDS->GetShapeType(nF1);
525 aT2=myDS->GetShapeType(nF2);
527 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
528 return 1; // Type mismatch
530 // BooleanOperations_ShapesDataStructure *pDS=myDS;
531 BooleanOperations_OnceExplorer aExp(*myDS);
532 aExp.Init(nF1, TopAbs_EDGE);
533 for (; aExp.More(); aExp.Next()) {
535 ip=SplitsOnFace(nE1, nF2, aLPB);
543 // 3 Simple Splits indices
544 //=======================================================================
545 // function: SplitsFace
547 //=======================================================================
548 Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
549 TColStd_ListOfInteger& aSplits)
551 Standard_Integer nE, iErr;
552 BOPTools_ListIteratorOfListOfPaveBlock aIt;
553 BOPTools_ListOfPaveBlock aLPB;
555 iErr=SplitsFace(nF, aLPB);
560 aIt.Initialize(aLPB);
561 for (; aIt.More(); aIt.Next()) {
562 const BOPTools_PaveBlock& aPB=aIt.Value();
569 //=======================================================================
570 // function: SplitsInFace
571 // purpose: splits of edges from nF1 in nF2
572 //=======================================================================
573 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
574 const Standard_Integer nF1,
575 const Standard_Integer nF2,
576 TColStd_ListOfInteger& aSplits)
578 Standard_Integer nE, iErr;
579 BOPTools_ListIteratorOfListOfPaveBlock aIt;
580 BOPTools_ListOfPaveBlock aLPB;
582 iErr=SplitsInFace(0, nF1, nF2, aLPB);
586 aIt.Initialize(aLPB);
587 for (; aIt.More(); aIt.Next()) {
588 const BOPTools_PaveBlock& aPB=aIt.Value();
594 //=======================================================================
595 // function: SplitsInFace
596 // purpose: splits of edge nE1 in aFace2
597 //=======================================================================
598 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
599 const Standard_Integer nF2,
600 TColStd_ListOfInteger& aSplits)
602 Standard_Integer nE, iErr;
603 BOPTools_ListIteratorOfListOfPaveBlock aIt;
604 BOPTools_ListOfPaveBlock aLPB;
606 iErr=SplitsInFace(nE1, nF2, aLPB);
610 aIt.Initialize(aLPB);
611 for (; aIt.More(); aIt.Next()) {
612 const BOPTools_PaveBlock& aPB=aIt.Value();
618 //=======================================================================
619 // function: SplitsOnEdge
620 // purpose: splits of edge nE1 on nE2
621 //=======================================================================
622 Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
623 const Standard_Integer nE2,
624 TColStd_ListOfInteger& aSplits)
626 Standard_Integer nE, iErr;
627 BOPTools_ListIteratorOfListOfPaveBlock aIt;
628 BOPTools_ListOfPaveBlock aLPB;
630 iErr=SplitsOnEdge(nE1, nE2, aLPB);
634 aIt.Initialize(aLPB);
635 for (; aIt.More(); aIt.Next()) {
636 const BOPTools_PaveBlock& aPB=aIt.Value();
642 //=======================================================================
643 // function: SplitsOnFace
644 // purpose: splits of edge nE1 on face nF2
645 //=======================================================================
646 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
647 const Standard_Integer nF2,
648 TColStd_ListOfInteger& aSplits)
650 Standard_Integer nE, iErr;
651 BOPTools_ListIteratorOfListOfPaveBlock aIt;
652 BOPTools_ListOfPaveBlock aLPB;
654 iErr=SplitsOnEdge(nE1, nF2, aLPB);
658 aIt.Initialize(aLPB);
659 for (; aIt.More(); aIt.Next()) {
660 const BOPTools_PaveBlock& aPB=aIt.Value();
666 //=======================================================================
667 // function: SplitsOnFace
668 // purpose: splits of edges from face nF1 on face nF2
669 //=======================================================================
670 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
671 const Standard_Integer nF1,
672 const Standard_Integer nF2,
673 TColStd_ListOfInteger& aSplits)
675 Standard_Integer nE, iErr;
676 BOPTools_ListIteratorOfListOfPaveBlock aIt;
677 BOPTools_ListOfPaveBlock aLPB;
679 iErr=SplitsOnFace(0, nF1, nF2, aLPB);
684 aIt.Initialize(aLPB);
685 for (; aIt.More(); aIt.Next()) {
686 const BOPTools_PaveBlock& aPB=aIt.Value();
692 //modified by NIZNHY-PKV Mon Oct 17 12:07:48 2011f
694 void SortPaveBlocks(BOPTools_ListOfPaveBlock &);
696 void SortShell(const Standard_Integer,
697 BOPTools_PaveBlock *);
699 Standard_Boolean Less(const BOPTools_PaveBlock &,
700 const BOPTools_PaveBlock &);
702 //=======================================================================
703 // function: RealSplitsInFace
705 //=======================================================================
706 void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nF,
707 BOPTools_ListOfPaveBlock& aLPBIn)
709 Standard_Integer j, aNbCBP, nSpIn;
710 TColStd_MapOfInteger aMFence;
711 BOPTools_ListOfPaveBlock aLPB;
712 BOPTools_ListIteratorOfListOfPaveBlock aItPB;
713 NMTTools_ListIteratorOfListOfCommonBlock aItCB;
715 NMTTools_CommonBlockPool& aCBP=ChangeCommonBlockPool();
717 aNbCBP=aCBP.Extent();
718 for (j=1; j<=aNbCBP; ++j) {
719 NMTTools_ListOfCommonBlock& aLCB=aCBP(j);
720 aItCB.Initialize(aLCB);
721 for (; aItCB.More(); aItCB.Next()) {
722 NMTTools_CommonBlock& aCB=aItCB.ChangeValue();
723 if (aCB.IsPaveBlockOnFace(nF)) {
724 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1();
726 if (aMFence.Add(nSpIn)){
733 SortPaveBlocks(aLPB);
735 aItPB.Initialize(aLPB);
736 for (; aItPB.More(); aItPB.Next()) {
737 const BOPTools_PaveBlock& aPB=aItPB.Value();
741 //=======================================================================
742 // function: SortPaveBlocks
744 //=======================================================================
745 void SortPaveBlocks(BOPTools_ListOfPaveBlock &aLPBIn)
747 Standard_Integer i, aNbPBIn;
748 BOPTools_ListIteratorOfListOfPaveBlock aItPB;
749 BOPTools_PaveBlock *pPB;
751 aNbPBIn=aLPBIn.Extent();
756 pPB=new BOPTools_PaveBlock[aNbPBIn];
758 aItPB.Initialize(aLPBIn);
759 for (i=0; aItPB.More(); aItPB.Next(), ++i) {
760 const BOPTools_PaveBlock& aPB=aItPB.Value();
764 SortShell(aNbPBIn, pPB);
767 for (i=0; i<aNbPBIn; ++i) {
768 aLPBIn.Append(pPB[i]);
771 delete [] (BOPTools_PaveBlock*)pPB;
773 //=======================================================================
774 //function : SortShell
776 //=======================================================================
777 void SortShell(const Standard_Integer n,
778 BOPTools_PaveBlock *a)
780 Standard_Integer nd, i, j, l, d=1;
781 BOPTools_PaveBlock x;
791 for (i=0; i<nd; ++i) {
795 if (Less(a[l], a[j])) {
801 if (j > -1) goto m30;
803 }//for (i=0; i<nd; ++i)
807 //=======================================================================
810 //=======================================================================
811 Standard_Boolean Less(const BOPTools_PaveBlock &aPB1,
812 const BOPTools_PaveBlock &aPB2)
814 Standard_Boolean bRet;
815 Standard_Integer iE1, iE2;
816 Standard_Real aT11, aT12, aT21, aT22;
818 iE1=aPB1.OriginalEdge();
819 iE2=aPB2.OriginalEdge();
825 aPB1.Parameters(aT11, aT12);
826 aPB2.Parameters(aT21, aT22);
830 //modified by NIZNHY-PKV Mon Oct 17 11:44:45 2011t