Salome HOME
LCM // Import/Export of SHP p.3
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportLandCoverMapDlg.cxx
index cf4de87aab6b083e6a3e47e30a7cc84af58b3417..40add2d825d6d226635243fc0383b7eda33f5c56 100644 (file)
 #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 )
@@ -39,6 +42,7 @@ HYDROGUI_ImportLandCoverMapDlg::HYDROGUI_ImportLandCoverMapDlg( HYDROGUI_Module*
   addPage( createPage1() );
   addPage( createPage2() );
   addPage( createPage3() );
+  myFirstPageState = false;
 }
 
 QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
@@ -174,7 +178,7 @@ void HYDROGUI_ImportLandCoverMapDlg::setAttributeNames( const QStringList& theAt
   myDBFAttr->addItems( theAttrNames );
 }
 
-void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theNames )
+/*void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theNames )
 {
   QList<QListWidgetItem*> aFoundItems;
 
@@ -185,7 +189,7 @@ void HYDROGUI_ImportLandCoverMapDlg::removePolygonNames( const QStringList& theN
       delete anItem;
     }
   }
-}
+}*/
 
 void HYDROGUI_ImportLandCoverMapDlg::setSelectedPolygonNames( const QStringList& theNames )
 {
@@ -283,3 +287,63 @@ 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