24 QString QgsSpatialIndexAlgorithm::name()
const 26 return QStringLiteral(
"createspatialindex" );
29 QString QgsSpatialIndexAlgorithm::displayName()
const 31 return QObject::tr(
"Create spatial index" );
34 QStringList QgsSpatialIndexAlgorithm::tags()
const 36 return QObject::tr(
"table,spatial,geometry,index,create,vector" ).split(
',' );
39 QString QgsSpatialIndexAlgorithm::group()
const 41 return QObject::tr(
"Vector general" );
44 QString QgsSpatialIndexAlgorithm::groupId()
const 46 return QStringLiteral(
"vectorgeneral" );
49 QgsProcessingAlgorithm::Flags QgsSpatialIndexAlgorithm::flags()
const 55 QString QgsSpatialIndexAlgorithm::shortHelpString()
const 57 return QObject::tr(
"Creates an index to speed up access to the features " 58 "in a layer based on their spatial location. Support " 59 "for spatial index creation is dependent on the layer's " 63 QgsSpatialIndexAlgorithm *QgsSpatialIndexAlgorithm::createInstance()
const 65 return new QgsSpatialIndexAlgorithm();
68 void QgsSpatialIndexAlgorithm::initAlgorithm(
const QVariantMap & )
77 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
80 throw QgsProcessingException( QObject::tr(
"Could not load source layer for %1." ).arg( QStringLiteral(
"INPUT" ) ) );
88 feedback->
pushInfo( QObject::tr(
"Could not create spatial index" ) );
93 feedback->
pushInfo( QObject::tr(
"Layer's data provider does not support spatial indexes" ) );
97 outputs.insert( QStringLiteral(
"OUTPUT" ), layer->
id() );
Base class for providing feedback from a processing algorithm.
virtual QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users...
A vector layer output for processing algorithms.
Allows creation of spatial index.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
Custom exception class for processing related exceptions.
A vector layer (with or without geometry) parameter for processing algorithms.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
This is the base class for vector data providers.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.