Skip to content

Commit

Permalink
Remove all deprecated usages of QgsCoordinateTransform without context
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent cb430c1 commit 71698bf
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 31 deletions.
1 change: 0 additions & 1 deletion python/core/auto_generated/qgsdataprovider.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/core/qgsdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/providers/arcgisrest/qgsarcgisservicesourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
}
Expand Down
4 changes: 1 addition & 3 deletions src/providers/wcs/qgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
9 changes: 4 additions & 5 deletions src/providers/wfs/qgswfscapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) );
Expand Down
5 changes: 4 additions & 1 deletion src/providers/wfs/qgswfscapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions src/providers/wfs/qgswfsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
16 changes: 4 additions & 12 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ) );

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/wms/qgswmssourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ),
Expand Down

0 comments on commit 71698bf

Please sign in to comment.