23 QString QgsTransferAnnotationsFromMainAlgorithm::name()
const
25 return QStringLiteral(
"transferannotationsfrommain" );
28 QString QgsTransferAnnotationsFromMainAlgorithm::displayName()
const
30 return QObject::tr(
"Transfer annotations from main layer" );
33 QStringList QgsTransferAnnotationsFromMainAlgorithm::tags()
const
35 return QObject::tr(
"annotations,drawing,cosmetic,objects" ).split(
',' );
38 QString QgsTransferAnnotationsFromMainAlgorithm::group()
const
40 return QObject::tr(
"Cartography" );
43 QString QgsTransferAnnotationsFromMainAlgorithm::groupId()
const
45 return QStringLiteral(
"cartography" );
48 QgsProcessingAlgorithm::Flags QgsTransferAnnotationsFromMainAlgorithm::flags()
const
54 QString QgsTransferAnnotationsFromMainAlgorithm::shortHelpString()
const
56 return QObject::tr(
"Transfer all annotations from the main annotation layer in a project to a new annotation layer." );
59 QgsTransferAnnotationsFromMainAlgorithm *QgsTransferAnnotationsFromMainAlgorithm::createInstance()
const
61 return new QgsTransferAnnotationsFromMainAlgorithm();
64 void QgsTransferAnnotationsFromMainAlgorithm::initAlgorithm(
const QVariantMap & )
66 addParameter(
new QgsProcessingParameterString( QStringLiteral(
"LAYER_NAME" ), QObject::tr(
"New layer name" ), QObject::tr(
"Annotations" ) ) );
80 std::unique_ptr< QgsAnnotationLayer > newLayer(
main->clone() );
81 newLayer->setName( parameterAsString( parameters, QStringLiteral(
"LAYER_NAME" ), context ) );
85 outputs.insert( QStringLiteral(
"OUTPUT" ), newLayer->id() );
Represents a map layer containing a set of georeferenced annotations, e.g.
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...
@ FlagRequiresProject
The algorithm requires that a valid QgsProject is available from the processing context in order to e...
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.
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 string parameter for processing algorithms.
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
QgsMapLayer * addMapLayer(QgsMapLayer *mapLayer, bool addToLegend=true, bool takeOwnership=true)
Add a layer to the map of loaded layers.
int main(int argc, char *argv[])