22 QString QgsExtractByExtentAlgorithm::name()
const 24 return QStringLiteral(
"extractbyextent" );
27 QString QgsExtractByExtentAlgorithm::displayName()
const 29 return QObject::tr(
"Extract/clip by extent" );
32 QStringList QgsExtractByExtentAlgorithm::tags()
const 34 return QObject::tr(
"clip,extract,intersect,intersection,mask,extent" ).split(
',' );
37 QString QgsExtractByExtentAlgorithm::group()
const 39 return QObject::tr(
"Vector overlay" );
42 QString QgsExtractByExtentAlgorithm::groupId()
const 44 return QStringLiteral(
"vectoroverlay" );
46 void QgsExtractByExtentAlgorithm::initAlgorithm(
const QVariantMap & )
54 QString QgsExtractByExtentAlgorithm::shortHelpString()
const 56 return QObject::tr(
"This algorithm creates a new vector layer that only contains features which fall within a specified extent. " 57 "Any features which intersect the extent will be included.\n\n" 58 "Optionally, feature geometries can also be clipped to the extent. If this option is selected, then the output " 59 "geometries will automatically be converted to multi geometries to ensure uniform output geometry types." );
62 QgsExtractByExtentAlgorithm *QgsExtractByExtentAlgorithm::createInstance()
const 64 return new QgsExtractByExtentAlgorithm();
69 std::unique_ptr< QgsFeatureSource > featureSource( parameterAsSource( parameters, QStringLiteral(
"INPUT" ), context ) );
73 QgsRectangle extent = parameterAsExtent( parameters, QStringLiteral(
"EXTENT" ), context, featureSource->sourceCrs() );
74 bool clip = parameterAsBool( parameters, QStringLiteral(
"CLIP" ), context );
80 std::unique_ptr< QgsFeatureSink > sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, dest, featureSource->fields(), outType, featureSource->sourceCrs() ) );
85 QgsGeometry clipGeom = parameterAsExtentGeometry( parameters, QStringLiteral(
"EXTENT" ), context, featureSource->sourceCrs() );
87 double step = featureSource->featureCount() > 0 ? 100.0 / featureSource->featureCount() : 1;
111 outputs.insert( QStringLiteral(
"OUTPUT" ), dest );
A boolean parameter for processing algorithms.
Wrapper for iterator of features from vector data provider or vector layer.
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
A rectangle specified with double values.
static Type multiType(Type type)
Returns the multi type for a WKB type.
Base class for providing feedback from a processing algorithm.
Use exact geometry intersection (slower) instead of bounding boxes.
void setProgress(double progress)
Sets the current progress for the feedback object.
A geometry is the spatial representation of a feature.
QgsGeometry intersection(const QgsGeometry &geometry) const
Returns a geometry representing the points shared by this geometry and other.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A feature sink output for processing algorithms.
Type
The WKB type describes the number of dimensions a geometry has.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Custom exception class for processing related exceptions.
A rectangular map extent parameter for processing algorithms.
bool convertToMultiType()
Converts single type geometry into multitype geometry e.g.
bool isCanceled() const
Tells whether the operation has been canceled already.
An input feature source (such as vector layers) parameter for processing algorithms.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
bool nextFeature(QgsFeature &f)
Contains information about the context in which a processing algorithm is executed.