Salome HOME
refs #1327: debug of scaling operations
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LandCoverMapOp.cxx
index 7aa4036b4dcc67688419dc8ac9af76cc61e92f47..16162cfbc943f4302de60bbe10895303f2cf1ca0 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <OCCViewer_ViewManager.h>
 
+#include <SalomeApp_Study.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_DataOwner.h>
@@ -154,9 +155,13 @@ void HYDROGUI_LandCoverMapOp::abortOperation()
 {
   closePreview();
 
+  bool aNoActiveOps = module()->getActiveOperations().isEmpty();
+
   HYDROGUI_Operation::abortOperation();
 
-  module()->update( UF_OCCViewer | UF_FitAll );
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+  if ( aStudy && !aNoActiveOps )
+    module()->update( UF_OCCViewer | UF_FitAll );
 }
 
 void HYDROGUI_LandCoverMapOp::commitOperation()
@@ -292,9 +297,9 @@ bool HYDROGUI_LandCoverMapOp::processApply( int& theUpdateFlags,
   // Split land cover(s) inside edited land cover map
   if ( myOperationId == SplitLandCoverId )
   {
-    bool aLandCoverSplitted = false;
+    bool aLandCoverSplit = false;
     if ( !aPolyline.IsNull() )
-      aLandCoverSplitted = aLandCoverMapObj->Split( aPolyline );
+      aLandCoverSplit = aLandCoverMapObj->Split( aPolyline );
     else if ( !aFace.IsNull() )
     {
       // Get the complete boundary of the object face as the splitting polyline
@@ -309,12 +314,12 @@ bool HYDROGUI_LandCoverMapOp::processApply( int& theUpdateFlags,
           continue;
 
         bool aSplitResult = aLandCoverMapObj->Split( aShape );
-        aLandCoverSplitted = ( i==0 ? aSplitResult : aLandCoverSplitted && aSplitResult );
+        aLandCoverSplit = ( i==0 ? aSplitResult : aLandCoverSplit && aSplitResult );
       }
     }
-    if ( !aLandCoverSplitted )
+    if ( !aLandCoverSplit )
     {
-      theErrorMsg = tr( "LAND_COVER_NOT_SPLITTED" );
+      theErrorMsg = tr( "LAND_COVER_NOT_SPLIT" );
       return false;
     }
   }
@@ -371,6 +376,9 @@ bool HYDROGUI_LandCoverMapOp::processApply( int& theUpdateFlags,
   if ( myOperationId == CreateLandCoverMapId )
     module()->enableLCMActions();
 
+  if ( myOperationId == RemoveLandCoverId || myOperationId == MergeLandCoverId || myOperationId == ChangeLandCoverTypeId )
+    aPanel->updateSelectedLandCoversLabel( getNbSelected() );
+
   return true;
 }