22using namespace Qt::StringLiterals;
26QString QgsExtentToLayerAlgorithm::name()
const
28 return u
"extenttolayer"_s;
31void QgsExtentToLayerAlgorithm::initAlgorithm(
const QVariantMap & )
37QString QgsExtentToLayerAlgorithm::shortHelpString()
const
39 return QObject::tr(
"This algorithm creates a new vector layer that contains a single feature with geometry matching an extent parameter.\n\n"
40 "It can be used in models to convert an extent into a layer which can be used for other algorithms which require "
41 "a layer based input." );
44QString QgsExtentToLayerAlgorithm::shortDescription()
const
46 return QObject::tr(
"Creates a vector layer that contains a single feature with geometry matching an extent parameter." );
49QgsExtentToLayerAlgorithm *QgsExtentToLayerAlgorithm::createInstance()
const
51 return new QgsExtentToLayerAlgorithm();
57 const QgsGeometry geom = parameterAsExtentGeometry( parameters, u
"INPUT"_s, context );
63 std::unique_ptr<QgsFeatureSink> sink( parameterAsSink( parameters, u
"OUTPUT"_s, context, dest, fields,
Qgis::WkbType::Polygon, crs ) );
77 outputs.insert( u
"OUTPUT"_s, dest );
@ VectorPolygon
Vector polygon layers.
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.