Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #4624 from nyalldawson/feature_source
QgsFeatureSource
- Loading branch information
Showing
with
1,046 additions
and 589 deletions.
- +1 −0 python/core/core.sip
- +81 −0 python/core/qgsfeaturesource.sip
- +4 −1 python/core/qgsvectordataprovider.sip
- +11 −5 python/core/qgsvectorlayer.sip
- +1 −0 src/core/CMakeLists.txt
- +1 −0 src/core/qgsfeaturesink.h
- +86 −0 src/core/qgsfeaturesource.h
- +5 −0 src/core/qgsvectordataprovider.cpp
- +8 −5 src/core/qgsvectordataprovider.h
- +5 −0 src/core/qgsvectorlayer.cpp
- +8 −5 src/core/qgsvectorlayer.h
- +12 −0 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
- +13 −0 src/providers/ogr/qgsogrfeatureiterator.cpp
- +13 −0 src/providers/postgres/qgspostgresfeatureiterator.cpp
- +12 −1 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
- +11 −0 src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
- +15 −0 src/providers/wfs/qgswfsfeatureiterator.cpp
- +605 −0 tests/src/python/featuresourcetestbase.py
- +62 −542 tests/src/python/providertestbase.py
- +1 −1 tests/src/python/test_provider_db2.py
- +3 −3 tests/src/python/test_provider_memory.py
- +1 −1 tests/src/python/test_provider_mssql.py
- +3 −3 tests/src/python/test_provider_oracle.py
- +15 −12 tests/src/python/test_provider_postgres.py
- +5 −2 tests/src/python/test_provider_shapefile.py
- +5 −2 tests/src/python/test_provider_spatialite.py
- +1 −1 tests/src/python/test_provider_virtual.py
- +5 −1 tests/src/python/test_provider_wfs.py
- +2 −2 tests/src/python/test_qgsdelimitedtextprovider.py
- +51 −2 tests/src/python/test_qgsvectorlayer.py
@@ -0,0 +1,81 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfeaturesource.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsFeatureSource | ||
{ | ||
%Docstring | ||
An interface for objects which provide features via a getFeatures method. | ||
|
||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfeaturesource.h" | ||
%End | ||
public: | ||
|
||
virtual ~QgsFeatureSource(); | ||
|
||
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0; | ||
%Docstring | ||
Returns an iterator for the features in the source. | ||
An optional ``request`` can be used to optimise the returned | ||
iterator, eg by restricting the returned attributes or geometry. | ||
:rtype: QgsFeatureIterator | ||
%End | ||
|
||
virtual QgsCoordinateReferenceSystem sourceCrs() const = 0; | ||
%Docstring | ||
Returns the coordinate reference system for features in the source. | ||
:rtype: QgsCoordinateReferenceSystem | ||
%End | ||
|
||
virtual QgsFields fields() const = 0; | ||
%Docstring | ||
Returns the fields associated with features in the source. | ||
:rtype: QgsFields | ||
%End | ||
|
||
virtual QgsWkbTypes::Type wkbType() const = 0; | ||
%Docstring | ||
Returns the geometry type for features returned by this source. | ||
:rtype: QgsWkbTypes.Type | ||
%End | ||
|
||
|
||
int __len__() const; | ||
%Docstring | ||
Returns the number of features contained in the source, or -1 | ||
if the feature count is unknown. | ||
:rtype: int | ||
%End | ||
%MethodCode | ||
sipRes = sipCpp->featureCount(); | ||
%End | ||
|
||
virtual long featureCount() const = 0; | ||
%Docstring | ||
Returns the number of features contained in the source, or -1 | ||
if the feature count is unknown. | ||
:rtype: long | ||
%End | ||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfeaturesource.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
@@ -0,0 +1,86 @@ | ||
/*************************************************************************** | ||
qgsfeaturesource.h | ||
---------------- | ||
begin : May 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFEATURESOURCE_H | ||
#define QGSFEATURESOURCE_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgis.h" | ||
|
||
class QgsFeatureIterator; | ||
class QgsFeatureRequest; | ||
class QgsCoordinateReferenceSystem; | ||
class QgsFields; | ||
|
||
/** | ||
* \class QgsFeatureSource | ||
* \ingroup core | ||
* An interface for objects which provide features via a getFeatures method. | ||
* | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsFeatureSource | ||
{ | ||
public: | ||
|
||
virtual ~QgsFeatureSource() = default; | ||
|
||
/** | ||
* Returns an iterator for the features in the source. | ||
* An optional \a request can be used to optimise the returned | ||
* iterator, eg by restricting the returned attributes or geometry. | ||
*/ | ||
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request = QgsFeatureRequest() ) const = 0; | ||
|
||
/** | ||
* Returns the coordinate reference system for features in the source. | ||
*/ | ||
virtual QgsCoordinateReferenceSystem sourceCrs() const = 0; | ||
|
||
/** | ||
* Returns the fields associated with features in the source. | ||
*/ | ||
virtual QgsFields fields() const = 0; | ||
|
||
/** | ||
* Returns the geometry type for features returned by this source. | ||
*/ | ||
virtual QgsWkbTypes::Type wkbType() const = 0; | ||
|
||
#ifdef SIP_RUN | ||
|
||
/** | ||
* Returns the number of features contained in the source, or -1 | ||
* if the feature count is unknown. | ||
*/ | ||
int __len__() const; | ||
% MethodCode | ||
sipRes = sipCpp->featureCount(); | ||
% End | ||
#endif | ||
|
||
/** | ||
* Returns the number of features contained in the source, or -1 | ||
* if the feature count is unknown. | ||
*/ | ||
virtual long featureCount() const = 0; | ||
|
||
}; | ||
|
||
Q_DECLARE_METATYPE( QgsFeatureSource * ) | ||
|
||
#endif // QGSFEATURESOURCE_H |
Oops, something went wrong.