22 QString QgsLoadLayerAlgorithm::name()
const
24 return QStringLiteral(
"loadlayer" );
27 QgsProcessingAlgorithm::Flags QgsLoadLayerAlgorithm::flags()
const
29 return FlagHideFromToolbox | FlagNotAvailableInStandaloneTool;
32 QString QgsLoadLayerAlgorithm::displayName()
const
34 return QObject::tr(
"Load layer into project" );
37 QStringList QgsLoadLayerAlgorithm::tags()
const
39 return QObject::tr(
"load,open,layer,raster,vector,project" ).split(
',' );
42 QString QgsLoadLayerAlgorithm::group()
const
44 return QObject::tr(
"Modeler tools" );
47 QString QgsLoadLayerAlgorithm::groupId()
const
49 return QStringLiteral(
"modelertools" );
52 QString QgsLoadLayerAlgorithm::shortHelpString()
const
54 return QObject::tr(
"This algorithm loads a layer to the current project." );
57 QgsLoadLayerAlgorithm *QgsLoadLayerAlgorithm::createInstance()
const
59 return new QgsLoadLayerAlgorithm();
62 void QgsLoadLayerAlgorithm::initAlgorithm(
const QVariantMap & )
71 QgsMapLayer *layer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
72 QString name = parameterAsString( parameters, QStringLiteral(
"NAME" ), context );
82 details.forceName =
true;
86 results.insert( QStringLiteral(
"OUTPUT" ), layer->
id() );
Base class for all map layer types.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
void setName(const QString &name)
Set the display name of the layer.
Details for layers to load into projects.
Contains information about the context in which a processing algorithm is executed.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
void addLayerToLoadOnCompletion(const QString &layer, const QgsProcessingContext::LayerDetails &details)
Adds a layer to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A map layer output for processing algorithms, where layers may be either vector or raster.
A map layer parameter for processing algorithms.
A string parameter for processing algorithms.