Skip to content

Commit

Permalink
consider datum transformation when pasting features
Browse files Browse the repository at this point in the history
proper fix in master bae6d56 could not be cherry-picked easily, this is not a perfect solution but it does solve the issue
  • Loading branch information
3nids committed Jul 19, 2017
1 parent b036b0b commit 7b424e6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/qgsclipboard.cpp
Expand Up @@ -35,6 +35,7 @@
#include "qgsvectorlayer.h"
#include "qgsogrutils.h"
#include "qgsjsonutils.h"
#include "qgsdatumtransformdialog.h"

QgsClipboard::QgsClipboard()
: QObject()
Expand Down Expand Up @@ -265,6 +266,28 @@ QgsFeatureList QgsClipboard::transformedCopyOf( const QgsCoordinateReferenceSyst
QgsFeatureList featureList = copyOf( fields );
QgsCoordinateTransform ct( crs(), destCRS );

//ask user about datum transformation
QSettings settings;
QList< QList< int > > dt = QgsCoordinateTransform::datumTransformations( crs(), destCRS );
if ( dt.size() > 1 && settings.value( "Projections/showDatumTransformDialog", false ).toBool() )
{
QgsDatumTransformDialog d( tr( "Datum transformation for copied features" ), dt );
if ( d.exec() == QDialog::Accepted )
{
QList< int > sdt = d.selectedDatumTransform();
if ( !sdt.isEmpty() )
{
ct.setSourceDatumTransform( sdt.at( 0 ) );
}
if ( sdt.size() > 1 )
{
ct.setDestinationDatumTransform( sdt.at( 1 ) );
}
ct.initialise();
}
}


QgsDebugMsg( "transforming clipboard." );
for ( QgsFeatureList::iterator iter = featureList.begin(); iter != featureList.end(); ++iter )
{
Expand Down

0 comments on commit 7b424e6

Please sign in to comment.