Salome HOME
Fix for the bug IPAL22851: Sub-shapes spelling
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_BuilderSolid.cxx
index 07be8c7fbe22aa6a068c3a5a58276ca07d0ac694..848ee7a4d4301646f1ebd2d5ad2cf25b4ad9661a 100755 (executable)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 // File:        GEOMAlgo_BuilderSolid.cxx
@@ -159,9 +159,11 @@ static
   if (myErrorStatus) {
     return;
   }
-  PerformInternalShapes();
-  if (myErrorStatus) {
-    return;
+  if (myComputeInternalShapes) {
+    PerformInternalShapes();
+    if (myErrorStatus) {
+      return;
+    }
   }
 }
 //=======================================================================
@@ -445,42 +447,44 @@ static
   aEFMap.Clear();
   AddedFacesMap.Clear();
   //
-  aItM.Initialize(myShapesToAvoid);
-  for (; aItM.More(); aItM.Next()) {
-    const TopoDS_Shape& aFF=aItM.Key();
-    TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
-  }
-  //
-  aItM.Initialize(myShapesToAvoid);
-  for (; aItM.More(); aItM.Next()) {
-    const TopoDS_Shape& aFF=aItM.Key();
-    if (!AddedFacesMap.Add(aFF)) {
-      continue;
+  if (myComputeInternalShapes) {
+    aItM.Initialize(myShapesToAvoid);
+    for (; aItM.More(); aItM.Next()) {
+      const TopoDS_Shape& aFF=aItM.Key();
+      TopExp::MapShapesAndAncestors(aFF, TopAbs_EDGE, TopAbs_FACE, aEFMap);
     }
     //
-    // make a new shell
-    TopoDS_Shell aShell;
-    aBB.MakeShell(aShell);
-    aBB.Add(aShell, aFF);
-    //
-    TopoDS_Iterator aItAddedF (aShell);
-    for (; aItAddedF.More(); aItAddedF.Next()) {
-      const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
+    aItM.Initialize(myShapesToAvoid);
+    for (; aItM.More(); aItM.Next()) {
+      const TopoDS_Shape& aFF=aItM.Key();
+      if (!AddedFacesMap.Add(aFF)) {
+        continue;
+      }
       //
-      TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
-      for (; aEdgeExp.More(); aEdgeExp.Next()) {
-        const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
-        const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
-        aItF.Initialize(aLF);
-        for (; aItF.More(); aItF.Next()) { 
-          const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
-          if (AddedFacesMap.Add(aFL)){
-            aBB.Add(aShell, aFL);
+      // make a new shell
+      TopoDS_Shell aShell;
+      aBB.MakeShell(aShell);
+      aBB.Add(aShell, aFF);
+      //
+      TopoDS_Iterator aItAddedF (aShell);
+      for (; aItAddedF.More(); aItAddedF.Next()) {
+        const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value()));
+        //
+        TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE);
+        for (; aEdgeExp.More(); aEdgeExp.Next()) {
+          const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current()));
+          const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE);
+          aItF.Initialize(aLF);
+          for (; aItF.More(); aItF.Next()) { 
+            const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value()));
+            if (AddedFacesMap.Add(aFL)){
+              aBB.Add(aShell, aFL);
+            }
           }
         }
       }
+      myLoopsInternal.Append(aShell);
     }
-    myLoopsInternal.Append(aShell);
   }
 }
 //=======================================================================