Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
File format checking on masks and output format files
git-svn-id: http://svn.osgeo.org/qgis/trunk@2834 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
sbr00pwb committed Feb 17, 2005
1 parent 81b6f03 commit 6641b37
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 21 deletions.
71 changes: 51 additions & 20 deletions plugins/openmodeller/openmodellergui.cpp
Expand Up @@ -1454,11 +1454,15 @@ for ( unsigned int i = 0; i < lstLayers->count(); i++ )
{
QListBoxItem *item = lstLayers->item( i );
lstProjLayers->insertItem(item->text());
cboOutputMaskLayer->insertItem(item->text());
}

//enable the user to carry on to the next page...
lblOutputLayerCount->setText("("+QString::number(lstProjLayers->count())+")");
setNextEnabled(currentPage(),true);



}


Expand All @@ -1478,12 +1482,21 @@ void OpenModellerGui::pbnOtherInputMask_clicked()
std::cout << "Selected filetype filter is : " << myFileTypeQString.ascii() << std::endl;
if (myFileNameQString==NULL || myFileNameQString=="") return;

//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherInputMaskDirectory", myFileNameQString );

cboMaskLayer->insertItem(myFileNameQString);
cboMaskLayer->setCurrentItem(cboMaskLayer->count()-1);
//Check selected file is a valid gdal file with projection info
if ((isValidGdalFile(myFileNameQString)) && ((isValidGdalProj(myFileNameQString))))
{
//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherInputMaskDirectory", myFileNameQString );

cboMaskLayer->insertItem(myFileNameQString);
cboMaskLayer->setCurrentItem(cboMaskLayer->count()-1);
}
else
{
QMessageBox::warning(this,"Error opening file!","The specified layer is invalid.\n Please check and try again.");
return;
}
}

void OpenModellerGui::pbnOtherOutputMask_clicked()
Expand All @@ -1502,12 +1515,21 @@ void OpenModellerGui::pbnOtherOutputMask_clicked()
std::cout << "Selected filetype filter is : " << myFileTypeQString.ascii() << std::endl;
if (myFileNameQString==NULL || myFileNameQString=="") return;

//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherOutputMaskDirectory", myFileNameQString );

cboOutputMaskLayer->insertItem(myFileNameQString);
cboOutputMaskLayer->setCurrentItem(cboOutputMaskLayer->count()-1);
//Check selected file is a valid gdal file with projection info
if ((isValidGdalFile(myFileNameQString)) && ((isValidGdalProj(myFileNameQString))))
{
//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherOutputMaskDirectory", myFileNameQString );

cboOutputMaskLayer->insertItem(myFileNameQString);
cboOutputMaskLayer->setCurrentItem(cboOutputMaskLayer->count()-1);
}
else
{
QMessageBox::warning(this,"Error opening file!","The specified layer is invalid.\n Please check and try again.");
return;
}
}

void OpenModellerGui::pbnOtherOutputFormat_clicked()
Expand All @@ -1525,11 +1547,20 @@ void OpenModellerGui::pbnOtherOutputFormat_clicked()
);
std::cout << "Selected filetype filter is : " << myFileTypeQString.ascii() << std::endl;
if (myFileNameQString==NULL || myFileNameQString=="") return;

//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherOutputFormatDirectory", myFileNameQString );

cboOutputFormatLayer->insertItem(myFileNameQString);
cboOutputFormatLayer->setCurrentItem(cboOutputFormatLayer->count()-1);

//Check selected file is a valid gdal file with projection info
if ((isValidGdalFile(myFileNameQString)) && ((isValidGdalProj(myFileNameQString))))
{
//store directory where localities file is for next time
QSettings settings;
settings.writeEntry("/openmodeller/otherOutputFormatDirectory", myFileNameQString );

cboOutputFormatLayer->insertItem(myFileNameQString);
cboOutputFormatLayer->setCurrentItem(cboOutputFormatLayer->count()-1);
}
else
{
QMessageBox::warning(this,"Error opening file!","The specified layer is invalid.\n Please check and try again.");
return;
}
}
2 changes: 1 addition & 1 deletion plugins/openmodeller/openmodellergui.h
Expand Up @@ -80,7 +80,7 @@ Q_OBJECT
void pbnOtherOutputFormat_clicked();
static bool isValidGdalFile(const QString theFilename);
static bool isValidGdalProj(const QString theFilename);

private:
OpenModeller * mOpenModeller;
QString modelNameQString;
Expand Down

0 comments on commit 6641b37

Please sign in to comment.