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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jun 2 06:52:41 EDT 2010


Author: mhugent
Date: 2010-06-02 06:52:41 -0400 (Wed, 02 Jun 2010)
New Revision: 13626

Modified:
   trunk/qgis/src/plugins/georeferencer/qgsgcplistmodel.cpp
   trunk/qgis/src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui
   trunk/qgis/src/plugins/georeferencer/qgsgeorefplugingui.cpp
   trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp
   trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.h
Log:
show residuals in pixel for non-linear transformations

Modified: trunk/qgis/src/plugins/georeferencer/qgsgcplistmodel.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgcplistmodel.cpp	2010-06-02 10:47:00 UTC (rev 13625)
+++ trunk/qgis/src/plugins/georeferencer/qgsgcplistmodel.cpp	2010-06-02 10:52:41 UTC (rev 13626)
@@ -92,15 +92,23 @@
   vector<QgsPoint> mapCoords, pixelCoords;
   mGCPList->createGCPVectors( mapCoords, pixelCoords );
 
-  // TODO: the parameters should probable be updated externally (by user interaction)
-  bTransformUpdated = mGeorefTransform->updateParametersFromGCPs( mapCoords, pixelCoords );
 
+
   //  // Setup table header
   QStringList itemLabels;
   QString unitType;
   QSettings s;
-  if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" )
+  bool mapUnitsPossible = false;
+
+  if ( mGeorefTransform )
   {
+    bTransformUpdated = mGeorefTransform->updateParametersFromGCPs( mapCoords, pixelCoords );
+    mapUnitsPossible = mGeorefTransform->providesAccurateInverseTransformation();
+  }
+
+
+  if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" && mapUnitsPossible )
+  {
     unitType = tr( "map units" );
   }
   else

Modified: trunk/qgis/src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui	2010-06-02 10:47:00 UTC (rev 13625)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui	2010-06-02 10:52:41 UTC (rev 13626)
@@ -70,7 +70,7 @@
       <item row="1" column="0">
        <widget class="QRadioButton" name="mMapUnitsButton">
         <property name="text">
-         <string>Map units</string>
+         <string>Use map units if possible</string>
         </property>
        </widget>
       </item>

Modified: trunk/qgis/src/plugins/georeferencer/qgsgeorefplugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeorefplugingui.cpp	2010-06-02 10:47:00 UTC (rev 13625)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeorefplugingui.cpp	2010-06-02 10:52:41 UTC (rev 13626)
@@ -1344,7 +1344,7 @@
 
   QString residualUnits;
   QSettings s;
-  if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" )
+  if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" && mGeorefTransform.providesAccurateInverseTransformation() )
   {
     residualUnits = tr( "map units" );
   }

Modified: trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp	2010-06-02 10:47:00 UTC (rev 13625)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp	2010-06-02 10:52:41 UTC (rev 13626)
@@ -150,6 +150,13 @@
   }
 }
 
+bool QgsGeorefTransform::providesAccurateInverseTransformation() const
+{
+  return ( mTransformParametrisation == Linear \
+           || mTransformParametrisation == Helmert \
+           || mTransformParametrisation == PolynomialOrder1 );
+}
+
 bool QgsGeorefTransform::parametersInitialized() const
 {
   return mParametersInitialized;

Modified: trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.h	2010-06-02 10:47:00 UTC (rev 13625)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.h	2010-06-02 10:52:41 UTC (rev 13626)
@@ -82,6 +82,9 @@
     //! \brief The transform parametrisation currently in use.
     TransformParametrisation transformParametrisation() const;
 
+    /**True for linear, Helmert, first order polynomial*/
+    bool providesAccurateInverseTransformation() const;
+
     //! \returns whether the parameters of this transform have been initialised by \ref updateParametersFromGCPs
     bool parametersInitialized() const;
 



More information about the QGIS-commit mailing list