[QGIS Commit] r13764 - trunk/qgis/src/plugins/georeferencer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jun 21 08:11:11 EDT 2010


Author: mhugent
Date: 2010-06-21 12:11:11 +0000 (Mon, 21 Jun 2010)
New Revision: 13764

Modified:
   trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.cpp
   trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.h
   trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialogbase.ui
Log:
Show checkbox for worldfile. Save output rasters in the same dir as the original raster if no path is given

Modified: trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.cpp	2010-06-21 07:41:46 UTC (rev 13763)
+++ trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.cpp	2010-06-21 12:11:11 UTC (rev 13764)
@@ -87,7 +87,14 @@
 
   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 @@
   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 @@
     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 @@
     QFileInfo fi( pdfReportFileName );
     s.setValue( "/Plugin-GeoReferencer/lastPDFReportDir", fi.absolutePath() );
   }
+  QDialog::accept();
 }
 
 void QgsTransformSettingsDialog::on_tbnOutputRaster_clicked()
@@ -240,6 +259,30 @@
   }
 }
 
+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;

Modified: trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.h	2010-06-21 07:41:46 UTC (rev 13763)
+++ trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialog.h	2010-06-21 12:11:11 UTC (rev 13764)
@@ -45,6 +45,8 @@
     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:

Modified: trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialogbase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialogbase.ui	2010-06-21 07:41:46 UTC (rev 13763)
+++ trunk/qgis/src/plugins/georeferencer/qgstransformsettingsdialogbase.ui	2010-06-21 12:11:11 UTC (rev 13764)
@@ -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">



More information about the QGIS-commit mailing list