15 #ifndef QGSFEATUREREQUEST_H
16 #define QGSFEATUREREQUEST_H
18 #include "qgis_core.h"
83 SubsetOfAttributes = 2,
85 IgnoreStaticNodesDuringExpressionCompilation = 8,
87 Q_DECLARE_FLAGS( Flags, Flag )
104 GeometrySkipInvalid = 1,
105 GeometryAbortOnInvalid = 2,
143 OrderByClause(
const QString &expression,
bool ascending =
true );
152 OrderByClause(
const QString &expression,
bool ascending,
bool nullsfirst );
192 bool ascending()
const;
197 void setAscending(
bool ascending );
203 bool nullsFirst()
const;
208 void setNullsFirst(
bool nullsFirst );
213 QString dump()
const;
231 class OrderBy :
public QList<QgsFeatureRequest::OrderByClause>
243 CORE_EXPORT
OrderBy(
const QList<QgsFeatureRequest::OrderByClause> &other );
251 QList<QgsFeatureRequest::OrderByClause> CORE_EXPORT list()
const;
256 void CORE_EXPORT save( QDomElement &elem )
const;
261 void CORE_EXPORT load(
const QDomElement &elem );
267 QSet<QString> CORE_EXPORT usedAttributes()
const;
273 QSet<int> CORE_EXPORT usedAttributeIndices(
const QgsFields &fields )
const;
278 QString CORE_EXPORT dump()
const;
377 Py_BEGIN_ALLOW_THREADS
379 sipCpp->setInvalidGeometryCallback( [a0](
const QgsFeature &arg )
382 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
461 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending =
true );
472 QgsFeatureRequest &addOrderBy(
const QString &expression,
bool ascending,
bool nullsfirst );
479 OrderBy orderBy()
const;
501 long limit()
const {
return mLimit; }
505 const Flags &
flags()
const {
return mFlags; }
605 Py_BEGIN_ALLOW_THREADS
607 sipCpp->setTransformErrorCallback( [a0](
const QgsFeature &arg )
610 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
640 bool acceptFeature(
const QgsFeature &feature );
696 bool requestMayBeNested() const;
719 Flags mFlags = Flags();
725 std::function<
void( const
QgsFeature & ) > mInvalidGeometryCallback;
726 std::function<
void( const
QgsFeature & ) > mTransformErrorCallback;
730 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.
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.
long limit() const
Returns the maximum number of features to request, or -1 if no limit set.
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 id, geometry and a list of field/values...
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