]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #626: No warning appears during attempt splitting not intersected polylines
authorabk <abk@opencascade.com>
Wed, 5 Aug 2015 14:21:08 +0000 (17:21 +0300)
committerabk <abk@opencascade.com>
Wed, 5 Aug 2015 14:21:08 +0000 (17:21 +0300)
Functionality to output the warning using the flag was created.

src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 5adf7730de1f0e76b172adeaacf7416327407807..ff9f45c210f6a55387b94329ff61ae4d820d046d 100644 (file)
@@ -26,6 +26,8 @@
 #include <LightApp_Application.h>
 #include <OCCViewer_ViewModel.h>
 #include <OCCViewer_ViewManager.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
 #include <gp_Pnt2d.hxx>
 #include <BRepLib_MakeVertex.hxx>
 #include <BRep_Builder.hxx>
@@ -87,15 +89,24 @@ bool HYDROGUI_SplitPolylinesOp::processApply( int& theUpdateFlags,
   double aTolerance = 1E-2; //TODO
 
   HYDROData_PolylineOperator anOp;
-  bool isIntersected = false;
   switch( aPanel->GetMode() )
   {
   case HYDROGUI_SplitPolylinesDlg::ByPoint:
     anOp.Split( doc(), aMainPolyline, aPoint, aTolerance );
     break;
   case HYDROGUI_SplitPolylinesDlg::ByTool:
+  {
+    bool isIntersected = false;
     anOp.Split( doc(), aMainPolyline, aToolPolyline, aTolerance, isIntersected);
+
+    if (!isIntersected)
+    {
+      const QString aTitle = tr("SPLIT_POLYLINE_BY_TOOL_WARNING_TITLE");
+      const QString aMsg = tr("SPLIT_POLYLINE_BY_TOOL_WARNING_MSG");
+      SUIT_MessageBox::warning(module()->getApp()->desktop(), aTitle, aMsg);
+    }
     break;
+  }
   case HYDROGUI_SplitPolylinesDlg::Split:
     anOp.Split( doc(), aPolylinesList, aTolerance );
     break;
index a2b27fd545cbbad27d74449e87186e65feb925be..27f896bee81aa218065884df33756a44e778384f 100644 (file)
@@ -3024,6 +3024,14 @@ Polyline should consist from one not closed curve.</translation>
       <source>SPLIT_POLYLINES</source>
       <translation>Split polylines</translation>
     </message>
+    <message>
+      <source>SPLIT_POLYLINE_BY_TOOL_WARNING_TITLE</source>
+      <translation>Split polyline by tool</translation>
+    </message>
+    <message>
+      <source>SPLIT_POLYLINE_BY_TOOL_WARNING_MSG</source>
+      <translation>The splitted polyline is not intersected by the tool.</translation>
+    </message>
   </context>
 
   <context>