23using namespace Qt::StringLiterals;
27QString QgsDensifyGeometriesByCountAlgorithm::name()
const
29 return u
"densifygeometries"_s;
32QString QgsDensifyGeometriesByCountAlgorithm::displayName()
const
34 return QObject::tr(
"Densify by count" );
37QStringList QgsDensifyGeometriesByCountAlgorithm::tags()
const
39 return QObject::tr(
"add,vertex,vertices,points,nodes" ).split(
',' );
42QString QgsDensifyGeometriesByCountAlgorithm::group()
const
44 return QObject::tr(
"Vector geometry" );
47QString QgsDensifyGeometriesByCountAlgorithm::groupId()
const
49 return u
"vectorgeometry"_s;
52QString QgsDensifyGeometriesByCountAlgorithm::shortHelpString()
const
55 "This algorithm takes a polygon or line layer "
56 "and generates a new one in which the geometries "
57 "have a larger number of vertices than the "
58 "original one.\n\n If the geometries have z or m values "
59 "present then these will be linearly interpolated "
60 "at the added nodes.\n\n The number of new vertices to "
61 "add to each feature geometry is specified "
62 "as an input parameter."
66QString QgsDensifyGeometriesByCountAlgorithm::shortDescription()
const
68 return QObject::tr(
"Creates a densified version of geometries by adding a fixed number of vertices to segments." );
71QgsDensifyGeometriesByCountAlgorithm *QgsDensifyGeometriesByCountAlgorithm::createInstance()
const
73 return new QgsDensifyGeometriesByCountAlgorithm;
76QList<int> QgsDensifyGeometriesByCountAlgorithm::inputLayerTypes()
const
81void QgsDensifyGeometriesByCountAlgorithm::initParameters(
const QVariantMap &configuration )
83 Q_UNUSED( configuration )
85 verticesCnt->setIsDynamic(
true );
87 verticesCnt->setDynamicLayerParameterName( u
"INPUT"_s );
88 addParameter( verticesCnt.release() );
91QString QgsDensifyGeometriesByCountAlgorithm::outputName()
const
93 return QObject::tr(
"Densified" );
99 mVerticesCnt = parameterAsInt( parameters, u
"VERTICES"_s, context );
102 if ( mDynamicVerticesCnt )
103 mVerticesCntProperty = parameters.value( u
"VERTICES"_s ).value<
QgsProperty>();
117 int verticesCnt = mVerticesCnt;
118 if ( mDynamicVerticesCnt )
119 verticesCnt = mVerticesCntProperty.valueAsInt( context.
expressionContext(), verticesCnt );
121 if ( verticesCnt > 0 )
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
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.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
Contains information about the context in which a processing algorithm is executed.
QgsExpressionContext & expressionContext()
Returns the expression context.
Base class for providing feedback from a processing algorithm.
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
Definition for a property.
@ IntegerPositive
Positive integer values (including 0).
A store for object properties.
QList< QgsFeature > QgsFeatureList