Skip to content

Commit

Permalink
show residuals in pixel for non-linear transformations
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13626 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 2, 2010
1 parent 0ee10f2 commit dcbbbfc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/plugins/georeferencer/qgsgcplistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ void QgsGCPListModel::updateModel()
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" );
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString& fileName, const QgsG

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" );
}
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/georeferencer/qgsgeoreftransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ void QgsGeorefTransform::selectTransformParametrisation( TransformParametrisatio
}
}

bool QgsGeorefTransform::providesAccurateInverseTransformation() const
{
return ( mTransformParametrisation == Linear \
|| mTransformParametrisation == Helmert \
|| mTransformParametrisation == PolynomialOrder1 );
}

bool QgsGeorefTransform::parametersInitialized() const
{
return mParametersInitialized;
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/georeferencer/qgsgeoreftransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class QgsGeorefTransform : public QgsGeorefTransformInterface
//! \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;

Expand Down

0 comments on commit dcbbbfc

Please sign in to comment.