Salome HOME
Merge branch 'BR_LAND_COVER' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationDlg.cxx
index 1b5fb33bdc60792a2a15d12985a42f6b5adb3689..5d3481e66fc7516c20420124c3a6f82ea106f456 100644 (file)
@@ -585,7 +585,7 @@ void HYDROGUI_CalculationDlg::onZonesDropped( const QList<SUIT_DataObject*>& the
       HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theTargetParent);
       if ( aRegion )
       {
-        emit moveZones( theTargetParent, aZonesList );
+        emit moveZones( theTargetParent, aZonesList, false );
       }
     }
   }
@@ -658,12 +658,49 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject )
 
 void HYDROGUI_CalculationDlg::onLandCoverZoneSelected( SUIT_DataObject* theObject )
 {
-  // TODO: implement this function
+  bool doShow = false;
+  HYDROGUI_Zone* aZone = dynamic_cast<HYDROGUI_Zone*>( theObject );
+  if ( aZone )
+  {
+    doShow = aZone->isMergingNeed();
+  }
+
+  if ( doShow )
+  {
+    // Fill the merge type combo box
+    bool prevBlock = myStricklerTypeChoice->blockSignals( true );
+    myCurrentZone = aZone;
+    myStricklerTypeChoice->clear();
+    myStricklerTypeChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
+    /*QStringList aList = aZone->getStricklerTypes();
+    for ( int i = 0; i < aList.length(); i++ )
+    {
+      myStricklerTypeChoice->addItem( aList.at( i ), HYDROData_Zone::Merge_Object );
+    }
+    // Select the current choice if any
+    int aCurIndex = 0;
+    switch ( aZone->getMergeType() )
+    {
+      case HYDROData_Zone::Merge_Object:
+        aCurIndex = 1 + aList.indexOf( aZone->text( HYDROGUI_DataObject::AltitudeObjId ) );
+        break;
+      default:
+        aCurIndex = 0; // Select unknown by default
+    }
+    myStricklerTypeChoice->setCurrentIndex( aCurIndex );*/
+    myStricklerTypeChoice->blockSignals( prevBlock );
+  }
+
+  myStricklerTypeChoice->setVisible( doShow );
+  myStricklerTypeChoice->setEnabled( getLandCoverMode() == HYDROData_CalculationCase::MANUAL );
+  myStricklerTypeChoice->setVisible( doShow );
 }
 
 void HYDROGUI_CalculationDlg::onMergeStricklerTypeSelected( int theIndex )
 {
-  // TODO: implement this function
+  int aType = myStricklerTypeChoice->itemData( theIndex ).toInt();
+  QString aText = myStricklerTypeChoice->itemText( theIndex );
+  emit setMergeStricklerType( aType, aText );
 }
 
 void HYDROGUI_CalculationDlg::onLandCoverZonesDropped( const QList<SUIT_DataObject*>& theList, 
@@ -843,7 +880,7 @@ void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_Calculatio
 
   // Build the calculation case subtree
   module()->getDataModel()->buildCaseTree( myBrowser->root(), myEditedObject, false );
-  
+
   myBrowser->updateTree();
   myBrowser->openLevels();
   myBrowser->adjustColumnsWidth();
@@ -977,7 +1014,7 @@ void HYDROGUI_CalculationDlg::setEditZonesEnabled( const bool theIsEnabled )
   Enable/disable land covers drag'n'drop and renaming.
   @param theIsEnabled if true - land covers drag'n'drop and renaming will be enabled
 */
-void HYDROGUI_CalculationDlg::setEditLandCoversEnabled( const bool theIsEnabled )
+void HYDROGUI_CalculationDlg::setEditLandCoverZonesEnabled( const bool theIsEnabled )
 {
   myLandCoverBrowser->setReadOnly( !theIsEnabled );
 }