24QString QgsRoundnessAlgorithm::name()
const
26 return QStringLiteral(
"roundness" );
29QString QgsRoundnessAlgorithm::displayName()
const
31 return QObject::tr(
"Roundness" );
34QStringList QgsRoundnessAlgorithm::tags()
const
36 return QObject::tr(
"roundness,circle" ).split(
',' );
39QString QgsRoundnessAlgorithm::group()
const
41 return QObject::tr(
"Vector geometry" );
44QString QgsRoundnessAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeometry" );
49QString QgsRoundnessAlgorithm::outputName()
const
51 return QObject::tr(
"Roundness" );
54QString QgsRoundnessAlgorithm::shortHelpString()
const
56 return QObject::tr(
"Calculates the roundness of each feature and stores it as a new field. The input vector layer must contain polygons.\n\n"
57 "The roundness of a polygon is defined as 4π × polygon area / perimeter². The roundness value varies between 0 and 1. A perfect circle has a roundness of 1, while a completely flat polygon has a roundness of 0." );
60QString QgsRoundnessAlgorithm::shortDescription()
const
62 return QObject::tr(
"Calculates the roundness of polygon features." );
65QgsRoundnessAlgorithm *QgsRoundnessAlgorithm::createInstance()
const
67 return new QgsRoundnessAlgorithm();
70QList<int> QgsRoundnessAlgorithm::inputLayerTypes()
const
83 newFields.
append(
QgsField( QStringLiteral(
"roundness" ), QMetaType::Type::Double ) );
96 double roundness = poly->roundness();
97 attributes << QVariant( roundness );
101 attributes << QVariant();
106 attributes << QVariant();
ProcessingSourceType
Processing data source types.
@ VectorPolygon
Vector polygon layers.
virtual const QgsAbstractGeometry * simplifiedTypeRef() const
Returns a reference to the simplest lossless representation of this geometry, e.g.
Curve polygon geometry type.
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.
bool hasGeometry() const
Returns true if the feature has an associated 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.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
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