Salome HOME
Fix bug 0020138: EDF SMESH : Impossible to create (n)D mesh after creating (n+1)D...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshOp.cxx
index 1aeacf8048ff43c29ddfbf33b49d2aeb66c00963..d511701400528d9486e37e7ff56105ee65ba402e 100644 (file)
@@ -1,29 +1,29 @@
-// SMESH SMESHGUI : GUI for SMESH component
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// Copyright (C) 2003  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
 //
+// SMESH SMESHGUI : GUI for SMESH component
 // File   : SMESHGUI_MeshOp.cxx
 // Author : Sergey LITONIN, Open CASCADE S.A.S.
-//
-
 // SMESH includes
+//
 #include "SMESHGUI_MeshOp.h"
 
 #include "SMESHGUI.h"
@@ -65,6 +65,7 @@
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
 
 // IDL includes
 #include <SALOMEconfig.h>
@@ -509,7 +510,7 @@ void SMESHGUI_MeshOp::selectionDone()
               shapeDim = (shapeDim < 2) ? 2 : shapeDim;
               TopoDS_Shape aShape;
               if (GEOMBase::GetShape(aGeomVar, aShape)) {
-                if (aShape.Closed())
+                if (/*aShape.Closed()*/BRep_Tool::IsClosed(aShape))
                   shapeDim = 3;
               }
             }
@@ -527,7 +528,7 @@ void SMESHGUI_MeshOp::selectionDone()
                   //shapeDim = 3; // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
                   shapeDim = (shapeDim < 2) ? 2 : shapeDim;
                   for (; exp.More() && shapeDim == 2; exp.Next()) {
-                    if (exp.Current().Closed())
+                    if (/*exp.Current().Closed()*/BRep_Tool::IsClosed(exp.Current()))
                       shapeDim = 3;
                   }
                 }
@@ -542,6 +543,10 @@ void SMESHGUI_MeshOp::selectionDone()
           }
         }
       }
+      for (int i = SMESH::DIM_3D; i > shapeDim; i--) {
+        // reset algos before disabling tabs (0020138)
+        onAlgoSelected(-1, i);
+      }
       myDlg->setMaxHypoDim( shapeDim );