Skip to content

Commit

Permalink
Add method to retrieve sink
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 3, 2017
1 parent fde71cf commit 96ad511
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/core/qgsfeaturesink.sip
Expand Up @@ -80,6 +80,12 @@ class QgsProxyFeatureSink : QgsFeatureSink
virtual bool addFeatures( QgsFeatureIterator &iterator );


QgsFeatureSink *destinationSink();
%Docstring
Returns the destination QgsFeatureSink which the proxy will forward features to.
:rtype: QgsFeatureSink
%End

};


Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsfeaturesink.h
Expand Up @@ -84,6 +84,11 @@ class CORE_EXPORT QgsProxyFeatureSink : public QgsFeatureSink
bool addFeatures( QgsFeatureList &features ) override;
bool addFeatures( QgsFeatureIterator &iterator ) override;

/**
* Returns the destination QgsFeatureSink which the proxy will forward features to.
*/
QgsFeatureSink *destinationSink() { return mSink; }

private:

QgsFeatureSink *mSink;
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_qgsfeaturesink.py
Expand Up @@ -74,6 +74,7 @@ def testProxyFeatureSink(self):

store = QgsFeatureStore(fields, QgsCoordinateReferenceSystem())
proxy = QgsProxyFeatureSink(store)
self.assertEqual(proxy.destinationSink(), store)

self.assertEqual(len(store), 0)

Expand Down

0 comments on commit 96ad511

Please sign in to comment.