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 = parameterAsBoolean( 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 );