Skip to content
Permalink
Browse files

[processing] Simplify algorithm should not run validity checks on geo…

…metries

Simplify (by its intrinsic nature) can output invalid geometries,
and its processing is not affected by the presence of input
geometry validity.

Also tag a few other algorithms which aren't sensitive to input
geometry validity.

(cherry picked from commit 9b6367f)
  • Loading branch information
nyalldawson committed Feb 8, 2019
1 parent 4be150c commit fa3bfddf0bcb0f3d63885c1fca85c1ff4c2f4248
@@ -132,6 +132,11 @@ QgsFeatureList QgsSimplifyAlgorithm::processFeature( const QgsFeature &feature,
return QgsFeatureList() << f;
}

QgsProcessingFeatureSource::Flag QgsSimplifyAlgorithm::sourceFlags() const
{
return QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks;
}

///@endcond


@@ -51,7 +51,7 @@ class QgsSimplifyAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString outputName() const override;
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &, QgsProcessingFeedback *feedback ) override;

QgsProcessingFeatureSource::Flag sourceFlags() const override;
private:

double mTolerance = 1.0;
@@ -156,6 +156,11 @@ QgsFeatureList QgsSmoothAlgorithm::processFeature( const QgsFeature &feature, Qg
return QgsFeatureList() << f;
}

QgsProcessingFeatureSource::Flag QgsSmoothAlgorithm::sourceFlags() const
{
return QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks;
}

///@endcond


@@ -49,6 +49,7 @@ class QgsSmoothAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QgsProcessing::SourceType outputLayerType() const override;
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsProcessingFeatureSource::Flag sourceFlags() const override;

private:
int mIterations = 1;
@@ -154,6 +154,11 @@ QgsFeatureList QgsSnapToGridAlgorithm::processFeature( const QgsFeature &feature
return QgsFeatureList() << f;
}

QgsProcessingFeatureSource::Flag QgsSnapToGridAlgorithm::sourceFlags() const
{
return QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks;
}

///@endcond


@@ -47,6 +47,7 @@ class QgsSnapToGridAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString outputName() const override;
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsProcessingFeatureSource::Flag sourceFlags() const override;

private:
double mIntervalX = 0.0;

0 comments on commit fa3bfdd

Please sign in to comment.
You can’t perform that action at this time.