18 #ifndef QGSPROCESSINGUTILS_H
19 #define QGSPROCESSINGUTILS_H
21 #include "qgis_core.h"
64 static QList< QgsRasterLayer * > compatibleRasterLayers(
QgsProject *project,
bool sort =
true );
81 static QList< QgsVectorLayer * > compatibleVectorLayers(
QgsProject *project,
82 const QList< int > &sourceTypes = QList< int >(),
98 static QList<QgsMeshLayer *> compatibleMeshLayers(
QgsProject *project,
bool sort =
true );
109 static QList< QgsMapLayer * > compatibleLayers(
QgsProject *project,
bool sort =
true );
117 static QString encodeProviderKeyAndUri(
const QString &providerKey,
const QString &uri );
130 static bool decodeProviderKeyAndUri(
const QString &
string, QString &providerKey
SIP_OUT, QString &uri
SIP_OUT );
185 static QString normalizeLayerSource( const QString &source );
193 static QString variantToPythonLiteral( const QVariant &value );
200 static QString stringToPythonLiteral( const QString &
string );
225 const QVariantMap &createOptions = QVariantMap(),
226 const QStringList &datasourceOptions = QStringList(),
227 const QStringList &layerOptions = QStringList(),
228 QgsFeatureSink::SinkFlags sinkFlags = QgsFeatureSink::SinkFlags(),
275 static QVariant generateIteratingDestination( const QVariant &input, const QVariant &
id,
QgsProcessingContext &context );
281 static QString tempFolder();
289 static QString generateTempFilename( const QString &basename );
316 static QString convertToCompatibleFormat( const
QgsVectorLayer *layer,
317 bool selectedFeaturesOnly,
318 const QString &baseName,
319 const QStringList &compatibleFormats,
320 const QString &preferredFormat,
357 static QString convertToCompatibleFormatAndLayerName( const
QgsVectorLayer *layer,
358 bool selectedFeaturesOnly,
359 const QString &baseName,
360 const QStringList &compatibleFormats,
361 const QString &preferredFormat,
364 QString &layerName
SIP_OUT,
long long featureLimit = -1 );
383 static QList<
int> fieldNamesToIndices( const QStringList &fieldNames, const
QgsFields &fields );
389 static
QgsFields indicesToFields( const QList<
int> &indices, const
QgsFields &fields );
401 static QString defaultVectorExtension();
413 static QString defaultRasterExtension();
420 const QList<
int > &sourceTypes = QList<
int >() );
454 Q_DECL_DEPRECATED static
QgsMapLayer *loadMapLayerFromString( const QString &
string, LayerHint typeHint = LayerHint::UnknownType )
SIP_DEPRECATED ;
456 static
void parseDestinationString( QString &destination, QString &providerKey, QString &uri, QString &layerName, QString &format, QMap<QString, QVariant> &options,
bool &useWriter, QString &extension );
458 friend class TestQgsProcessing;
477 FlagSkipGeometryValidityChecks = 1 << 1,
479 Q_DECLARE_FLAGS( Flags, Flag )
492 long long featureLimit = -1 );
509 long featureCount()
const override;
510 QString sourceName()
const override;
511 QSet<QVariant> uniqueValues(
int fieldIndex,
int limit = -1 )
const override;
512 QVariant minimumValue(
int fieldIndex )
const override;
513 QVariant maximumValue(
int fieldIndex )
const override;
516 SpatialIndexPresence hasSpatialIndex()
const override;
533 bool mOwnsSource = false;
535 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
536 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
538 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackSkip;
539 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallbackAbort;
541 long long mFeatureLimit = -1;
574 bool addFeature(
QgsFeature &feature, QgsFeatureSink::Flags flags = QgsFeatureSink::Flags() )
override;
582 bool mOwnsSink =
false;
587 #endif // QGSPROCESSINGUTILS_H