Skip to content
Permalink
Browse files

Merge pull request #4883 from 3nids/copy_datum_218

consider datum transformation when pasting features (fixes #16846)
  • Loading branch information
jef-n committed Jul 19, 2017
2 parents b036b0b + 7b424e6 commit 76e6b529bf6efe0b0f733e1df91471a280733ef2
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/app/qgsclipboard.cpp
@@ -35,6 +35,7 @@
#include "qgsvectorlayer.h"
#include "qgsogrutils.h"
#include "qgsjsonutils.h"
#include "qgsdatumtransformdialog.h"

QgsClipboard::QgsClipboard()
: QObject()
@@ -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 )
{

0 comments on commit 76e6b52

Please sign in to comment.
You can’t perform that action at this time.