Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2977 from rouault/wfs
First part of QEP 35: WFS provider enhancements
  • Loading branch information
jef-n committed Apr 7, 2016
2 parents 5895780 + 9040ec1 commit 19b9103
Show file tree
Hide file tree
Showing 54 changed files with 7,439 additions and 2,163 deletions.
1 change: 1 addition & 0 deletions ci/travis/linux/qt5/blacklist.txt
Expand Up @@ -67,6 +67,7 @@ PyQgsVectorFileWriter
PyQgsVectorLayer
PyQgsVirtualLayerDefinition
PyQgsVirtualLayerProvider
PyQgsWFSProvider
PyQgsZonalStatistics
qgis_alignrastertest
qgis_composereffectstest
Expand Down
5 changes: 5 additions & 0 deletions python/core/qgsdataprovider.sip
Expand Up @@ -218,6 +218,11 @@ class QgsDataProvider : QObject
*/
virtual QgsError error() const;

/** Invalidate connections corresponding to specified name
* @note added in QGIS 2.16
*/
virtual void invalidateConnections( const QString& connection );

signals:

/**
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsdataprovider.h
Expand Up @@ -306,6 +306,11 @@ class CORE_EXPORT QgsDataProvider : public QObject
*/
virtual QgsError error() const { return mError; }

/** Invalidate connections corresponding to specified name
* @note added in QGIS 2.16
*/
virtual void invalidateConnections( const QString& connection ) { Q_UNUSED( connection ); }

signals:

/**
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsfeatureiterator.cpp
Expand Up @@ -224,6 +224,10 @@ bool QgsAbstractFeatureIterator::prepareOrderBy( const QList<QgsFeatureRequest::
return false;
}

void QgsAbstractFeatureIterator::setInterruptionChecker( QgsInterruptionChecker* )
{
}

///////

QgsFeatureIterator& QgsFeatureIterator::operator=( const QgsFeatureIterator & other )
Expand Down
40 changes: 38 additions & 2 deletions src/core/qgsfeatureiterator.h
Expand Up @@ -21,6 +21,19 @@

class QgsAbstractGeometrySimplifier;

/** \ingroup core
* Interface that can be optionaly attached to an iterator so its
* nextFeature() implementaton can check if it must stop as soon as possible.
* @note Added in QGIS 2.16
* @note not available in Python bindings
*/
class CORE_EXPORT QgsInterruptionChecker
{
public:
//! return true if the iterator must stop as soon as possible
virtual bool mustStop() const = 0;
};

/** \ingroup core
* Internal feature iterator to be implemented within data providers
*/
Expand All @@ -41,6 +54,16 @@ class CORE_EXPORT QgsAbstractFeatureIterator
//! end of iterating: free the resources / lock
virtual bool close() = 0;

/** Attach an object that can be queried regularly by the iterator to check
* if it must stopped. This is mostly useful for iterators where a single
* nextFeature()/fetchFeature() iteration might be very long. A typical use case is the
* WFS provider. When nextFeature()/fetchFeature() is reasonably fast, it is not necessary
* to implement this method. The default implementation does nothing.
* @note added in QGIS 2.16
* @note not available in Python bindings
*/
virtual void setInterruptionChecker( QgsInterruptionChecker* interruptionChecker );

protected:
/**
* If you write a feature iterator for your provider, this is the method you
Expand Down Expand Up @@ -168,8 +191,6 @@ class QgsAbstractFeatureIteratorFromSource : public QgsAbstractFeatureIterator
bool mOwnSource;
};



/**
* \ingroup core
* Wrapper for iterator of features from vector data provider or vector layer
Expand All @@ -195,6 +216,15 @@ class CORE_EXPORT QgsFeatureIterator
//! find out whether the iterator is still valid or closed already
bool isClosed() const;

/** Attach an object that can be queried regularly by the iterator to check
* if it must stopped. This is mostly useful for iterators where a single
* nextFeature()/fetchFeature() iteration might be very long. A typical use case is the
* WFS provider.
* @note added in QGIS 2.16
* @note not available in Python bindings
*/
void setInterruptionChecker( QgsInterruptionChecker* interruptionChecker );

friend bool operator== ( const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2 );
friend bool operator!= ( const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2 );

Expand Down Expand Up @@ -265,4 +295,10 @@ inline bool operator!= ( const QgsFeatureIterator &fi1, const QgsFeatureIterator
return !( fi1 == fi2 );
}

inline void QgsFeatureIterator::setInterruptionChecker( QgsInterruptionChecker* interruptionChecker )
{
if ( mIter )
mIter->setInterruptionChecker( interruptionChecker );
}

#endif // QGSFEATUREITERATOR_H

0 comments on commit 19b9103

Please sign in to comment.