1 // File: NMTTools_PaveFiller_8.cxx
2 // Created: Fri Dec 19 11:15:53 2003
3 // Author: Peter KURNEV
7 #include <NMTTools_PaveFiller.ixx>
9 #include <TColStd_ListOfInteger.hxx>
10 #include <TColStd_ListIteratorOfListOfInteger.hxx>
12 #include <BooleanOperations_ShapesDataStructure.hxx>
13 #include <BooleanOperations_OnceExplorer.hxx>
15 #include <BOPTools_PaveBlock.hxx>
16 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
17 #include <BOPTools_ListOfPaveBlock.hxx>
19 #include <NMTDS_ShapesDataStructure.hxx>
21 #include <NMTTools_ListOfCommonBlock.hxx>
22 #include <NMTTools_ListIteratorOfListOfCommonBlock.hxx>
23 #include <NMTTools_CommonBlock.hxx>
24 #include <NMTTools_CommonBlockAPI.hxx>
26 //=======================================================================
27 // function: RealPaveBlock
29 //=======================================================================
30 const BOPTools_PaveBlock& NMTTools_PaveFiller::RealPaveBlock(const BOPTools_PaveBlock& aPB)
34 nE=aPB.OriginalEdge();
35 const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
36 NMTTools_CommonBlockAPI aCBAPI(aLCBE);
37 if (aCBAPI.IsCommonBlock(aPB)) {
38 NMTTools_CommonBlock& aCB=aCBAPI.CommonBlock(aPB);
39 const BOPTools_PaveBlock& aPBx=aCB.PaveBlock1();
44 //=======================================================================
45 // function: CommonBlocksFace
47 //=======================================================================
48 Standard_Integer NMTTools_PaveFiller::CommonBlocksFace(const Standard_Integer nF,
49 NMTTools_ListOfCommonBlock& aLCB)
53 NMTTools_ListIteratorOfListOfCommonBlock anIt;
55 aT=myDS->GetShapeType(nF);
57 if (aT!=TopAbs_FACE) {
58 return 1; // Type mismatch
61 BooleanOperations_ShapesDataStructure *pDS=myDS;
62 BooleanOperations_OnceExplorer aExp(*pDS);
64 aExp.Init(nF, TopAbs_EDGE);
65 for (; aExp.More(); aExp.Next()) {
67 const NMTTools_ListOfCommonBlock& aLCBE=myCommonBlockPool(myDS->RefEdge(nE));
68 anIt.Initialize(aLCBE);
69 for (; anIt.More(); anIt.Next()) {
70 const NMTTools_CommonBlock& aCBE=anIt.Value();
80 //=======================================================================
81 // function: RealSplitsFace
83 //=======================================================================
84 void NMTTools_PaveFiller::RealSplitsFace(const Standard_Integer nF,
85 BOPTools_ListOfPaveBlock& aLPB)
88 BOPTools_ListIteratorOfListOfPaveBlock anIt;
90 BooleanOperations_ShapesDataStructure *pDS=myDS;
91 BooleanOperations_OnceExplorer aExp(*pDS);
93 aExp.Init(nF, TopAbs_EDGE);
94 for (; aExp.More(); aExp.Next()) {
96 const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
97 anIt.Initialize(aLPBE);
98 for (; anIt.More(); anIt.Next()) {
99 const BOPTools_PaveBlock& aPB=anIt.Value();
100 const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
105 //=======================================================================
106 // function: HasRealSplitsInOnFace
108 //=======================================================================
109 Standard_Boolean NMTTools_PaveFiller::HasRealSplitsInOnFace(const Standard_Integer nF1,
110 const Standard_Integer nF2)
112 Standard_Boolean bFlag;
113 BOPTools_ListOfPaveBlock aLPB;
115 RealSplitsInFace(0, nF1, nF2, aLPB);
117 bFlag=!aLPB.IsEmpty();
122 RealSplitsInFace(0, nF1, nF2, aLPB);
124 bFlag=!aLPB.IsEmpty();
127 //=======================================================================
128 // function: RealSplitsInFace
130 //=======================================================================
131 void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer ,//for overriding
132 const Standard_Integer nF1,
133 const Standard_Integer nF2,
134 BOPTools_ListOfPaveBlock& aLPB)
136 Standard_Integer nE1;
138 BooleanOperations_ShapesDataStructure *pDS=myDS;
139 BooleanOperations_OnceExplorer aExp(*pDS);
140 aExp.Init(nF1, TopAbs_EDGE);
141 for (; aExp.More(); aExp.Next()) {
143 RealSplitsInFace (nE1, nF2, aLPB);
146 //=======================================================================
147 // function: RealSplitsInFace
149 //=======================================================================
150 void NMTTools_PaveFiller::RealSplitsInFace(const Standard_Integer nE1,
151 const Standard_Integer nF2,
152 BOPTools_ListOfPaveBlock& aLPB)
154 Standard_Integer nF1;
156 TColStd_ListIteratorOfListOfInteger anItLFCB;
157 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
159 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
161 anItCB.Initialize(aLCB);
162 for (; anItCB.More(); anItCB.Next()) {
163 NMTTools_CommonBlock& aCB=anItCB.Value();
164 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
165 const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
167 const TColStd_ListOfInteger& aLFCB=aCB.Faces();
168 anItLFCB.Initialize(aLFCB);
169 for (; anItLFCB.More(); anItLFCB.Next()) {
170 nF1=anItLFCB.Value();
177 //=======================================================================
178 // function: RealSplitsOnEdge
180 //=======================================================================
181 void NMTTools_PaveFiller::RealSplitsOnEdge(const Standard_Integer nE1,
182 const Standard_Integer nE2,
183 BOPTools_ListOfPaveBlock& aLPB)
187 BOPTools_ListIteratorOfListOfPaveBlock anIt;
188 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
190 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
192 anItCB.Initialize(aLCB);
193 for (; anItCB.More(); anItCB.Next()) {
194 NMTTools_CommonBlock& aCB=anItCB.Value();
195 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
196 const BOPTools_PaveBlock& aPB1R=RealPaveBlock(aPB1);
198 const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
199 anIt.Initialize(aLPBx);
200 for (; anIt.More(); anIt.Next()) {
201 const BOPTools_PaveBlock& aPB2=anIt.Value();
202 nE=aPB2.OriginalEdge();
209 //=======================================================================
210 // function: RealSplitsOnFace
212 //=======================================================================
213 void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer nE1,
214 const Standard_Integer nF2,
215 BOPTools_ListOfPaveBlock& aLPB)
217 Standard_Integer nE2;
219 BooleanOperations_ShapesDataStructure *pDS=myDS;
220 BooleanOperations_OnceExplorer aExp(*pDS);
221 aExp.Init(nF2, TopAbs_EDGE);
222 for (; aExp.More(); aExp.Next()) {
224 RealSplitsOnEdge(nE1, nE2, aLPB);
227 //=======================================================================
228 // function: RealSplitsOnFace
230 //=======================================================================
231 void NMTTools_PaveFiller::RealSplitsOnFace(const Standard_Integer ,//for overriding
232 const Standard_Integer nF1,
233 const Standard_Integer nF2,
234 BOPTools_ListOfPaveBlock& aLPB)
236 Standard_Integer nE1;
238 BooleanOperations_ShapesDataStructure *pDS=myDS;
239 BooleanOperations_OnceExplorer aExp(*myDS);
240 aExp.Init(nF1, TopAbs_EDGE);
241 for (; aExp.More(); aExp.Next()) {
243 RealSplitsOnFace(nE1, nF2, aLPB);
248 //=======================================================================
249 // function: SplitsFace
251 //=======================================================================
252 Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
253 BOPTools_ListOfPaveBlock& aLPB)
257 BOPTools_ListIteratorOfListOfPaveBlock anIt;
259 aT=myDS->GetShapeType(nF);
261 if (aT!=TopAbs_FACE) {
262 return 1; // Type mismatch
265 BooleanOperations_ShapesDataStructure *pDS=myDS;
266 BooleanOperations_OnceExplorer aExp(*pDS);
268 aExp.Init(nF, TopAbs_EDGE);
269 for (; aExp.More(); aExp.Next()) {
271 const BOPTools_ListOfPaveBlock& aLPBE=mySplitShapesPool(myDS->RefEdge(nE));
272 anIt.Initialize(aLPBE);
273 for (; anIt.More(); anIt.Next()) {
274 const BOPTools_PaveBlock& aPBE=anIt.Value();
281 //=======================================================================
282 // function: SplitsInFace
283 // purpose: splits of edges from nF1 in nF2
284 //=======================================================================
285 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
286 const Standard_Integer nF1,
287 const Standard_Integer nF2,
288 BOPTools_ListOfPaveBlock& aLPB)
290 Standard_Integer nE1;
291 TopAbs_ShapeEnum aT1, aT2;
293 aT1=myDS->GetShapeType(nF1);
294 aT2=myDS->GetShapeType(nF2);
296 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
297 return 1; // Type mismatch
299 BooleanOperations_ShapesDataStructure *pDS=myDS;
300 BooleanOperations_OnceExplorer aExp(*pDS);
301 aExp.Init(nF1, TopAbs_EDGE);
302 for (; aExp.More(); aExp.Next()) {
304 SplitsInFace (nE1, nF2, aLPB);
308 //=======================================================================
309 // function: SplitsInFace
310 // purpose: splits of edge nE1 in aFace2
311 //=======================================================================
312 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
313 const Standard_Integer nF2,
314 BOPTools_ListOfPaveBlock& aLPB)
316 Standard_Integer nF1;
317 TopAbs_ShapeEnum aT1, aT2;
319 aT1=myDS->GetShapeType(nE1);
320 aT2=myDS->GetShapeType(nF2);
322 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
323 return 1; // Type mismatch
326 TColStd_ListIteratorOfListOfInteger anItLFCB;
327 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
329 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
331 anItCB.Initialize(aLCB);
332 for (; anItCB.More(); anItCB.Next()) {
333 NMTTools_CommonBlock& aCB=anItCB.Value();
334 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
336 const TColStd_ListOfInteger& aLFCB=aCB.Faces();
337 anItLFCB.Initialize(aLFCB);
338 for (; anItLFCB.More(); anItLFCB.Next()) {
339 nF1=anItLFCB.Value();
347 //=======================================================================
348 // function: SplitsOnEdge
349 // purpose: splits of edge nE1 on nE2
350 //=======================================================================
351 Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
352 const Standard_Integer nE2,
353 BOPTools_ListOfPaveBlock& aLPB)
356 TopAbs_ShapeEnum aT1, aT2;
358 aT1=myDS->GetShapeType(nE1);
359 aT2=myDS->GetShapeType(nE2);
361 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
362 return 1; // Type mismatch
365 BOPTools_ListIteratorOfListOfPaveBlock anIt;
366 NMTTools_ListIteratorOfListOfCommonBlock anItCB;
368 const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
370 anItCB.Initialize(aLCB);
371 for (; anItCB.More(); anItCB.Next()) {
372 NMTTools_CommonBlock& aCB=anItCB.Value();
373 const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);//XXX
375 const BOPTools_ListOfPaveBlock& aLPBx=aCB.PaveBlocks();
376 anIt.Initialize(aLPBx);
377 for (; anIt.More(); anIt.Next()) {
378 const BOPTools_PaveBlock& aPB2=anIt.Value();
379 nE=aPB2.OriginalEdge();
387 //=======================================================================
388 // function: SplitsOnFace
389 // purpose: splits of edge nE1 on face nF2
390 //=======================================================================
391 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
392 const Standard_Integer nF2,
393 BOPTools_ListOfPaveBlock& aLPB)
395 Standard_Integer nE2, ip;
396 TopAbs_ShapeEnum aT1, aT2;
398 aT1=myDS->GetShapeType(nE1);
399 aT2=myDS->GetShapeType(nF2);
401 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
402 return 1; // Type mismatch
404 BooleanOperations_ShapesDataStructure *pDS=myDS;
405 BooleanOperations_OnceExplorer aExp(*pDS);
406 aExp.Init(nF2, TopAbs_EDGE);
407 for (; aExp.More(); aExp.Next()) {
409 ip=SplitsOnEdge(nE1, nE2, aLPB);
416 //=======================================================================
417 // function: SplitsOnFace
418 // purpose: splits of edges from face nF1 on face nF2
419 //=======================================================================
420 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
421 const Standard_Integer nF1,
422 const Standard_Integer nF2,
423 BOPTools_ListOfPaveBlock& aLPB)
425 Standard_Integer nE1, ip;
426 TopAbs_ShapeEnum aT1, aT2;
428 aT1=myDS->GetShapeType(nF1);
429 aT2=myDS->GetShapeType(nF2);
431 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
432 return 1; // Type mismatch
434 BooleanOperations_ShapesDataStructure *pDS=myDS;
435 BooleanOperations_OnceExplorer aExp(*myDS);
436 aExp.Init(nF1, TopAbs_EDGE);
437 for (; aExp.More(); aExp.Next()) {
439 ip=SplitsOnFace(nE1, nF2, aLPB);
447 // 3 Simple Splits indices
448 //=======================================================================
449 // function: SplitsFace
451 //=======================================================================
452 Standard_Integer NMTTools_PaveFiller::SplitsFace(const Standard_Integer nF,
453 TColStd_ListOfInteger& aSplits)
455 Standard_Integer nE, iErr;
456 BOPTools_ListIteratorOfListOfPaveBlock aIt;
457 BOPTools_ListOfPaveBlock aLPB;
459 iErr=SplitsFace(nF, aLPB);
464 aIt.Initialize(aLPB);
465 for (; aIt.More(); aIt.Next()) {
466 const BOPTools_PaveBlock& aPB=aIt.Value();
473 //=======================================================================
474 // function: SplitsInFace
475 // purpose: splits of edges from nF1 in nF2
476 //=======================================================================
477 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
478 const Standard_Integer nF1,
479 const Standard_Integer nF2,
480 TColStd_ListOfInteger& aSplits)
482 Standard_Integer nE, iErr;
483 BOPTools_ListIteratorOfListOfPaveBlock aIt;
484 BOPTools_ListOfPaveBlock aLPB;
486 iErr=SplitsInFace(0, nF1, nF2, aLPB);
490 aIt.Initialize(aLPB);
491 for (; aIt.More(); aIt.Next()) {
492 const BOPTools_PaveBlock& aPB=aIt.Value();
498 //=======================================================================
499 // function: SplitsInFace
500 // purpose: splits of edge nE1 in aFace2
501 //=======================================================================
502 Standard_Integer NMTTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
503 const Standard_Integer nF2,
504 TColStd_ListOfInteger& aSplits)
506 Standard_Integer nE, iErr;
507 BOPTools_ListIteratorOfListOfPaveBlock aIt;
508 BOPTools_ListOfPaveBlock aLPB;
510 iErr=SplitsInFace(nE1, nF2, aLPB);
514 aIt.Initialize(aLPB);
515 for (; aIt.More(); aIt.Next()) {
516 const BOPTools_PaveBlock& aPB=aIt.Value();
522 //=======================================================================
523 // function: SplitsOnEdge
524 // purpose: splits of edge nE1 on nE2
525 //=======================================================================
526 Standard_Integer NMTTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
527 const Standard_Integer nE2,
528 TColStd_ListOfInteger& aSplits)
530 Standard_Integer nE, iErr;
531 BOPTools_ListIteratorOfListOfPaveBlock aIt;
532 BOPTools_ListOfPaveBlock aLPB;
534 iErr=SplitsOnEdge(nE1, nE2, aLPB);
538 aIt.Initialize(aLPB);
539 for (; aIt.More(); aIt.Next()) {
540 const BOPTools_PaveBlock& aPB=aIt.Value();
546 //=======================================================================
547 // function: SplitsOnFace
548 // purpose: splits of edge nE1 on face nF2
549 //=======================================================================
550 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
551 const Standard_Integer nF2,
552 TColStd_ListOfInteger& aSplits)
554 Standard_Integer nE, iErr;
555 BOPTools_ListIteratorOfListOfPaveBlock aIt;
556 BOPTools_ListOfPaveBlock aLPB;
558 iErr=SplitsOnEdge(nE1, nF2, aLPB);
562 aIt.Initialize(aLPB);
563 for (; aIt.More(); aIt.Next()) {
564 const BOPTools_PaveBlock& aPB=aIt.Value();
570 //=======================================================================
571 // function: SplitsOnFace
572 // purpose: splits of edges from face nF1 on face nF2
573 //=======================================================================
574 Standard_Integer NMTTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
575 const Standard_Integer nF1,
576 const Standard_Integer nF2,
577 TColStd_ListOfInteger& aSplits)
579 Standard_Integer nE, iErr;
580 BOPTools_ListIteratorOfListOfPaveBlock aIt;
581 BOPTools_ListOfPaveBlock aLPB;
583 iErr=SplitsOnFace(0, nF1, nF2, aLPB);
588 aIt.Initialize(aLPB);
589 for (; aIt.More(); aIt.Next()) {
590 const BOPTools_PaveBlock& aPB=aIt.Value();