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( QLatin1String( 
"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() );
 
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
virtual Flags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
@ FlagNoThreading
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
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.
This is the base class for vector data providers.
@ CreateSpatialIndex
Allows creation of spatial index.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
virtual Q_INVOKABLE QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
Represents a vector layer which manages a vector based data sets.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.