25using namespace Qt::StringLiterals;
29QString QgsInterpolatePointAlgorithm::name()
const
31 return u
"interpolatepoint"_s;
34QString QgsInterpolatePointAlgorithm::displayName()
const
36 return QObject::tr(
"Interpolate point on line" );
39QStringList QgsInterpolatePointAlgorithm::tags()
const
41 return QObject::tr(
"linestring,reference,referencing,distance,interpolate" ).split(
',' );
44QString QgsInterpolatePointAlgorithm::group()
const
46 return QObject::tr(
"Vector geometry" );
49QString QgsInterpolatePointAlgorithm::groupId()
const
51 return u
"vectorgeometry"_s;
54QString QgsInterpolatePointAlgorithm::outputName()
const
56 return QObject::tr(
"Interpolated points" );
59QString QgsInterpolatePointAlgorithm::shortHelpString()
const
61 return QObject::tr(
"This algorithm creates a point geometry interpolated at a set distance along line or curve geometries.\n\n"
62 "Z and M values are linearly interpolated from existing values.\n\n"
63 "If a multipart geometry is encountered, only the first part is considered when "
64 "interpolating the point.\n\n"
65 "If the specified distance is greater than the curve's length, the resultant feature will have a null geometry." );
68QString QgsInterpolatePointAlgorithm::shortDescription()
const
70 return QObject::tr(
"Interpolates a point along lines at a set distance." );
73QList<int> QgsInterpolatePointAlgorithm::inputLayerTypes()
const
93QgsInterpolatePointAlgorithm *QgsInterpolatePointAlgorithm::createInstance()
const
95 return new QgsInterpolatePointAlgorithm();
98void QgsInterpolatePointAlgorithm::initParameters(
const QVariantMap & )
100 auto distance = std::make_unique<QgsProcessingParameterDistance>( u
"DISTANCE"_s, QObject::tr(
"Distance" ), 0.0, u
"INPUT"_s,
false, 0 );
101 distance->setIsDynamic(
true );
103 distance->setDynamicLayerParameterName( u
"INPUT"_s );
104 addParameter( distance.release() );
115 mDistance = parameterAsDouble( parameters, u
"DISTANCE"_s, context );
117 if ( mDynamicDistance )
118 mDistanceProperty = parameters.value( u
"DISTANCE"_s ).value<
QgsProperty>();
129 double distance = mDistance;
130 if ( mDynamicDistance )
131 distance = mDistanceProperty.valueAsDouble( context.
expressionContext(), distance );
ProcessingSourceType
Processing data source types.
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
WkbType
The WKB type describes the number of dimensions a geometry has.
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
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.
A geometry is the spatial representation of a feature.
QgsGeometry interpolate(double distance) const
Returns an interpolated point on the geometry at the specified distance.
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.
static Qgis::WkbType addM(Qgis::WkbType type)
Adds the m dimension to a WKB type and returns the new type.
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
QList< QgsFeature > QgsFeatureList