24QString QgsConcaveHullByFeatureAlgorithm::name()
const
26 return QStringLiteral(
"concavehullbyfeature" );
29QString QgsConcaveHullByFeatureAlgorithm::displayName()
const
31 return QObject::tr(
"Concave hull (by feature)" );
34QStringList QgsConcaveHullByFeatureAlgorithm::tags()
const
36 return QObject::tr(
"concave,hull,bounds,bounding,convex" ).split(
',' );
39QString QgsConcaveHullByFeatureAlgorithm::group()
const
41 return QObject::tr(
"Vector geometry" );
44QString QgsConcaveHullByFeatureAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeometry" );
49QString QgsConcaveHullByFeatureAlgorithm::outputName()
const
51 return QObject::tr(
"Concave hulls" );
54QString QgsConcaveHullByFeatureAlgorithm::shortHelpString()
const
56 return QObject::tr(
"This algorithm calculates the concave hull for each feature in an input layer." ) + QStringLiteral(
"\n\n" )
57 + QObject::tr(
"A concave hull is a polygon which contains all the points of the input geometries, but is a better approximation than the convex hull to the area occupied by the input." ) + QStringLiteral(
"\n\n" )
58 + QObject::tr(
"It is frequently used to convert a multi-point into a polygonal area which contains all the points from the input geometry." ) + QStringLiteral(
"\n\n" )
59 + QObject::tr(
"See the 'Concave hull (by layer)' algorithm for a concave hull calculation which covers the whole layer or grouped subsets of features." );
62QString QgsConcaveHullByFeatureAlgorithm::shortDescription()
const
64 return QObject::tr(
"Calculates the concave hull for each feature in an input layer." );
67QgsConcaveHullByFeatureAlgorithm *QgsConcaveHullByFeatureAlgorithm::createInstance()
const
69 return new QgsConcaveHullByFeatureAlgorithm();
72void QgsConcaveHullByFeatureAlgorithm::initParameters(
const QVariantMap & )
78QList<int> QgsConcaveHullByFeatureAlgorithm::inputLayerTypes()
const
83QgsFields QgsConcaveHullByFeatureAlgorithm::outputFields(
const QgsFields &inputFields )
const
86 newFields.
append(
QgsField( QStringLiteral(
"area" ), QMetaType::Type::Double, QString(), 20, 6 ) );
87 newFields.
append(
QgsField( QStringLiteral(
"perimeter" ), QMetaType::Type::Double, QString(), 20, 6 ) );
93#if GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR < 11
94 throw QgsProcessingException( QObject::tr(
"This algorithm requires a QGIS build based on GEOS 3.11 or later" ) );
96 mPercentage = parameterAsDouble( parameters, QStringLiteral(
"ALPHA" ), context );
97 mAllowHoles = parameterAsBool( parameters, QStringLiteral(
"HOLES" ), context );
111 feedback->
reportError( QObject::tr(
"Cannot calculate convex hull for a single point feature (%1) (try 'Concave hull (by layer)' algorithm instead)." ).arg( f.
id() ) );
117 if ( outputGeometry.
isNull() )
132 feedback->
pushWarning( QObject::tr(
"Concave hull for feature %1 resulted in a linestring, ignoring" ).arg( f.
id() ) );
136 feedback->
pushWarning( QObject::tr(
"Concave hull for feature %1 resulted in a point, ignoring" ).arg( f.
id() ) );
@ VectorPoint
Vector point layers.
@ Double
Double/float values.
Abstract base class for all geometries.
virtual double perimeter() const
Returns the planar, 2-dimensional perimeter of the geometry.
virtual double area() const
Returns the planar, 2-dimensional area of the geometry.
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 clearGeometry()
Removes any geometry associated with the feature.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
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.
int numGeometries() const
Returns the number of geometries within the collection.
A geometry is the spatial representation of a feature.
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
QgsGeometry concaveHull(double targetPercent, bool allowHoles=false) const
Returns a possibly concave polygon that contains all the points in the geometry.
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 pushWarning(const QString &warning)
Pushes a warning informational message from the algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
A boolean parameter for processing algorithms.
A numeric parameter for processing algorithms.
static QgsFields combineFields(const QgsFields &fieldsA, const QgsFields &fieldsB, const QString &fieldsBPrefix=QString())
Combines two field lists, avoiding duplicate field names (in a case-insensitive manner).
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QList< QgsFeature > QgsFeatureList