19#include <QtConcurrentMap>
23static void getFeaturesForProvider(
const QPair< std::shared_ptr< QgsAbstractFeatureSource >,
QgsFeatureRequest > &pair )
35 constexpr int JOBS_TO_RUN = 100;
36 QList< QPair< std::shared_ptr< QgsAbstractFeatureSource >,
QgsFeatureRequest > > jobs;
37 jobs.reserve( JOBS_TO_RUN );
38 for (
int i = 0; i < JOBS_TO_RUN; ++i )
40 jobs.append( qMakePair( std::shared_ptr< QgsAbstractFeatureSource >( provider->
featureSource() ), request ) );
45 QtConcurrent::blockingMap( jobs, getFeaturesForProvider );
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
This is the base class for vector data providers.
virtual QgsAbstractFeatureSource * featureSource() const =0
Returns feature source object that can be used for querying provider's data.