22QString QgsAlgorithmRemoveDuplicateVertices::name()
const
24 return QStringLiteral(
"removeduplicatevertices" );
27QString QgsAlgorithmRemoveDuplicateVertices::displayName()
const
29 return QObject::tr(
"Remove duplicate vertices" );
32QStringList QgsAlgorithmRemoveDuplicateVertices::tags()
const
34 return QObject::tr(
"points,valid,overlapping,vertex,nodes,invalid,error,repair" ).split(
',' );
37QString QgsAlgorithmRemoveDuplicateVertices::group()
const
39 return QObject::tr(
"Vector geometry" );
42QString QgsAlgorithmRemoveDuplicateVertices::groupId()
const
44 return QStringLiteral(
"vectorgeometry" );
47QString QgsAlgorithmRemoveDuplicateVertices::outputName()
const
49 return QObject::tr(
"Cleaned" );
52QString QgsAlgorithmRemoveDuplicateVertices::shortHelpString()
const
54 return QObject::tr(
"This algorithm removes duplicate vertices from features, wherever removing the vertices does "
55 "not result in a degenerate geometry.\n\n"
56 "The tolerance parameter specifies the tolerance for coordinates when determining whether "
57 "vertices are identical.\n\n"
58 "By default, z values are not considered when detecting duplicate vertices. E.g. two vertices "
59 "with the same x and y coordinate but different z values will still be considered "
60 "duplicate and one will be removed. If the Use Z Value parameter is true, then the z values are "
61 "also tested and vertices with the same x and y but different z will be maintained.\n\n"
62 "Note that duplicate vertices are not tested between different parts of a multipart geometry. E.g. "
63 "a multipoint geometry with overlapping points will not be changed by this method." );
66QgsAlgorithmRemoveDuplicateVertices *QgsAlgorithmRemoveDuplicateVertices::createInstance()
const
68 return new QgsAlgorithmRemoveDuplicateVertices();
71void QgsAlgorithmRemoveDuplicateVertices::initParameters(
const QVariantMap & )
73 std::unique_ptr<QgsProcessingParameterDistance> tolerance = std::make_unique<QgsProcessingParameterDistance>( QStringLiteral(
"TOLERANCE" ), QObject::tr(
"Tolerance" ), 0.000001, QStringLiteral(
"INPUT" ),
false, 0, 10000000.0 );
74 tolerance->setIsDynamic(
true );
76 tolerance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
77 addParameter( tolerance.release() );
79 std::unique_ptr<QgsProcessingParameterBoolean> useZ = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral(
"USE_Z_VALUE" ), QObject::tr(
"Use Z Value" ),
false );
80 useZ->setIsDynamic(
true );
82 useZ->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
83 addParameter( useZ.release() );
94 mTolerance = parameterAsDouble( parameters, QStringLiteral(
"TOLERANCE" ), context );
96 if ( mDynamicTolerance )
97 mToleranceProperty = parameters.value( QStringLiteral(
"TOLERANCE" ) ).value<
QgsProperty>();
99 mUseZValues = parameterAsBoolean( parameters, QStringLiteral(
"USE_Z_VALUE" ), context );
102 mUseZProperty = parameters.value( QStringLiteral(
"USE_Z_VALUE" ) ).value<
QgsProperty>();
113 double tolerance = mTolerance;
114 if ( mDynamicTolerance )
115 tolerance = mToleranceProperty.valueAsDouble( context.
expressionContext(), tolerance );
117 bool useZValue = mUseZValues;
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
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.
bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
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.
bool valueAsBool(const QgsExpressionContext &context, bool defaultValue=false, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as an boolean.
QList< QgsFeature > QgsFeatureList