Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 11, 2019
1 parent 4be150c commit fa3bfdd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/analysis/processing/qgsalgorithmsimplify.cpp
Expand Up @@ -132,6 +132,11 @@ QgsFeatureList QgsSimplifyAlgorithm::processFeature( const QgsFeature &feature,
return QgsFeatureList() << f;
}

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

///@endcond


2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmsimplify.h
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/analysis/processing/qgsalgorithmsmooth.cpp
Expand Up @@ -156,6 +156,11 @@ QgsFeatureList QgsSmoothAlgorithm::processFeature( const QgsFeature &feature, Qg
return QgsFeatureList() << f;
}

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

///@endcond


1 change: 1 addition & 0 deletions src/analysis/processing/qgsalgorithmsmooth.h
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/analysis/processing/qgsalgorithmsnaptogrid.cpp
Expand Up @@ -154,6 +154,11 @@ QgsFeatureList QgsSnapToGridAlgorithm::processFeature( const QgsFeature &feature
return QgsFeatureList() << f;
}

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

///@endcond


1 change: 1 addition & 0 deletions src/analysis/processing/qgsalgorithmsnaptogrid.h
Expand Up @@ -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;
Expand Down

0 comments on commit fa3bfdd

Please sign in to comment.