Salome HOME
refs #585: flag in merge operations
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index b55b4a086e7f7ba9f95f9b50223c69d27276aabd..a4177f665ba69b50ddd94c16ac896f83eb28ff7c 100644 (file)
@@ -655,7 +655,13 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         theMenu->addAction( action( DuplicateStricklerTableId ) );
         theMenu->addSeparator();
 
-        if ( !isLandCoversScalarMapModeOn( anActiveViewId ) ) {
+        Handle(HYDROData_StricklerTable) aTable = 
+          Handle(HYDROData_StricklerTable)::DownCast( aSeq.First() );
+        QString aCurrentTable = 
+          HYDROGUI_DataObject::dataObjectEntry( getLandCoverColoringTable( anActiveViewId ) );
+        bool isUsed = aCurrentTable == HYDROGUI_DataObject::dataObjectEntry( aTable );
+
+        if ( !isUsed && !getObjectShapes( anActiveViewId, KIND_LAND_COVER ).isEmpty() ) {
           theMenu->addAction( action( LandCoverScalarMapModeOnId ) );
           theMenu->addSeparator();
         }
@@ -683,8 +689,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       theMenu->addSeparator();
     }
 
-    if (anIsPolyline || anIsPolyline3D)
-      theMenu->addAction( action( ExportPolylineId ) );
+    bool anIsPoly = anIsPolyline || anIsPolyline3D;
+    if ((anIsPoly && !anIsLandCover) || (!anIsPoly && anIsLandCover))
+      theMenu->addAction( action( ExportToShapeFileID ) );
 
     // Add copy action
     QAction* aCopyAction = action( CopyId );
@@ -1797,3 +1804,23 @@ bool HYDROGUI_Module::isLandCoversScalarMapModeOn( const int theViewId ) const
 {
   return myLandCoverColoringMap.contains( theViewId );
 }
+
+void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObject )
+{
+  if ( theObject.IsNull() || !theObject->IsRemoved() ) {
+    return;
+  }
+
+  if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) {
+    Handle(HYDROData_StricklerTable) aTable = 
+      Handle(HYDROData_StricklerTable)::DownCast( theObject );
+    QList<int> aViewIds;
+    QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+    while ( anIter.hasNext() ) {
+      if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == 
+           HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
+        anIter.remove();
+      }
+    }
+  }
+}