Skip to content
Permalink
Browse files

[processing] Collect features algorithm doesn't care about geometry v…

…alidity
  • Loading branch information
nyalldawson committed Jul 8, 2020
1 parent d9936de commit e8c080aca5a790435f111d232d2958bd92d153af
@@ -24,9 +24,9 @@
//

QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback,
const std::function<QgsGeometry( const QVector< QgsGeometry >& )> &collector, int maxQueueLength )
const std::function<QgsGeometry( const QVector< QgsGeometry >& )> &collector, int maxQueueLength, QgsProcessingFeatureSource::Flags sourceFlags )
{
std::unique_ptr< QgsFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) );
std::unique_ptr< QgsProcessingFeatureSource > source( parameterAsSource( parameters, QStringLiteral( "INPUT" ), context ) );
if ( !source )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) );

@@ -41,7 +41,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
long count = source->featureCount();

QgsFeature f;
QgsFeatureIterator it = source->getFeatures();
QgsFeatureIterator it = source->getFeatures( QgsFeatureRequest(), sourceFlags );

double step = count > 0 ? 100.0 / count : 1;
int current = 0;
@@ -281,7 +281,7 @@ QVariantMap QgsCollectAlgorithm::processAlgorithm( const QVariantMap &parameters
return processCollection( parameters, context, feedback, []( const QVector< QgsGeometry > &parts )->QgsGeometry
{
return QgsGeometry::collectGeometry( parts );
} );
}, 0, QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks );
}


@@ -34,7 +34,7 @@ class QgsCollectorAlgorithm : public QgsProcessingAlgorithm
protected:

QVariantMap processCollection( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback,
const std::function<QgsGeometry( const QVector<QgsGeometry>& )> &collector, int maxQueueLength = 0 );
const std::function<QgsGeometry( const QVector<QgsGeometry>& )> &collector, int maxQueueLength = 0, QgsProcessingFeatureSource::Flags sourceFlags = nullptr );
};

/**

0 comments on commit e8c080a

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