Skip to content

Commit f8dfdc4

Browse files
elpasonyalldawson
authored andcommittedApr 17, 2019
Deprecate method without transformContext
1 parent e930bee commit f8dfdc4

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed
 

‎python/core/auto_generated/processing/qgsprocessingutils.sip.in

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,22 @@ temporary layer store.
176176
available in Python bindings as createFeatureSink()
177177
%End
178178

179-
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
179+
180+
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext );
181+
%Docstring
182+
Combines the extent of several map ``layers``. If specified, the target ``crs``
183+
will be used to transform the layer's extent to the desired output reference system
184+
using the specified ``transformContext``.
185+
186+
.. versionadded:: 3.10
187+
%End
188+
189+
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) /Deprecated/;
180190
%Docstring
181191
Combines the extent of several map ``layers``. If specified, the target ``crs``
182192
will be used to transform the layer's extent to the desired output reference system.
193+
194+
.. deprecated:: Use version with transformContext argument instead
183195
%End
184196

185197
static QVariant generateIteratingDestination( const QVariant &input, const QVariant &id, QgsProcessingContext &context );

‎src/core/processing/qgsprocessingutils.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ void QgsProcessingUtils::createFeatureSinkPython( QgsFeatureSink **sink, QString
627627
}
628628

629629

630-
QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs )
630+
QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext )
631631
{
632632
QgsRectangle extent;
633633
for ( const QgsMapLayer *layer : layers )
@@ -638,7 +638,7 @@ QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *>
638638
if ( crs.isValid() )
639639
{
640640
//transform layer extent to target CRS
641-
QgsCoordinateTransform ct( layer->crs(), crs, QgsProject::instance()->transformContext() );
641+
QgsCoordinateTransform ct( layer->crs(), crs, transformContext );
642642
try
643643
{
644644
QgsRectangle reprojExtent = ct.transformBoundingBox( layer->extent() );
@@ -659,6 +659,12 @@ QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *>
659659
return extent;
660660
}
661661

662+
// Deprecated
663+
QgsRectangle QgsProcessingUtils::combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs )
664+
{
665+
return QgsProcessingUtils::combineLayerExtents( layers, crs, QgsCoordinateTransformContext( ) );
666+
}
667+
662668
QVariant QgsProcessingUtils::generateIteratingDestination( const QVariant &input, const QVariant &id, QgsProcessingContext &context )
663669
{
664670
if ( !input.isValid() )

‎src/core/processing/qgsprocessingutils.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,21 @@ class CORE_EXPORT QgsProcessingUtils
213213
*/
214214
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 );
215215

216+
217+
/**
218+
* Combines the extent of several map \a layers. If specified, the target \a crs
219+
* will be used to transform the layer's extent to the desired output reference system
220+
* using the specified \a transformContext.
221+
* \since QGIS 3.10
222+
*/
223+
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext );
224+
216225
/**
217226
* Combines the extent of several map \a layers. If specified, the target \a crs
218227
* will be used to transform the layer's extent to the desired output reference system.
228+
* \deprecated Use version with transformContext argument instead
219229
*/
220-
static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() );
230+
Q_DECL_DEPRECATED static QgsRectangle combineLayerExtents( const QList<QgsMapLayer *> &layers, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem() ) SIP_DEPRECATED;
221231

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

0 commit comments

Comments
 (0)
Please sign in to comment.