Skip to content

Commit

Permalink
Deprecate method without transformContext
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent e930bee commit f8dfdc4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
14 changes: 13 additions & 1 deletion python/core/auto_generated/processing/qgsprocessingutils.sip.in
Expand Up @@ -176,10 +176,22 @@ temporary layer store.
available in Python bindings as createFeatureSink()
%End

static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );

static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext );
%Docstring
Combines the extent of several map ``layers``. If specified, the target ``crs``
will be used to transform the layer's extent to the desired output reference system
using the specified ``transformContext``.

.. versionadded:: 3.10
%End

static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) /Deprecated/;
%Docstring
Combines the extent of several map ``layers``. If specified, the target ``crs``
will be used to transform the layer's extent to the desired output reference system.

.. deprecated:: Use version with transformContext argument instead
%End

static QVariant generateIteratingDestination( const QVariant &input, const QVariant &id, QgsProcessingContext &context );
Expand Down
10 changes: 8 additions & 2 deletions src/core/processing/qgsprocessingutils.cpp
Expand Up @@ -627,7 +627,7 @@ void QgsProcessingUtils::createFeatureSinkPython( QgsFeatureSink **sink, QString
}


QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs )
QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext )
{
QgsRectangle extent;
for ( const QgsMapLayer *layer : layers )
Expand All @@ -638,7 +638,7 @@ QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *>
if ( crs.isValid() )
{
//transform layer extent to target CRS
QgsCoordinateTransform ct( layer->crs(), crs, QgsProject::instance()->transformContext() );
QgsCoordinateTransform ct( layer->crs(), crs, transformContext );
try
{
QgsRectangle reprojExtent = ct.transformBoundingBox( layer->extent() );
Expand All @@ -659,6 +659,12 @@ QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *>
return extent;
}

// Deprecated
QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs )
{
return QgsProcessingUtils::combineLayerExtents( layers, crs, QgsCoordinateTransformContext( ) );
}

QVariant QgsProcessingUtils::generateIteratingDestination( const QVariant &input, const QVariant &id, QgsProcessingContext &context )
{
if ( !input.isValid() )
Expand Down
12 changes: 11 additions & 1 deletion src/core/processing/qgsprocessingutils.h
Expand Up @@ -213,11 +213,21 @@ class CORE_EXPORT QgsProcessingUtils
*/
static void createFeatureSinkPython( QgsFeatureSink **sink SIP_OUT SIP_TRANSFERBACK, QString &destination SIP_INOUT, QgsProcessingContext &context, const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs, const QVariantMap &createOptions = QVariantMap() ) SIP_THROW( QgsProcessingException ) SIP_PYNAME( createFeatureSink );


/**
* Combines the extent of several map \a layers. If specified, the target \a crs
* will be used to transform the layer's extent to the desired output reference system
* using the specified \a transformContext.
* \since QGIS 3.10
*/
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext );

/**
* Combines the extent of several map \a layers. If specified, the target \a crs
* will be used to transform the layer's extent to the desired output reference system.
* \deprecated Use version with transformContext argument instead
*/
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
Q_DECL_DEPRECATED static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) SIP_DEPRECATED;

/**
* Converts an \a input parameter value for use in source iterating mode, where one individual sink
Expand Down

0 comments on commit f8dfdc4

Please sign in to comment.