Skip to content

Commit

Permalink
Merge pull request #4883 from 3nids/copy_datum_218
Browse files Browse the repository at this point in the history
consider datum transformation when pasting features (fixes #16846)
  • Loading branch information
jef-n authored Jul 19, 2017
2 parents b036b0b + 7b424e6 commit 76e6b52
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/app/qgsclipboard.cpp
Original file line number Diff line number Diff line change
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 76e6b52

Please sign in to comment.