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.
  • Loading branch information
nyalldawson committed Feb 8, 2019
1 parent 061882d commit 9b6367fc1f9f25359f35b28dd97872d761bbb978
@@ -132,6 +132,11 @@ QgsFeatureList QgsSimplifyAlgorithm::processFeature( const QgsFeature &feature,
return QgsFeatureList() << f;
}

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

///@endcond


@@ -52,7 +52,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;
@@ -144,6 +144,11 @@ QgsFeatureList QgsSplitLinesByLengthAlgorithm::processFeature( const QgsFeature
}
}

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


///@endcond

@@ -51,6 +51,7 @@ class QgsSplitLinesByLengthAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString outputName() const override;
QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsProcessingFeatureSource::Flag sourceFlags() const override;

private:

0 comments on commit 9b6367f

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