22 QString QgsCentroidAlgorithm::name()
const 24 return QStringLiteral(
"centroids" );
27 QString QgsCentroidAlgorithm::displayName()
const 29 return QObject::tr(
"Centroids" );
32 QStringList QgsCentroidAlgorithm::tags()
const 34 return QObject::tr(
"centroid,center,average,point,middle" ).split(
',' );
37 QString QgsCentroidAlgorithm::group()
const 39 return QObject::tr(
"Vector geometry" );
42 QString QgsCentroidAlgorithm::groupId()
const 44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsCentroidAlgorithm::outputName()
const 49 return QObject::tr(
"Centroids" );
52 void QgsCentroidAlgorithm::initAlgorithm(
const QVariantMap & )
58 QString QgsCentroidAlgorithm::shortHelpString()
const 60 return QObject::tr(
"This algorithm creates a new point layer, with points representing the centroid of the geometries in an input layer.\n\n" 61 "The attributes associated to each point in the output layer are the same ones associated to the original features." );
64 QgsCentroidAlgorithm *QgsCentroidAlgorithm::createInstance()
const 66 return new QgsCentroidAlgorithm();
77 feedback->
pushInfo( QObject::tr(
"Error calculating centroid for feature %1" ).arg( feature.
id() ) );
Base class for providing feedback from a processing algorithm.
QList< QgsFeature > QgsFeatureList
QgsGeometry centroid() const
Returns the center of mass of a geometry.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
A feature sink output for processing algorithms.
QgsGeometry geometry() const
Returns the geometry associated with this feature.
An input feature source (such as vector layers) parameter for processing algorithms.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Contains information about the context in which a processing algorithm is executed.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.