QGIS API Documentation
2.6.0-Brighton
|
This class wraps a request for features to a vector layer (or directly its vector data provider). More...
#include <qgsfeaturerequest.h>
Public Types | |
enum | Flag { NoFlags = 0, NoGeometry = 1, SubsetOfAttributes = 2, ExactIntersect = 4 } |
enum | FilterType { FilterNone, FilterRect, FilterFid, FilterExpression, FilterFids } |
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 & | operator= (const QgsFeatureRequest &rh) |
~QgsFeatureRequest () | |
FilterType | filterType () const |
QgsFeatureRequest & | setFilterRect (const QgsRectangle &rect) |
Set rectangle from which features will be taken. | |
const QgsRectangle & | filterRect () const |
QgsFeatureRequest & | setFilterFid (QgsFeatureId fid) |
Set feature ID that should be fetched. | |
const QgsFeatureId & | filterFid () const |
QgsFeatureRequest & | setFilterFids (QgsFeatureIds fids) |
Set feature ID that should be fetched. | |
const QgsFeatureIds & | filterFids () const |
QgsFeatureRequest & | setFilterExpression (const QString &expression) |
Set filter expression. {. | |
QgsExpression * | filterExpression () const |
QgsFeatureRequest & | setFlags (Flags flags) |
Set flags that affect how features will be fetched. | |
const Flags & | flags () const |
QgsFeatureRequest & | setSubsetOfAttributes (const QgsAttributeList &attrs) |
Set a subset of attributes that will be fetched. | |
const QgsAttributeList & | subsetOfAttributes () const |
QgsFeatureRequest & | setSubsetOfAttributes (const QStringList &attrNames, const QgsFields &fields) |
Set a subset of attributes by names that will be fetched. | |
QgsFeatureRequest & | setSimplifyMethod (const QgsSimplifyMethod &simplifyMethod) |
Set a simplification method for geometries that will be fetched. | |
const QgsSimplifyMethod & | simplifyMethod () const |
Get simplification method for geometries that will be fetched. | |
bool | acceptFeature (const QgsFeature &feature) |
Check if a feature is accepted by this requests filter. |
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:
QgsFeatureRequest::QgsFeatureRequest | ( | ) |
construct a default request: for all features get attributes and geometries
|
explicit |
construct a request with feature ID filter
|
explicit |
construct a request with rectangle filter
|
explicit |
construct a request with a filter expression
QgsFeatureRequest::QgsFeatureRequest | ( | const QgsFeatureRequest & | rh | ) |
copy constructor
QgsFeatureRequest::~QgsFeatureRequest | ( | ) |
bool QgsFeatureRequest::acceptFeature | ( | const QgsFeature & | feature | ) |
Check if a feature is accepted by this requests filter.
feature | The feature which will be tested |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
QgsFeatureRequest & QgsFeatureRequest::operator= | ( | const QgsFeatureRequest & | rh | ) |
QgsFeatureRequest & QgsFeatureRequest::setFilterExpression | ( | const QString & | expression | ) |
Set filter expression. {.
QgsFeatureRequest & QgsFeatureRequest::setFilterFid | ( | QgsFeatureId | fid | ) |
Set feature ID that should be fetched.
QgsFeatureRequest & QgsFeatureRequest::setFilterFids | ( | QgsFeatureIds | fids | ) |
Set feature ID that should be fetched.
QgsFeatureRequest & QgsFeatureRequest::setFilterRect | ( | const QgsRectangle & | rect | ) |
Set rectangle from which features will be taken.
Empty rectangle removes the filter.
QgsFeatureRequest & QgsFeatureRequest::setFlags | ( | Flags | flags | ) |
Set flags that affect how features will be fetched.
QgsFeatureRequest & QgsFeatureRequest::setSimplifyMethod | ( | const QgsSimplifyMethod & | simplifyMethod | ) |
Set a simplification method for geometries that will be fetched.
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)
QgsFeatureRequest & QgsFeatureRequest::setSubsetOfAttributes | ( | const QStringList & | attrNames, |
const QgsFields & | fields | ||
) |
Set a subset of attributes by names that will be fetched.
|
inline |
Get simplification method for geometries that will be fetched.
|
inline |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |