18#ifndef QGSPROCESSINGUTILS_H
19#define QGSPROCESSINGUTILS_H
70 static QList< QgsRasterLayer * > compatibleRasterLayers(
QgsProject *project,
bool sort =
true );
91 static QList< QgsVectorLayer * > compatibleVectorLayers(
QgsProject *project,
92 const QList< int > &sourceTypes = QList< int >(),
112 static QList<QgsMeshLayer *> compatibleMeshLayers(
QgsProject *project,
bool sort =
true );
131 static QList<QgsPluginLayer *> compatiblePluginLayers(
QgsProject *project,
bool sort =
true );
150 static QList<QgsPointCloudLayer *> compatiblePointCloudLayers(
QgsProject *project,
bool sort =
true );
169 static QList<QgsAnnotationLayer *> compatibleAnnotationLayers(
QgsProject *project,
bool sort =
true );
188 static QList<QgsVectorTileLayer *> compatibleVectorTileLayers(
QgsProject *project,
bool sort =
true );
199 static QList< QgsMapLayer * > compatibleLayers(
QgsProject *project,
bool sort =
true );
207 static QString encodeProviderKeyAndUri(
const QString &providerKey,
const QString &uri );
220 static bool decodeProviderKeyAndUri(
const QString &
string, QString &providerKey
SIP_OUT, QString &uri
SIP_OUT );
278 static QString normalizeLayerSource( const QString &source );
286 static QString variantToPythonLiteral( const QVariant &value );
293 static QString stringToPythonLiteral( const QString &
string );
318 const QVariantMap &createOptions = QVariantMap(),
319 const QStringList &datasourceOptions = QStringList(),
320 const QStringList &layerOptions = QStringList(),
321 QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
368 static QVariant generateIteratingDestination( const QVariant &input, const QVariant &
id,
QgsProcessingContext &context );
382 static QString generateTempFilename( const QString &basename, const
QgsProcessingContext *context =
nullptr );
412 static QString convertToCompatibleFormat( const
QgsVectorLayer *layer,
413 bool selectedFeaturesOnly,
414 const QString &baseName,
415 const QStringList &compatibleFormats,
416 const QString &preferredFormat,
419 long long featureLimit = -1,
420 const QString &filterExpression = QString() );
456 static QString convertToCompatibleFormatAndLayerName( const
QgsVectorLayer *layer,
457 bool selectedFeaturesOnly,
458 const QString &baseName,
459 const QStringList &compatibleFormats,
460 const QString &preferredFormat,
464 long long featureLimit = -1,
465 const QString &filterExpression = QString() );
484 static QList<
int> fieldNamesToIndices( const QStringList &fieldNames, const
QgsFields &fields );
490 static
QgsFields indicesToFields( const QList<
int> &indices, const
QgsFields &fields );
504 static QString defaultVectorExtension();
518 static QString defaultRasterExtension();
531 static QString defaultPointCloudExtension();
544 static QString defaultVectorTileExtension();
552 static QVariantMap removePointerValuesFromMap( const QVariantMap &map );
561 static QVariantMap preprocessQgisProcessParameters( const QVariantMap ¶meters,
bool &ok, QString &error );
571 const QList<
int > &sourceTypes = QList<
int >() );
585 template< typename T> static QList< T * > compatibleMapLayers(
QgsProject *project,
bool sort = true );
619 Q_DECL_DEPRECATED static
QgsMapLayer *loadMapLayerFromString( const QString &
string, LayerHint typeHint = LayerHint::UnknownType )
SIP_DEPRECATED ;
621 static
void parseDestinationString( QString &destination, QString &providerKey, QString &uri, QString &layerName, QString &format, QMap<QString, QVariant> &options,
bool &useWriter, QString &extension );
623 friend class TestQgsProcessing;
642 FlagSkipGeometryValidityChecks = 1 << 1,
644 Q_DECLARE_FLAGS( Flags, Flag )
659 long long featureLimit = -1,
const QString &filterExpression = QString() );
676 long long featureCount()
const override;
677 QString sourceName()
const override;
678 QSet<QVariant> uniqueValues(
int fieldIndex,
int limit = -1 )
const override;
679 QVariant minimumValue(
int fieldIndex )
const override;
680 QVariant maximumValue(
int fieldIndex )
const override;
683 SpatialIndexPresence hasSpatialIndex()
const override;
700 bool mOwnsSource = false;
702 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
703 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
705 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackSkip;
706 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackAbort;
708 long long mFeatureLimit = -1;
709 QString mFilterExpression;
742 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
743 bool addFeatures(
QgsFeatureList &features, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
744 bool addFeatures(
QgsFeatureIterator &iterator, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
750 bool mOwnsSink =
false;
WkbType
The WKB type describes the number of dimensions a geometry has.
Represents a map layer containing a set of georeferenced annotations, e.g.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Wrapper for iterator of features from vector data provider or vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
An interface for objects which accept features via addFeature(s) methods.
An interface for objects which provide features via a getFeatures method.
FeatureAvailability
Possible return value for hasFeatures() to determine if a source is empty.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
A storage object for map layers, in which the layers are owned by the store and have their lifetime b...
Base class for all map layer types.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Base class for plugin layers.
Represents a map layer supporting display of point clouds.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
QgsProxyFeatureSink subclass which reports feature addition errors to a QgsProcessingContext.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
Base class for providing feedback from a processing algorithm.
Abstract base class for processing providers.
Utility functions for use with processing classes.
LayerHint
Layer type hints.
@ UnknownType
Unknown layer type.
Contains enumerations and other constants for use in processing algorithms and parameters.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A simple feature sink which proxies feature addition on to another feature sink.
Represents a raster layer.
A rectangle specified with double values.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Represents a vector layer which manages a vector based data sets.
Implements a map layer that is dedicated to rendering of vector tiles.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_MONKEYPATCH_SCOPEENUM
#define SIP_THROW(name,...)
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
const QgsCoordinateReferenceSystem & crs