connect( myGeomObjects, SIGNAL( orderChanged() ), SLOT( onOrderChanged() ) );
+ connect( myPriorityWidget, SIGNAL( ruleChanged() ), SLOT( onRuleChanged() ) );
+
return aPage;
}
connect( anAddBtn, SIGNAL( clicked() ), SIGNAL( addLandCovers() ) );
connect( aRemoveBtn, SIGNAL( clicked() ), SIGNAL( removeLandCovers() ) );
- connect( myLandCovers, SIGNAL( orderLandCoverChanged() ), SLOT( onOrderLandCoverChanged() ) );
+ connect( myLandCovers, SIGNAL( orderChanged() ), SLOT( onOrderLandCoverChanged() ) );
+
+ connect( myLandCoverPriorityWidget, SIGNAL( ruleChanged() ), SLOT( onLandCoverRuleChanged() ) );
return aPage;
}
QFrame* aFrame = new QFrame( aPage );
QGridLayout* aLayout = new QGridLayout( aPage );
+
+ QLabel* aResultsOnGeomObjectsLabel = new QLabel( tr( "RESULTS_ON_GEOMETRY_OBJECTS" ), aFrame );
myBrowser = new HYDROGUI_DataBrowser( module(), NULL, aPage );
myBrowser->setAutoOpenLevel( 3 );
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
- aLayout->addWidget( myBrowser, 0, 0, 1, 2 );
+ aLayout->addWidget( aResultsOnGeomObjectsLabel, 0, 0 );
+ aLayout->addWidget( myBrowser, 1, 0, 1, 2 );
myBathymetryLabel = new QLabel( tr( "BATHYMETRY" ), aFrame );
myBathymetryChoice = new QComboBox( aFrame );
myBathymetryChoice->setVisible( false );
myBathymetryLabel->setVisible( false );
- aLayout->addWidget( myBathymetryLabel, 1, 0 );
- aLayout->addWidget( myBathymetryChoice, 1, 1 );
+ aLayout->addWidget( myBathymetryLabel, 2, 0 );
+ aLayout->addWidget( myBathymetryChoice, 2, 1 );
aPage->setLayout( aLayout );
QGridLayout* aLayout = new QGridLayout( aPage );
- myLandCoverBrowser = new HYDROGUI_DataBrowser( module(), NULL, aPage );
+ QLabel* aResultsOnLandCoversLabel = new QLabel( tr( "RESULTS_ON_LAND_COVERS" ), aFrame );
+
+ myLandCoverBrowser = new HYDROGUI_DataBrowser( module(), NULL, aPage, true );
myLandCoverBrowser->setAutoOpenLevel( 3 );
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
- aLayout->addWidget( myLandCoverBrowser, 0, 0, 1, 2 );
+ aLayout->addWidget( aResultsOnLandCoversLabel, 0, 0 );
+ aLayout->addWidget( myLandCoverBrowser, 1, 0, 1, 2 );
myStricklerTypeLabel = new QLabel( tr( "STRICKLER_TYPE" ), aFrame );
myStricklerTypeChoice = new QComboBox( aFrame );
myStricklerTypeLabel->setVisible( false );
myStricklerTypeChoice->setVisible( false );
- aLayout->addWidget( myBathymetryLabel, 1, 0 );
- aLayout->addWidget( myBathymetryChoice, 1, 1 );
+ aLayout->addWidget( myStricklerTypeLabel, 2, 0 );
+ aLayout->addWidget( myStricklerTypeChoice, 2, 1 );
aPage->setLayout( aLayout );
HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theTargetParent);
if ( aRegion )
{
- emit moveZones( theTargetParent, aZonesList );
+ emit moveZones( theTargetParent, aZonesList, false );
}
}
}
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->getObjects();
+ 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 );
+ myStricklerTypeLabel->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,
SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction )
{
- // TODO: implement this function
+ QList<SUIT_DataObject*> aZonesList;
+ HYDROGUI_Zone* aZone;
+ // Get a list of dropped land cover zones
+ for ( int i = 0; i < theList.length(); i++ )
+ {
+ aZone = dynamic_cast<HYDROGUI_Zone*>( theList.at( i ) );
+ if ( aZone )
+ {
+ aZonesList.append( aZone );
+ }
+ }
+ if ( aZonesList.length() > 0 )
+ {
+ // Get the target region
+ HYDROGUI_NamedObject* aRegionsRoot = dynamic_cast<HYDROGUI_NamedObject*>(theTargetParent);
+ if ( aRegionsRoot )
+ {
+ // Create a new region
+ emit createLandCoverRegion( aZonesList );
+ }
+ else
+ {
+ HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theTargetParent);
+ if ( aRegion )
+ {
+ emit moveZones( theTargetParent, aZonesList, true );
+ }
+ }
+ }
}
void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
// Build the calculation case subtree
module()->getDataModel()->buildCaseTree( myBrowser->root(), myEditedObject, false );
-
+
myBrowser->updateTree();
myBrowser->openLevels();
myBrowser->adjustColumnsWidth();
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 );
}
myGeomObjects->undoLastMove();
}
+/**
+ Slot called when priority rule for geometry objects is changed.
+ */
+void HYDROGUI_CalculationDlg::onRuleChanged()
+{
+ bool isConfirmed = true;
+ emit ruleChanged( isConfirmed );
+ if( !isConfirmed )
+ myPriorityWidget->undoLastChange();
+}
+
void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals )
{
bool isBlocked;
else
myLandCovers->undoLastMove();
}
+
+/**
+ Slot called when priority rule for land covers is changed.
+ */
+void HYDROGUI_CalculationDlg::onLandCoverRuleChanged()
+{
+ bool isConfirmed = true;
+ emit ruleLandCoverChanged( isConfirmed );
+ if( !isConfirmed )
+ myLandCoverPriorityWidget->undoLastChange();
+}