Skip to content

Commit 76e6b52

Browse files
authoredJul 19, 2017
Merge pull request #4883 from 3nids/copy_datum_218
consider datum transformation when pasting features (fixes #16846)
2 parents b036b0b + 7b424e6 commit 76e6b52

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎src/app/qgsclipboard.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "qgsvectorlayer.h"
3636
#include "qgsogrutils.h"
3737
#include "qgsjsonutils.h"
38+
#include "qgsdatumtransformdialog.h"
3839

3940
QgsClipboard::QgsClipboard()
4041
: QObject()
@@ -265,6 +266,28 @@ QgsFeatureList QgsClipboard::transformedCopyOf( const QgsCoordinateReferenceSyst
265266
QgsFeatureList featureList = copyOf( fields );
266267
QgsCoordinateTransform ct( crs(), destCRS );
267268

269+
//ask user about datum transformation
270+
QSettings settings;
271+
QList< QList< int > > dt = QgsCoordinateTransform::datumTransformations( crs(), destCRS );
272+
if ( dt.size() > 1 && settings.value( "Projections/showDatumTransformDialog", false ).toBool() )
273+
{
274+
QgsDatumTransformDialog d( tr( "Datum transformation for copied features" ), dt );
275+
if ( d.exec() == QDialog::Accepted )
276+
{
277+
QList< int > sdt = d.selectedDatumTransform();
278+
if ( !sdt.isEmpty() )
279+
{
280+
ct.setSourceDatumTransform( sdt.at( 0 ) );
281+
}
282+
if ( sdt.size() > 1 )
283+
{
284+
ct.setDestinationDatumTransform( sdt.at( 1 ) );
285+
}
286+
ct.initialise();
287+
}
288+
}
289+
290+
268291
QgsDebugMsg( "transforming clipboard." );
269292
for ( QgsFeatureList::iterator iter = featureList.begin(); iter != featureList.end(); ++iter )
270293
{

0 commit comments

Comments
 (0)
Please sign in to comment.