Skip to content

Commit

Permalink
Make some QgsProcessingFeatureBasedAlgorithm methods public (qgis#45331)
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Sep 30, 2021
1 parent 7417c67 commit 3383231
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 42 deletions.
43 changes: 21 additions & 22 deletions python/core/auto_generated/processing/qgsprocessingalgorithm.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1144,11 +1144,6 @@ can break valid model execution - so use with extreme caution, and consider usin
``feedback`` to instead report non-fatal processing failures for features instead.
%End

protected:

virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() );


virtual QString inputParameterName() const;
%Docstring
Returns the name of the parameter corresponding to the input layer.
Expand Down Expand Up @@ -1218,6 +1213,12 @@ implement logic here to indicate which fields are output by the algorithm.

This is called once by the base class when creating the output sink for the algorithm (i.e. it is
not called once per feature processed).
%End

QgsCoordinateReferenceSystem sourceCrs() const;
%Docstring
Returns the source's coordinate reference system. This will only return a valid CRS when
called from a subclasses' :py:func:`~QgsProcessingFeatureBasedAlgorithm.processFeature` implementation.
%End

virtual QgsCoordinateReferenceSystem outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const;
Expand All @@ -1230,23 +1231,6 @@ This is called once by the base class when creating the output sink for the algo
not called once per feature processed).
%End

virtual void initParameters( const QVariantMap &configuration = QVariantMap() );
%Docstring
Initializes any extra parameters added by the algorithm subclass. There is no need
to declare the input source or output sink, as these are automatically created by
QgsProcessingFeatureBasedAlgorithm.
%End

QgsCoordinateReferenceSystem sourceCrs() const;
%Docstring
Returns the source's coordinate reference system. This will only return a valid CRS when
called from a subclasses' :py:func:`~QgsProcessingFeatureBasedAlgorithm.processFeature` implementation.
%End


virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException );


virtual QgsFeatureRequest request() const;
%Docstring
Returns the feature request used for fetching features to process from the
Expand All @@ -1265,6 +1249,21 @@ checks based on the geometry type of the layer.
.. versionadded:: 3.4
%End

protected:

virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() );


virtual void initParameters( const QVariantMap &configuration = QVariantMap() );
%Docstring
Initializes any extra parameters added by the algorithm subclass. There is no need
to declare the input source or output sink, as these are automatically created by
QgsProcessingFeatureBasedAlgorithm.
%End

virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException );


void prepareSource( const QVariantMap &parameters, QgsProcessingContext &context );
%Docstring
Read the source from ``parameters`` and ``context`` and set it
Expand Down
39 changes: 19 additions & 20 deletions src/core/processing/qgsprocessingalgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,6 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
*/
virtual QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) SIP_THROW( QgsProcessingException ) = 0 SIP_VIRTUALERRORHANDLER( processing_exception_handler );

protected:

void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;

/**
* Returns the name of the parameter corresponding to the input layer.
*
Expand Down Expand Up @@ -1228,6 +1224,12 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
*/
virtual QgsFields outputFields( const QgsFields &inputFields ) const;

/**
* Returns the source's coordinate reference system. This will only return a valid CRS when
* called from a subclasses' processFeature() implementation.
*/
QgsCoordinateReferenceSystem sourceCrs() const;

/**
* Maps the input source coordinate reference system (\a inputCrs) to a corresponding
* output CRS generated by the algorithm. The default behavior is that the algorithm maintains
Expand All @@ -1238,22 +1240,6 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
*/
virtual QgsCoordinateReferenceSystem outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const;

/**
* Initializes any extra parameters added by the algorithm subclass. There is no need
* to declare the input source or output sink, as these are automatically created by
* QgsProcessingFeatureBasedAlgorithm.
*/
virtual void initParameters( const QVariantMap &configuration = QVariantMap() );

/**
* Returns the source's coordinate reference system. This will only return a valid CRS when
* called from a subclasses' processFeature() implementation.
*/
QgsCoordinateReferenceSystem sourceCrs() const;


QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override SIP_THROW( QgsProcessingException );

/**
* Returns the feature request used for fetching features to process from the
* source layer. The default implementation requests all attributes and geometry.
Expand All @@ -1270,6 +1256,19 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
*/
bool supportInPlaceEdit( const QgsMapLayer *layer ) const override;

protected:

void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;

/**
* Initializes any extra parameters added by the algorithm subclass. There is no need
* to declare the input source or output sink, as these are automatically created by
* QgsProcessingFeatureBasedAlgorithm.
*/
virtual void initParameters( const QVariantMap &configuration = QVariantMap() );

QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override SIP_THROW( QgsProcessingException );

/**
* Read the source from \a parameters and \a context and set it
*
Expand Down

0 comments on commit 3383231

Please sign in to comment.