Skip to content
Permalink
Browse files

Remove all deprecated usages of QgsCoordinateTransform without context

  • Loading branch information
elpaso authored and nyalldawson committed Mar 21, 2019
1 parent cb430c1 commit 71698bf70751bb65a0d474c85262481a2d04bdc3
@@ -75,7 +75,6 @@ If the provider isn't capable of returning its projection then an invalid
QgsCoordinateReferenceSystem will be returned.
%End


virtual void setDataSourceUri( const QString &uri );
%Docstring
Set the data source specification. This may be a path or database
@@ -115,7 +115,6 @@ class CORE_EXPORT QgsDataProvider : public QObject
*/
virtual QgsCoordinateReferenceSystem crs() const = 0;


/**
* Set the data source specification. This may be a path or database
* connection string
@@ -310,9 +310,7 @@ void QgsArcGisServiceSourceSelect::addButtonClicked()
{
try
{
Q_NOWARN_DEPRECATED_PUSH
extent = QgsCoordinateTransform( canvasCrs, pCrs ).transform( extent );
Q_NOWARN_DEPRECATED_POP
extent = QgsCoordinateTransform( canvasCrs, pCrs, QgsProject::instance()->transformContext() ).transform( extent );
QgsDebugMsg( QStringLiteral( "canvas transform: Canvas CRS=%1, Provider CRS=%2, BBOX=%3" )
.arg( canvasCrs.authid(), pCrs.authid(), extent.asWktCoordinates() ) );
}
@@ -1069,9 +1069,7 @@ bool QgsWcsProvider::calculateExtent() const
//QgsDebugMsg( "qgisSrsSource: " + qgisSrsSource.toWkt() );
//QgsDebugMsg( "qgisSrsDest: " + qgisSrsDest.toWkt() );

Q_NOWARN_DEPRECATED_PUSH
mCoordinateTransform = QgsCoordinateTransform( qgisSrsSource, qgisSrsDest );
Q_NOWARN_DEPRECATED_POP
mCoordinateTransform = QgsCoordinateTransform( qgisSrsSource, qgisSrsDest, options().coordinateTransformContext );
}

QgsDebugMsg( "mCoverageSummary.wgs84BoundingBox= " + mCoverageSummary.wgs84BoundingBox.toString() );
@@ -27,8 +27,9 @@
#include <QDomDocument>
#include <QStringList>

QgsWfsCapabilities::QgsWfsCapabilities( const QString &uri )
: QgsWfsRequest( QgsWFSDataSourceURI( uri ) )
QgsWfsCapabilities::QgsWfsCapabilities( const QString &uri, const QgsDataProvider::ProviderOptions &options )
: QgsWfsRequest( QgsWFSDataSourceURI( uri ) ),
mOptions( options )
{
// Using Qt::DirectConnection since the download might be running on a different thread.
// In this case, the request was sent from the main thread and is executed with the main
@@ -484,9 +485,7 @@ void QgsWfsCapabilities::capabilitiesReplyFinished()
// into the CRS, and then back to WGS84, works (check that we are in the validity area)
QgsCoordinateReferenceSystem crsWGS84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( QStringLiteral( "CRS:84" ) );

Q_NOWARN_DEPRECATED_PUSH
QgsCoordinateTransform ct( crsWGS84, crs );
Q_NOWARN_DEPRECATED_POP
QgsCoordinateTransform ct( crsWGS84, crs, mOptions.coordinateTransformContext );

QgsPointXY ptMin( featureType.bbox.xMinimum(), featureType.bbox.yMinimum() );
QgsPointXY ptMinBack( ct.transform( ct.transform( ptMin, QgsCoordinateTransform::ForwardTransform ), QgsCoordinateTransform::ReverseTransform ) );
@@ -20,13 +20,14 @@

#include "qgsrectangle.h"
#include "qgswfsrequest.h"
#include "qgsdataprovider.h"

//! Manages the GetCapabilities request
class QgsWfsCapabilities : public QgsWfsRequest
{
Q_OBJECT
public:
explicit QgsWfsCapabilities( const QString &uri );
explicit QgsWfsCapabilities( const QString &uri, const QgsDataProvider::ProviderOptions &options = QgsDataProvider::ProviderOptions() );

//! start network connection to get capabilities
bool requestCapabilities( bool synchronous, bool forceRefresh );
@@ -126,6 +127,8 @@ class QgsWfsCapabilities : public QgsWfsRequest
private:
Capabilities mCaps;

QgsDataProvider::ProviderOptions mOptions;

//! Takes <Operations> element and updates the capabilities
void parseSupportedOperations( const QDomElement &operationsElem,
bool &insertCap,
@@ -1819,10 +1819,7 @@ bool QgsWFSProvider::getCapabilities()
if ( mShared->mCaps.featureTypes[i].bboxSRSIsWGS84 )
{
QgsCoordinateReferenceSystem src = QgsCoordinateReferenceSystem::fromOgcWmsCrs( QStringLiteral( "CRS:84" ) );
Q_NOWARN_DEPRECATED_PUSH
QgsCoordinateTransform ct( src, mShared->mSourceCRS );
Q_NOWARN_DEPRECATED_POP

QgsCoordinateTransform ct( src, mShared->mSourceCRS, options().coordinateTransformContext );
QgsDebugMsgLevel( "latlon ext:" + r.toString(), 4 );
QgsDebugMsgLevel( "src:" + src.authid(), 4 );
QgsDebugMsgLevel( "dst:" + mShared->mSourceCRS.authid(), 4 );
@@ -1365,9 +1365,7 @@ bool QgsWmsProvider::extentForNonTiledLayer( const QString &layerName, const QSt
if ( !wgs.isValid() || !dst.isValid() )
return false;

Q_NOWARN_DEPRECATED_PUSH
QgsCoordinateTransform xform( wgs, dst );
Q_NOWARN_DEPRECATED_POP
QgsCoordinateTransform xform( wgs, dst, options().coordinateTransformContext );

QgsDebugMsg( QStringLiteral( "transforming layer extent %1" ).arg( extent.toString( true ) ) );
try
@@ -1598,9 +1596,7 @@ bool QgsWmsProvider::calculateExtent() const
{
QgsCoordinateReferenceSystem qgisSrsSource = QgsCoordinateReferenceSystem::fromOgcWmsCrs( mTileLayer->boundingBoxes[i].crs );

Q_NOWARN_DEPRECATED_PUSH
QgsCoordinateTransform ct( qgisSrsSource, qgisSrsDest );
Q_NOWARN_DEPRECATED_POP
QgsCoordinateTransform ct( qgisSrsSource, qgisSrsDest, options().coordinateTransformContext );

QgsDebugMsg( QStringLiteral( "ct: %1 => %2" ).arg( mTileLayer->boundingBoxes.at( i ).crs, mImageCrs ) );

@@ -2954,9 +2950,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
QgsCoordinateTransform coordinateTransform;
if ( featuresCrs.isValid() && featuresCrs != crs() )
{
Q_NOWARN_DEPRECATED_PUSH
coordinateTransform = QgsCoordinateTransform( featuresCrs, crs() );
Q_NOWARN_DEPRECATED_POP
coordinateTransform = QgsCoordinateTransform( featuresCrs, crs(), options().coordinateTransformContext );
}
QgsFeatureStore featureStore( fields, crs() );
QMap<QString, QVariant> params;
@@ -3032,9 +3026,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa

if ( featuresCrs.isValid() && featuresCrs != crs() )
{
Q_NOWARN_DEPRECATED_PUSH
coordinateTransform = QgsCoordinateTransform( featuresCrs, crs() );
Q_NOWARN_DEPRECATED_POP
coordinateTransform = QgsCoordinateTransform( featuresCrs, crs(), options().coordinateTransformContext );
}
}

@@ -480,7 +480,7 @@ void QgsWMSSourceSelect::btnConnect_clicked()
return;
}

QgsWmsCapabilities caps;
QgsWmsCapabilities caps( QgsDataProvider::ProviderOptions { QgsProject::instance()->transformContext() } );
if ( !caps.parseResponse( capDownload.response(), wmsSettings.parserSettings() ) )
{
QMessageBox msgBox( QMessageBox::Warning, tr( "WMS Provider" ),

0 comments on commit 71698bf

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