QGIS API Documentation
2.8.2-Wien
|
This class wraps a request for features to a vector layer (or directly its vector data provider). More...
#include <qgsfeaturerequest.h>
Public Types | |
enum | FilterType { FilterNone, FilterRect, FilterFid, FilterExpression, FilterFids } |
enum | Flag { NoFlags = 0, NoGeometry = 1, SubsetOfAttributes = 2, ExactIntersect = 4 } |
Public Member Functions | |
QgsFeatureRequest () | |
construct a default request: for all features get attributes and geometries | |
QgsFeatureRequest (QgsFeatureId fid) | |
construct a request with feature ID filter | |
QgsFeatureRequest (const QgsRectangle &rect) | |
construct a request with rectangle filter | |
QgsFeatureRequest (const QgsExpression &expr) | |
construct a request with a filter expression | |
QgsFeatureRequest (const QgsFeatureRequest &rh) | |
copy constructor | |
~QgsFeatureRequest () | |
bool | acceptFeature (const QgsFeature &feature) |
Check if a feature is accepted by this requests filter. | |
QgsExpression * | filterExpression () const |
const QgsFeatureId & | filterFid () const |
const QgsFeatureIds & | filterFids () const |
const QgsRectangle & | filterRect () const |
FilterType | filterType () const |
const Flags & | flags () const |
QgsFeatureRequest & | operator= (const QgsFeatureRequest &rh) |
QgsFeatureRequest & | setFilterExpression (const QString &expression) |
Set filter expression. {. | |
QgsFeatureRequest & | setFilterFid (QgsFeatureId fid) |
Set feature ID that should be fetched. | |
QgsFeatureRequest & | setFilterFids (QgsFeatureIds fids) |
Set feature ID that should be fetched. | |
QgsFeatureRequest & | setFilterRect (const QgsRectangle &rect) |
Set rectangle from which features will be taken. | |
QgsFeatureRequest & | setFlags (Flags flags) |
Set flags that affect how features will be fetched. | |
QgsFeatureRequest & | setSimplifyMethod (const QgsSimplifyMethod &simplifyMethod) |
Set a simplification method for geometries that will be fetched. | |
QgsFeatureRequest & | setSubsetOfAttributes (const QgsAttributeList &attrs) |
Set a subset of attributes that will be fetched. | |
QgsFeatureRequest & | setSubsetOfAttributes (const QStringList &attrNames, const QgsFields &fields) |
Set a subset of attributes by names that will be fetched. | |
const QgsSimplifyMethod & | simplifyMethod () const |
Get simplification method for geometries that will be fetched. | |
const QgsAttributeList & | subsetOfAttributes () const |
Static Public Attributes | |
static const QString | AllAttributes = QString( "#!allattributes!#" ) |
This class wraps a request for features to a vector layer (or directly its vector data provider).
The request may apply a filter to fetch only a particular subset of features. Currently supported filters:
For efficiency, it is also possible to tell provider that some data is not required:
The options may be chained, e.g.: QgsFeatureRequest().setFilterRect(QgsRectangle(0,0,1,1)).setFlags(QgsFeatureRequest::ExactIntersect)
Examples:
Definition at line 58 of file qgsfeaturerequest.h.
Definition at line 70 of file qgsfeaturerequest.h.
Definition at line 61 of file qgsfeaturerequest.h.
QgsFeatureRequest::QgsFeatureRequest | ( | ) |
construct a default request: for all features get attributes and geometries
Definition at line 25 of file qgsfeaturerequest.cpp.
|
explicit |
construct a request with feature ID filter
Definition at line 33 of file qgsfeaturerequest.cpp.
|
explicit |
construct a request with rectangle filter
Definition at line 41 of file qgsfeaturerequest.cpp.
|
explicit |
construct a request with a filter expression
Definition at line 50 of file qgsfeaturerequest.cpp.
QgsFeatureRequest::QgsFeatureRequest | ( | const QgsFeatureRequest & | rh | ) |
copy constructor
Definition at line 58 of file qgsfeaturerequest.cpp.
QgsFeatureRequest::~QgsFeatureRequest | ( | ) |
Definition at line 83 of file qgsfeaturerequest.cpp.
bool QgsFeatureRequest::acceptFeature | ( | const QgsFeature & | feature | ) |
Check if a feature is accepted by this requests filter.
feature | The feature which will be tested |
Definition at line 157 of file qgsfeaturerequest.cpp.
|
inline |
Definition at line 113 of file qgsfeaturerequest.h.
|
inline |
Definition at line 105 of file qgsfeaturerequest.h.
|
inline |
Definition at line 109 of file qgsfeaturerequest.h.
|
inline |
Definition at line 101 of file qgsfeaturerequest.h.
|
inline |
Definition at line 96 of file qgsfeaturerequest.h.
|
inline |
Definition at line 117 of file qgsfeaturerequest.h.
QgsFeatureRequest & QgsFeatureRequest::operator= | ( | const QgsFeatureRequest & | rh | ) |
Definition at line 63 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setFilterExpression | ( | const QString & | expression | ) |
Set filter expression. {.
Definition at line 109 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setFilterFid | ( | QgsFeatureId | fid | ) |
Set feature ID that should be fetched.
Definition at line 95 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setFilterFids | ( | QgsFeatureIds | fids | ) |
Set feature ID that should be fetched.
Definition at line 102 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setFilterRect | ( | const QgsRectangle & | rect | ) |
Set rectangle from which features will be taken.
Empty rectangle removes the filter.
Definition at line 88 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setFlags | ( | Flags | flags | ) |
Set flags that affect how features will be fetched.
Definition at line 117 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setSimplifyMethod | ( | const QgsSimplifyMethod & | simplifyMethod | ) |
Set a simplification method for geometries that will be fetched.
Definition at line 151 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setSubsetOfAttributes | ( | const QgsAttributeList & | attrs | ) |
Set a subset of attributes that will be fetched.
Empty list means that all attributes are used. To disable fetching attributes, reset the FetchAttributes flag (which is set by default)
Definition at line 123 of file qgsfeaturerequest.cpp.
QgsFeatureRequest & QgsFeatureRequest::setSubsetOfAttributes | ( | const QStringList & | attrNames, |
const QgsFields & | fields | ||
) |
Set a subset of attributes by names that will be fetched.
Definition at line 130 of file qgsfeaturerequest.cpp.
|
inline |
Get simplification method for geometries that will be fetched.
Definition at line 132 of file qgsfeaturerequest.h.
|
inline |
Definition at line 122 of file qgsfeaturerequest.h.
|
static |
Definition at line 79 of file qgsfeaturerequest.h.
|
protected |
Definition at line 156 of file qgsfeaturerequest.h.
|
protected |
Definition at line 150 of file qgsfeaturerequest.h.
|
protected |
Definition at line 154 of file qgsfeaturerequest.h.
|
protected |
Definition at line 152 of file qgsfeaturerequest.h.
|
protected |
Definition at line 153 of file qgsfeaturerequest.h.
|
protected |
Definition at line 151 of file qgsfeaturerequest.h.
|
protected |
Definition at line 155 of file qgsfeaturerequest.h.
|
protected |
Definition at line 157 of file qgsfeaturerequest.h.