@@ -43,9 +43,9 @@ bool QgsDatumTransformDialog::run( const QgsCoordinateReferenceSystem &sourceCrs
43
43
{
44
44
if ( dlg.exec () )
45
45
{
46
- QPair< QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > dt = dlg.selectedDatumTransforms ();
46
+ const TransformInfo dt = dlg.selectedDatumTransform ();
47
47
QgsCoordinateTransformContext context = QgsProject::instance ()->transformContext ();
48
- context.addSourceDestinationDatumTransform ( dt.first . first , dt.second . first , dt.first . second , dt.second . second );
48
+ context.addSourceDestinationDatumTransform ( dt.sourceCrs , dt.destinationCrs , dt.sourceTransformId , dt.destinationTransformId );
49
49
QgsProject::instance ()->setTransformContext ( context );
50
50
return true ;
51
51
}
@@ -255,15 +255,15 @@ void QgsDatumTransformDialog::accept()
255
255
QgsSettings settings;
256
256
settings.beginGroup ( QStringLiteral ( " /Projections" ) );
257
257
258
- QPair< QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > dt = selectedDatumTransforms ();
258
+ const TransformInfo dt = selectedDatumTransform ();
259
259
260
- QString srcAuthId = dt.first . first .authid ();
261
- QString destAuthId = dt.second . first .authid ();
262
- int sourceDatumTransform = dt.first . second ;
260
+ QString srcAuthId = dt.sourceCrs .authid ();
261
+ QString destAuthId = dt.destinationCrs .authid ();
262
+ int sourceDatumTransform = dt.sourceTransformId ;
263
263
QString sourceDatumProj;
264
264
if ( sourceDatumTransform >= 0 )
265
265
sourceDatumProj = QgsDatumTransform::datumTransformToProj ( sourceDatumTransform );
266
- int destinationDatumTransform = dt.second . second ;
266
+ int destinationDatumTransform = dt.destinationTransformId ;
267
267
QString destinationDatumProj;
268
268
if ( destinationDatumTransform >= 0 )
269
269
destinationDatumProj = QgsDatumTransform::datumTransformToProj ( destinationDatumTransform );
@@ -292,23 +292,23 @@ bool QgsDatumTransformDialog::shouldAskUserForSelection() const
292
292
return false ;
293
293
}
294
294
295
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > QgsDatumTransformDialog::defaultDatumTransform () const
295
+ QgsDatumTransformDialog::TransformInfo QgsDatumTransformDialog::defaultDatumTransform () const
296
296
{
297
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > preferredNonDeprecated;
298
- preferredNonDeprecated.first . first = mSourceCrs ;
299
- preferredNonDeprecated.second . first = mDestinationCrs ;
297
+ TransformInfo preferredNonDeprecated;
298
+ preferredNonDeprecated.sourceCrs = mSourceCrs ;
299
+ preferredNonDeprecated.destinationCrs = mDestinationCrs ;
300
300
bool foundPreferredNonDeprecated = false ;
301
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > preferred;
302
- preferred.first . first = mSourceCrs ;
303
- preferred.second . first = mDestinationCrs ;
301
+ TransformInfo preferred;
302
+ preferred.sourceCrs = mSourceCrs ;
303
+ preferred.destinationCrs = mDestinationCrs ;
304
304
bool foundPreferred = false ;
305
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > nonDeprecated;
306
- nonDeprecated.first . first = mSourceCrs ;
307
- nonDeprecated.second . first = mDestinationCrs ;
305
+ TransformInfo nonDeprecated;
306
+ nonDeprecated.sourceCrs = mSourceCrs ;
307
+ nonDeprecated.destinationCrs = mDestinationCrs ;
308
308
bool foundNonDeprecated = false ;
309
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > fallback;
310
- fallback.first . first = mSourceCrs ;
311
- fallback.second . first = mDestinationCrs ;
309
+ TransformInfo fallback;
310
+ fallback.sourceCrs = mSourceCrs ;
311
+ fallback.destinationCrs = mDestinationCrs ;
312
312
bool foundFallback = false ;
313
313
314
314
for ( const QgsDatumTransform::TransformPair &transform : qgis::as_const ( mDatumTransforms ) )
@@ -321,28 +321,28 @@ QPair<QPair<QgsCoordinateReferenceSystem, int>, QPair<QgsCoordinateReferenceSyst
321
321
if ( !foundPreferredNonDeprecated && ( ( srcInfo.preferred && !srcInfo.deprecated ) || transform.sourceTransformId == -1 )
322
322
&& ( ( destInfo.preferred && !destInfo.deprecated ) || transform.destinationTransformId == -1 ) )
323
323
{
324
- preferredNonDeprecated.first . second = transform.sourceTransformId ;
325
- preferredNonDeprecated.second . second = transform.destinationTransformId ;
324
+ preferredNonDeprecated.sourceTransformId = transform.sourceTransformId ;
325
+ preferredNonDeprecated.destinationTransformId = transform.destinationTransformId ;
326
326
foundPreferredNonDeprecated = true ;
327
327
}
328
328
else if ( !foundPreferred && ( srcInfo.preferred || transform.sourceTransformId == -1 ) &&
329
329
( destInfo.preferred || transform.destinationTransformId == -1 ) )
330
330
{
331
- preferred.first . second = transform.sourceTransformId ;
332
- preferred.second . second = transform.destinationTransformId ;
331
+ preferred.sourceTransformId = transform.sourceTransformId ;
332
+ preferred.destinationTransformId = transform.destinationTransformId ;
333
333
foundPreferred = true ;
334
334
}
335
335
else if ( !foundNonDeprecated && ( !srcInfo.deprecated || transform.sourceTransformId == -1 )
336
336
&& ( !destInfo.deprecated || transform.destinationTransformId == -1 ) )
337
337
{
338
- nonDeprecated.first . second = transform.sourceTransformId ;
339
- nonDeprecated.second . second = transform.destinationTransformId ;
338
+ nonDeprecated.sourceTransformId = transform.sourceTransformId ;
339
+ nonDeprecated.destinationTransformId = transform.destinationTransformId ;
340
340
foundNonDeprecated = true ;
341
341
}
342
342
else if ( !foundFallback )
343
343
{
344
- fallback.first . second = transform.sourceTransformId ;
345
- fallback.second . second = transform.destinationTransformId ;
344
+ fallback.sourceTransformId = transform.sourceTransformId ;
345
+ fallback.destinationTransformId = transform.destinationTransformId ;
346
346
foundFallback = true ;
347
347
}
348
348
}
@@ -361,30 +361,30 @@ void QgsDatumTransformDialog::applyDefaultTransform()
361
361
if ( mDatumTransforms .count () > 0 )
362
362
{
363
363
QgsCoordinateTransformContext context = QgsProject::instance ()->transformContext ();
364
- const QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > dt = defaultDatumTransform ();
365
- context.addSourceDestinationDatumTransform ( dt.first . first , dt.second . first , dt.first . second , dt.second . second );
364
+ const TransformInfo dt = defaultDatumTransform ();
365
+ context.addSourceDestinationDatumTransform ( dt.sourceCrs , dt.destinationCrs , dt.sourceTransformId , dt.destinationTransformId );
366
366
QgsProject::instance ()->setTransformContext ( context );
367
367
}
368
368
}
369
369
370
- QPair<QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > QgsDatumTransformDialog::selectedDatumTransforms ()
370
+ QgsDatumTransformDialog::TransformInfo QgsDatumTransformDialog::selectedDatumTransform ()
371
371
{
372
372
int row = mDatumTransformTableWidget ->currentRow ();
373
- QPair< QPair<QgsCoordinateReferenceSystem, int >, QPair<QgsCoordinateReferenceSystem, int > > sdt;
374
- sdt.first . first = mSourceCrs ;
375
- sdt.second . first = mDestinationCrs ;
373
+ TransformInfo sdt;
374
+ sdt.sourceCrs = mSourceCrs ;
375
+ sdt.destinationCrs = mDestinationCrs ;
376
376
377
377
if ( row >= 0 )
378
378
{
379
379
QTableWidgetItem *srcItem = mDatumTransformTableWidget ->item ( row, 0 );
380
- sdt.first . second = srcItem ? srcItem->data ( Qt::UserRole ).toInt () : -1 ;
380
+ sdt.sourceTransformId = srcItem ? srcItem->data ( Qt::UserRole ).toInt () : -1 ;
381
381
QTableWidgetItem *destItem = mDatumTransformTableWidget ->item ( row, 1 );
382
- sdt.second . second = destItem ? destItem->data ( Qt::UserRole ).toInt () : -1 ;
382
+ sdt.destinationTransformId = destItem ? destItem->data ( Qt::UserRole ).toInt () : -1 ;
383
383
}
384
384
else
385
385
{
386
- sdt.first . second = -1 ;
387
- sdt.second . second = -1 ;
386
+ sdt.sourceTransformId = -1 ;
387
+ sdt.destinationTransformId = -1 ;
388
388
}
389
389
return sdt;
390
390
}
0 commit comments