15 #ifndef QGSFEATUREREQUEST_H
16 #define QGSFEATUREREQUEST_H
18 #include "qgis_core.h"
83 SubsetOfAttributes = 2,
85 IgnoreStaticNodesDuringExpressionCompilation = 8,
88 Q_DECLARE_FLAGS( Flags, Flag )
105 GeometrySkipInvalid = 1,
106 GeometryAbortOnInvalid = 2,
144 OrderByClause(
const QString &expression,
bool ascending =
true );
153 OrderByClause(
const QString &expression,
bool ascending,
bool nullsfirst );
193 bool ascending()
const;
198 void setAscending(
bool ascending );
204 bool nullsFirst()
const;
209 void setNullsFirst(
bool nullsFirst );
214 QString dump()
const;
232 class OrderBy :
public QList<QgsFeatureRequest::OrderByClause>
244 CORE_EXPORT
OrderBy(
const QList<QgsFeatureRequest::OrderByClause> &other );
252 QList<QgsFeatureRequest::OrderByClause> CORE_EXPORT list()
const;
257 void CORE_EXPORT save( QDomElement &elem )
const;
262 void CORE_EXPORT load(
const QDomElement &elem );
268 QSet<QString> CORE_EXPORT usedAttributes()
const;
274 QSet<int> CORE_EXPORT usedAttributeIndices(
const QgsFields &fields )
const;
279 QString CORE_EXPORT dump()
const;
378 Py_BEGIN_ALLOW_THREADS
380 sipCpp->setInvalidGeometryCallback( [a0](
const QgsFeature &arg )
383 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
462 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending =
true );
473 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending,
bool nullsfirst );
480 OrderBy orderBy()
const;
503 long long limit()
const {
return mLimit; }
505 long long limit()
const;
510 const Flags &
flags()
const {
return mFlags; }
610 Py_BEGIN_ALLOW_THREADS
612 sipCpp->setTransformErrorCallback( [a0](
const QgsFeature &arg )
615 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
645 bool acceptFeature(
const QgsFeature &feature );
701 bool requestMayBeNested() const;
724 Flags mFlags = Flags();
727 long long mLimit = -1;
730 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
731 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
735 int mRequestMayBeNested = false;
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
Gets 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.
static const QString ALL_ATTRIBUTES
A special attribute that if set matches all attributes.
QgsExpressionContext * expressionContext()
Returns the expression context used to evaluate filter expressions.
QgsAttributeList subsetOfAttributes() const
Returns the subset of attributes which at least need to be fetched.
QgsFeatureRequest & disableFilter()
Disables filter conditions.
const QgsRectangle & filterRect() const
Returns the rectangle from which features will be taken.
FilterType filterType() const
Returns the filter type which is currently set on this request.
const QgsFeatureIds & filterFids() const
Gets feature IDs that should be fetched.
FilterType
Types of filters.
@ FilterFid
Filter using feature ID.
@ FilterNone
No filter is applied.
@ FilterExpression
Filter using expression.
const Flags & flags() const
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
Gets the feature ID that should be fetched.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
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