18 #ifndef QGSPROCESSINGUTILS_H
19 #define QGSPROCESSINGUTILS_H
21 #include "qgis_core.h"
70 static QList< QgsRasterLayer * > compatibleRasterLayers(
QgsProject *project,
bool sort =
true );
90 static QList< QgsVectorLayer * > compatibleVectorLayers(
QgsProject *project,
91 const QList< int > &sourceTypes = QList< int >(),
110 static QList<QgsMeshLayer *> compatibleMeshLayers(
QgsProject *project,
bool sort =
true );
128 static QList<QgsPluginLayer *> compatiblePluginLayers(
QgsProject *project,
bool sort =
true );
146 static QList<QgsPointCloudLayer *> compatiblePointCloudLayers(
QgsProject *project,
bool sort =
true );
164 static QList<QgsAnnotationLayer *> compatibleAnnotationLayers(
QgsProject *project,
bool sort =
true );
175 static QList< QgsMapLayer * > compatibleLayers(
QgsProject *project,
bool sort =
true );
183 static QString encodeProviderKeyAndUri(
const QString &providerKey,
const QString &uri );
196 static bool decodeProviderKeyAndUri(
const QString &
string, QString &providerKey
SIP_OUT, QString &uri
SIP_OUT );
253 static QString normalizeLayerSource( const QString &source );
261 static QString variantToPythonLiteral( const QVariant &value );
268 static QString stringToPythonLiteral( const QString &
string );
293 const QVariantMap &createOptions = QVariantMap(),
294 const QStringList &datasourceOptions = QStringList(),
295 const QStringList &layerOptions = QStringList(),
296 QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
343 static QVariant generateIteratingDestination( const QVariant &input, const QVariant &
id,
QgsProcessingContext &context );
349 static QString tempFolder();
357 static QString generateTempFilename( const QString &basename );
384 static QString convertToCompatibleFormat( const
QgsVectorLayer *layer,
385 bool selectedFeaturesOnly,
386 const QString &baseName,
387 const QStringList &compatibleFormats,
388 const QString &preferredFormat,
425 static QString convertToCompatibleFormatAndLayerName( const
QgsVectorLayer *layer,
426 bool selectedFeaturesOnly,
427 const QString &baseName,
428 const QStringList &compatibleFormats,
429 const QString &preferredFormat,
432 QString &layerName
SIP_OUT,
long long featureLimit = -1 );
451 static QList<
int> fieldNamesToIndices( const QStringList &fieldNames, const
QgsFields &fields );
457 static
QgsFields indicesToFields( const QList<
int> &indices, const
QgsFields &fields );
470 static QString defaultVectorExtension();
483 static QString defaultRasterExtension();
495 static QString defaultPointCloudExtension();
503 static QVariantMap removePointerValuesFromMap( const QVariantMap &map );
513 const QList<
int > &sourceTypes = QList<
int >() );
527 template< typename T> static QList< T * > compatibleMapLayers(
QgsProject *project,
bool sort = true );
561 Q_DECL_DEPRECATED static
QgsMapLayer *loadMapLayerFromString( const QString &
string, LayerHint typeHint = LayerHint::UnknownType )
SIP_DEPRECATED ;
563 static
void parseDestinationString( QString &destination, QString &providerKey, QString &uri, QString &layerName, QString &format, QMap<QString, QVariant> &options,
bool &useWriter, QString &extension );
565 friend class TestQgsProcessing;
584 FlagSkipGeometryValidityChecks = 1 << 1,
586 Q_DECLARE_FLAGS( Flags, Flag )
599 long long featureLimit = -1 );
616 long long featureCount()
const override;
617 QString sourceName()
const override;
618 QSet<QVariant> uniqueValues(
int fieldIndex,
int limit = -1 )
const override;
619 QVariant minimumValue(
int fieldIndex )
const override;
620 QVariant maximumValue(
int fieldIndex )
const override;
623 SpatialIndexPresence hasSpatialIndex()
const override;
640 bool mOwnsSource = false;
642 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
643 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
645 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackSkip;
646 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackAbort;
648 long long mFeatureLimit = -1;
681 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
689 bool mOwnsSink =
false;
694 #endif // QGSPROCESSINGUTILS_H