qgswfsfeatureiterator.h (QGIS-final-3_10_11) | : | qgswfsfeatureiterator.h (QGIS-final-3_10_12) | ||
---|---|---|---|---|
skipping to change at line 93 | skipping to change at line 93 | |||
process the results as soon as they arrived and notify them to the | process the results as soon as they arrived and notify them to the | |||
serializer to fill the case, and to the iterator that subscribed | serializer to fill the case, and to the iterator that subscribed | |||
Instances of this class may be run in a dedicated thread (QgsWFSThreadedFeat ureDownloader) | Instances of this class may be run in a dedicated thread (QgsWFSThreadedFeat ureDownloader) | |||
A progress dialog may pop-up in GUI mode (if the download takes a certain ti me) | A progress dialog may pop-up in GUI mode (if the download takes a certain ti me) | |||
to allow canceling the download. | to allow canceling the download. | |||
*/ | */ | |||
class QgsWFSFeatureDownloader: public QgsWfsRequest | class QgsWFSFeatureDownloader: public QgsWfsRequest | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QgsWFSFeatureDownloader( QgsWFSSharedData *shared ); | explicit QgsWFSFeatureDownloader( QgsWFSSharedData *shared, bool requestMade FromMainThread ); | |||
~QgsWFSFeatureDownloader() override; | ~QgsWFSFeatureDownloader() override; | |||
/** | /** | |||
* Start the download. | * Start the download. | |||
* \param serializeFeatures whether to notify the sharedData serializer. | * \param serializeFeatures whether to notify the sharedData serializer. | |||
* \param maxFeatures user-defined limit of features to download. Overrides | * \param maxFeatures user-defined limit of features to download. Overrides | |||
* the one defined in the URI. Typically by the QgsWFSPro vider, | * the one defined in the URI. Typically by the QgsWFSPro vider, | |||
* when it cannot guess the geometry type. | * when it cannot guess the geometry type. | |||
*/ | */ | |||
void run( bool serializeFeatures, int maxFeatures ); | void run( bool serializeFeatures, int maxFeatures ); | |||
skipping to change at line 119 | skipping to change at line 119 | |||
signals: | signals: | |||
//! Emitted when new features have been received | //! Emitted when new features have been received | |||
void featureReceived( QVector<QgsWFSFeatureGmlIdPair> ); | void featureReceived( QVector<QgsWFSFeatureGmlIdPair> ); | |||
//! Emitted when new features have been received | //! Emitted when new features have been received | |||
void featureReceived( int featureCount ); | void featureReceived( int featureCount ); | |||
//! Emitted when the download is finished (successful or not) | //! Emitted when the download is finished (successful or not) | |||
void endOfDownload( bool success ); | void endOfDownload( bool success ); | |||
// Emitted when QgsNetworkAccessManager emit signals that require | ||||
// QgsBackgroundCachedFeatureIterator to process (authentication) events, | ||||
// if it was started from the main thread. | ||||
void resumeMainThread(); | ||||
//! Used internally by the stop() method | //! Used internally by the stop() method | |||
void doStop(); | void doStop(); | |||
//! Emitted with the total accumulated number of features downloaded. | //! Emitted with the total accumulated number of features downloaded. | |||
void updateProgress( int totalFeatureCount ); | void updateProgress( int totalFeatureCount ); | |||
protected: | protected: | |||
QString errorMessageWithReason( const QString &reason ) override; | QString errorMessageWithReason( const QString &reason ) override; | |||
private slots: | private slots: | |||
skipping to change at line 188 | skipping to change at line 193 | |||
protected: | protected: | |||
//! Inherited from QThread. Starts the download | //! Inherited from QThread. Starts the download | |||
void run() override; | void run() override; | |||
private: | private: | |||
QgsWFSSharedData *mShared; //!< Mutable data shared between provider and fe ature sources | QgsWFSSharedData *mShared; //!< Mutable data shared between provider and fe ature sources | |||
QgsWFSFeatureDownloader *mDownloader = nullptr; | QgsWFSFeatureDownloader *mDownloader = nullptr; | |||
QWaitCondition mWaitCond; | QWaitCondition mWaitCond; | |||
QMutex mWaitMutex; | QMutex mWaitMutex; | |||
bool mRequestMadeFromMainThread = false; | ||||
}; | }; | |||
class QgsWFSFeatureSource; | class QgsWFSFeatureSource; | |||
/** | /** | |||
* Feature iterator. The iterator will internally both subscribe to a live | * Feature iterator. The iterator will internally both subscribe to a live | |||
downloader to receive 'fresh' features, and to a iterator on the features | downloader to receive 'fresh' features, and to a iterator on the features | |||
already cached. It will actually start by consuming cache features for | already cached. It will actually start by consuming cache features for | |||
initial feedback, and then process the live downloaded features. */ | initial feedback, and then process the live downloaded features. */ | |||
class QgsWFSFeatureIterator : public QObject, | class QgsWFSFeatureIterator : public QObject, | |||
skipping to change at line 217 | skipping to change at line 223 | |||
bool close() override; | bool close() override; | |||
void setInterruptionChecker( QgsFeedback *interruptionChecker ) override; | void setInterruptionChecker( QgsFeedback *interruptionChecker ) override; | |||
//! Used by QgsWFSSharedData::registerToCache() | //! Used by QgsWFSSharedData::registerToCache() | |||
void connectSignals( QgsWFSFeatureDownloader *downloader ); | void connectSignals( QgsWFSFeatureDownloader *downloader ); | |||
private slots: | private slots: | |||
void featureReceivedSynchronous( const QVector<QgsWFSFeatureGmlIdPair> &list ); | void featureReceivedSynchronous( const QVector<QgsWFSFeatureGmlIdPair> &list ); | |||
void endOfDownloadSynchronous( bool success ); | void endOfDownloadSynchronous( bool success ); | |||
void resumeMainThreadSynchronous(); | ||||
private: | private: | |||
//! Translate mRequest to a request compatible of the Spatialite cache | //! Translate mRequest to a request compatible of the Spatialite cache | |||
QgsFeatureRequest buildRequestCache( int gencounter ); | QgsFeatureRequest buildRequestCache( int gencounter ); | |||
bool fetchFeature( QgsFeature &f ) override; | bool fetchFeature( QgsFeature &f ) override; | |||
//! Copies feature attributes / geometry from srcFeature to dstFeature | //! Copies feature attributes / geometry from srcFeature to dstFeature | |||
void copyFeature( const QgsFeature &srcFeature, QgsFeature &dstFeature, bool srcIsCache ); | void copyFeature( const QgsFeature &srcFeature, QgsFeature &dstFeature, bool srcIsCache ); | |||
std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources | std::shared_ptr<QgsWFSSharedData> mShared; //!< Mutable data shared between provider and feature sources | |||
//! Subset of attributes (relatives to mShared->mFields) to fetch. Only vali d if ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) | //! Subset of attributes (relatives to mShared->mFields) to fetch. Only vali d if ( mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes ) | |||
QgsAttributeList mSubSetAttributes; | QgsAttributeList mSubSetAttributes; | |||
bool mNewFeaturesReceived = false; | bool mNewFeaturesReceived = false; | |||
bool mDownloadFinished = false; | bool mDownloadFinished = false; | |||
bool mProcessEvents = false; | ||||
QgsFeatureIterator mCacheIterator; | QgsFeatureIterator mCacheIterator; | |||
QgsFeedback *mInterruptionChecker = nullptr; | QgsFeedback *mInterruptionChecker = nullptr; | |||
bool mTimeoutOrInterruptionOccurred = false; | bool mTimeoutOrInterruptionOccurred = false; | |||
//! this mutex synchronizes the mWriterXXXX variables between featureReceive dSynchronous() and fetchFeature() | //! this mutex synchronizes the mWriterXXXX variables between featureReceive dSynchronous() and fetchFeature() | |||
QMutex mMutex; | QMutex mMutex; | |||
QWaitCondition mWaitCond; | QWaitCondition mWaitCond; | |||
//! used to forger mWriterFilename | //! used to forger mWriterFilename | |||
int mCounter; | int mCounter; | |||
//! maximum size in bytes of mWriterByteArray before flushing it to disk | //! maximum size in bytes of mWriterByteArray before flushing it to disk | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added |