Skip to content
Permalink
Browse files

Fix outdated example code, convert to python

(because c++ devs are l33t and don't need examples...)
  • Loading branch information
nyalldawson committed May 3, 2018
1 parent fdaa57a commit 1e7d479321438c611325b3bd3ac93e16f9e1eea3
Showing with 33 additions and 22 deletions.
  1. +17 −11 python/core/qgsfeaturerequest.sip.in
  2. +16 −11 src/core/qgsfeaturerequest.h
@@ -31,19 +31,25 @@ For efficiency, it is also possible to tell provider that some data is not requi
- SimplifyMethod for geometries to fetch

The options may be chained, e.g.:
QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest.ExactIntersect)

.. code-block:: python

QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest.ExactIntersect)

Examples:
- fetch all features:
QgsFeatureRequest()
- fetch all features, only one attribute
QgsFeatureRequest().setSubsetOfAttributes(QStringList("myfield"), provider->fieldMap())
- fetch all features, without geometries
QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)
- fetch only features from particular extent
QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1))
- fetch only one feature
QgsFeatureRequest().setFilterFid(45)

.. code-block:: python

# fetch all features:
QgsFeatureRequest()
# fetch all features, only one attribute
QgsFeatureRequest().setSubsetOfAttributes(['myfield'], layer.fields())
# fetch all features, without geometries
QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)
# fetch only features from particular extent
QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1))
# fetch only one feature
QgsFeatureRequest().setFilterFid(45)
%End

%TypeHeaderCode
@@ -49,20 +49,25 @@
* - SimplifyMethod for geometries to fetch
*
* The options may be chained, e.g.:
* QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest::ExactIntersect)
*
* \code{.py}
* QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest.ExactIntersect)
* \endcode
*
* Examples:
* - fetch all features:
* QgsFeatureRequest()
* - fetch all features, only one attribute
* QgsFeatureRequest().setSubsetOfAttributes(QStringList("myfield"), provider->fieldMap())
* - fetch all features, without geometries
* QgsFeatureRequest().setFlags(QgsFeatureRequest::NoGeometry)
* - fetch only features from particular extent
* QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1))
* - fetch only one feature
* QgsFeatureRequest().setFilterFid(45)
*
* \code{.py}
* # fetch all features:
* QgsFeatureRequest()
* # fetch all features, only one attribute
* QgsFeatureRequest().setSubsetOfAttributes(['myfield'], layer.fields())
* # fetch all features, without geometries
* QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)
* # fetch only features from particular extent
* QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1))
* # fetch only one feature
* QgsFeatureRequest().setFilterFid(45)
* \endcode
*/
class CORE_EXPORT QgsFeatureRequest
{

0 comments on commit 1e7d479

Please sign in to comment.
You can’t perform that action at this time.