Navigation Menu

Skip to content

Commit

Permalink
Show checkbox for worldfile. Save output rasters in the same dir as t…
Browse files Browse the repository at this point in the history
…he original raster if no path is given

git-svn-id: http://svn.osgeo.org/qgis/trunk@13764 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 21, 2010
1 parent 42c1554 commit 350fcc4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 14 deletions.
49 changes: 46 additions & 3 deletions src/plugins/georeferencer/qgstransformsettingsdialog.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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
{
Expand All @@ -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() );
Expand All @@ -166,6 +184,7 @@ void QgsTransformSettingsDialog::accept()
QFileInfo fi( pdfReportFileName );
s.setValue( "/Plugin-GeoReferencer/lastPDFReportDir", fi.absolutePath() );
}
QDialog::accept();
}

void QgsTransformSettingsDialog::on_tbnOutputRaster_clicked()
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/georeferencer/qgstransformsettingsdialog.h
Expand Up @@ -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:
Expand Down
29 changes: 18 additions & 11 deletions src/plugins/georeferencer/qgstransformsettingsdialogbase.ui
Expand Up @@ -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"/>
Expand All @@ -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"/>
Expand All @@ -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"/>
Expand All @@ -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>
Expand All @@ -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">
Expand All @@ -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">
Expand Down

0 comments on commit 350fcc4

Please sign in to comment.