mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
Improve caching of transforms
This commit is contained in:
parent
0a9c107fcc
commit
1422d5382c
@ -52,6 +52,10 @@ QgsCoordinateTransform::QgsCoordinateTransform()
|
||||
QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination )
|
||||
{
|
||||
d = new QgsCoordinateTransformPrivate( source, destination, QgsCoordinateTransformContext() );
|
||||
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
d->initialize();
|
||||
@ -65,6 +69,10 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
|
||||
#ifdef QGISDEBUG
|
||||
d->mHasContext = true;
|
||||
#endif
|
||||
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
d->initialize();
|
||||
@ -78,6 +86,10 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
|
||||
#ifdef QGISDEBUG
|
||||
d->mHasContext = true;
|
||||
#endif
|
||||
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
d->initialize();
|
||||
@ -91,6 +103,10 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst
|
||||
#ifdef QGISDEBUG
|
||||
d->mHasContext = true; // not strictly true, but we don't need to worry if datums have been explicitly set
|
||||
#endif
|
||||
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
d->initialize();
|
||||
@ -115,6 +131,9 @@ void QgsCoordinateTransform::setSourceCrs( const QgsCoordinateReferenceSystem &c
|
||||
{
|
||||
d.detach();
|
||||
d->mSourceCRS = crs;
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
d->calculateTransforms();
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
@ -126,6 +145,9 @@ void QgsCoordinateTransform::setDestinationCrs( const QgsCoordinateReferenceSyst
|
||||
{
|
||||
d.detach();
|
||||
d->mDestCRS = crs;
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
d->calculateTransforms();
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
@ -141,6 +163,9 @@ void QgsCoordinateTransform::setContext( const QgsCoordinateTransformContext &co
|
||||
#ifdef QGISDEBUG
|
||||
d->mHasContext = true;
|
||||
#endif
|
||||
if ( !d->mSourceCRS.isValid() || !d->mDestCRS.isValid() )
|
||||
return;
|
||||
|
||||
d->calculateTransforms();
|
||||
if ( !setFromCache( d->mSourceCRS, d->mDestCRS, d->mSourceDatumTransform, d->mDestinationDatumTransform ) )
|
||||
{
|
||||
|
@ -33,6 +33,10 @@ class GUI_EXPORT QgsDatumTransformDialog : public QDialog, private Ui::QgsDatumT
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor for QgsDatumTransformDialog.
|
||||
*/
|
||||
QgsDatumTransformDialog( const QList< QList< int > > &dt, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr );
|
||||
~QgsDatumTransformDialog();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user