Skip to content

Commit

Permalink
Added layer count checking to ensure input layers = output layers
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@2819 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
sbr00pwb committed Feb 16, 2005
1 parent e1e7db3 commit 267fe9a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
50 changes: 41 additions & 9 deletions plugins/openmodeller/openmodellergui.cpp
Expand Up @@ -411,7 +411,8 @@ void OpenModellerGui::formSelected(const QString &thePageNameQString)
}
myLastFileNameQString=*myIterator;
++myIterator;
}
}
lblInputLayerCount->setText("("+QString::number(lstLayers->count())+")");
//enable the user to carry on to the next page...
setNextEnabled(currentPage(),true);
}
Expand Down Expand Up @@ -450,16 +451,17 @@ void OpenModellerGui::formSelected(const QString &thePageNameQString)
myProjLastFileNameQString=*myProjIterator;
++myProjIterator;
}
lblOutputLayerCount->setText("("+QString::number(lstProjLayers->count())+")");
//enable the user to carry on to the next page...
setNextEnabled(currentPage(),true);
}
if ( lstProjLayers->count()==0)
if ((lstProjLayers->count() > 0) && (checkLayersMatch()))
{
setNextEnabled(currentPage(),false);
setNextEnabled(currentPage(),true);
}
else
else
{
setNextEnabled(currentPage(),true);
setNextEnabled(currentPage(),false);
}


Expand Down Expand Up @@ -792,6 +794,7 @@ void OpenModellerGui::pbnRemoveLayerFile_clicked()
setNextEnabled(currentPage(),false);
}

lblInputLayerCount->setText("("+QString::number(lstLayers->count())+")");
}


Expand Down Expand Up @@ -842,6 +845,7 @@ void OpenModellerGui::pbnSelectLayerFile_clicked()
QMessageBox::warning( this,QString("openModeller Wizard Error"),QString("This file is not a valid GDAL file. Please check and try again."));
}

lblInputLayerCount->setText("("+QString::number(lstLayers->count())+")");
}


Expand Down Expand Up @@ -1322,7 +1326,15 @@ void OpenModellerGui::pbnSelectLayerFileProj_clicked()
{
QMessageBox::warning( this,QString("openModeller Wizard Error"),QString("This file is not a valid GDAL file. Please check and try again."));
}

lblOutputLayerCount->setText("("+QString::number(lstProjLayers->count())+")");
if ((lstProjLayers->count() > 0) && (checkLayersMatch()))
{
setNextEnabled(currentPage(),true);
}
else
{
setNextEnabled(currentPage(),false);
}
}

void OpenModellerGui::pbnSelectLayerFolderProj_clicked()
Expand Down Expand Up @@ -1373,6 +1385,16 @@ void OpenModellerGui::pbnRemoveLayerFileProj_clicked()
{
setNextEnabled(currentPage(),false);
}
lblOutputLayerCount->setText("("+QString::number(lstProjLayers->count())+")");

if ((lstProjLayers->count() > 0) && (checkLayersMatch()))
{
setNextEnabled(currentPage(),true);
}
else
{
setNextEnabled(currentPage(),false);
}

}

Expand All @@ -1385,9 +1407,19 @@ void OpenModellerGui::createModelImage(QString theBaseName)
myImageWriter.writeImage(theBaseName+".tif",myImageFileNameString);
std::cout << "Model image written to : " << myImageFileNameString << std::endl;




}

bool OpenModellerGui::checkLayersMatch()
{
// Checks to see if the input and output layers match
// NB MORE SOPHISTICATED CHECKING SHOULD BE ADDED LATER!!!!
if (lstProjLayers->count()==lstLayers->count())
{
return true;
}
else
{
return false;
}
}

3 changes: 2 additions & 1 deletion plugins/openmodeller/openmodellergui.h
Expand Up @@ -75,7 +75,7 @@ Q_OBJECT
void pbnRemoveLayerFileProj_clicked();
void pbnSelectLayerFileProj_clicked();
static bool isValidGdalFile(const QString theFilename);
static bool isValidGdalProj(const QString theFilename);
static bool isValidGdalProj(const QString theFilename);

private:
OpenModeller * mOpenModeller;
Expand Down Expand Up @@ -112,6 +112,7 @@ Q_OBJECT
QWidget *mLayoutWidget;
void getProjList();
void createModelImage(QString theBaseName);
bool checkLayersMatch();

signals:
void drawModelImage(QString);
Expand Down

0 comments on commit 267fe9a

Please sign in to comment.