22QString QgsExtentToLayerAlgorithm::name()
const
24 return QStringLiteral(
"extenttolayer" );
27void QgsExtentToLayerAlgorithm::initAlgorithm(
const QVariantMap & )
33QString QgsExtentToLayerAlgorithm::shortHelpString()
const
35 return QObject::tr(
"This algorithm creates a new vector layer that contains a single feature with geometry matching an extent parameter.\n\n"
36 "It can be used in models to convert an extent into a layer which can be used for other algorithms which require "
37 "a layer based input." );
40QgsExtentToLayerAlgorithm *QgsExtentToLayerAlgorithm::createInstance()
const
42 return new QgsExtentToLayerAlgorithm();
48 const QgsGeometry geom = parameterAsExtentGeometry( parameters, QStringLiteral(
"INPUT" ), context );
51 fields.
append(
QgsField( QStringLiteral(
"id" ), QMetaType::Type::Int ) );
54 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, fields,
Qgis::WkbType::Polygon,
crs ) );
67 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
@ VectorPolygon
Vector polygon layers.
This class represents a coordinate reference system (CRS).
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
void setProgress(double progress)
Sets the current progress for the feedback object.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
A geometry is the spatial representation of a feature.
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 rectangular map extent parameter for processing algorithms.
A feature sink output for processing algorithms.
const QgsCoordinateReferenceSystem & crs