Index: src/plugins/georeferencer/qgsgcplistmodel.cpp =================================================================== --- src/plugins/georeferencer/qgsgcplistmodel.cpp (Revision 13522) +++ src/plugins/georeferencer/qgsgcplistmodel.cpp (Arbeitskopie) @@ -16,7 +16,7 @@ #include "qgsgcplist.h" #include "qgsgcplistmodel.h" - +#include "qgis.h" #include "qgsgeorefdatapoint.h" #include "qgsgeoreftransform.h" @@ -85,15 +85,11 @@ if ( !mGCPList ) return; -// // Setup table header - QStringList itemLabels; -// // Set column headers - itemLabels << "on/off" << "id" << "srcX" << "srcY" << "dstX" << "dstY" << "dX" << "dY" << "residual"; -// setColumnCount(itemLabels.size()); - setHorizontalHeaderLabels( itemLabels ); - setRowCount( mGCPList->size() ); + bool bTransformUpdated = false; + bool wldTransform = false; + double wldScaleX, wldScaleY, rotation; + QgsPoint origin; - bool bTransformUpdated = false; if ( mGeorefTransform ) { vector mapCoords, pixelCoords; @@ -101,8 +97,32 @@ // TODO: the parameters should probable be updated externally (by user interaction) bTransformUpdated = mGeorefTransform->updateParametersFromGCPs( mapCoords, pixelCoords ); + //transformation that involves only scaling and rotation (linear or helmert) ? + wldTransform = mGeorefTransform->getOriginScaleRotation( origin, wldScaleX, wldScaleY, rotation ); + if ( wldTransform && !doubleNear( rotation, 0.0 ) ) + { + wldScaleX *= cos( rotation ); + wldScaleY *= cos( rotation ); + } + if ( wldTransform ) + { + + } } + // // Setup table header + QStringList itemLabels; + if ( wldTransform ) + { + itemLabels << "on/off" << "id" << "srcX" << "srcY" << "dstX" << "dstY" << QString( "dX[" ) + tr( "map units" ) + "]" << QString( "dY[" ) + tr( "map units" ) + "]" << "residual"; + } + else + { + itemLabels << "on/off" << "id" << "srcX" << "srcY" << "dstX" << "dstY" << QString( "dX[" ) + tr( "pixels" ) + "]" << QString( "dY[" ) + tr( "pixels" ) + "]" << "residual"; + } + setHorizontalHeaderLabels( itemLabels ); + setRowCount( mGCPList->size() ); + for ( int i = 0; i < mGCPList->sizeAll(); ++i ) { int j = 0; @@ -135,8 +155,13 @@ // As transforms of order >=2 are not invertible, we are only // interested in the residual in this direction mGeorefTransform->transformWorldToRaster( p->mapCoords(), dst ); - dX = ( dst.x() - p->pixelCoords().x() ); + dX = ( dst.x() - p->pixelCoords().x() ); dY = -( dst.y() - p->pixelCoords().y() ); + if ( wldTransform ) + { + dX *= wldScaleX; + dY *= wldScaleY; + } residual = sqrt( dX * dX + dY * dY ); } else @@ -152,7 +177,7 @@ if ( residual >= 0.f ) { setItem( i, j++, QGSSTANDARDITEM( dX ) /*create_item(dX)*/ ); - setItem( i, j++, QGSSTANDARDITEM( dY ) /*create_item(-dY)*/); + setItem( i, j++, QGSSTANDARDITEM( dY ) /*create_item(-dY)*/ ); setItem( i, j++, QGSSTANDARDITEM( residual ) /*create_item(residual)*/ ); } else Index: src/plugins/georeferencer/qgsgeorefplugingui.cpp =================================================================== --- src/plugins/georeferencer/qgsgeorefplugingui.cpp (Revision 13523) +++ src/plugins/georeferencer/qgsgeorefplugingui.cpp (Arbeitskopie) @@ -108,7 +108,6 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui() { - QgsTransformSettingsDialog::resetSettings(); clearGCPData(); // delete layer (and don't signal it as it's our private layer) @@ -1226,15 +1225,6 @@ //transformation that involves only scaling and rotation (linear or helmert) ? bool wldTransform = transform.getOriginScaleRotation( origin, scaleX, scaleY, rotation ); - //consider rotation in scale parameter - double wldScaleX = scaleX; - double wldScaleY = scaleY; - if ( wldTransform && !doubleNear( rotation, 0.0 ) ) - { - wldScaleX *= cos( rotation ); - wldScaleY *= cos( rotation ); - } - if ( wldTransform ) { QString parameterTitle = tr( "Transformation parameters" ); @@ -1277,10 +1267,8 @@ { if (( *gcpIt )->isEnabled() ) { - resXMap = ( *gcpIt )->residual().x() * wldScaleX; - resYMap = ( *gcpIt )->residual().y() * wldScaleY; - sumVxSquare += ( resXMap * resXMap ); - sumVySquare += ( resYMap * resYMap ); + sumVxSquare += (( *gcpIt )->residual().x() * ( *gcpIt )->residual().x() ); + sumVySquare += (( *gcpIt )->residual().y() * ( *gcpIt )->residual().y() ); } } @@ -1326,7 +1314,7 @@ //convert residual scale bar plot to map units if scaling is equal in x- and y-direction (e.g. helmert) if ( wldTransform ) { - if ( doubleNear( wldScaleX, wldScaleY ) ) + if ( doubleNear( scaleX, scaleX ) ) { resPlotItem->setPixelToMapUnits( scaleX ); resPlotItem->setConvertScaleToMapUnits( true ); @@ -1354,17 +1342,7 @@ { QStringList currentGCPStrings; QPointF residual = ( *gcpIt )->residual(); - double residualX = residual.x(); - if ( wldTransform ) - { - residualX *= wldScaleX; - } - double residualY = residual.y(); - if ( wldTransform ) - { - residualY *= wldScaleY; - } - double residualTot = sqrt( residualX * residualX + residualY * residualY ); + double residualTot = sqrt( residual.x() * residual.x() + residual.y() * residual.y() ); currentGCPStrings << QString::number(( *gcpIt )->id() ); if (( *gcpIt )->isEnabled() ) @@ -1376,7 +1354,7 @@ currentGCPStrings << tr( "no" ); } currentGCPStrings << QString::number(( *gcpIt )->pixelCoords().x(), 'f', 2 ) << QString::number(( *gcpIt )->pixelCoords().y(), 'f', 2 ) << QString::number(( *gcpIt )->mapCoords().x(), 'f', 2 )\ - << QString::number(( *gcpIt )->mapCoords().y(), 'f', 2 ) << QString::number( residualX ) << QString::number( residualY ) << QString::number( residualTot ); + << QString::number(( *gcpIt )->mapCoords().y(), 'f', 2 ) << QString::number( residual.x() ) << QString::number( residual.y() ) << QString::number( residualTot ); gcpTable->addRow( currentGCPStrings ); }