Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Operations.cxx
index e15ed250f98b0fc4be70649e3bb401dfeae452ba..8371e64d1dbe85ea64a6e5e8dee481e4aaab7d7a 100644 (file)
@@ -53,7 +53,7 @@
 #include "HYDROGUI_GeoreferencementOp.h"
 #include "HYDROGUI_SetColorOp.h"
 #include "HYDROGUI_BathymetryBoundsOp.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_ZLevelsOp.h"
 #include "HYDROGUI_LocalCSOp.h"
 #include "HYDROGUI_RiverBottomOp.h"
@@ -75,6 +75,7 @@
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
 #include <HYDROData_SplitToZonesTool.h>
+#include <HYDROData_Iterator.h>
 
 #include <GeometryGUI.h>
 #include <GeometryGUI_Operations.h>
@@ -196,7 +197,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" );
 
@@ -355,6 +356,7 @@ void HYDROGUI_Module::createToolbars()
   createTool( SplitLandCoverId, aToolBar );
   createTool( MergeLandCoverId, aToolBar );
   createTool( ChangeLandCoverTypeId, aToolBar );
+  enableLCMActions();
 
   createTool( separator(), aToolBar );
   createTool( CreateCalculationId, aToolBar );
@@ -406,6 +408,24 @@ void HYDROGUI_Module::updateUndoRedoControls()
   aRedoAction->setEnabled( aCanRedo );
 }
 
+void HYDROGUI_Module::enableLCMActions()
+{
+  HYDROData_Iterator anIt( HYDROData_Document::Document( getStudyId() ), KIND_LAND_COVER_MAP );
+  bool anEnableTools = anIt.More();
+
+  QtxListAction* anAction;
+  anAction = (QtxListAction*)action( AddLandCoverId );
+  if ( anAction ) anAction->setEnabled( anEnableTools );
+  anAction = (QtxListAction*)action( RemoveLandCoverId );
+  if ( anAction ) anAction->setEnabled( anEnableTools );
+  anAction = (QtxListAction*)action( SplitLandCoverId );
+  if ( anAction ) anAction->setEnabled( anEnableTools );
+  anAction = (QtxListAction*)action( MergeLandCoverId );
+  if ( anAction ) anAction->setEnabled( anEnableTools );
+  anAction = (QtxListAction*)action( ChangeLandCoverTypeId );
+  if ( anAction ) anAction->setEnabled( anEnableTools );
+}
+
 void HYDROGUI_Module::onOperation()
 {
   const QAction* anAction = dynamic_cast<const QAction*>( sender() );
@@ -593,8 +613,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 );