23using namespace Qt::StringLiterals;
27QString QgsDensifyGeometriesByIntervalAlgorithm::name()
const
29 return u
"densifygeometriesgivenaninterval"_s;
32QString QgsDensifyGeometriesByIntervalAlgorithm::displayName()
const
34 return QObject::tr(
"Densify by interval" );
37QStringList QgsDensifyGeometriesByIntervalAlgorithm::tags()
const
39 return QObject::tr(
"add,vertex,vertices,points,nodes" ).split(
',' );
42QString QgsDensifyGeometriesByIntervalAlgorithm::group()
const
44 return QObject::tr(
"Vector geometry" );
47QString QgsDensifyGeometriesByIntervalAlgorithm::groupId()
const
49 return u
"vectorgeometry"_s;
52QString QgsDensifyGeometriesByIntervalAlgorithm::shortHelpString()
const
54 return QObject::tr(
"This algorithm takes a polygon or line layer and generates a new one "
55 "in which the geometries have a larger number of vertices than the original one.\n\n"
56 "Geometries are densified by adding additional vertices on "
57 "edges that have a maximum distance of the interval parameter "
61QString QgsDensifyGeometriesByIntervalAlgorithm::shortDescription()
const
63 return QObject::tr(
"Creates a densified version of geometries by setting a maximum distance for segments." );
66QgsDensifyGeometriesByIntervalAlgorithm *QgsDensifyGeometriesByIntervalAlgorithm::createInstance()
const
68 return new QgsDensifyGeometriesByIntervalAlgorithm;
71QList<int> QgsDensifyGeometriesByIntervalAlgorithm::inputLayerTypes()
const
76void QgsDensifyGeometriesByIntervalAlgorithm::initParameters(
const QVariantMap &configuration )
78 Q_UNUSED( configuration )
79 auto interval = std::make_unique<QgsProcessingParameterDistance>( u
"INTERVAL"_s, QObject::tr(
"Interval between vertices to add" ), 1, u
"INPUT"_s,
false, 0, 10000000 );
80 interval->setIsDynamic(
true );
82 interval->setDynamicLayerParameterName( u
"INPUT"_s );
83 addParameter( interval.release() );
86QString QgsDensifyGeometriesByIntervalAlgorithm::outputName()
const
88 return QObject::tr(
"Densified" );
97 double interval = mInterval;
98 if ( mDynamicInterval )
99 interval = mIntervalProperty.valueAsDouble( context.
expressionContext(), interval );
110 mInterval = parameterAsDouble( parameters, u
"INTERVAL"_s, context );
113 if ( mDynamicInterval )
114 mIntervalProperty = parameters.value( u
"INTERVAL"_s ).value<
QgsProperty>();
@ 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 densifyByDistance(double distance) const
Densifies the geometry by adding regularly placed extra nodes inside each segment so that the maximum...
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.
@ DoublePositive
Positive double value (including 0).
A store for object properties.
QList< QgsFeature > QgsFeatureList