Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index cad9dc666008bdef9ea84852fb0e13ffd325ce31..19d2e20757c0f91b3f4d75e5eb7b0e5a6a8f72c9 100644 (file)
@@ -253,7 +253,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsFusedImage = false;
   bool anIsCutImage = false;
   bool anIsSplittedImage = false;
-  bool anIsMustBeUpdatedImage = false;
+  bool anIsMustobjectBeUpdated = false;
   bool anIsPolyline = false;
   bool anIsPolyline3D = false;
   bool anIsProfile = false;
@@ -267,6 +267,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsZone = false;
   bool anIsObstacle = false;
   bool anIsStream = false;
+  bool anIsChannel = false;
   bool anIsGeomObject = false;
 
   // check the selected GEOM objects
@@ -289,6 +290,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       anIsVisibleInSelection |= aVisibility;
       anIsHiddenInSelection |= !aVisibility;
 
+      if ( anObject->IsMustBeUpdated() )
+      {
+        anIsMustobjectBeUpdated = true;
+      }
+
       ObjectKind anObjectKind = anObject->GetKind();
       if( anObjectKind == KIND_IMAGE )
       {
@@ -311,10 +317,6 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
                 anIsSplittedImage = true;
             }
           }
-          if ( anImage->IsMustBeUpdated() )
-          {
-            anIsMustBeUpdatedImage = true;
-          }
         }
       }
       else if( anObjectKind == KIND_POLYLINEXY )
@@ -348,6 +350,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         anIsObstacle = true;
       else if( anObjectKind == KIND_STREAM )
         anIsStream = true;
+      else if( anObjectKind == KIND_CHANNEL )
+        anIsChannel = true;
     }
 
     anIsGeomObject = HYDROData_Tool::IsGeometryObject( anObject );
@@ -372,6 +376,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
           theMenu->addAction( action( ImportBathymetryId ) );
           break;
         case KIND_ARTIFICIAL_OBJECT:
+          theMenu->addAction( action( CreateChannelId ) );
           break;
         case KIND_NATURAL_OBJECT:
           theMenu->addAction( action( CreateImmersibleZoneId ) );
@@ -406,9 +411,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   if( anIsSelectedDataObjects )
   {
-    if ( anIsMustBeUpdatedImage )
+    if ( anIsMustobjectBeUpdated )
     {
-      theMenu->addAction( action( UpdateImageId ) );
+      theMenu->addAction( action( UpdateObjectId ) );
       theMenu->addSeparator();
     }
 
@@ -428,7 +433,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
             theMenu->addAction( action( EditSplittedImageId ) );
         }
 
-        theMenu->addAction( action( ObserveImageId ) );
+        //RKV: BUG#98: theMenu->addAction( action( ObserveImageId ) );
         theMenu->addAction( action( ExportImageId ) );
         theMenu->addSeparator();
 
@@ -443,6 +448,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( SplitImageId ) );
         theMenu->addSeparator();
       }
+      else if( anIsBathymetry )
+      {
+        theMenu->addAction( action( EditImportedBathymetryId ) );
+        theMenu->addSeparator();
+      }
       else if( anIsPolyline )
       {
         theMenu->addAction( action( EditPolylineId ) );
@@ -475,6 +485,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( EditStreamId ) );
         theMenu->addSeparator();
       }
+      else if( anIsChannel )
+      {
+        theMenu->addAction( action( EditChannelId ) );
+        theMenu->addSeparator();
+      }
       else if( anIsVisualState && anIsObjectBrowser )
       {
         theMenu->addAction( action( SaveVisualStateId ) );
@@ -496,8 +511,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     theMenu->addAction( action( DeleteId ) );
     theMenu->addSeparator();
 
-    if( anIsImage || anIsPolyline || anIsPolyline3D || anIsImmersibleZone || anIsZone || 
-        anIsRegion || anIsBathymetry || anIsObstacle || anIsStream || anIsValidProfile )
+    if( anIsImage || anIsPolyline || anIsPolyline3D || 
+        anIsImmersibleZone || anIsZone || anIsRegion ||
+        anIsBathymetry || anIsObstacle || anIsStream ||
+        anIsChannel || anIsValidProfile )
     {
       if( anIsHiddenInSelection )
         theMenu->addAction( action( ShowId ) );