void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged()
{
- int aCurIndex = GetCurrentWizardIndex();
+ int aCurIndex = getCurrentWizardIndex();
if (aCurIndex == 0 && getViewerState())
emit selectionChanged( getSelectedPolygonNames() );
}
myFirstPageState = theState;
}
+bool HYDROGUI_ImportLandCoverMapDlg::getFirstPageState() const
+{
+ return myFirstPageState;
+}
+
+
bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
{
//Check the state of the current page
- int aCurrPage = GetCurrentWizardIndex();
+ int aCurrPage = getCurrentWizardIndex();
switch ( aCurrPage )
{
case 0:
{
- if (!myFirstPageState)
- {
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("FILE_ISNT_CHOSEN"));
+ //this method verifies first page
+ if (!CheckFirstPageFilling())
return false;
- }
- if (myPolygonsListWidget->selectedItems().empty())
- {
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
- return false;
- }
- if (getAttrCheckBoxState() && !getDbfState())
- {
- SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), tr("DBF_LOAD_ERR_MESS"));
- return false;
- }
break;
}
case 1:
{
if (myDBFAttrListWidget->selectedItems().empty())
{
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), "Attribute isn't selected");
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr ("ATTRS_ISNT_SELECTED"));
return false;
}
break;
}
case 2: //last page
{
- if (myPolygonsListWidget->selectedItems().empty())
+ if (this->isPolygonListEmpty())
{
SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
return false;
return myDbfState;
}
-int HYDROGUI_ImportLandCoverMapDlg::GetCurrentWizardIndex() const
+int HYDROGUI_ImportLandCoverMapDlg::getCurrentWizardIndex() const
{
return wizard()->currentIndex();
}
bool HYDROGUI_ImportLandCoverMapDlg::getViewerState() const
{
return myUpdateViewerState;
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::isPolygonListEmpty() const
+{
+ return myPolygonsListWidget->selectedItems().empty();
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::CheckFirstPageFilling() const
+{
+ if (!this->getFirstPageState())
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("FILE_ISNT_CHOSEN"));
+ return false;
+ }
+ if (this->isPolygonListEmpty())
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
+ return false;
+ }
+ if (this->getAttrCheckBoxState() && !this->getDbfState())
+ {
+ SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), tr("DBF_LOAD_ERR_MESS"));
+ return false;
+ }
+ return true;
}
\ No newline at end of file
QString getFileName() const;
void setFirstPageState(bool theState);
+ bool getFirstPageState() const;
bool getAttrCheckBoxState() const;
void getValAttr2StricklerTypeCorr(QStringList& theAttrValues, QStringList& theST);
QVector<int> getSelectedPolygonIndices() const;
+ bool isPolygonListEmpty() const;
+
+ bool CheckFirstPageFilling() const;
void setDbfState(bool theState);
bool getDbfState() const;
- int GetCurrentWizardIndex() const;
+ int getCurrentWizardIndex() const;
void setViewerState(bool theState);
bool getViewerState() const;
return;
int aCurIndex = -1;
- aCurIndex = aPanel->GetCurrentWizardIndex();
+ aCurIndex = aPanel->getCurrentWizardIndex();
if (aCurIndex != 0)
return;
OCCViewer_ViewManager* aViewManager = getPreviewManager();
Handle(AIS_InteractiveContext) aCtx = NULL;
- if ( aViewManager ) {
- if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
+ if ( aViewManager )
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
aCtx = aViewer->getAISContext();
- }
- }
if ( !aCtx.IsNull() )
{
void HYDROGUI_ImportLandCoverMapOp::onApply()
{
+ HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ if (!aPanel->CheckFirstPageFilling())
+ return;
+
QApplication::setOverrideCursor( Qt::WaitCursor );
int anUpdateFlags = 0;
QString anErrorMsg;
<source>POLYGONS_ISNT_SELECTED</source>
<translation>Polygons isn't selected</translation>
</message>
- <message>
+ <message>
+ <source>ATTRS_ISNT_SELECTED</source>
+ <translation>Attribute isn't selected</translation>
+ </message>
+
+ <message>
<source>DBF_LOAD_ERR_MESS</source>
<translation>Cant open DBF file or it's corrupted</translation>
</message>
<source>DEF_POLYGON_NAME</source>
<translation>polygon</translation>
</message>
-
+ <message>
+ <source>LCM_IMPORT_WARNING</source>
+ <translation>Import of Land cover map</translation>
+ </message>
<message>
<source>CANNT_IMPORT_LCM</source>
<translation>Cannot import land cover map;</translation>