18 #ifndef QGSPROCESSINGALGORITHM_H 19 #define QGSPROCESSINGALGORITHM_H 21 #include "qgis_core.h" 40 #include <qgsprocessingmodelalgorithm.h> 56 if ( dynamic_cast< QgsProcessingModelAlgorithm * >( sipCpp ) != NULL )
57 sipType = sipType_QgsProcessingModelAlgorithm;
58 else if ( dynamic_cast< QgsProcessingFeatureBasedAlgorithm * >( sipCpp ) != NULL )
59 sipType = sipType_QgsProcessingFeatureBasedAlgorithm;
61 sipType = sipType_QgsProcessingAlgorithm;
70 FlagHideFromToolbox = 1 << 1,
71 FlagHideFromModeler = 1 << 2,
72 FlagSupportsBatch = 1 << 3,
73 FlagCanCancel = 1 << 4,
74 FlagRequiresMatchingCrs = 1 << 5,
75 FlagNoThreading = 1 << 6,
76 FlagDeprecated = FlagHideFromToolbox | FlagHideFromModeler,
78 Q_DECLARE_FLAGS( Flags,
Flag )
136 virtual QString name() const = 0;
151 virtual QString displayName() const = 0;
157 virtual QStringList tags()
const {
return QStringList(); }
165 virtual QString shortHelpString()
const;
173 virtual QString helpString()
const;
180 virtual QString helpUrl()
const;
186 virtual QIcon icon()
const;
192 virtual QString svgIconPath()
const;
200 virtual QString
group()
const {
return QString(); }
209 virtual QString
groupId()
const {
return QString(); }
215 virtual Flags flags()
const;
223 virtual bool canExecute( QString *errorMessage
SIP_OUT =
nullptr )
const;
232 virtual bool checkParameterValues(
const QVariantMap ¶meters,
242 virtual QVariantMap preprocessParameters(
const QVariantMap ¶meters );
268 int countVisibleParameters()
const;
294 bool hasHtmlOutputs()
const;
313 QVariantMap run(
const QVariantMap ¶meters,
357 virtual QWidget *createCustomParametersWidget( QWidget *parent =
nullptr )
const SIP_FACTORY;
374 virtual bool validateInputCrs(
const QVariantMap ¶meters,
384 virtual QString asPythonCommand(
const QVariantMap ¶meters,
QgsProcessingContext &context )
const;
418 virtual void initAlgorithm(
const QVariantMap &configuration = QVariantMap() ) = 0;
443 void removeParameter(
const QString &name );
556 QString parameterAsString(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
561 QString parameterAsExpression(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
566 double parameterAsDouble(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
571 int parameterAsInt(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
576 int parameterAsEnum(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
581 QList<int> parameterAsEnums(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
586 bool parameterAsBool(
const QVariantMap ¶meters,
const QString &name,
const QgsProcessingContext &context )
const;
627 QString parameterAsCompatibleSourceLayerPath(
const QVariantMap ¶meters,
const QString &name,
651 QString parameterAsOutputLayer(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
656 QString parameterAsFileOutput(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
724 QString parameterAsFile(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
730 QVariantList parameterAsMatrix(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
735 QList< QgsMapLayer *> parameterAsLayerList(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
740 QList<double> parameterAsRange(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
745 QStringList parameterAsFields(
const QVariantMap ¶meters,
const QString &name,
QgsProcessingContext &context )
const;
752 bool mHasPrepared =
false;
753 bool mHasExecuted =
false;
754 bool mHasPostProcessed =
false;
755 std::unique_ptr< QgsProcessingContext > mLocalContext;
760 friend class TestQgsProcessing;
761 friend class QgsProcessingModelAlgorithm;
768 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingAlgorithm::Flags )
806 void initAlgorithm(
const QVariantMap &configuration = QVariantMap() )
override;
813 virtual QString outputName()
const = 0;
820 virtual QList<int> inputLayerTypes()
const;
869 virtual void initParameters(
const QVariantMap &configuration = QVariantMap() );
902 QVariantMap processAlgorithm(
const QVariantMap ¶meters,
913 std::unique_ptr< QgsProcessingFeatureSource > mSource;
919 #endif // QGSPROCESSINGALGORITHM_H #define SIP_VIRTUALERRORHANDLER(name)
QList< const QgsProcessingParameterDefinition *> QgsProcessingParameterDefinitions
List of processing parameters.
A rectangle specified with double values.
Base class for all map layer types.
Base class for providing feedback from a processing algorithm.
QgsProcessingParameterDefinitions parameterDefinitions() const
Returns an ordered list of parameter definitions utilized by the algorithm.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QList< QgsFeature > QgsFeatureList
virtual QString group() const
Returns the name of the group this algorithm belongs to.
A class to represent a 2D point.
An interface for objects which accept features via addFeature(s) methods.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
Abstract base class for processing providers.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Abstract base class for processing algorithms.
Type
The WKB type describes the number of dimensions a geometry has.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
QgsProcessingOutputDefinitions outputDefinitions() const
Returns an ordered list of output definitions utilized by the algorithm.
Base class for the definition of processing outputs.
QList< const QgsProcessingOutputDefinition *> QgsProcessingOutputDefinitions
List of processing parameters.
This class represents a coordinate reference system (CRS).
Base class for the definition of processing parameters.
Flag
Flags indicating how and when an algorithm operates and should be exposed to users.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
SourceType
Data source types enum.
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
An abstract QgsProcessingAlgorithm base class for processing algorithms which operate "feature-by-fea...
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.