X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_CalculationDlg.cxx;h=1133fcb18dfe23ac9d75924a4559c0de2d4e3187;hb=58bb6b7459bebeeb089c9ed486c4683a8bae7288;hp=a2d3c7dce3107ac9596f114f6775fd666a8f1022;hpb=a72bc1fe339d74df864cfcbc765e2b62c2543d25;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index a2d3c7dc..1133fcb1 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -19,7 +19,7 @@ #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" @@ -85,6 +85,7 @@ void HYDROGUI_CalculationDlg::reset() HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList; myGeomObjects->setObjects(anObject2VisibleList); myPolylineName->clear(); + myLandCoverMapName->clear(); myStricklerTableName->clear(); myAvailableGeomObjects->clear(); @@ -315,7 +316,12 @@ QWizardPage* HYDROGUI_CalculationDlg::createLandCoverMapPage() { // 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 ); @@ -324,25 +330,24 @@ QWizardPage* HYDROGUI_CalculationDlg::createLandCoverMapPage() { 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; } @@ -603,6 +608,16 @@ void HYDROGUI_CalculationDlg::setPolylineNames( const QStringList& theObjects, c } } +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(); @@ -656,7 +671,7 @@ QStringList HYDROGUI_CalculationDlg::getSelectedAvailableGeomObjects() const void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_CalculationCase) theCase ) { myEditedObject = theCase; - myValidator->setEditedObject( theCase ); + myValidator->setEditedObject( myEditedObject ); // Build the calculation case subtree module()->getDataModel()->buildCaseTree( myBrowser->root(), myEditedObject); @@ -666,17 +681,6 @@ void HYDROGUI_CalculationDlg::setEditedObject( const Handle(HYDROData_Calculatio 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 @@ -785,31 +789,6 @@ QList HYDROGUI_CalculationDlg::getGeometryObjects() return anObjects; } -/** - Get chosen land cover map. - @return the land cover map object - */ -Handle(HYDROData_LandCoverMap) HYDROGUI_CalculationDlg::getLandCoverMap() -{ - /* TODO - QList anEntities = myLandCovers->getObjects(); - QList 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 @@ -852,7 +831,6 @@ void HYDROGUI_CalculationDlg::onRuleChanged() myPriorityWidget->undoLastChange(); } -// TODO: setLandCoverMap(...) void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals ) { bool isBlocked; @@ -866,3 +844,17 @@ void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTabl 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 ); +}