Skip to content

Commit ce063b8

Browse files
committedMay 25, 2017
Add QgsFeatureSource interface as interface for classes which
provide feature iterators via a getFeatures method
1 parent 13a3f2f commit ce063b8

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed
 

‎python/core/core.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
%Include qgsfeatureiterator.sip
5757
%Include qgsfeaturerequest.sip
5858
%Include qgsfeaturesink.sip
59+
%Include qgsfeaturesource.sip
5960
%Include qgsfeedback.sip
6061
%Include qgsfield.sip
6162
%Include qgsfieldconstraints.sip

‎python/core/qgsfeaturesource.sip

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsfeaturesource.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsFeatureSource
13+
{
14+
%Docstring
15+
An interface for objects which provide features via a getFeatures method.
16+
17+
.. versionadded:: 3.0
18+
%End
19+
20+
%TypeHeaderCode
21+
#include "qgsfeaturesource.h"
22+
%End
23+
public:
24+
25+
virtual ~QgsFeatureSource();
26+
27+
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;
28+
%Docstring
29+
Returns an iterator for the features in the source.
30+
An optional ``request`` can be used to optimise the returned
31+
iterator, eg by restricting the returned attributes or geometry.
32+
:rtype: QgsFeatureIterator
33+
%End
34+
35+
};
36+
37+
/************************************************************************
38+
* This file has been generated automatically from *
39+
* *
40+
* src/core/qgsfeaturesource.h *
41+
* *
42+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
43+
************************************************************************/

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ SET(QGIS_CORE_HDRS
753753
qgsfeatureiterator.h
754754
qgsfeaturerequest.h
755755
qgsfeaturesink.h
756+
qgsfeaturesource.h
756757
qgsfeaturestore.h
757758
qgsfieldformatter.h
758759
qgsfield_p.h

‎src/core/qgsfeaturesource.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/***************************************************************************
2+
qgsfeaturesource.h
3+
----------------
4+
begin : May 2017
5+
copyright : (C) 2017 by Nyall Dawson
6+
email : nyall dot dawson at gmail dot com
7+
***************************************************************************/
8+
9+
/***************************************************************************
10+
* *
11+
* This program is free software; you can redistribute it and/or modify *
12+
* it under the terms of the GNU General Public License as published by *
13+
* the Free Software Foundation; either version 2 of the License, or *
14+
* (at your option) any later version. *
15+
* *
16+
***************************************************************************/
17+
18+
#ifndef QGSFEATURESOURCE_H
19+
#define QGSFEATURESOURCE_H
20+
21+
#include "qgis_core.h"
22+
#include "qgis.h"
23+
#include "qgsfeature.h"
24+
#include "qgsfeatureiterator.h"
25+
26+
/**
27+
* \class QgsFeatureSource
28+
* \ingroup core
29+
* An interface for objects which provide features via a getFeatures method.
30+
*
31+
* \since QGIS 3.0
32+
*/
33+
class CORE_EXPORT QgsFeatureSource
34+
{
35+
public:
36+
37+
virtual ~QgsFeatureSource() = default;
38+
39+
/**
40+
* Returns an iterator for the features in the source.
41+
* An optional \a request can be used to optimise the returned
42+
* iterator, eg by restricting the returned attributes or geometry.
43+
*/
44+
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0;
45+
46+
};
47+
48+
#endif // QGSFEATURESOURCE_H

0 commit comments

Comments
 (0)
Please sign in to comment.