23QString QgsDensifyGeometriesByCountAlgorithm::name()
const
25 return QStringLiteral(
"densifygeometries" );
28QString QgsDensifyGeometriesByCountAlgorithm::displayName()
const
30 return QObject::tr(
"Densify by count" );
33QStringList QgsDensifyGeometriesByCountAlgorithm::tags()
const
35 return QObject::tr(
"add,vertex,vertices,points,nodes" ).split(
',' );
38QString QgsDensifyGeometriesByCountAlgorithm::group()
const
40 return QObject::tr(
"Vector geometry" );
43QString QgsDensifyGeometriesByCountAlgorithm::groupId()
const
45 return QStringLiteral(
"vectorgeometry" );
48QString QgsDensifyGeometriesByCountAlgorithm::shortHelpString()
const
50 return QObject::tr(
"This algorithm takes a polygon or line layer "
51 "and generates a new one in which the geometries "
52 "have a larger number of vertices than the "
53 "original one.\n\n If the geometries have z or m values "
54 "present then these will be linearly interpolated "
55 "at the added nodes.\n\n The number of new vertices to "
56 "add to each feature geometry is specified "
57 "as an input parameter." );
60QString QgsDensifyGeometriesByCountAlgorithm::shortDescription()
const
62 return QObject::tr(
"Creates a densified version of geometries." );
65QgsDensifyGeometriesByCountAlgorithm *QgsDensifyGeometriesByCountAlgorithm::createInstance()
const
67 return new QgsDensifyGeometriesByCountAlgorithm;
70QList<int> QgsDensifyGeometriesByCountAlgorithm::inputLayerTypes()
const
75void QgsDensifyGeometriesByCountAlgorithm::initParameters(
const QVariantMap &configuration )
77 Q_UNUSED( configuration )
78 std::unique_ptr<QgsProcessingParameterNumber> verticesCnt = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral(
"VERTICES" ), QObject::tr(
"Number of vertices to add" ),
Qgis::ProcessingNumberParameterType::Integer, 1,
false, 1, 10000000 );
79 verticesCnt->setIsDynamic(
true );
81 verticesCnt->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
82 addParameter( verticesCnt.release() );
85QString QgsDensifyGeometriesByCountAlgorithm::outputName()
const
87 return QObject::tr(
"Densified" );
93 mVerticesCnt = parameterAsInt( parameters, QStringLiteral(
"VERTICES" ), context );
96 if ( mDynamicVerticesCnt )
97 mVerticesCntProperty = parameters.value( QStringLiteral(
"VERTICES" ) ).value<
QgsProperty>();
111 int verticesCnt = mVerticesCnt;
112 if ( mDynamicVerticesCnt )
113 verticesCnt = mVerticesCntProperty.valueAsInt( context.
expressionContext(), verticesCnt );
115 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