25QString QgsSpatialIndexAlgorithm::name()
const
27 return QStringLiteral(
"createspatialindex" );
30QString QgsSpatialIndexAlgorithm::displayName()
const
32 return QObject::tr(
"Create spatial index" );
35QStringList QgsSpatialIndexAlgorithm::tags()
const
37 return QObject::tr(
"table,spatial,geometry,index,create,vector" ).split(
',' );
40QString QgsSpatialIndexAlgorithm::group()
const
42 return QObject::tr(
"Vector general" );
45QString QgsSpatialIndexAlgorithm::groupId()
const
47 return QStringLiteral(
"vectorgeneral" );
56QString QgsSpatialIndexAlgorithm::shortHelpString()
const
58 return QObject::tr(
"Creates an index to speed up access to the features "
59 "in a layer based on their spatial location. Support "
60 "for spatial index creation is dependent on the layer's "
64QgsSpatialIndexAlgorithm *QgsSpatialIndexAlgorithm::createInstance()
const
66 return new QgsSpatialIndexAlgorithm();
69void QgsSpatialIndexAlgorithm::initAlgorithm(
const QVariantMap & )
78 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
81 throw QgsProcessingException( QObject::tr(
"Could not load source layer for %1." ).arg( QLatin1String(
"INPUT" ) ) );
89 feedback->
pushInfo( QObject::tr(
"Could not create spatial index" ) );
94 feedback->
pushInfo( QObject::tr(
"Layer's data provider does not support spatial indexes" ) );
98 outputs.insert( QStringLiteral(
"OUTPUT" ), layer->
id() );
@ CreateSpatialIndex
Allows creation of spatial index.
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
@ NoThreading
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
virtual Qgis::ProcessingAlgorithmFlags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
A vector layer output for processing algorithms.
A vector layer (with or without geometry) parameter for processing algorithms.
Base class for vector data providers.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
virtual Q_INVOKABLE Qgis::VectorProviderCapabilities capabilities() const
Returns flags containing the supported capabilities.
Represents a vector layer which manages a vector based dataset.
QgsVectorDataProvider * dataProvider() final
Returns the layer's data provider, it may be nullptr.