Skip to content

Commit dcbbbfc

Browse files
author
mhugent
committed
show residuals in pixel for non-linear transformations
git-svn-id: http://svn.osgeo.org/qgis/trunk@13626 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0ee10f2 commit dcbbbfc

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

src/plugins/georeferencer/qgsgcplistmodel.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,22 @@ void QgsGCPListModel::updateModel()
9292
vector<QgsPoint> mapCoords, pixelCoords;
9393
mGCPList->createGCPVectors( mapCoords, pixelCoords );
9494

95-
// TODO: the parameters should probable be updated externally (by user interaction)
96-
bTransformUpdated = mGeorefTransform->updateParametersFromGCPs( mapCoords, pixelCoords );
95+
9796

9897
// // Setup table header
9998
QStringList itemLabels;
10099
QString unitType;
101100
QSettings s;
102-
if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" )
101+
bool mapUnitsPossible = false;
102+
103+
if ( mGeorefTransform )
104+
{
105+
bTransformUpdated = mGeorefTransform->updateParametersFromGCPs( mapCoords, pixelCoords );
106+
mapUnitsPossible = mGeorefTransform->providesAccurateInverseTransformation();
107+
}
108+
109+
110+
if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" && mapUnitsPossible )
103111
{
104112
unitType = tr( "map units" );
105113
}

src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<item row="1" column="0">
7171
<widget class="QRadioButton" name="mMapUnitsButton">
7272
<property name="text">
73-
<string>Map units</string>
73+
<string>Use map units if possible</string>
7474
</property>
7575
</widget>
7676
</item>

src/plugins/georeferencer/qgsgeorefplugingui.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString& fileName, const QgsG
13441344

13451345
QString residualUnits;
13461346
QSettings s;
1347-
if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" )
1347+
if ( s.value( "/Plugin-GeoReferencer/Config/ResidualUnits" ) == "mapUnits" && mGeorefTransform.providesAccurateInverseTransformation() )
13481348
{
13491349
residualUnits = tr( "map units" );
13501350
}

src/plugins/georeferencer/qgsgeoreftransform.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ void QgsGeorefTransform::selectTransformParametrisation( TransformParametrisatio
150150
}
151151
}
152152

153+
bool QgsGeorefTransform::providesAccurateInverseTransformation() const
154+
{
155+
return ( mTransformParametrisation == Linear \
156+
|| mTransformParametrisation == Helmert \
157+
|| mTransformParametrisation == PolynomialOrder1 );
158+
}
159+
153160
bool QgsGeorefTransform::parametersInitialized() const
154161
{
155162
return mParametersInitialized;

src/plugins/georeferencer/qgsgeoreftransform.h

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface
8282
//! \brief The transform parametrisation currently in use.
8383
TransformParametrisation transformParametrisation() const;
8484

85+
/**True for linear, Helmert, first order polynomial*/
86+
bool providesAccurateInverseTransformation() const;
87+
8588
//! \returns whether the parameters of this transform have been initialised by \ref updateParametersFromGCPs
8689
bool parametersInitialized() const;
8790

0 commit comments

Comments
 (0)