26QString QgsCoverageUnionAlgorithm::name()
const
28 return QStringLiteral(
"coverageunion" );
31QString QgsCoverageUnionAlgorithm::displayName()
const
33 return QObject::tr(
"Dissolve coverage" );
36QStringList QgsCoverageUnionAlgorithm::tags()
const
38 return QObject::tr(
"union,merge,topological,boundary" ).split(
',' );
41QString QgsCoverageUnionAlgorithm::group()
const
43 return QObject::tr(
"Vector coverage" );
46QString QgsCoverageUnionAlgorithm::groupId()
const
48 return QStringLiteral(
"vectorcoverage" );
51void QgsCoverageUnionAlgorithm::initAlgorithm(
const QVariantMap & )
57QString QgsCoverageUnionAlgorithm::shortDescription()
const
59 return QObject::tr(
"Dissolves a coverage of polygon features" );
62QString QgsCoverageUnionAlgorithm::shortHelpString()
const
64 return QObject::tr(
"This algorithm operates on a coverage (represented as a set of polygon features "
65 "with exactly matching edge geometry) to dissolve (union) the geometries.\n\n"
66 "It provides a heavily optimized approach for unioning these features compared with "
67 "the standard Dissolve tools." );
70QgsCoverageUnionAlgorithm *QgsCoverageUnionAlgorithm::createInstance()
const
72 return new QgsCoverageUnionAlgorithm();
77 std::unique_ptr<QgsProcessingFeatureSource> source( parameterAsSource( parameters, QStringLiteral(
"INPUT" ), context ) );
82 std::unique_ptr<QgsFeatureSink> sink( parameterAsSink( parameters, QStringLiteral(
"OUTPUT" ), context, sinkId, source->fields(),
Qgis::WkbType::MultiPolygon, source->sourceCrs() ) );
89 const long count = source->featureCount();
95 const double step = count > 0 ? 100.0 / count : 1;
98 feedback->
pushInfo( QObject::tr(
"Collecting features" ) );
120 feedback->
pushInfo( QObject::tr(
"Dissolving coverage" ) );
125 switch ( source->invalidGeometryCheck() )
141 std::unique_ptr<QgsAbstractGeometry> dissolved =
geos.unionCoverage( &error );
145 if ( !error.isEmpty() )
153 feedback->
pushInfo( QObject::tr(
"Storing output" ) );
155 outFeature.setGeometry( std::move( dissolved ) );
162 outputs.insert( QStringLiteral(
"OUTPUT" ), sinkId );
@ VectorPolygon
Vector polygon layers.
@ Valid
Coverage is valid.
@ NoCheck
No invalid geometry checking.
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ SkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
@ MultiPolygon
MultiPolygon.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
@ 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...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
bool isCanceled() const
Tells whether the operation has been canceled already.
void setProgress(double progress)
Sets the current progress for the feedback object.
void reserve(int size)
Attempts to allocate memory for at least size geometries.
virtual bool addGeometry(QgsAbstractGeometry *g)
Adds a geometry and takes ownership. Returns true in case of success.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Does vector analysis using the GEOS library and handles import, export, and exception handling.
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.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
A feature sink output for processing algorithms.
An input feature source (such as vector layers) parameter for processing algorithms.
Contains geos related utilities and functions.