Salome HOME
0019580: EDF 702 GEOM : Partition dialog should warn the user when he create an empty...
authordmv <dmv@opencascade.com>
Thu, 21 May 2009 13:52:57 +0000 (13:52 +0000)
committerdmv <dmv@opencascade.com>
Thu, 21 May 2009 13:52:57 +0000 (13:52 +0000)
src/GEOMGUI/GEOM_msg_en.ts
src/OperationGUI/OperationGUI_PartitionDlg.cxx

index eb6cd5a1c521efbd7e2cfb657eb132945a35a10d..9f911138492ef0595fe07da239c1e1b5f4229fba 100644 (file)
@@ -579,6 +579,14 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_FACE</source>
             <translation>Face</translation>
         </message>
+       <message>
+            <source>GEOM_CS</source>
+            <translation>Coordinate system</translation>
+        </message>
+       <message>
+            <source>GEOM_GCS</source>
+            <translation>Global coordinate system</translation>
+        </message>
        <message>
             <source>GEOM_LCS</source>
             <translation>Local coordinate system</translation>
@@ -1063,6 +1071,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_PARTITION</source>
             <translation>Partition</translation>
         </message>
+       <message>
+            <source>GEOM_WRN_PARTITION_RESULT_EMPTY</source>
+            <translation>The partition result is empty, please verify the reconstruction limit parameter.</translation>
+        </message>
         <message>
             <source>GEOM_PARTITION_HALFSPACE</source>
             <translation>Half-space partition</translation>
index e52df271c4f2bf71e5cdbf5ff4c4ad22a1506ef1..0b10ca3914ca74fe443b6043bceccfab5b682cb8 100644 (file)
 #include <SUIT_Desktop.h>
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_MessageBox.h>
 #include <SalomeApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+
 //=================================================================================
 // class    : OperationGUI_PartitionDlg()
 // purpose  : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the 
@@ -404,8 +408,21 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
     res = true;
   }
 
-  if ( !anObj->_is_nil() )
-    objects.push_back( anObj._retn() );
+  if ( !anObj->_is_nil() ) {
+    TopoDS_Shape aShape;
+    GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE);
+    TopoDS_Iterator It (aShape, Standard_True, Standard_True);
+    int nbSubshapes=0;
+    for (; It.More(); It.Next())
+      nbSubshapes++;
+
+    if (nbSubshapes)
+      objects.push_back( anObj._retn() );
+    else
+      SUIT_MessageBox::warning(this,
+                               QObject::tr("GEOM_ERROR"),
+                               QObject::tr("GEOM_WRN_PARTITION_RESULT_EMPTY"));
+  }
 
   return res;
 }