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
23 // File: GEOMAlgo_BuilderSolid.cxx
25 // Author: Peter KURNEV
27 #include <GEOMAlgo_BuilderSolid.hxx>
29 #include <gp_Pnt2d.hxx>
35 #include <Geom_Curve.hxx>
36 #include <Geom_Surface.hxx>
37 #include <Geom2d_Curve.hxx>
41 #include <TopoDS_Iterator.hxx>
42 #include <TopoDS_Face.hxx>
44 #include <TopoDS_Shape.hxx>
45 #include <TopoDS_Shell.hxx>
46 #include <TopoDS_Edge.hxx>
47 #include <TopoDS_Solid.hxx>
48 #include <TopoDS_Vertex.hxx>
49 #include <TopoDS_Compound.hxx>
51 #include <BRep_Builder.hxx>
52 #include <BRep_Tool.hxx>
53 #include <BRepTools.hxx>
54 #include <BRepClass3d_SolidClassifier.hxx>
57 #include <TopExp_Explorer.hxx>
59 #include <TopTools_MapOfShape.hxx>
60 #include <TopTools_MapIteratorOfMapOfShape.hxx>
61 #include <TopTools_MapOfOrientedShape.hxx>
62 #include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
63 #include <TopTools_ListOfShape.hxx>
64 #include <TopTools_ListIteratorOfListOfShape.hxx>
65 #include <TopTools_DataMapOfShapeShape.hxx>
66 #include <TopTools_IndexedMapOfShape.hxx>
67 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
68 #include <TopTools_DataMapOfShapeListOfShape.hxx>
69 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
71 #include <IntTools_Context.hxx>
73 #include <BOPTools_Tools2D.hxx>
74 #include <BOPTools_Tools3D.hxx>
76 #include <NMTTools_ListOfCoupleOfShape.hxx>
77 #include <NMTTools_CoupleOfShape.hxx>
78 #include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
80 #include <GEOMAlgo_Tools3D.hxx>
81 #include <GEOMAlgo_BuilderTools.hxx>
85 Standard_Boolean IsGrowthShell(const TopoDS_Shape& ,
86 const TopTools_IndexedMapOfShape& );
88 Standard_Boolean IsHole(const TopoDS_Shape& ,
89 const Handle(IntTools_Context)& );
91 Standard_Boolean IsInside(const TopoDS_Shape& ,
93 const Handle(IntTools_Context)& );
95 void MakeInternalShells(const TopTools_MapOfShape& ,
96 TopTools_ListOfShape& );
99 Standard_Boolean IsClosedShell(const TopoDS_Shell& );
102 Standard_Boolean RefineShell(const TopoDS_Shell& ,
105 //=======================================================================
108 //=======================================================================
109 GEOMAlgo_BuilderSolid::GEOMAlgo_BuilderSolid()
111 GEOMAlgo_BuilderArea()
114 //=======================================================================
117 //=======================================================================
118 GEOMAlgo_BuilderSolid::~GEOMAlgo_BuilderSolid()
121 //=======================================================================
124 //=======================================================================
125 void GEOMAlgo_BuilderSolid::Perform()
129 // Initialize the context
130 GEOMAlgo_BuilderArea::Perform();
134 TopTools_ListIteratorOfListOfShape aIt;
136 aBB.MakeCompound(aC);
137 aIt.Initialize(myShapes);
138 for(; aIt.More(); aIt.Next()) {
139 const TopoDS_Shape& aF=aIt.Value();
143 PerformShapesToAvoid();
156 if (myComputeInternalShapes) {
157 PerformInternalShapes();
163 //=======================================================================
164 //function :PerformShapesToAvoid
166 //=======================================================================
167 void GEOMAlgo_BuilderSolid::PerformShapesToAvoid()
169 Standard_Boolean bFound;
170 Standard_Integer i, iCnt, aNbE, aNbF;
171 TopAbs_Orientation aOrE;
172 TopTools_IndexedDataMapOfShapeListOfShape aMEF;
173 TopTools_ListIteratorOfListOfShape aIt;
175 myShapesToAvoid.Clear();
180 bFound=Standard_False;
184 aIt.Initialize (myShapes);
185 for (; aIt.More(); aIt.Next()) {
186 const TopoDS_Shape& aF=aIt.Value();
187 if (!myShapesToAvoid.Contains(aF)) {
188 TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
199 for (i=1; i<=aNbE; ++i) {
200 const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
201 if (BRep_Tool::Degenerated(aE)) {
205 TopTools_ListOfShape& aLF=aMEF.ChangeFromKey(aE);
212 aOrE=aE.Orientation();
214 const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
216 if (aOrE==TopAbs_INTERNAL) {
219 bFound=Standard_True;
220 myShapesToAvoid.Add(aF1);
223 const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
224 if (aF2.IsSame(aF1)) {
225 if (BRep_Tool::IsClosed(aE, aF1)) {
229 if (aOrE==TopAbs_INTERNAL) {
233 bFound=Standard_True;
234 myShapesToAvoid.Add(aF1);
235 myShapesToAvoid.Add(aF2);
240 TopTools_ListIteratorOfListOfShape aItLF;
242 aItLF.Initialize (aLF);
243 for (; aItLF.More(); aItLF.Next()) {
244 const TopoDS_Shape& aFx=aItLF.Value();
249 }// for (i=1; i<=aNbE; ++i) {
257 //=======================================================================
258 //function : PerformLoops
260 //=======================================================================
261 void GEOMAlgo_BuilderSolid::PerformLoops()
267 Standard_Integer aNbLF, aNbOff, aNbFP;
268 TopAbs_Orientation anOr;
271 NMTTools_CoupleOfShape aCSOff;
272 TopTools_MapOfOrientedShape AddedFacesMap;
273 TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP;
274 TopTools_ListIteratorOfListOfShape aItF, aIt;
275 TopTools_MapIteratorOfMapOfOrientedShape aItM;
276 TopoDS_Iterator aItS;
278 //=================================================
282 aItF.Initialize (myShapes);
283 for (; aItF.More(); aItF.Next()) {
284 const TopoDS_Shape& aFF = aItF.Value();
285 TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
288 aItF.Initialize (myShapes);
289 for (; aItF.More(); aItF.Next()) {
290 const TopoDS_Shape& aFF = aItF.Value();
291 if (myShapesToAvoid.Contains(aFF)) {
294 if (!AddedFacesMap.Add(aFF)) {
300 aBB.MakeShell(aShell);
301 aBB.Add(aShell, aFF);
304 TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
306 // loop on faces added to Shell; add their neighbor faces to Shell and so on
307 TopoDS_Iterator aItAddedF (aShell);
308 for (; aItAddedF.More(); aItAddedF.Next()) {
309 const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
311 // loop on edges of aF; find a good neighbor face of aF by aE
312 TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
313 for (; aEdgeExp.More(); aEdgeExp.Next()) {
314 const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current()));
317 if (aMEFP.Contains(aE)) {
318 const TopTools_ListOfShape& aLFP=aMEFP.FindFromKey(aE);
325 anOr=aE.Orientation();
326 if (anOr==TopAbs_INTERNAL) {
330 if (BRep_Tool::Degenerated(aE)) {
334 // candidate faces list
335 const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
341 // try to select one of neighbors
342 // check if a face already added to Shell shares E
343 Standard_Boolean bFound;
344 TopTools_ListIteratorOfListOfShape aItLF;
345 NMTTools_ListOfCoupleOfShape aLCSOff;
347 aItLF.Initialize(aLF);
348 for (; aItLF.More(); aItLF.Next()) {
349 const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value()));
350 if (myShapesToAvoid.Contains(aFL)) {
353 if (aF.IsSame(aFL)) {
356 if (AddedFacesMap.Contains(aFL)){
360 bFound=GEOMAlgo_Tools3D::GetEdgeOff(aE, aFL, aEL);
365 aCSOff.SetShape1(aEL);
366 aCSOff.SetShape2(aFL);
367 aLCSOff.Append(aCSOff);
368 }//for (; aItLF.More(); aItLF.Next()) {
370 aNbOff=aLCSOff.Extent();
377 aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2()));
380 GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF);
383 if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
384 aBB.Add(aShell, aSelF);
385 TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
387 } // for (; aEdgeExp.More(); aEdgeExp.Next()) {
388 } //for (; aItAddedF.More(); aItAddedF.Next()) {
390 if (IsClosedShell(aShell)) {
391 myLoops.Append(aShell);
393 //modified by NIZNHY-PKV Wed Oct 27 07:10:41 2010f
395 Standard_Boolean bRefine;
398 bRefine=RefineShell(aShell, aShx);
400 myLoops.Append(aShx);
403 //modified by NIZNHY-PKV Wed Oct 27 07:10:44 2010t
404 } // for (; aItF.More(); aItF.Next()) {
407 TopTools_MapOfOrientedShape aMP;
409 // a. collect all edges that are in loops
410 aIt.Initialize (myLoops);
411 for (; aIt.More(); aIt.Next()) {
412 const TopoDS_Shape& aS=aIt.Value();
414 for (; aItS.More(); aItS.Next()) {
415 const TopoDS_Shape& aF=aItS.Value();
420 // b. collect all faces that are to avoid
421 aItM.Initialize(myShapesToAvoid);
422 for (; aItM.More(); aItM.Next()) {
423 const TopoDS_Shape& aF=aItM.Key();
427 // c. add all faces that are not processed to myShapesToAvoid
428 aIt.Initialize (myShapes);
429 for (; aIt.More(); aIt.Next()) {
430 const TopoDS_Shape& aF=aIt.Value();
431 if (!aMP.Contains(aF)) {
432 myShapesToAvoid.Add(aF);
435 //=================================================
439 myLoopsInternal.Clear();
442 AddedFacesMap.Clear();
444 if (myComputeInternalShapes) {
445 aItM.Initialize(myShapesToAvoid);
446 for (; aItM.More(); aItM.Next()) {
447 const TopoDS_Shape& aFF=aItM.Key();
448 TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
451 aItM.Initialize(myShapesToAvoid);
452 for (; aItM.More(); aItM.Next()) {
453 const TopoDS_Shape& aFF=aItM.Key();
454 if (!AddedFacesMap.Add(aFF)) {
460 aBB.MakeShell(aShell);
461 aBB.Add(aShell, aFF);
463 TopoDS_Iterator aItAddedF (aShell);
464 for (; aItAddedF.More(); aItAddedF.Next()) {
465 const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
467 TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
468 for (; aEdgeExp.More(); aEdgeExp.Next()) {
469 const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
470 const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
471 aItF.Initialize(aLF);
472 for (; aItF.More(); aItF.Next()) {
473 const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
474 if (AddedFacesMap.Add(aFL)){
475 aBB.Add(aShell, aFL);
480 myLoopsInternal.Append(aShell);
484 //=======================================================================
485 //function : PerformAreas
487 //=======================================================================
488 void GEOMAlgo_BuilderSolid::PerformAreas()
492 Standard_Boolean bIsGrowthShell, bIsHole;
493 TopTools_ListOfShape aNewSolids, aHoleShells;
494 TopoDS_Shape anInfinitePointShape;
495 TopTools_DataMapOfShapeShape aInOutMap;
496 TopTools_DataMapOfShapeListOfShape aMSH;
497 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH;
498 TopTools_ListIteratorOfListOfShape aShellIt, aSolidIt;
499 TopTools_IndexedMapOfShape aMHF;
504 // Draft solids [aNewSolids]
505 aShellIt.Initialize(myLoops);
506 for ( ; aShellIt.More(); aShellIt.Next()) {
507 const TopoDS_Shape& aShell = aShellIt.Value();
509 bIsGrowthShell=IsGrowthShell(aShell, aMHF);
510 if (bIsGrowthShell) {
511 // make a growth solid from a shell
513 aBB.MakeSolid(Solid);
514 aBB.Add (Solid, aShell);
516 aNewSolids.Append (Solid);
519 // check if a shell is a hole
520 bIsHole=IsHole(aShell, myContext);
523 aHoleShells.Append(aShell);
524 TopExp::MapShapes(aShell, TopAbs_FACE, aMHF);
527 // make a growth solid from a shell
529 aBB.MakeSolid(Solid);
530 aBB.Add (Solid, aShell);
532 aNewSolids.Append (Solid);
537 // 2. Find outer growth shell that is most close to each hole shell
538 aShellIt.Initialize(aHoleShells);
539 for (; aShellIt.More(); aShellIt.Next()) {
540 const TopoDS_Shape& aHole = aShellIt.Value();
542 aSolidIt.Initialize(aNewSolids);
543 for ( ; aSolidIt.More(); aSolidIt.Next()) {
544 const TopoDS_Shape& aSolid = aSolidIt.Value();
546 if (!IsInside(aHole, aSolid, myContext)){
550 if ( aInOutMap.IsBound (aHole)){
551 const TopoDS_Shape& aSolid2 = aInOutMap(aHole);
552 if (IsInside(aSolid, aSolid2, myContext)) {
553 aInOutMap.UnBind(aHole);
554 aInOutMap.Bind (aHole, aSolid);
558 aInOutMap.Bind (aHole, aSolid);
562 // Add aHole to a map Solid/ListOfHoles [aMSH]
563 if (aInOutMap.IsBound(aHole)){
564 const TopoDS_Shape& aSolid=aInOutMap(aHole);
565 if (aMSH.IsBound(aSolid)) {
566 TopTools_ListOfShape& aLH=aMSH.ChangeFind(aSolid);
570 TopTools_ListOfShape aLH;
572 aMSH.Bind(aSolid, aLH);
574 //aBB.Add (aSolid, aHole);
576 }// for (; aShellIt.More(); aShellIt.Next()) {
578 // 3. Add aHoles to Solids
579 aItMSH.Initialize(aMSH);
580 for (; aItMSH.More(); aItMSH.Next()) {
581 TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key()));
583 const TopTools_ListOfShape& aLH=aItMSH.Value();
584 aShellIt.Initialize(aLH);
585 for (; aShellIt.More(); aShellIt.Next()) {
586 const TopoDS_Shape& aHole = aShellIt.Value();
587 aBB.Add (aSolid, aHole);
591 BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(aSolid);
596 // These aNewSolids are draft solids that
597 // do not contain any internal shapes
599 myAreas.Append(aNewSolids);
601 //=======================================================================
602 //function : PerformInternalShapes
604 //=======================================================================
605 void GEOMAlgo_BuilderSolid::PerformInternalShapes()
609 Standard_Integer aNbFI=myLoopsInternal.Extent();
610 if (!aNbFI) {// nothing to do
615 TopTools_ListIteratorOfListOfShape aShellIt, aSolidIt;
617 TopTools_MapOfShape aMF, aMFP;
618 TopTools_MapIteratorOfMapOfShape aItMF;
619 TopTools_IndexedDataMapOfShapeListOfShape aMEF;
620 TopTools_ListOfShape aLSI;
622 // 1. All internal faces
623 aShellIt.Initialize(myLoopsInternal);
624 for (; aShellIt.More(); aShellIt.Next()) {
625 const TopoDS_Shape& aShell=aShellIt.Value();
626 aIt.Initialize(aShell);
627 for (; aIt.More(); aIt.Next()) {
628 const TopoDS_Shape& aF=aIt.Value();
635 aSolidIt.Initialize(myAreas);
636 for ( ; aSolidIt.More(); aSolidIt.Next()) {
637 TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value()));
640 TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF);
642 // 2.1 Separate faces to process aMFP
644 aItMF.Initialize(aMF);
645 for (; aItMF.More(); aItMF.Next()) {
646 const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key()));
647 if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, myContext)) {
652 // 2.2 Make Internal Shells
654 MakeInternalShells(aMFP, aLSI);
656 // 2.3 Add them to aSolid
657 aShellIt.Initialize(aLSI);
658 for (; aShellIt.More(); aShellIt.Next()) {
659 const TopoDS_Shape& aSI=aShellIt.Value();
660 aBB.Add (aSolid, aSI);
663 // 2.4 Remove faces aMFP from aMF
664 aItMF.Initialize(aMFP);
665 for (; aItMF.More(); aItMF.Next()) {
666 const TopoDS_Shape& aF=aItMF.Key();
674 } //for ( ; aSolidIt.More(); aSolidIt.Next()) {
677 //=======================================================================
678 //function : MakeInternalShells
680 //=======================================================================
681 void MakeInternalShells(const TopTools_MapOfShape& theMF,
682 TopTools_ListOfShape& theShells)
684 TopTools_MapIteratorOfMapOfShape aItM;
685 TopTools_MapOfShape aAddedFacesMap;
686 TopTools_ListIteratorOfListOfShape aItF;
687 TopTools_IndexedDataMapOfShapeListOfShape aMEF;
690 aItM.Initialize(theMF);
691 for (; aItM.More(); aItM.Next()) {
692 const TopoDS_Shape& aF=aItM.Key();
693 TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
696 aItM.Initialize(theMF);
697 for (; aItM.More(); aItM.Next()) {
698 TopoDS_Shape aFF=aItM.Key();
699 if (!aAddedFacesMap.Add(aFF)) {
705 aBB.MakeShell(aShell);
706 aFF.Orientation(TopAbs_INTERNAL);
707 aBB.Add(aShell, aFF);
709 TopoDS_Iterator aItAddedF (aShell);
710 for (; aItAddedF.More(); aItAddedF.Next()) {
711 const TopoDS_Shape& aF =aItAddedF.Value();
713 TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
714 for (; aEdgeExp.More(); aEdgeExp.Next()) {
715 const TopoDS_Shape& aE =aEdgeExp.Current();
716 const TopTools_ListOfShape& aLF=aMEF.FindFromKey(aE);
717 aItF.Initialize(aLF);
718 for (; aItF.More(); aItF.Next()) {
719 TopoDS_Shape aFL=aItF.Value();
720 if (aAddedFacesMap.Add(aFL)){
721 aFL.Orientation(TopAbs_INTERNAL);
722 aBB.Add(aShell, aFL);
727 theShells.Append(aShell);
730 //=======================================================================
733 //=======================================================================
734 Standard_Boolean IsHole(const TopoDS_Shape& theS2,
735 const Handle(IntTools_Context)& theContext)
737 TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2;
738 BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2);
740 aClsf.PerformInfinitePoint(::RealSmall());
742 return (aClsf.State()==TopAbs_IN);
744 //=======================================================================
745 //function : IsInside
747 //=======================================================================
748 Standard_Boolean IsInside(const TopoDS_Shape& theS1,
749 const TopoDS_Shape& theS2,
750 const Handle(IntTools_Context)& theContext)
752 TopExp_Explorer aExp;
755 TopoDS_Solid *pS2=(TopoDS_Solid *)&theS2;
757 aExp.Init(theS1, TopAbs_FACE);
759 BRepClass3d_SolidClassifier& aClsf=theContext->SolidClassifier(*pS2);
760 aClsf.PerformInfinitePoint(::RealSmall());
761 aState=aClsf.State();
764 TopTools_IndexedMapOfShape aBounds;
765 const TopoDS_Face& aF = TopoDS::Face(aExp.Current());
766 aState=GEOMAlgo_Tools3D::ComputeState(aF, *pS2, 1.e-14, aBounds, theContext);
768 return (aState==TopAbs_IN);
770 //=======================================================================
771 //function : IsGrowthShell
773 //=======================================================================
774 Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
775 const TopTools_IndexedMapOfShape& theMHF)
777 Standard_Boolean bRet;
781 if (theMHF.Extent()) {
782 aIt.Initialize(theShell);
783 for(; aIt.More(); aIt.Next()) {
784 const TopoDS_Shape& aF=aIt.Value();
785 if (theMHF.Contains(aF)) {
792 //=======================================================================
793 //function : IsClosedShell
795 //=======================================================================
796 Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell)
798 Standard_Integer aNbE;
799 Standard_Boolean bRet;
801 TopExp_Explorer aExp;
802 TopTools_MapOfShape aM;
805 aIt.Initialize(theShell);
806 for(; aIt.More(); aIt.Next()) {
807 const TopoDS_Face& aF=TopoDS::Face(aIt.Value());
808 aExp.Init(aF, TopAbs_EDGE);
809 for (; aExp.More(); aExp.Next()) {
810 const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current()));
811 if (BRep_Tool::Degenerated(aE)) {
815 if (aE.Orientation()==TopAbs_INTERNAL) {
831 //=======================================================================
832 //function : RefineShell
834 //=======================================================================
835 Standard_Boolean RefineShell(const TopoDS_Shell& aShell,
839 Standard_Boolean bRet;
840 Standard_Integer i, aNbE, aNbF;
841 TopAbs_Orientation aOrE;
842 TopTools_IndexedDataMapOfShapeListOfShape aMEF;
843 TopTools_MapOfOrientedShape aMFx;
847 TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF);
849 for (i=1; i<=aNbE; ++i) {
850 const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i)));
852 if (BRep_Tool::Degenerated(aE)) {
856 aOrE=aE.Orientation();
858 const TopTools_ListOfShape& aLF=aMEF(i);
864 const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First()));
866 if (aOrE==TopAbs_INTERNAL) {
873 const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last()));
874 if (aF2.IsSame(aF1)) {
875 if (BRep_Tool::IsClosed(aE, aF1)) {
878 if (aOrE==TopAbs_INTERNAL) {
897 aIt.Initialize(aShell);
898 for (; aIt.More(); aIt.Next()) {
899 const TopoDS_Shape& aF=aIt.Value();
900 if (!aMFx.Contains(aF)) {
907 bRet=IsClosedShell(aShx);