0024148: Test case bugs/vis/bug24131_markers works wrong on software MS OpenGL
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller_3.cxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
2// Copyright (c) 2010-2012 OPEN CASCADE SAS
3// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6//
7// The content of this file is subject to the Open CASCADE Technology Public
8// License Version 6.5 (the "License"). You may not use the content of this file
9// except in compliance with the License. Please obtain a copy of the License
10// at http://www.opencascade.org and read it completely before using this file.
11//
12// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
13// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14//
15// The Original Code and all software distributed under the License is
16// distributed on an "AS IS" basis, without warranty of any kind, and the
17// Initial Developer hereby disclaims all such warranties, including without
18// limitation, any warranties of merchantability, fitness for a particular
19// purpose or non-infringement. Please see the License for the specific terms
20// and conditions governing the rights and limitations under the License.
21
22
23#include <BOPAlgo_PaveFiller.ixx>
24
25#include <Precision.hxx>
26#include <NCollection_IncAllocator.hxx>
27#include <NCollection_UBTreeFiller.hxx>
28
29#include <Bnd_Box.hxx>
30
31#include <TopoDS_Edge.hxx>
32#include <TopoDS_Vertex.hxx>
33#include <TopoDS_Compound.hxx>
34#include <BRep_Tool.hxx>
35#include <BRep_Builder.hxx>
36#include <BRepTools.hxx>
37#include <BRepBndLib.hxx>
38//
39#include <IntTools_EdgeEdge.hxx>
40#include <IntTools_Range.hxx>
41#include <IntTools_SequenceOfCommonPrts.hxx>
42#include <IntTools_CommonPrt.hxx>
43#include <IntTools_SequenceOfRanges.hxx>
44//
45#include <BOPTools_AlgoTools.hxx>
46//
47#include <BOPCol_DataMapOfShapeInteger.hxx>
48#include <BOPCol_DataMapOfIntegerShape.hxx>
49#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
50//
51#include <BOPInt_Context.hxx>
52#include <BOPInt_ShrunkRange.hxx>
53#include <BOPInt_Tools.hxx>
54//
55#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
56#include <BOPDS_MapOfPaveBlock.hxx>
57#include <BOPDS_CommonBlock.hxx>
58#include <BOPDS_CoupleOfPaveBlocks.hxx>
59#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
60#include <BOPDS_Iterator.hxx>
61#include <BOPDS_VectorOfInterfEE.hxx>
62#include <BOPDS_Interf.hxx>
63#include <BOPDS_Pave.hxx>
64#include <BOPDS_BoxBndTree.hxx>
65
66#include <BOPAlgo_Tools.hxx>
67
68//=======================================================================
69// function: PerformEE
70// purpose:
71//=======================================================================
72 void BOPAlgo_PaveFiller::PerformEE()
73{
74 Standard_Boolean bJustAdd, bOrder;
75 Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize;
76 Standard_Integer aNbCPrts, nWhat, nWith;
77 Standard_Real aTS11, aTS12, aTS21, aTS22;
78 Standard_Real aTolE1, aTolE2, aDeflection;
79 TopAbs_ShapeEnum aType;
80 TopoDS_Edge aEWhat, aEWith;
81 BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
82 Handle(NCollection_IncAllocator) aAllocator;
83 //
84 myErrorStatus=0;
85 //
86 myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
87 iSize=myIterator->ExpectedLength();
88 if (!iSize) {
89 return;
90 }
91 //
92 //-----------------------------------------------------scope f
93 aAllocator=new NCollection_IncAllocator();
94 BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
95 BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
96 //
97 aDiscretize=30;
98 aDeflection=0.01;
99 //
100 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
101 aEEs.SetStartSize(iSize);
102 aEEs.SetIncrement(iSize);
103 aEEs.Init();
104 //
105 for (; myIterator->More(); myIterator->Next()) {
106 myIterator->Value(nE1, nE2, bJustAdd);
107 if(bJustAdd) {
108 continue;
109 }
110 //
111 const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1);
112 if (aSIE1.HasFlag()){
113 continue;
114 }
115 const BOPDS_ShapeInfo& aSIE2=myDS->ShapeInfo(nE2);
116 if (aSIE2.HasFlag()){
117 continue;
118 }
119 //
120 const TopoDS_Edge& aE1=(*(TopoDS_Edge *)(&aSIE1.Shape()));
121 const TopoDS_Edge& aE2=(*(TopoDS_Edge *)(&aSIE2.Shape()));
122 //
123 aTolE1=BRep_Tool::Tolerance(aE1);
124 aTolE2=BRep_Tool::Tolerance(aE2);
125 //
126 BOPDS_ListOfPaveBlock& aLPB1=myDS->ChangePaveBlocks(nE1);
127 BOPDS_ListOfPaveBlock& aLPB2=myDS->ChangePaveBlocks(nE2);
128 //
129 aIt1.Initialize(aLPB1);
130 for (; aIt1.More(); aIt1.Next()) {
131 Bnd_Box aBB1;
132 //
133 Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue();
134 if (!aPB1->HasShrunkData()) {
135 FillShrunkData(aPB1);
136 if (myWarningStatus) {
137 continue;
138 }
139 }
140 aPB1->ShrunkData(aTS11, aTS12, aBB1);
141 //
142 aIt2.Initialize(aLPB2);
143 for (; aIt2.More(); aIt2.Next()) {
144 Bnd_Box aBB2;
145 //
146 Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
147 if (!aPB2->HasShrunkData()) {
148 FillShrunkData(aPB2);
149 if (myWarningStatus) {
150 continue;
151 }
152 }
153 aPB2->ShrunkData(aTS21, aTS22, aBB2);
154 //
155 if (aBB1.IsOut(aBB2)) {
156 continue;
157 }
158 //
159 // -----------f
160 //DEBft
161 //printf(" nE1=%d nE2=%d\n", nE1, nE2);
162 //
163 IntTools_EdgeEdge aEdgeEdge;
164 //
165 aEdgeEdge.SetEdge1 (aE1);
166 aEdgeEdge.SetEdge2 (aE2);
167 aEdgeEdge.SetTolerance1 (aTolE1);
168 aEdgeEdge.SetTolerance2 (aTolE2);
169 aEdgeEdge.SetDiscretize (aDiscretize);
170 aEdgeEdge.SetDeflection (aDeflection);
171 //
172 IntTools_Range aSR1(aTS11, aTS12);
173 IntTools_Range aSR2(aTS21, aTS22);
174 IntTools_Range anewSR1 = aSR1;
175 IntTools_Range anewSR2 = aSR2;
176 //
177 BOPTools_AlgoTools::CorrectRange (aE1, aE2, aSR1, anewSR1);
178 BOPTools_AlgoTools::CorrectRange (aE2, aE1, aSR2, anewSR2);
179 //
180 aEdgeEdge.SetRange1(anewSR1);
181 aEdgeEdge.SetRange2(anewSR2);
182 //
183 aEdgeEdge.Perform();
184 if (!aEdgeEdge.IsDone()) {
185 continue;
186 }
187 //
188 bOrder=aEdgeEdge.Order();
189 if (!bOrder) {
190 aEWhat=aE1;
191 aEWith=aE2;
192 nWhat=nE1;
193 nWith=nE2;
194 }
195 else {
196 nWhat=nE2;
197 nWith=nE1;
198 aEWhat=aE2;
199 aEWith=aE1;
200 }
201 //
202 const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeEdge.CommonParts();
203 //
204 aNbCPrts=aCPrts.Length();
205 for (i=1; i<=aNbCPrts; ++i) {
206 const IntTools_CommonPrt& aCPart=aCPrts(i);
207 aType=aCPart.Type();
208 switch (aType) {
209 case TopAbs_VERTEX: {
210 Standard_Boolean bIsOnPave1, bIsOnPave2;
211 Standard_Real aT1, aT2, aTol;
212 IntTools_Range aR1, aR2;
213 TopoDS_Vertex aVnew;
214 //
215 BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
216 aTol=Precision::Confusion();
217 //
218 //decide to keep the pave or not
219 aR1 = (bOrder) ? anewSR2 : anewSR1;
220 aR2 = (bOrder) ? anewSR1 : anewSR2;
221 //
222 bIsOnPave1=BOPInt_Tools::IsOnPave(aT1, aR1, aTol);
223 bIsOnPave2=BOPInt_Tools::IsOnPave(aT2, aR2, aTol);
224 //
225 if(bIsOnPave1 || bIsOnPave2) {
226 continue;
227 }
228 //
229 BOPTools_AlgoTools::MakeNewVertex(aEWhat, aT1, aEWith, aT2, aVnew);
230 // <-LXBR
231 {
232 Standard_Integer nV11, nV12, nV21, nV22, nVS[2], k, j, iFound;
233 Standard_Real aTolVx, aTolVnew, aD2, aDT2;
234 BOPCol_MapOfInteger aMV;
235 gp_Pnt aPnew, aPx;
236 //
237 iFound=0;
238 j=-1;
239 nV11=aPB1->Pave1().Index();
240 nV12=aPB1->Pave2().Index();
241 nV21=aPB2->Pave1().Index();
242 nV22=aPB2->Pave2().Index();
243 aMV.Add(nV11);
244 aMV.Add(nV12);
245 //
246 if (aMV.Contains(nV21)) {
247 ++j;
248 nVS[j]=nV21;
249 }
250 if (aMV.Contains(nV22)) {
251 ++j;
252 nVS[j]=nV22;
253 }
254 //
255 aTolVnew=BRep_Tool::Tolerance(aVnew);
256 aPnew=BRep_Tool::Pnt(aVnew);
257 //
258 for (k=0; k<=j; ++k) {
259 const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
260 aTolVx=BRep_Tool::Tolerance(aVx);
261 aPx=BRep_Tool::Pnt(aVx);
262 aD2=aPnew.SquareDistance(aPx);
263 //
264 aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
265 //
266 if (aD2<aDT2) {
267 iFound=1;
268 break;
269 }
270 }
271 //
272 if (iFound) {
273 continue;
274 }
275 }
276
277 // 1
278 iX=aEEs.Append()-1;
279 BOPDS_InterfEE& aEE=aEEs(iX);
280 aEE.SetIndices(nWhat, nWith);
281 aEE.SetCommonPart(aCPart);
282 // 2
283 myDS->AddInterf(nWhat, nWith);
284 //
285 BOPDS_CoupleOfPaveBlocks aCPB;
286 //
287 aCPB.SetPaveBlocks(aPB1, aPB2);
288 aCPB.SetIndexInterf(iX);
289 aMVCPB.Add(aVnew, aCPB);
290 }//case TopAbs_VERTEX:
291 break;
292 //
293 case TopAbs_EDGE: {
294 Standard_Boolean bHasSameBounds;
295 Standard_Integer aNbComPrt2;
296 //
297 aNbComPrt2=aCPart.Ranges2().Length();
298 if (aNbComPrt2>1){
299 break;
300 }
301 //// <-LXBR
302 bHasSameBounds=aPB1->HasSameBounds(aPB2);
303 if (!bHasSameBounds) {
304 break;
305 }
306 // 1
307 iX=aEEs.Append()-1;
308 BOPDS_InterfEE& aEE=aEEs(iX);
309 aEE.SetIndices(nWhat, nWith);
310 aEE.SetCommonPart(aCPart);
311 // 2
312 myDS->AddInterf(nWhat, nWith);
313 //
314 BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
315 }//case TopAbs_EDGE
316 break;
317 default:
318 break;
319 }//switch (aType) {
320 }//for (i=1; i<=aNbCPrts; i++) {
321 // -----------t
322 //
323 }// for (; aIt2.More(); aIt2.Next()) {
324 }// for (; aIt1.More(); aIt1.Next()) {
325 }
326 //
327 //=========================================
328 // post treatment
329 //=========================================
5a77460e 330 BOPAlgo_Tools::PerformCommonBlocks(aMPBLPB, aAllocator, myDS);
4e57c75e 331 PerformVerticesEE(aMVCPB, aAllocator);
332 //-----------------------------------------------------scope t
333 aMPBLPB.Clear();
334 aMVCPB.Clear();
335 aAllocator.Nullify();
336}
337//=======================================================================
338//function : PerformVertices
339//purpose :
340//=======================================================================
341 Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
342 (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
343 Handle(NCollection_BaseAllocator)& theAllocator)
344{
345 Standard_Integer aNbV, iRet;
346 //
347 iRet=0;
348 aNbV=theMVCPB.Extent();
349 if (!aNbV) {
350 return iRet;
351 }
352 //
353 Standard_Integer nVx, iV, j, nE, iFlag, iX, i, aNb;
354 Standard_Real aT;
355 TopoDS_Shape aV;
356 BOPCol_ListIteratorOfListOfShape aItLS;
357 BOPCol_ListIteratorOfListOfInteger aItLI;
358 BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
359 BOPDS_ShapeInfo aSI;
360 BOPDS_Pave aPave;
361 //
362 BOPDS_IndexedDataMapOfPaveBlockListOfInteger aMPBLI(100, theAllocator);
363 BOPCol_ListOfShape aLS(theAllocator);
364 BOPCol_IndexedDataMapOfShapeInteger aMVI(100, theAllocator);
365 BOPCol_IndexedDataMapOfShapeListOfShape aImages;
366 //
367 aSI.SetShapeType(TopAbs_VERTEX);
368 BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
369 //
370 // 1 prepare arguments
371 //
372 // <- DEB
373 for (i=1; i<=aNbV; ++i) {
374 const TopoDS_Shape& aS=theMVCPB.FindKey(i);
375 const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
376 iV=aCPB.IndexInterf();
377 aMVI.Add(aS, iV);
378 }
379 //
380 // 2 Fuse vertices
381 TreatNewVertices(aMVI, aImages);
382 //
383 // 3 Add new vertices to myDS;
384 // connect indices to CPB structure
385 aNb = aImages.Extent();
386 for (i=1; i<=aNb; ++i) {
387 const TopoDS_Vertex& aV=(*(TopoDS_Vertex*)(&aImages.FindKey(i)));
388 const BOPCol_ListOfShape& aLVSD=aImages.FindFromIndex(i);
389 //
390 aSI.SetShape(aV);
391 iV=myDS->Append(aSI);
392 //
393 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(iV);
394 Bnd_Box& aBox=aSIDS.ChangeBox();
395 BRepBndLib::Add(aV, aBox);
396 //
397 aItLS.Initialize(aLVSD);
398 for (; aItLS.More(); aItLS.Next()) {
399 const TopoDS_Shape& aVx = aItLS.Value();
400 BOPDS_CoupleOfPaveBlocks &aCPB=theMVCPB.ChangeFromKey(aVx);
401 aCPB.SetIndex(iV);
402 // update EE interference
403 iX=aCPB.IndexInterf();
404 BOPDS_InterfEE& aEE=aEEs(iX);
405 aEE.SetIndexNew(iV);
406 }
407 }
408 //
409 // 4 Map PaveBlock/ListOfVertices to add to this PaveBlock ->aMPBLI
410 {
411 Handle(BOPDS_PaveBlock) aPB[2];
412 //
413 for (i=1; i<=aNbV; ++i) {
414 const BOPDS_CoupleOfPaveBlocks& aCPB=theMVCPB.FindFromIndex(i);
415 iV=aCPB.Index();
416 aCPB.PaveBlocks(aPB[0], aPB[1]);
417 for (j=0; j<2; ++j) {
418 if (aMPBLI.Contains(aPB[j])) {
419 BOPCol_ListOfInteger& aLI=aMPBLI.ChangeFromKey(aPB[j]);
420 aLI.Append(iV);
421 }
422 else {
423 BOPCol_ListOfInteger aLI(theAllocator);
424 aLI.Append(iV);
425 aMPBLI.Add(aPB[j], aLI);
426 }
427 }
428 }
429 }
430 //
431 // 5
432 // 5.1 Compute Extra Paves and
433 // 5.2. Add Extra Paves to the PaveBlocks
434 aNb=aMPBLI.Extent();
435 for(i=1; i<=aNb; ++i) {
436 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
437 nE=aPB->OriginalEdge();
438 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
439 // 1,2
440 const BOPCol_ListOfInteger& aLI=aMPBLI.FindFromIndex(i);
441 aItLI.Initialize(aLI);
442 for (; aItLI.More(); aItLI.Next()) {
443 nVx=aItLI.Value();
444 const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
445 //
446 iFlag=myContext->ComputeVE (aVx, aE, aT);
447 if (!iFlag) {
448 aPave.SetIndex(nVx);
449 aPave.SetParameter(aT);
450 aPB->AppendExtPave(aPave);
451 }
452 }
453 }
454 // 6 Split PaveBlocksa
455 aNb=aMPBLI.Extent();
456 for(i=1; i<=aNb; ++i) {
457 Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
458 nE=aPB->OriginalEdge();
459 // 3
5a77460e 460 if (!myDS->IsCommonBlock(aPB)) {
4e57c75e 461 myDS->UpdatePaveBlock(aPB);
462 }
463 else {
5a77460e 464 const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
4e57c75e 465 myDS->UpdateCommonBlock(aCB);
466 }
467 }//for (; aItMPBLI.More(); aItMPBLI.Next()) {
468 //
469 return iRet;
470}
471
472//=======================================================================
473//function : TreatNewVertices
474//purpose :
475//=======================================================================
476 void BOPAlgo_PaveFiller::TreatNewVertices(
477 const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
478 BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
479{
480 Standard_Integer j, i, aNbV, aNbVSD;
481 Standard_Real aTol;
482 TopoDS_Shape aVF;
483 TopoDS_Vertex aVnew;
484 BOPCol_IndexedMapOfShape aMVProcessed;
485
486 BOPCol_ListIteratorOfListOfInteger aIt;
487 BOPCol_IndexedDataMapOfShapeListOfShape aMVLV;
488 BOPCol_DataMapOfIntegerShape aMIS;
489 BOPCol_IndexedDataMapOfShapeBox aMSB;
490 //
491 BOPDS_BoxBndTreeSelector aSelector;
492 BOPDS_BoxBndTree aBBTree;
493 NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
494 //
495 aNbV = aMapVI.Extent();
496 for (i=1; i<=aNbV; ++i) {
497 const TopoDS_Shape& aV=aMapVI.FindKey(i);
498 Bnd_Box aBox;
499 //
500 aTol=BRep_Tool::Tolerance(*(TopoDS_Vertex*)(&aV));
501 aBox.SetGap(aTol);
502 BRepBndLib::Add(aV, aBox);
503 //
504 aTreeFiller.Add(i, aBox);
505 //
506 aMIS.Bind(i, aV);
507 aMSB.Add(aV, aBox);
508 }
509 //
510 aTreeFiller.Fill();
511
512 // Chains
513 for (i=1; i<=aNbV; ++i) {
514 const TopoDS_Shape& aV=aMapVI.FindKey(i);
515 //
516 if (aMVProcessed.Contains(aV)) {
517 continue;
518 }
519 //
520 Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
521 BOPCol_ListOfShape aLVSD;
522 BOPCol_MapOfInteger aMIP, aMIP1, aMIPC;
523 BOPCol_MapIteratorOfMapOfInteger aIt1;
524 //
525 aMIP.Add(i);
302f96fb 526 for(;;) {
4e57c75e 527 aNbIP=aMIP.Extent();
528 aIt1.Initialize(aMIP);
529 for(; aIt1.More(); aIt1.Next()) {
530 aIP=aIt1.Key();
531 if (aMIPC.Contains(aIP)) {
532 continue;
533 }
534 //
535 const TopoDS_Shape& aVP=aMIS.Find(aIP);
536 const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
537 //
538 aSelector.Clear();
539 aSelector.SetBox(aBoxVP);
540 //
541 aNbVSD=aBBTree.Select(aSelector);
542 if (!aNbVSD) {
543 continue; // it must not be
544 }
545 //
546 const BOPCol_ListOfInteger& aLI=aSelector.Indices();
547 aIt.Initialize(aLI);
548 for (; aIt.More(); aIt.Next()) {
549 aIP1=aIt.Value();
550 if (aMIP.Contains(aIP1)) {
551 continue;
552 }
553 aMIP1.Add(aIP1);
554 } //for (; aIt.More(); aIt.Next()) {
555 }//for(; aIt1.More(); aIt1.Next()) {
556 //
557 aNbIP1=aMIP1.Extent();
558 if (!aNbIP1) {
559 break; // from while(1)
560 }
561 //
562 aIt1.Initialize(aMIP);
563 for(; aIt1.More(); aIt1.Next()) {
564 aIP=aIt1.Key();
565 aMIPC.Add(aIP);
566 }
567 //
568 aMIP.Clear();
569 aIt1.Initialize(aMIP1);
570 for(; aIt1.More(); aIt1.Next()) {
571 aIP=aIt1.Key();
572 aMIP.Add(aIP);
573 }
574 aMIP1.Clear();
575 }// while(1)
576 //...
577 aNbIP=aMIPC.Extent();
578 if (!aNbIP) {
579 aMIPC.Add(i);
580 }
581 //
582 aIt1.Initialize(aMIPC);
583 for(j=0; aIt1.More(); aIt1.Next(), ++j) {
584 aIP=aIt1.Key();
585 const TopoDS_Shape& aVP=aMIS.Find(aIP);
586 if (!j) {
587 aVF=aVP;
588 }
589 aLVSD.Append(aVP);
590 aMVProcessed.Add(aVP);
591 }
592 aMVLV.Add(aVF, aLVSD);
593 }// for (i=1; i<=aNbV; ++i) {
594
595 // Make new vertices
596 aNbV=aMVLV.Extent();
597 for (i=1; i<=aNbV; ++i) {
598 const TopoDS_Shape& aV=aMVLV.FindKey(i);
599 BOPCol_ListOfShape& aLVSD=aMVLV.ChangeFromIndex(i);
600 aNbVSD=aLVSD.Extent();
601 if (aNbVSD>1) {
602 BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
603 myImages.Add(aVnew, aLVSD);
604 } else {
605 myImages.Add(aV, aLVSD);
606 }
607 }
608}
609
610//=======================================================================
611//function : FillShrunkData
612//purpose :
613//=======================================================================
614 void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
615{
616 Standard_Integer nE, nV1, nV2, iErr;
617 Standard_Real aT1, aT2, aTS1, aTS2;
618 BOPInt_ShrunkRange aSR;
619 //
620 myErrorStatus=0;
621 myWarningStatus = 0;
622 //
623 const BOPDS_Pave& aPave1=thePB->Pave1();
624 nV1=aPave1.Index();
625 aT1=aPave1.Parameter();
626 const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
627 //
628 const BOPDS_Pave& aPave2=thePB->Pave2();
629 nV2=aPave2.Index();
630 aT2=aPave2.Parameter();
631 const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
632 //
633 nE=thePB->OriginalEdge();
634 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
635 //
636 aSR.SetData(aE, aT1, aT2, aV1, aV2, myContext);
637 //
638 aSR.Perform();
639 iErr=aSR.ErrorStatus();
640 if (iErr) {
641 myWarningStatus = 1;
642 //myErrorStatus=40;
643 return;
644 }
645 //
646 aSR.ShrunkRange(aTS1, aTS2);
647 const Bnd_Box& aBox=aSR.BndBox();
648 //
649 thePB->SetShrunkData(aTS1, aTS2, aBox);
650}
651 /*
652 // DEBf
653 {
654 TopoDS_Compound aCx;
655 BRep_Builder aBBx;
656 aBBx.MakeCompound(aCx);
657 aItMVCPB.Initialize(theMVCPB);
658 for (; aItMVCPB.More(); aItMVCPB.Next()) {
659 const TopoDS_Shape& aS=aItMVCPB.Key();
660 aBBx.Add(aCx, aS);
661 }
662 BRepTools::Write(aCx, "cx");
663 }
664 // DEBt
665 */