Skip to content

Commit

Permalink
Added seperate output format combo and the ability to select masks la…
Browse files Browse the repository at this point in the history
…yers other than those used for model building/projection.

git-svn-id: http://svn.osgeo.org/qgis/trunk@2829 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
sbr00pwb committed Feb 17, 2005
1 parent e01b234 commit 9a77cd5
Show file tree
Hide file tree
Showing 4 changed files with 347 additions and 185 deletions.
113 changes: 108 additions & 5 deletions plugins/openmodeller/openmodellergui.cpp
Expand Up @@ -466,7 +466,19 @@ void OpenModellerGui::formSelected(const QString &thePageNameQString)


}

if (thePageNameQString==tr("Step 6 of 9"))
{
//MASK AND FORMAT LAYERS

for ( unsigned int i = 0; i < cboOutputMaskLayer->count(); i++ )
{
cboOutputMaskLayer->setCurrentItem( i );
QString item = cboOutputMaskLayer->currentText();
cboOutputFormatLayer->insertItem(item);
}


}

if (thePageNameQString==tr("Step 8 of 9"))
{
Expand Down Expand Up @@ -647,7 +659,10 @@ void OpenModellerGui::makeConfigFile()
myQTextStream << tr("\n\n##\n");
myQTextStream << tr("# A layer that specifies the region of interest for model projection\n");
myQTextStream << tr("Output Mask = ") << outputMaskNameQString << "\n";
myQTextStream << tr("\n\n##\n");
myQTextStream << tr("\n\n##\n");
myQTextStream << tr("# A layer that specifies the region of interest for model projection\n");
myQTextStream << tr("Output Format = ") << outputFormatQString << "\n";
myQTextStream << tr("\n\n##\n");
myQTextStream << tr("## Model Output Settings\n");
myQTextStream << tr("##\n\n");

Expand Down Expand Up @@ -736,6 +751,7 @@ void OpenModellerGui::accept()

maskNameQString=cboMaskLayer->currentText();
outputMaskNameQString=cboOutputMaskLayer->currentText();
outputFormatQString=cboOutputFormatLayer->currentText();
taxonNameQString=cboTaxon->currentText();
makeConfigFile();
parseAndRun(outputFileNameQString+".cfg");
Expand Down Expand Up @@ -1071,7 +1087,7 @@ void OpenModellerGui::leOutputDirectory_textChanged( const QString &theOutputDir
}
}

void OpenModellerGui::pbnSelectLayerFolder_clicked()
/*void OpenModellerGui::pbnSelectLayerFolder_clicked()
{
QSettings settings;
Expand All @@ -1097,7 +1113,7 @@ void OpenModellerGui::pbnSelectLayerFolder_clicked()
//enable the user to carry on to the next page...
setNextEnabled(currentPage(),true);
}

*/
void OpenModellerGui::traverseDirectories(const QString& dirname, QListBox* theListBox, QComboBox* theComboBox)
{
QDir dir(dirname);
Expand Down Expand Up @@ -1344,7 +1360,7 @@ void OpenModellerGui::pbnSelectLayerFileProj_clicked()
}
}

void OpenModellerGui::pbnSelectLayerFolderProj_clicked()
/*void OpenModellerGui::pbnSelectLayerFolderProj_clicked()
{
QSettings settings;
Expand All @@ -1368,6 +1384,7 @@ void OpenModellerGui::pbnSelectLayerFolderProj_clicked()
//enable the user to carry on to the next page...
setNextEnabled(currentPage(),true);
}
*/

void OpenModellerGui::pbnRemoveLayerFileProj_clicked()
{
Expand Down Expand Up @@ -1430,3 +1447,89 @@ bool OpenModellerGui::checkLayersMatch()
}
}

void OpenModellerGui::pbnCopyLayers_clicked()
{
lstProjLayers->clear();
for ( unsigned int i = 0; i < lstLayers->count(); i++ )
{
QListBoxItem *item = lstLayers->item( i );
lstProjLayers->insertItem(item->text());
}

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


void OpenModellerGui::pbnOtherInputMask_clicked()
{
std::cout << " OpenModellerGui::pbnOtherInputMask_clicked() " << std::endl;
QString myFileTypeQString;
QString myGDALFilterString="GDAL (*.tif; *.asc; *.bil;*.jpg;*.adf)";
QString myFileNameQString = QFileDialog::getOpenFileName(
"" , //initial dir
myGDALFilterString, //filters to select
this , //parent dialog
"OpenFileDialog" , //QFileDialog qt object name
"Select layer file" , //caption
&myFileTypeQString //the pointer to store selected filter
);
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);
}

void OpenModellerGui::pbnOtherOutputMask_clicked()
{
std::cout << " OpenModellerGui::pbnOtherOutputMask_clicked() " << std::endl;
QString myFileTypeQString;
QString myGDALFilterString="GDAL (*.tif; *.asc; *.bil;*.jpg;*.adf)";
QString myFileNameQString = QFileDialog::getOpenFileName(
"" , //initial dir
myGDALFilterString, //filters to select
this , //parent dialog
"OpenFileDialog" , //QFileDialog qt object name
"Select layer file" , //caption
&myFileTypeQString //the pointer to store selected filter
);
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);
}

void OpenModellerGui::pbnOtherOutputFormat_clicked()
{
std::cout << " OpenModellerGui::pbnOtherOutputFormat_clicked() " << std::endl;
QString myFileTypeQString;
QString myGDALFilterString="GDAL (*.tif; *.asc; *.bil;*.jpg;*.adf)";
QString myFileNameQString = QFileDialog::getOpenFileName(
"" , //initial dir
myGDALFilterString, //filters to select
this , //parent dialog
"OpenFileDialog" , //QFileDialog qt object name
"Select layer file" , //caption
&myFileTypeQString //the pointer to store selected filter
);
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);
}
9 changes: 7 additions & 2 deletions plugins/openmodeller/openmodellergui.h
Expand Up @@ -67,13 +67,17 @@ Q_OBJECT
void cboModelAlgorithm_highlighted( const QString &theModelAlgorithm );
void leOutputFileName_textChanged( const QString &theOutputFileName);
void leOutputDirectory_textChanged( const QString &theOutputDirectory);
void pbnSelectLayerFolder_clicked();
void traverseDirectories(const QString& dirname, QListBox*, QComboBox*);
bool checkLocalitiesFileFormat(const QString);
void pbnDefaultParameters_clicked();
void pbnSelectLayerFolderProj_clicked();
//void pbnSelectLayerFolder_clicked();
//void pbnSelectLayerFolderProj_clicked();
void pbnRemoveLayerFileProj_clicked();
void pbnSelectLayerFileProj_clicked();
void pbnCopyLayers_clicked();
void pbnOtherInputMask_clicked();
void pbnOtherOutputMask_clicked();
void pbnOtherOutputFormat_clicked();
static bool isValidGdalFile(const QString theFilename);
static bool isValidGdalProj(const QString theFilename);

Expand All @@ -89,6 +93,7 @@ Q_OBJECT
QString outputMaskNameQString;
QStringList extraParametersQStringList;
QString outputFileNameQString;
QString outputFormatQString;
bool useTheseSettingsAgainFlag;
typedef QMap<QString, QWidget *> ParametersMap;
//setup QMap object and layout for the frame into which the controls will go
Expand Down

0 comments on commit 9a77cd5

Please sign in to comment.