22QString QgsCopyLayerMetadataAlgorithm::name()
const
24 return QStringLiteral(
"copylayermetadata" );
27QString QgsCopyLayerMetadataAlgorithm::displayName()
const
29 return QObject::tr(
"Copy layer metadata" );
32QStringList QgsCopyLayerMetadataAlgorithm::tags()
const
34 return QObject::tr(
"change,layer,metadata,qmd" ).split(
',' );
37QString QgsCopyLayerMetadataAlgorithm::group()
const
39 return QObject::tr(
"Metadata tools" );
42QString QgsCopyLayerMetadataAlgorithm::groupId()
const
44 return QStringLiteral(
"metadatatools" );
47QString QgsCopyLayerMetadataAlgorithm::shortHelpString()
const
49 return QObject::tr(
"Copies metadata from an input layer to a target layer.\n\nAny existing metadata in the target layer will be replaced." );
52QgsCopyLayerMetadataAlgorithm *QgsCopyLayerMetadataAlgorithm::createInstance()
const
54 return new QgsCopyLayerMetadataAlgorithm();
57void QgsCopyLayerMetadataAlgorithm::initAlgorithm(
const QVariantMap & )
67 QgsMapLayer *inputLayer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
68 QgsMapLayer *targetLayer = parameterAsLayer( parameters, QStringLiteral(
"TARGET" ), context );
69 const bool saveAsDefault = parameterAsBool( parameters, QStringLiteral(
"DEFAULT" ), context );
77 mLayerId = targetLayer->
id();
94 Q_UNUSED( parameters );
98 results.insert( QStringLiteral(
"OUTPUT" ), mLayerId );
104QString QgsApplyLayerMetadataAlgorithm::name()
const
106 return QStringLiteral(
"setlayermetadata" );
109QString QgsApplyLayerMetadataAlgorithm::displayName()
const
111 return QObject::tr(
"Set layer metadata" );
114QStringList QgsApplyLayerMetadataAlgorithm::tags()
const
116 return QObject::tr(
"change,layer,metadata,qmd" ).split(
',' );
119QString QgsApplyLayerMetadataAlgorithm::group()
const
121 return QObject::tr(
"Metadata tools" );
124QString QgsApplyLayerMetadataAlgorithm::groupId()
const
126 return QStringLiteral(
"metadatatools" );
129QString QgsApplyLayerMetadataAlgorithm::shortHelpString()
const
131 return QObject::tr(
"Applies the metadata to a layer. The metadata must be defined as QMD file.\n\nAny existing metadata in the layer will be replaced." );
134QgsApplyLayerMetadataAlgorithm *QgsApplyLayerMetadataAlgorithm::createInstance()
const
136 return new QgsApplyLayerMetadataAlgorithm();
139void QgsApplyLayerMetadataAlgorithm::initAlgorithm(
const QVariantMap & )
149 QgsMapLayer *layer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
150 const QString metadata = parameterAsFile( parameters, QStringLiteral(
"METADATA" ), context );
151 const bool saveAsDefault = parameterAsBool( parameters, QStringLiteral(
"DEFAULT" ), context );
156 mLayerId = layer->
id();
180 Q_UNUSED( parameters );
184 results.insert( QStringLiteral(
"OUTPUT" ), mLayerId );
190QString QgsExportLayerMetadataAlgorithm::name()
const
192 return QStringLiteral(
"exportlayermetadata" );
195QString QgsExportLayerMetadataAlgorithm::displayName()
const
197 return QObject::tr(
"Export layer metadata" );
200QStringList QgsExportLayerMetadataAlgorithm::tags()
const
202 return QObject::tr(
"export,layer,metadata,qmd" ).split(
',' );
205QString QgsExportLayerMetadataAlgorithm::group()
const
207 return QObject::tr(
"Metadata tools" );
210QString QgsExportLayerMetadataAlgorithm::groupId()
const
212 return QStringLiteral(
"metadatatools" );
215QString QgsExportLayerMetadataAlgorithm::shortHelpString()
const
217 return QObject::tr(
"Exports layer's metadata to a QMD file." );
220QgsExportLayerMetadataAlgorithm *QgsExportLayerMetadataAlgorithm::createInstance()
const
222 return new QgsExportLayerMetadataAlgorithm();
225void QgsExportLayerMetadataAlgorithm::initAlgorithm(
const QVariantMap & )
228 addParameter(
new QgsProcessingParameterFileDestination( QStringLiteral(
"OUTPUT" ), QObject::tr(
"Output" ), QObject::tr(
"QGIS Metadata File" ) + QStringLiteral(
" (*.qmd *.QMD)" ) ) );
233 QgsMapLayer *layer = parameterAsLayer( parameters, QStringLiteral(
"INPUT" ), context );
234 const QString outputFile = parameterAsString( parameters, QStringLiteral(
"OUTPUT" ), context );
247 results.insert( QStringLiteral(
"OUTPUT" ), outputFile );
@ File
Parameter is a single file.
Base class for all map layer types.
virtual QString loadNamedMetadata(const QString &uri, bool &resultFlag)
Retrieve a named metadata for this layer if one exists (either as a .qmd file on disk or as a record ...
QgsLayerMetadata metadata
virtual void setMetadata(const QgsLayerMetadata &metadata)
Sets the layer's metadata store.
virtual QString saveDefaultMetadata(bool &resultFlag)
Save the current metadata of this layer as the default metadata (either as a .qmd file on disk or as ...
QString saveNamedMetadata(const QString &uri, bool &resultFlag)
Save the current metadata of this layer as a named metadata (either as a .qmd file on disk or as a re...
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.
A map layer output for processing algorithms, where layers may be either vector or raster.
A boolean parameter for processing algorithms.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
An input file or folder parameter for processing algorithms.
A map layer parameter for processing algorithms.