Salome HOME
refs #1326: debug of the selection on bathymetry
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Operations.cxx
index 04aa55f71da27ed5b94dcc0f1603ca4581f4fa65..3fa2afa37f50579a272d8c8d25c3288612d0d0d3 100644 (file)
@@ -69,8 +69,8 @@
 #include "HYDROGUI_SplitPolylinesOp.h"
 #include "HYDROGUI_LandCoverColoringOp.h"
 #include "HYDROGUI_SetTransparencyOp.h"
-
 #include "HYDROGUI_ImportLandCoverMapOp.h"
+#include "HYDROGUI_BathymetrySelectionOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -153,6 +153,8 @@ void HYDROGUI_Module::createActions()
   createAction( ImportBathymetryId, "IMPORT_BATHYMETRY", "IMPORT_BATHYMETRY_ICO", Qt::CTRL + Qt::Key_B );
   createAction( EditImportedBathymetryId, "EDIT_IMPORTED_BATHYMETRY", "EDIT_IMPORTED_BATHYMETRY_ICO" );
   createAction( BathymetryBoundsId, "BATHYMETRY_BOUNDS", "BATHYMETRY_BOUNDS_ICO" );
+  createAction( BathymetrySelectionId, "BATHYMETRY_SELECTION", "BATHYMETRY_SELECTION_ICO",
+    0, true, SLOT( onBathymetrySelection() ) );
 
   createAction( CreateImmersibleZoneId, "CREATE_IMMERSIBLE_ZONE", "CREATE_IMMERSIBLE_ZONE_ICO" );
   createAction( EditImmersibleZoneId, "EDIT_IMMERSIBLE_ZONE", "EDIT_IMMERSIBLE_ZONE_ICO" );
@@ -197,7 +199,7 @@ void HYDROGUI_Module::createActions()
   createAction( EditCutImageId, "EDIT_CUT_IMAGE", "EDIT_CUT_IMAGE_ICO" );
 
   createAction( SplitImageId, "SPLIT_IMAGE", "SPLIT_IMAGE_ICO" );
-  createAction( EditSplittedImageId, "EDIT_SPLITTED_IMAGE", "EDIT_SPLITTED_IMAGE_ICO" );
+  createAction( EditSplitImageId, "EDIT_SPLIT_IMAGE", "EDIT_SPLIT_IMAGE_ICO" );
 
   createAction( RecognizeContoursId, "RECOGNIZE_CONTOURS", "RECOGNIZE_CONTOURS_ICO" );
 
@@ -365,6 +367,9 @@ void HYDROGUI_Module::createToolbars()
   createTool( FuseImagesId, aToolBar );
   createTool( CutImagesId, aToolBar );
   createTool( SplitImageId, aToolBar );
+
+  createTool( separator(), aToolBar );
+  createTool( BathymetrySelectionId, aToolBar );
 }
 
 void HYDROGUI_Module::createUndoRedoActions()
@@ -565,6 +570,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case BathymetryBoundsId:
     anOp = new HYDROGUI_BathymetryBoundsOp( aModule );
     break;
+  case BathymetrySelectionId:
+    anOp = new HYDROGUI_BathymetrySelectionOp( aModule );
+    break;
   case CreateImmersibleZoneId:
   case EditImmersibleZoneId:
     anOp = new HYDROGUI_ImmersibleZoneOp( aModule, theId == EditImmersibleZoneId );
@@ -613,8 +621,8 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
     anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Cut, theId == EditCutImageId );
     break;
   case SplitImageId:
-  case EditSplittedImageId:
-    anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Split, theId == EditSplittedImageId );
+  case EditSplitImageId:
+    anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Split, theId == EditSplitImageId );
     break;
   case ImportObstacleFromFileId:
     anOp = new HYDROGUI_ImportObstacleFromFileOp( aModule );
@@ -755,3 +763,16 @@ bool HYDROGUI_Module::renameObject( const QString& theEntry, const QString& theN
   }
   return aRes;
 }
+
+void HYDROGUI_Module::onBathymetrySelection()
+{
+  QAction* a = qobject_cast<QAction*>( sender() );
+  if( !a )
+    return;
+
+  bool isChecked = a->isChecked();
+  if( isChecked )
+    startOperation( BathymetrySelectionId );
+  else
+    operation( BathymetrySelectionId )->abort();
+}