#include "HYDROGUI_CalculationDlg.h"
#include "HYDROGUI_ObjSelector.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
#include "HYDROGUI_DataBrowser.h"
#include "HYDROGUI_DataModel.h"
#include "HYDROGUI_ListSelector.h"
HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
myGeomObjects->setObjects(anObject2VisibleList);
myPolylineName->clear();
+ myLandCoverMapName->clear();
myStricklerTableName->clear();
myAvailableGeomObjects->clear();
// Top of the page
QWidget* aTopContainer = new QWidget;
- // TODO: add combo-box to choose land cover map object
+ // Combo-box to choose land cover map object
+ QLabel* aLandCoverMapLabel = new QLabel( tr( "LAND_COVER_MAP" ), aPage );
+ myLandCoverMapName = new QComboBox( aPage );
+ myLandCoverMapName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ connect( myLandCoverMapName, SIGNAL( activated( const QString & ) ),
+ SIGNAL( landCoverMapSelected( const QString & ) ) );
// Combo-box to choose Strickler table name
QLabel* aStricklerTableLabel = new QLabel( tr( "STRICKLER_TABLE" ), aPage );
myStricklerTableName = new QComboBox( aPage );
SIGNAL( StricklerTableSelected( const QString & ) ) );
// Fill the top layout of the page
- QGridLayout* aTopLayout = new QGridLayout;
+ QGridLayout* aGridLayout = new QGridLayout;
+ aGridLayout->setMargin( 5 );
+ aGridLayout->setSpacing( 5 );
+ aGridLayout->setVerticalSpacing( 10 );
+ aGridLayout->addWidget( aLandCoverMapLabel, 0, 0 );
+ aGridLayout->addWidget( myLandCoverMapName, 0, 1 );
+ aGridLayout->addWidget( aStricklerTableLabel, 1, 0 );
+ aGridLayout->addWidget( myStricklerTableName, 1, 1 );
+
+ QVBoxLayout* aTopLayout = new QVBoxLayout;
aTopLayout->setMargin( 5 );
aTopLayout->setSpacing( 5 );
- aTopLayout->setVerticalSpacing( 10 );
- // TODO: add land cover map combo-box to the layout
- aTopLayout->addWidget( aStricklerTableLabel, 0, 0, Qt::AlignHCenter );
- aTopLayout->addWidget( myStricklerTableName, 0, 1 );
+ aTopLayout->addLayout( aGridLayout );
+ aTopLayout->addStretch( 1 );
aTopContainer->setLayout( aTopLayout );
- // Page layout
- QVBoxLayout* aPageLayout = new QVBoxLayout;
- aPageLayout->setMargin( 5 );
- aPageLayout->setSpacing( 5 );
-
- aPage->setLayout( aPageLayout );
-
- // Connections
- // TODO
+ aPage->setLayout( aTopLayout );
return aPage;
}
}
}
+void HYDROGUI_CalculationDlg::setLandCoverMapsNames( const QStringList& theObjects, const QStringList& theObjectsEntries )
+{
+ myLandCoverMapName->clear();
+
+ for ( int i = 0, n = theObjects.length(); i < n; ++i )
+ {
+ myLandCoverMapName->addItem( theObjects.at( i ), theObjectsEntries.at( i ) );
+ }
+}
+
void HYDROGUI_CalculationDlg::setStricklerTableNames( const QStringList& theObjects, const QStringList& theObjectsEntries )
{
myStricklerTableName->clear();
myBrowser->adjustColumnsWidth();
myBrowser->setAutoUpdate( true );
myBrowser->setUpdateModified( true );
-
- /*TODO
- // Build the calculation case subtree for Land Cover regions
- module()->getDataModel()->buildCaseTree( myLandCoverBrowser->root(), myEditedObject, true );
-
- myLandCoverBrowser->updateTree();
- myLandCoverBrowser->openLevels();
- myLandCoverBrowser->adjustColumnsWidth();
- myLandCoverBrowser->setAutoUpdate( true );
- myLandCoverBrowser->setUpdateModified( true );
- */
}
HYDROGUI_Zone* HYDROGUI_CalculationDlg::getCurrentZone() const
return anObjects;
}
-/**
- Get chosen land cover map.
- @return the land cover map object
- */
-Handle(HYDROData_LandCoverMap) HYDROGUI_CalculationDlg::getLandCoverMap()
-{
- /* TODO
- QList<Handle(HYDROData_Entity)> anEntities = myLandCovers->getObjects();
- QList<Handle(HYDROData_Entity)> aLandCovers;
-
- foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
- Handle(HYDROData_LandCover) aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
- if ( aLandCover.IsNull() ) {
- continue;
- }
-
- aLandCovers << aLandCover;
- }
-
- return aLandCovers;
- */
- Handle(HYDROData_LandCoverMap) aLandCoverMap = NULL;
- return aLandCoverMap;
-}
-
/**
Get rules.
@return the list of rules
myPriorityWidget->undoLastChange();
}
-// TODO: setLandCoverMap(...)
void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals )
{
bool isBlocked;
else
emit StricklerTableSelected( theStricklerTableName );
}
+
+void HYDROGUI_CalculationDlg::setLandCoverMap( const QString& theLandCoverMapName, bool theBlockSignals )
+{
+ bool isBlocked;
+ if ( theBlockSignals )
+ isBlocked = myLandCoverMapName->blockSignals( true );
+
+ myLandCoverMapName->setCurrentIndex( myLandCoverMapName->findText( theLandCoverMapName ) );
+
+ if ( theBlockSignals )
+ myLandCoverMapName->blockSignals( isBlocked );
+ else
+ emit landCoverMapSelected( theLandCoverMapName );
+}