Skip to content
Permalink
Browse files

Tweak transform logic (only remove src/dest transforms when both tran…

…sforms are -1)
  • Loading branch information
nyalldawson committed Nov 6, 2017
1 parent 257278f commit 71f84f77fbfaed6a39d8aec2e252e0cfe141159e
@@ -115,7 +115,7 @@ bool QgsCoordinateTransformContext::addSourceDestinationDatumTransform( const Qg

d.detach();
d->mLock.lockForWrite();
if ( sourceTransform == -1 || destinationTransform == -1 )
if ( sourceTransform == -1 && destinationTransform == -1 )
{
d->mSourceDestDatumTransforms.remove( qMakePair( sourceCrs.authid(), destinationCrs.authid() ) );
}
@@ -129,11 +129,18 @@ def testSourceDestinationDatumTransforms(self):
# remove existing
self.assertTrue(context.addSourceDestinationDatumTransform(QgsCoordinateReferenceSystem(3111),
QgsCoordinateReferenceSystem(4283), -1, 3))
self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:28356', 'EPSG:4283'): (3, 4),
self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:3111', 'EPSG:4283'): (-1, 3),
('EPSG:28356', 'EPSG:4283'): (3, 4),
('EPSG:28356', 'EPSG:28357'): (9, 11)})
self.assertTrue(context.addSourceDestinationDatumTransform(QgsCoordinateReferenceSystem(28356),
QgsCoordinateReferenceSystem(28357), 1, -1))
self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:28356', 'EPSG:4283'): (3, 4)})
self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:3111', 'EPSG:4283'): (-1, 3),
('EPSG:28356', 'EPSG:4283'): (3, 4),
('EPSG:28356', 'EPSG:28357'): (1, -1)})
self.assertTrue(context.addSourceDestinationDatumTransform(QgsCoordinateReferenceSystem(28356),
QgsCoordinateReferenceSystem(28357), -1, -1))
self.assertEqual(context.sourceDestinationDatumTransforms(), {('EPSG:3111', 'EPSG:4283'): (-1, 3),
('EPSG:28356', 'EPSG:4283'): (3, 4)})

context.clear()
self.assertEqual(context.sourceDestinationDatumTransforms(), {})

0 comments on commit 71f84f7

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