Skip to content
Permalink
Browse files
Show checkbox for worldfile. Save output rasters in the same dir as t…
…he original raster if no path is given

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13764 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 21, 2010
1 parent caa18f7 commit 074e85e1a5198f1e360f1c24242d52e66ced20ed
@@ -87,7 +87,14 @@ void QgsTransformSettingsDialog::getTransformSettings( QgsGeorefTransform::Trans

rm = ( QgsImageWarper::ResamplingMethod )cmbResampling->currentIndex();
comprMethod = cmbCompressionComboBox->currentText();
raster = leOutputRaster->text();
if ( mWorldFileCheckBox->isChecked() )
{
raster = "";
}
else
{
raster = leOutputRaster->text();
}
proj = leTargetSRS->text();
pdfReportFile = mReportFileLineEdit->text();
zt = cbxZeroAsTrans->isChecked();
@@ -134,12 +141,11 @@ void QgsTransformSettingsDialog::accept()
int minGCPpoints;
if ( checkGCPpoints( cmbTransformType->currentIndex(), minGCPpoints ) )
{
if ( leOutputRaster->text().isEmpty() && cmbTransformType->currentIndex() > 1 )
if ( leOutputRaster->text().isEmpty() )
{
QMessageBox::information( this, tr( "Info" ), tr( "Please set output name" ) );
return;
}
QDialog::accept();
}
else
{
@@ -150,6 +156,18 @@ void QgsTransformSettingsDialog::accept()
return;
}

//if the file path is relative, make it relative to the raster file directory
QString outputRasterName = leOutputRaster->text();
QFileInfo rasterFileInfo( mModifiedRaster );
QFileInfo outputFileInfo( rasterFileInfo.absoluteDir(), outputRasterName );

if ( outputFileInfo.fileName().isEmpty() || !outputFileInfo.dir().exists() )
{
QMessageBox::information( this, tr( "Info" ), tr( "Invalid output file name" ) );
return;
}
leOutputRaster->setText( outputFileInfo.absoluteFilePath() );

QSettings s;
s.setValue( "/Plugin-GeoReferencer/lasttransformation", cmbTransformType->currentIndex() );
s.setValue( "/Plugin-GeoReferencer/lastresampling", cmbResampling->currentIndex() );
@@ -166,6 +184,7 @@ void QgsTransformSettingsDialog::accept()
QFileInfo fi( pdfReportFileName );
s.setValue( "/Plugin-GeoReferencer/lastPDFReportDir", fi.absolutePath() );
}
QDialog::accept();
}

void QgsTransformSettingsDialog::on_tbnOutputRaster_clicked()
@@ -240,6 +259,30 @@ void QgsTransformSettingsDialog::on_leTargetSRS_textChanged( const QString &text
}
}

void QgsTransformSettingsDialog::on_cmbTransformType_currentIndexChanged( const QString& text )
{
if ( text == tr( "Linear" ) )
{
mWorldFileCheckBox->setEnabled( true );
}
else
{
mWorldFileCheckBox->setEnabled( false );
}
}

void QgsTransformSettingsDialog::on_mWorldFileCheckBox_stateChanged( int state )
{
bool enableOutputRaster = true;
if ( state == Qt::Checked )
{
enableOutputRaster = false;
}
label_2->setEnabled( enableOutputRaster );
leOutputRaster->setEnabled( enableOutputRaster );
tbnOutputRaster->setEnabled( enableOutputRaster );
}

bool QgsTransformSettingsDialog::checkGCPpoints( int count, int &minGCPpoints )
{
QgsGeorefTransform georefTransform;
@@ -45,6 +45,8 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti
void on_tbnTargetSRS_clicked();
void on_tbnReportFile_clicked();
void on_leTargetSRS_textChanged( const QString &text );
void on_cmbTransformType_currentIndexChanged( const QString& text );
void on_mWorldFileCheckBox_stateChanged( int state );
QIcon getThemeIcon( const QString &theName );

private:
@@ -115,14 +115,14 @@
</item>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Output raster:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="leOutputRaster"/>
@@ -136,14 +136,14 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Target SRS:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="leTargetSRS"/>
@@ -157,14 +157,14 @@
</item>
</layout>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Generate pdf report:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="mReportFileLineEdit"/>
@@ -178,21 +178,21 @@
</item>
</layout>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QCheckBox" name="cbxUserResolution">
<property name="text">
<string>Set Target Resolution</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Horizontal</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QgsValidatedDoubleSpinBox" name="dsbHorizRes">
<property name="decimals">
<number>5</number>
@@ -205,14 +205,14 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Vertical</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="9" column="1">
<widget class="QgsValidatedDoubleSpinBox" name="dsbVerticalRes">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -234,6 +234,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="mWorldFileCheckBox">
<property name="text">
<string>Create world file</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">

0 comments on commit 074e85e

Please sign in to comment.