#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_FileDlg.h>
-
+#include <HYDROGUI_Module.h>
+#include <SUIT_MessageBox.h>
+#include <LightApp_Application.h>
#include <QTableWidget>
#include <QHeaderView>
#include <QComboBox>
+#include <QStackedWidget>
HYDROGUI_ImportLandCoverMapDlg::HYDROGUI_ImportLandCoverMapDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_Wizard( theModule, theTitle )
addPage( createPage1() );
addPage( createPage2() );
addPage( createPage3() );
+ myFirstPageState = false;
}
QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
myDBFAttr = new QListWidget( aPage );
- myDBFAttr->setSelectionMode( QListWidget::ExtendedSelection );
+ myDBFAttr->setSelectionMode( QListWidget::SingleSelection );
myDBFAttr->setEditTriggers( QListWidget::NoEditTriggers );
myDBFAttr->setViewMode( QListWidget::ListMode );
myDBFAttr->setSortingEnabled( false );
myTableW = new QTableWidget();
- myTableW->setRowCount(5);
- myTableW->setColumnCount(2);
-
- QStringList list;
- list << "1" << "2" << "3";
-
- for (int i = 0; i < 5; i++)
- for (int j = 0; j < 2; j++)
- {
- QComboBox* CB = new QComboBox();
- CB->addItems(list);
- myTableW->setCellWidget(i,j,CB);
- }
-
// Layout
QVBoxLayout* aPageLayout = new QVBoxLayout;
aPageLayout->setMargin( 5 );
void HYDROGUI_ImportLandCoverMapDlg::reset()
{
myPolygons->clear();
+ myDBFAttr->clear();
}
void HYDROGUI_ImportLandCoverMapDlg::setPolygonNames( const QStringList& theNames )
myPolygons->addItems( theNames );
}
-void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theNames )
+void HYDROGUI_ImportLandCoverMapDlg::setAttributeNames( const QStringList& theAttrNames )
+{
+ myDBFAttr->clear();
+ myDBFAttr->addItems( theAttrNames );
+}
+
+/*void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theNames )
{
QList<QListWidgetItem*> aFoundItems;
delete anItem;
}
}
-}
+}*/
void HYDROGUI_ImportLandCoverMapDlg::setSelectedPolygonNames( const QStringList& theNames )
{
}
+
void HYDROGUI_ImportLandCoverMapDlg::onBrowse()
{
QString aFilter( tr( "LANDCOVERMAP_FILTER" ) );
return myFileName->text();
}
+
+void HYDROGUI_ImportLandCoverMapDlg::FillCorrTable(const QStringList& theFirstColumn, const QStringList& theSecondColumn)
+{
+ int FCSize = theFirstColumn.size();
+ int SCSize = theSecondColumn.size();
+
+ myTableW->setRowCount(FCSize);
+ myTableW->setColumnCount(2);
+
+ for (int i = 0; i < FCSize; i++)
+ {
+ QTableWidgetItem* aTWI = new QTableWidgetItem();
+ aTWI->setText(theFirstColumn.at(i));
+ aTWI->setFlags(Qt::ItemIsUserCheckable);
+ myTableW->setItem(i, 0, aTWI);
+ }
+
+ for (int i = 0; i < FCSize; i++)
+ {
+ QComboBox* aCB = new QComboBox();
+ aCB->addItems(theSecondColumn);
+ myTableW->setCellWidget(i, 1, aCB);
+ }
+}
+
+QString HYDROGUI_ImportLandCoverMapDlg::getSelectedFieldName() const
+{
+ return myDBFAttr->selectedItems().first()->text();
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setFirstPageState(bool bState)
+{
+ myFirstPageState = bState;
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
+{
+ //Check the state of curent page
+ int CurrPage = wizard()->currentIndex();
+ switch ( CurrPage )
+ {
+ case 0:
+ {
+ if (!myFirstPageState)
+ return false;
+ break;
+ }
+ case 1:
+ {
+ if (this->myDBFAttr->selectedItems().empty())
+ return false;
+ break;
+ }
+ default:
+ return false;
+ }
+ return true;
+
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::GetAttribute2StricklerCorr(QStringList& AttrValues, QStringList& ST)
+{
+ int aRowCount = myTableW->rowCount();
+ for (int i = 0; i < aRowCount; i++)
+ {
+ QTableWidgetItem* aTWI = myTableW->item(i, 0);
+ AttrValues.push_back(aTWI->text());
+ }
+
+ for (int i = 0; i < aRowCount; i++)
+ {
+ QWidget* aW = myTableW->cellWidget(i, 1);
+ QComboBox* aCB = dynamic_cast<QComboBox*> (aW);
+ ST.push_back(aCB->currentText());
+ }
+}
+
+
+QVector<int> HYDROGUI_ImportLandCoverMapDlg::getSelectedPolygonIndices() const
+{
+ QVector<int> aSelectedIndices;
+
+ QModelIndexList aSelectedItems = myPolygons->selectionModel()->selectedIndexes();
+ foreach( QModelIndex index, aSelectedItems ) {
+ aSelectedIndices << index.row();
+ }
+
+ return aSelectedIndices;
+}
\ No newline at end of file