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: GEOMAlgo_GetInPlace.cxx
23 // Author: Peter KURNEV
25 #include <GEOMAlgo_GetInPlace.hxx>
27 #include <GEOMAlgo_Tools.hxx>
29 #include <NMTTools_CoupleOfShape.hxx>
31 #include <NMTDS_BoxBndTree.hxx>
33 #include <Basics_OCCTVersion.hxx>
35 #include <NCollection_UBTreeFiller.hxx>
37 #include <Bnd_Box.hxx>
40 #include <TColStd_ListOfInteger.hxx>
41 #include <TColStd_ListIteratorOfListOfInteger.hxx>
43 #include <TopAbs_ShapeEnum.hxx>
45 #include <TopoDS_Iterator.hxx>
46 #include <TopoDS_Shape.hxx>
47 #include <TopoDS_Vertex.hxx>
48 #include <TopoDS_Edge.hxx>
49 #include <TopoDS_Face.hxx>
50 #include <TopoDS_Compound.hxx>
52 #include <BRep_Tool.hxx>
53 #include <BRep_Builder.hxx>
55 #include <BRepBndLib.hxx>
59 #include <TopTools_IndexedMapOfShape.hxx>
60 #include <TopTools_ListOfShape.hxx>
61 #include <TopTools_DataMapOfShapeListOfShape.hxx>
62 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
63 #include <TopTools_ListIteratorOfListOfShape.hxx>
64 #include <TopTools_MapOfShape.hxx>
65 #include <TopTools_MapIteratorOfMapOfShape.hxx>
69 void MapBRepShapes(const TopoDS_Shape& aS,
70 TopTools_IndexedMapOfShape& aM);
73 //=======================================================================
74 //function : GEOMAlgo_GetInPlace
76 //=======================================================================
77 GEOMAlgo_GetInPlace::GEOMAlgo_GetInPlace()
85 myFound=Standard_False;
86 myCheckGeometry=Standard_True;
88 //=======================================================================
91 //=======================================================================
92 GEOMAlgo_GetInPlace::~GEOMAlgo_GetInPlace()
95 //=======================================================================
96 //function : SetTolMass
98 //=======================================================================
99 void GEOMAlgo_GetInPlace::SetTolMass(const Standard_Real theTol)
103 //=======================================================================
106 //=======================================================================
107 Standard_Real GEOMAlgo_GetInPlace::TolMass()const
111 //=======================================================================
112 //function : SetTolCG
114 //=======================================================================
115 void GEOMAlgo_GetInPlace::SetTolCG(const Standard_Real theTol)
119 //=======================================================================
122 //=======================================================================
123 Standard_Real GEOMAlgo_GetInPlace::TolCG()const
127 //=======================================================================
130 //=======================================================================
131 Standard_Boolean GEOMAlgo_GetInPlace::IsFound()const
135 //=======================================================================
136 //function : SetShapeWhere
138 //=======================================================================
139 void GEOMAlgo_GetInPlace::SetShapeWhere(const TopoDS_Shape& theShape)
141 myShapeWhere=theShape;
143 //=======================================================================
144 //function : ShapeWhere
146 //=======================================================================
147 const TopoDS_Shape& GEOMAlgo_GetInPlace::ShapeWhere()const
151 //=======================================================================
152 //function : ShapesIn
154 //=======================================================================
155 const GEOMAlgo_DataMapOfShapeMapOfShape& GEOMAlgo_GetInPlace::ShapesIn()const
159 //=======================================================================
160 //function : ShapesOn
162 //=======================================================================
163 const GEOMAlgo_DataMapOfShapeMapOfShape& GEOMAlgo_GetInPlace::ShapesOn()const
167 //=======================================================================
170 //=======================================================================
171 void GEOMAlgo_GetInPlace::Clear()
176 GEOMAlgo_GluerAlgo::Clear();
180 myMapShapePnt.Clear();
182 //=======================================================================
185 //=======================================================================
186 void GEOMAlgo_GetInPlace::Perform()
188 myFound=Standard_False;
202 #if OCC_VERSION_LARGE > 0x06050200
203 // Initialize the context
204 GEOMAlgo_GluerAlgo::Perform();
277 //=======================================================================
278 //function : CheckData
280 //=======================================================================
281 void GEOMAlgo_GetInPlace::CheckData()
286 if (myArgument.IsNull()) {
291 if (myShapeWhere.IsNull()) {
296 //=======================================================================
297 //function : Intersect
299 //=======================================================================
300 void GEOMAlgo_GetInPlace::Intersect()
302 Standard_Integer i, j, aNbS1, aNbS2, aNbSD;
303 TColStd_ListIteratorOfListOfInteger aItLI;
304 TopTools_IndexedMapOfShape aMS1, aMS2;
305 TopTools_DataMapOfShapeListOfShape aDMSLS;
306 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
307 TopTools_ListIteratorOfListOfShape aItLS;
308 NMTTools_CoupleOfShape aCS;
310 NMTDS_BoxBndTreeSelector aSelector;
311 NMTDS_BoxBndTree aBBTree;
312 NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
319 MapBRepShapes(myArgument, aMS1);
321 for (i=1; i<=aNbS1; ++i) {
324 const TopoDS_Shape& aS1=aMS1(i);
325 BRepBndLib::Add(aS1, aBox1);
326 //modified by NIZNHY-PKV Fri Jun 10 08:20:03 2011f
327 //aBox1.SetGap(myTolerance);
328 aBox1.Enlarge(myTolerance);
329 //modified by NIZNHY-PKV Fri Jun 10 08:20:06 2011t
331 aTreeFiller.Add(i, aBox1);
336 MapBRepShapes(myShapeWhere, aMS2);
338 for (j=1; j<=aNbS2; ++j) {
341 const TopoDS_Shape& aS2=aMS2(j);
342 BRepBndLib::Add(aS2, aBox2);
343 //modified by NIZNHY-PKV Fri Jun 10 08:20:23 2011f
344 //aBox2.SetGap(myTolerance);
345 aBox2.Enlarge(myTolerance);
346 //modified by NIZNHY-PKV Fri Jun 10 08:20:25 2011t
349 aSelector.SetBox(aBox2);
350 aNbSD=aBBTree.Select(aSelector);
352 continue; // it should not be
355 const TColStd_ListOfInteger& aLI=aSelector.Indices();
356 aItLI.Initialize(aLI);
357 for (; aItLI.More(); aItLI.Next()) {
359 const TopoDS_Shape& aS1=aMS1(i);
361 if (aDMSLS.IsBound(aS1)) {
362 TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aS1);
366 TopTools_ListOfShape aLS;
369 aDMSLS.Bind(aS1, aLS);
372 }// for (j=1; j<=aNbS2; ++j) {
374 aItDMSLS.Initialize(aDMSLS);
375 for (; aItDMSLS.More(); aItDMSLS.Next()) {
376 const TopoDS_Shape& aS1=aItDMSLS.Key();
377 const TopTools_ListOfShape& aLS2=aItDMSLS.Value();
379 aItLS.Initialize(aLS2);
380 for (; aItLS.More(); aItLS.Next()) {
381 const TopoDS_Shape& aS2=aItLS.Value();
383 myIterator.AppendPair(aCS);
387 //=======================================================================
388 //function : PerformVV
390 //=======================================================================
391 void GEOMAlgo_GetInPlace::PerformVV()
396 myIterator.Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
397 for (; myIterator.More(); myIterator.Next()) {
398 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
399 const TopoDS_Shape& aV1=aCS.Shape1();
400 const TopoDS_Shape& aV2=aCS.Shape2();
402 FillShapesOn(aV1, aV2);
405 //=======================================================================
406 //function : FillEdgesOn
408 //=======================================================================
409 void GEOMAlgo_GetInPlace::FillEdgesOn()
411 Standard_Integer i, aNbE;
413 TopTools_IndexedMapOfShape aME;
414 TopTools_MapIteratorOfMapOfShape aItMS;
416 TopExp::MapShapes(myArgument, TopAbs_EDGE, aME);
418 for (i=1; i<=aNbE; ++i) {
419 const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(i));
420 if (BRep_Tool::Degenerated(aE1)) {
425 for (; aIt.More(); aIt.Next()) {
426 const TopoDS_Shape& aV1=aIt.Value();
427 if (myShapesOn.IsBound(aV1)) {
428 const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aV1);
429 //aNbSOn=aMSOn.Extent();
430 aItMS.Initialize(aMSOn);
431 for (; aItMS.More(); aItMS.Next()) {
432 const TopoDS_Shape& aV2=aItMS.Key();
433 FillShapesOn(aE1, aV2);
439 //=======================================================================
440 //function : PerformVE
442 //=======================================================================
443 void GEOMAlgo_GetInPlace::PerformVE()
445 Standard_Boolean bFound;
451 myIterator.Initialize(TopAbs_EDGE, TopAbs_VERTEX);
452 for (; myIterator.More(); myIterator.Next()) {
453 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
454 const TopoDS_Shape& aE1=aCS.Shape1();
455 const TopoDS_Shape& aV2=aCS.Shape2();
457 if (myShapesOn.IsBound(aE1)) {
458 const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1);
459 if (aMSOn.Contains(aV2)) {
464 bFound=CheckCoincidence(aE1, aV2);
469 FillShapesIn(aE1, aV2);
473 //=======================================================================
474 //function : PerformEE
476 //=======================================================================
477 void GEOMAlgo_GetInPlace::PerformEE()
479 Standard_Boolean bHasOn, bHasIn, bFound;
481 TopTools_MapOfShape aMSX;
486 myIterator.Initialize(TopAbs_EDGE, TopAbs_EDGE);
487 for (; myIterator.More(); myIterator.Next()) {
488 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
489 const TopoDS_Shape& aE1=aCS.Shape1();
490 const TopoDS_Shape& aE2=aCS.Shape2();
492 bHasOn=myShapesOn.IsBound(aE1);
493 bHasIn=myShapesIn.IsBound(aE1);
494 const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aE1) : aMSX;
495 const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aE1) : aMSX;
497 bFound=Standard_True;
499 for (; aIt.More(); aIt.Next()) {
500 const TopoDS_Shape& aV2=aIt.Value();
501 if (!(aMSOn.Contains(aV2) || aMSIn.Contains(aV2))) {
510 bFound=CheckCoincidence(aE1, aE2);
515 FillShapesIn(aE1, aE2);
519 //=======================================================================
520 //function : PerformVF
522 //=======================================================================
523 void GEOMAlgo_GetInPlace::PerformVF()
525 Standard_Boolean bHasOn, bHasIn, bFound;
526 Standard_Integer i, aNbE;
527 TopTools_MapOfShape aMSX;
528 TopTools_IndexedMapOfShape aME;
533 myIterator.Initialize(TopAbs_FACE, TopAbs_VERTEX);
534 for (; myIterator.More(); myIterator.Next()) {
535 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
536 const TopoDS_Shape& aF1=aCS.Shape1();
537 const TopoDS_Shape& aV2=aCS.Shape2();
540 TopExp::MapShapes(aF1, TopAbs_EDGE, aME);
542 bFound=Standard_False;
544 for (i=1; i<=aNbE; ++i) {
545 const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(i));
546 if (BRep_Tool::Degenerated(aE1)) {
550 bHasOn=myShapesOn.IsBound(aE1);
551 bHasIn=myShapesIn.IsBound(aE1);
552 const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aE1) : aMSX;
553 const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aE1) : aMSX;
554 bFound= (aMSOn.Contains(aV2) || aMSIn.Contains(aV2));
564 bFound=CheckCoincidence(aF1, aV2);
569 FillShapesIn(aF1, aV2);
573 //=======================================================================
574 //function : FillFacesOn
576 //=======================================================================
577 void GEOMAlgo_GetInPlace::FillFacesOn()
579 Standard_Integer i, j, aNbF, aNbE;
581 TopTools_IndexedMapOfShape aMF, aME;
582 TopTools_MapIteratorOfMapOfShape aItMS;
584 TopExp::MapShapes(myArgument, TopAbs_FACE, aMF);
586 for (i=1; i<=aNbF; ++i) {
587 const TopoDS_Face& aF1=*((TopoDS_Face*)&aMF(i));
590 TopExp::MapShapes(aF1, TopAbs_EDGE, aME);
592 for (j=1; j<=aNbE; ++j) {
593 const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aME(j));
594 if (BRep_Tool::Degenerated(aE1)) {
598 if (myShapesOn.IsBound(aE1)) {
599 const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aE1);
600 aItMS.Initialize(aMSOn);
601 for (; aItMS.More(); aItMS.Next()) {
602 const TopoDS_Shape& aS2=aItMS.Key();
603 FillShapesOn(aF1, aS2);
607 if (myShapesIn.IsBound(aE1)) {
608 const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aE1);
609 aItMS.Initialize(aMSIn);
610 for (; aItMS.More(); aItMS.Next()) {
611 const TopoDS_Shape& aS2=aItMS.Key();
612 FillShapesOn(aF1, aS2);
615 }//for (j=1; j<=aNbE; ++j) {
616 }//for (i=1; i<=aNbF; ++i) {
618 //=======================================================================
619 //function : PerformEF
621 //=======================================================================
622 void GEOMAlgo_GetInPlace::PerformEF()
624 Standard_Boolean bFound, bHasOnF, bHasInF;
626 TopTools_MapOfShape aMSX;
631 myIterator.Initialize(TopAbs_FACE, TopAbs_EDGE);
632 for (; myIterator.More(); myIterator.Next()) {
633 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
634 const TopoDS_Shape& aF1=aCS.Shape1();
635 const TopoDS_Shape& aE2=aCS.Shape2();
638 bHasOnF=myShapesOn.IsBound(aF1);
639 const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aF1) : aMSX;
640 bFound=aMSOnF.Contains(aE2);
646 bHasInF=myShapesIn.IsBound(aF1);
647 const TopTools_MapOfShape& aMSInF=(bHasInF) ? myShapesIn.Find(aF1) : aMSX;
650 for (; aIt.More(); aIt.Next()) {
651 const TopoDS_Shape& aV2=aIt.Value();
652 bFound=(aMSOnF.Contains(aV2) || aMSInF.Contains(aV2));
660 //------------------------------
661 bFound=CheckCoincidence(aF1, aE2);
666 FillShapesIn(aF1, aE2);
670 //=======================================================================
671 //function : PerformFF
673 //=======================================================================
674 void GEOMAlgo_GetInPlace::PerformFF()
676 Standard_Boolean bFound, bHasOnF, bHasInF;
677 Standard_Integer i, aNbS2;
678 TopTools_MapOfShape aMSX;
679 TopTools_IndexedMapOfShape aMS2;
684 myIterator.Initialize(TopAbs_FACE, TopAbs_FACE);
685 for (; myIterator.More(); myIterator.Next()) {
686 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
687 const TopoDS_Shape& aF1=aCS.Shape1();
688 const TopoDS_Shape& aF2=aCS.Shape2();
690 bHasOnF=myShapesOn.IsBound(aF1);
691 const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aF1) : aMSX;
693 bHasInF=myShapesIn.IsBound(aF1);
694 const TopTools_MapOfShape& aMSInF=(bHasInF) ? myShapesIn.Find(aF1) : aMSX;
697 MapBRepShapes(aF2, aMS2);
699 bFound=Standard_False;
701 for (i=1; i<=aNbS2; ++i) {
702 const TopoDS_Shape& aS2=aMS2(i);
703 if (aS2.IsSame(aF2)) {
706 bFound=(aMSOnF.Contains(aS2) || aMSInF.Contains(aS2));
715 bFound=CheckCoincidence(aF1, aF2);
720 FillShapesIn(aF1, aF2);
724 //=======================================================================
725 //function : FillSolidsOn
727 //=======================================================================
728 void GEOMAlgo_GetInPlace::FillSolidsOn()
730 Standard_Integer i, j, aNbS, aNbF;
731 TopTools_IndexedMapOfShape aMS, aMF;
732 TopTools_MapIteratorOfMapOfShape aItMS;
734 TopExp::MapShapes(myArgument, TopAbs_SOLID, aMS);
737 for (i=1; i<=aNbS; ++i) {
738 const TopoDS_Shape& aSD1=aMS(i);
741 TopExp::MapShapes(aSD1, TopAbs_FACE, aMF);
743 for (j=1; j<=aNbF; ++j) {
744 const TopoDS_Shape& aF1=aMF(j);
746 if (myShapesOn.IsBound(aF1)) {
747 const TopTools_MapOfShape& aMSOn=myShapesOn.Find(aF1);
748 aItMS.Initialize(aMSOn);
749 for (; aItMS.More(); aItMS.Next()) {
750 const TopoDS_Shape& aS2=aItMS.Key();
751 FillShapesOn(aSD1, aS2);
755 if (myShapesIn.IsBound(aF1)) {
756 const TopTools_MapOfShape& aMSIn=myShapesIn.Find(aF1);
757 aItMS.Initialize(aMSIn);
758 for (; aItMS.More(); aItMS.Next()) {
759 const TopoDS_Shape& aS2=aItMS.Key();
760 FillShapesOn(aSD1, aS2);
763 }//for (j=1; j<=aNbF; ++j) {
764 }//for (i=1; i<=aNbS; ++i) {
766 //=======================================================================
767 //function : PerformZF
769 //=======================================================================
770 void GEOMAlgo_GetInPlace::PerformZF()
772 Standard_Boolean bFound, bHasOnF;
773 TopTools_MapOfShape aMSX;
778 myIterator.Initialize(TopAbs_SOLID, TopAbs_FACE);
779 for (; myIterator.More(); myIterator.Next()) {
780 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
781 const TopoDS_Shape& aSo1=aCS.Shape1();
782 const TopoDS_Shape& aF2=aCS.Shape2();
784 bHasOnF=myShapesOn.IsBound(aSo1);
785 const TopTools_MapOfShape& aMSOnF=(bHasOnF) ? myShapesOn.Find(aSo1) : aMSX;
786 bFound=aMSOnF.Contains(aF2);
790 //------------------------------
791 bFound=CheckCoincidence(aSo1, aF2);
796 FillShapesIn(aSo1, aF2);
800 //=======================================================================
801 //function : PerformZZ
803 //=======================================================================
804 void GEOMAlgo_GetInPlace::PerformZZ()
806 Standard_Boolean bFound, bHasOn, bHasIn;
807 Standard_Integer i, aNbS2, iCntOn, iCntIn, iCntOut;
808 TopTools_MapOfShape aMSX;
809 TopTools_IndexedMapOfShape aMS2;
814 myIterator.Initialize(TopAbs_SOLID, TopAbs_SOLID);
815 for (; myIterator.More(); myIterator.Next()) {
816 const NMTTools_CoupleOfShape& aCS=myIterator.Value();
817 const TopoDS_Shape& aSo1=aCS.Shape1();
818 const TopoDS_Shape& aSo2=aCS.Shape2();
820 bHasOn=myShapesOn.IsBound(aSo1);
821 const TopTools_MapOfShape& aMSOn=(bHasOn) ? myShapesOn.Find(aSo1) : aMSX;
823 bHasIn=myShapesIn.IsBound(aSo1);
824 const TopTools_MapOfShape& aMSIn=(bHasIn) ? myShapesIn.Find(aSo1) : aMSX;
827 TopExp::MapShapes(aSo2, TopAbs_FACE, aMS2);
832 bFound=Standard_False;
834 for (i=1; i<=aNbS2; ++i) {
835 const TopoDS_Shape& aF2=aMS2(i);
837 if (aMSIn.Contains(aF2)) {
839 bFound=Standard_True;
842 else if (!aMSOn.Contains(aF2)) {
844 bFound=Standard_False;// out
852 if (!bFound && iCntOut) {
857 bFound=CheckCoincidence(aSo1, aSo2);
863 FillShapesIn(aSo1, aSo2);
865 }// for (; myIterator.More(); myIterator.Next()) {
867 //=======================================================================
868 //function : FillImages
870 //=======================================================================
871 void GEOMAlgo_GetInPlace::FillImages()
873 Standard_Integer i, aNbS, aNbSx, aNbSi;
874 TopAbs_ShapeEnum aType;
876 TopTools_ListOfShape aLSx;
877 TopTools_ListIteratorOfListOfShape aItLS;
878 TopTools_IndexedMapOfShape aMS;
879 TopTools_MapIteratorOfMapOfShape aItMS;
888 TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMS);
890 for (i=1; i<=aNbS; ++i) {
891 const TopoDS_Shape& aV=aMS(i);
892 if (myShapesOn.IsBound(aV)) {
893 const TopTools_MapOfShape& aMSx=myShapesOn.Find(aV);
897 aItMS.Initialize(aMSx);
898 for (; aItMS.More(); aItMS.Next()) {
899 const TopoDS_Shape& aVx=aItMS.Key();
903 myImages.Bind(aV, aLSx);
909 TopExp::MapShapes(myArgument, TopAbs_EDGE, aMS);
911 for (i=1; i<=aNbS; ++i) {
912 const TopoDS_Shape& aE=aMS(i);
913 if (myShapesIn.IsBound(aE)) {
914 const TopTools_MapOfShape& aMSx=myShapesIn.Find(aE);
918 aItMS.Initialize(aMSx);
919 for (; aItMS.More(); aItMS.Next()) {
920 const TopoDS_Shape& aEx=aItMS.Key();
921 aType=aEx.ShapeType();
922 if (aType==TopAbs_EDGE){
927 myImages.Bind(aE, aLSx);
933 TopExp::MapShapes(myArgument, TopAbs_WIRE, aMS);
935 for (i=1; i<=aNbS; ++i) {
936 const TopoDS_Shape& aW=aMS(i);
939 for(; aIt.More(); aIt.Next()) {
940 const TopoDS_Shape& aE=aIt.Value();
941 if (myImages.IsBound(aE)) {
942 const TopTools_ListOfShape& aLSi=myImages.Find(aE);
945 aItLS.Initialize(aLSi);
946 for (; aItLS.More(); aItLS.Next()) {
947 const TopoDS_Shape& aEi=aItLS.Value();
952 myImages.Bind(aW, aLSx);
957 TopExp::MapShapes(myArgument, TopAbs_FACE, aMS);
959 for (i=1; i<=aNbS; ++i) {
960 const TopoDS_Shape& aF=aMS(i);
961 if (myShapesIn.IsBound(aF)) {
962 const TopTools_MapOfShape& aMSx=myShapesIn.Find(aF);
966 aItMS.Initialize(aMSx);
967 for (; aItMS.More(); aItMS.Next()) {
968 const TopoDS_Shape& aFx=aItMS.Key();
969 aType=aFx.ShapeType();
970 if (aType==TopAbs_FACE){
975 myImages.Bind(aF, aLSx);
981 TopExp::MapShapes(myArgument, TopAbs_SHELL, aMS);
983 for (i=1; i<=aNbS; ++i) {
984 const TopoDS_Shape& aSh=aMS(i);
987 for(; aIt.More(); aIt.Next()) {
988 const TopoDS_Shape& aF=aIt.Value();
989 if (myImages.IsBound(aF)) {
990 const TopTools_ListOfShape& aLSi=myImages.Find(aF);
993 aItLS.Initialize(aLSi);
994 for (; aItLS.More(); aItLS.Next()) {
995 const TopoDS_Shape& aFi=aItLS.Value();
1000 myImages.Bind(aSh, aLSx);
1005 TopExp::MapShapes(myArgument, TopAbs_SOLID, aMS);
1007 for (i=1; i<=aNbS; ++i) {
1008 const TopoDS_Shape& aZ=aMS(i);
1009 if (myShapesIn.IsBound(aZ)) {
1010 const TopTools_MapOfShape& aMSx=myShapesIn.Find(aZ);
1011 aNbSx=aMSx.Extent();
1014 aItMS.Initialize(aMSx);
1015 for (; aItMS.More(); aItMS.Next()) {
1016 const TopoDS_Shape& aZx=aItMS.Key();
1017 aType=aZx.ShapeType();
1018 if (aType==TopAbs_SOLID){
1023 myImages.Bind(aZ, aLSx);
1029 TopExp::MapShapes(myArgument, TopAbs_COMPSOLID, aMS);
1031 for (i=1; i<=aNbS; ++i) {
1032 const TopoDS_Shape& aCs=aMS(i);
1034 aIt.Initialize(aCs);
1035 for(; aIt.More(); aIt.Next()) {
1036 const TopoDS_Shape& aZ=aIt.Value();
1037 if (myImages.IsBound(aZ)) {
1038 const TopTools_ListOfShape& aLSi=myImages.Find(aZ);
1039 aNbSi=aLSi.Extent();
1041 aItLS.Initialize(aLSi);
1042 for (; aItLS.More(); aItLS.Next()) {
1043 const TopoDS_Shape& aZi=aItLS.Value();
1048 myImages.Bind(aCs, aLSx);
1052 aType=myArgument.ShapeType();
1053 if (aType==TopAbs_COMPOUND) {
1054 FillImagesCompound(myArgument);
1057 //=======================================================================
1058 //function : FillImagesCompound
1060 //=======================================================================
1061 void GEOMAlgo_GetInPlace::FillImagesCompound(const TopoDS_Shape& aS)
1063 TopAbs_ShapeEnum aType;
1064 TopoDS_Iterator aIt;
1065 TopTools_ListOfShape aLSx;
1066 TopTools_ListIteratorOfListOfShape aItLS;
1069 for(; aIt.More(); aIt.Next()) {
1070 const TopoDS_Shape& aSx=aIt.Value();
1071 aType=aSx.ShapeType();
1073 if (aType==TopAbs_COMPOUND) {
1074 FillImagesCompound(aSx);
1077 if (myImages.IsBound(aSx)) {
1078 const TopTools_ListOfShape& aLSi=myImages.Find(aSx);
1079 aItLS.Initialize(aLSi);
1080 for (; aItLS.More(); aItLS.Next()) {
1081 const TopoDS_Shape& aSi=aItLS.Value();
1086 myImages.Bind(aS, aLSx);
1089 //=======================================================================
1090 //function : FillShapesIn
1092 //=======================================================================
1093 void GEOMAlgo_GetInPlace::FillShapesIn(const TopoDS_Shape& aS1,
1094 const TopoDS_Shape& aS2)
1096 if (myShapesIn.IsBound(aS1)) {
1097 TopTools_MapOfShape& aMS=myShapesIn.ChangeFind(aS1);
1101 TopTools_MapOfShape aMS;
1104 myShapesIn.Bind(aS1, aMS);
1107 //=======================================================================
1108 //function : FillShapesOn
1110 //=======================================================================
1111 void GEOMAlgo_GetInPlace::FillShapesOn(const TopoDS_Shape& aS1,
1112 const TopoDS_Shape& aS2)
1114 if (myShapesOn.IsBound(aS1)) {
1115 TopTools_MapOfShape& aMS=myShapesOn.ChangeFind(aS1);
1119 TopTools_MapOfShape aMS;
1122 myShapesOn.Bind(aS1, aMS);
1125 //=======================================================================
1126 //function : MapBRepShapes
1128 //=======================================================================
1129 void MapBRepShapes(const TopoDS_Shape& aS,
1130 TopTools_IndexedMapOfShape& aM)
1132 Standard_Boolean bDegenerated;
1133 TopAbs_ShapeEnum aType;
1134 TopoDS_Iterator aIt;
1136 aType=aS.ShapeType();
1137 if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
1138 aType==TopAbs_FACE || aType==TopAbs_SOLID) {
1139 bDegenerated=Standard_False;
1140 if (aType==TopAbs_EDGE) {
1141 TopoDS_Edge *pE=(TopoDS_Edge*)&aS;
1142 bDegenerated=BRep_Tool::Degenerated(*pE);
1144 if (!bDegenerated) {
1150 for(; aIt.More(); aIt.Next()) {
1151 const TopoDS_Shape& aSx=aIt.Value();
1152 aType=aSx.ShapeType();
1153 MapBRepShapes(aSx, aM);