15 #ifndef QGSFEATUREREQUEST_H
16 #define QGSFEATUREREQUEST_H
18 #include "qgis_core.h"
90 SubsetOfAttributes = 2,
92 IgnoreStaticNodesDuringExpressionCompilation = 8,
95 Q_DECLARE_FLAGS( Flags, Flag )
112 GeometrySkipInvalid = 1,
113 GeometryAbortOnInvalid = 2,
151 OrderByClause(
const QString &expression,
bool ascending =
true );
160 OrderByClause(
const QString &expression,
bool ascending,
bool nullsfirst );
200 bool ascending()
const;
205 void setAscending(
bool ascending );
211 bool nullsFirst()
const;
216 void setNullsFirst(
bool nullsFirst );
221 QString dump()
const;
239 class OrderBy :
public QList<QgsFeatureRequest::OrderByClause>
251 CORE_EXPORT
OrderBy(
const QList<QgsFeatureRequest::OrderByClause> &other );
259 QList<QgsFeatureRequest::OrderByClause> CORE_EXPORT list()
const;
264 void CORE_EXPORT save( QDomElement &elem )
const;
269 void CORE_EXPORT load(
const QDomElement &elem );
275 QSet<QString> CORE_EXPORT usedAttributes()
const;
281 QSet<int> CORE_EXPORT usedAttributeIndices(
const QgsFields &fields )
const;
286 QString CORE_EXPORT dump()
const;
497 Py_BEGIN_ALLOW_THREADS
499 sipCpp->setInvalidGeometryCallback( [a0](
const QgsFeature &arg )
502 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
590 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending =
true );
601 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending,
bool nullsfirst );
608 OrderBy orderBy()
const;
631 long long limit()
const {
return mLimit; }
633 long long limit()
const;
648 Flags
flags()
const {
return mFlags; }
799 Py_BEGIN_ALLOW_THREADS
801 sipCpp->setTransformErrorCallback( [a0](
const QgsFeature &arg )
804 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
834 bool acceptFeature(
const QgsFeature &feature );
893 bool requestMayBeNested() const;
945 Qgis::SpatialFilterType mSpatialFilter =
Qgis::SpatialFilterType::NoFilter;
965 double mDistanceWithin = 0;
971 Flags mFlags = Flags();
974 long long mLimit = -1;
977 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
978 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
982 int mRequestMayBeNested = false;
The Qgis class provides global constants for use throughout the application.
SpatialFilterType
Feature request spatial filter types.
Helper template that cares of two things: 1.
Internal feature iterator to be implemented within data providers.
Base class that can be used for any class that is capable of returning features.
QSet< QgsAbstractFeatureIterator * > mActiveIterators
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Gets an iterator for features matching the specified request.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Class for parsing and evaluation of expressions (formerly called "search strings").
Wrapper for iterator of features from vector data provider or vector layer.
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
Represents a list of OrderByClauses, with the most important first and the least important last.
CORE_EXPORT OrderBy()
Create a new empty order by.
This class wraps a request for features to a vector layer (or directly its vector data provider).
std::function< void(const QgsFeature &) > invalidGeometryCallback() const
Returns the callback function to use when encountering an invalid geometry and invalidGeometryCheck()...
const QgsSimplifyMethod & simplifyMethod() const
Returns the simplification method for geometries that will be fetched.
InvalidGeometryCheck
Handling of features with invalid geometries.
InvalidGeometryCheck invalidGeometryCheck() const
Returns the invalid geometry checking behavior.
QgsExpression * filterExpression() const
Returns the filter expression (if set).
long long limit() const
Returns the maximum number of features to request, or -1 if no limit set.
QgsGeometry referenceGeometry() const
Returns the reference geometry used for spatial filtering of features.
static const QString ALL_ATTRIBUTES
A special attribute that if set matches all attributes.
Flags flags() const
Returns the flags which affect how features are fetched.
QgsExpressionContext * expressionContext()
Returns the expression context used to evaluate filter expressions.
std::shared_ptr< QgsGeometryEngine > referenceGeometryEngine() const
Returns the reference geometry engine used for spatial filtering of features.
Qgis::SpatialFilterType spatialFilterType() const
Returns the spatial filter type which is currently set on this request.
double distanceWithin() const
Returns the maximum distance from the referenceGeometry() of fetched features, if spatialFilterType()...
QgsAttributeList subsetOfAttributes() const
Returns the subset of attributes which at least need to be fetched.
QgsFeatureRequest & disableFilter()
Disables any attribute/ID filtering.
FilterType filterType() const
Returns the attribute/ID filter type which is currently set on this request.
const QgsFeatureIds & filterFids() const
Returns the feature IDs that should be fetched.
FilterType
Types of filters.
@ FilterFid
Filter using feature ID.
@ FilterNone
No filter is applied.
@ FilterExpression
Filter using expression.
std::function< void(const QgsFeature &) > transformErrorCallback() const
Returns the callback function to use when encountering a transform error when iterating features and ...
QgsFeatureId filterFid() const
Returns the feature ID that should be fetched.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
A geometry engine is a low-level representation of a QgsAbstractGeometry object, optimised for use wi...
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
This class contains information about how to simplify geometries fetched from a QgsFeatureIterator.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
const QgsCoordinateReferenceSystem & crs