From c4651de4193d23f155282dbdf6af6025bc648bab Mon Sep 17 00:00:00 2001 From: isn Date: Tue, 17 Nov 2015 15:49:22 +0300 Subject: [PATCH] bug #702 --- src/HYDROData/HYDROData_LandCoverMap.cxx | 2 +- .../HYDROGUI_ImportLandCoverMapDlg.cxx | 24 +++++++++++++++---- src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h | 1 + .../HYDROGUI_ImportLandCoverMapOp.cxx | 6 +++++ src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 ++-- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 1187916c..33a705cd 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -939,7 +939,7 @@ QStringList HYDROData_LandCoverMap::DumpToPython( const QString& thePyScri QString aDbfFileName = thePyScriptPath; aDbfFileName.replace( ".py", ".dbf" ); - ExportSHP( aShpFileName, true, 1 ); + ExportSHP( aShpFileName, true, 0.1 ); QString anAttr = "CODE_06"; //TODO: some custom choice QStringList anAttrValues, aTypes; diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx index 82e4b9d7..134239b8 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx @@ -83,7 +83,7 @@ QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() { aLandcoverNameLayout->addWidget( aLandcoverNameLabel ); aLandcoverNameLayout->addWidget( myObjectName ); - QGroupBox* aPolygonsGroup = new QGroupBox( tr( "FOUNDED_POLYGONS" ) ); + QGroupBox* aPolygonsGroup = new QGroupBox( tr( "FOUND_POLYGONS" ) ); myPolygonsListWidget = new QListWidget( aPolygonsGroup ); myPolygonsListWidget->setSelectionMode( QListWidget::ExtendedSelection ); myPolygonsListWidget->setEditTriggers( QListWidget::NoEditTriggers ); @@ -196,8 +196,10 @@ void HYDROGUI_ImportLandCoverMapDlg::setSelectedPolygonNames( const QStringList& } void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged() -{ - emit selectionChanged( getSelectedPolygonNames() ); +{ + int aCurIndex = GetCurrentWizardIndex(); + if (aCurIndex == 0) + emit selectionChanged( getSelectedPolygonNames() ); } QStringList HYDROGUI_ImportLandCoverMapDlg::getSelectedPolygonNames() const @@ -310,7 +312,7 @@ void HYDROGUI_ImportLandCoverMapDlg::setFirstPageState(bool theState) bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const { //Check the state of the current page - int aCurrPage = wizard()->currentIndex(); + int aCurrPage = GetCurrentWizardIndex(); switch ( aCurrPage ) { case 0: @@ -341,6 +343,15 @@ bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const } break; } + case 2: //last page + { + if (myPolygonsListWidget->selectedItems().empty()) + { + SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED")); + return false; + } + break; + } default: return false; } @@ -405,4 +416,9 @@ void HYDROGUI_ImportLandCoverMapDlg::setDbfState(bool theState) bool HYDROGUI_ImportLandCoverMapDlg::getDbfState() const { return myDbfState; +} + +int HYDROGUI_ImportLandCoverMapDlg::GetCurrentWizardIndex() const +{ + return wizard()->currentIndex(); } \ No newline at end of file diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h index e7992563..2e7a7c0d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h @@ -62,6 +62,7 @@ public: void setDbfState(bool theState); bool getDbfState() const; + int GetCurrentWizardIndex() const; void FillCorrespondenceTable(const QStringList& theFirstColumn, const QStringList& theSecondColumn, diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx index 3e77bd37..5f35ec26 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx @@ -330,6 +330,12 @@ void HYDROGUI_ImportLandCoverMapOp::onViewerSelectionChanged() if ( !aPanel ) return; + int aCurIndex = -1; + aCurIndex = aPanel->GetCurrentWizardIndex(); + + if (aCurIndex != 0) + return; + OCCViewer_ViewManager* aViewManager = getPreviewManager(); Handle(AIS_InteractiveContext) aCtx = NULL; if ( aViewManager ) { diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index cf5b2b4d..16d67a97 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -2334,8 +2334,8 @@ file cannot be correctly imported for an Obstacle definition. Name - FOUNDED_POLYGONS - Founded polygons: + FOUND_POLYGONS + Found polygons: USE_DBF_AS_ST -- 2.39.2