QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsfeaturerequest.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeaturerequest.cpp
3  ---------------------
4  begin : Mai 2012
5  copyright : (C) 2012 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #include "qgsfeaturerequest.h"
16 
17 #include "qgsfields.h"
18 #include "qgsgeometry.h"
19 
20 #include <QStringList>
21 
22 //constants
23 const QString QgsFeatureRequest::ALL_ATTRIBUTES = QStringLiteral( "#!allattributes!#" );
24 
26  : mFlags( nullptr )
27 {
28 }
29 
31  : mFilter( FilterFid )
32  , mFilterFid( fid )
33  , mFlags( nullptr )
34 {
35 }
36 
38  : mFilter( FilterFids )
39  , mFilterFids( fids )
40  , mFlags( nullptr )
41 {
42 
43 }
44 
46  : mFilterRect( rect )
47  , mFlags( nullptr )
48 {
49 }
50 
52  : mFilter( FilterExpression )
53  , mFilterExpression( new QgsExpression( expr ) )
54  , mExpressionContext( context )
55  , mFlags( nullptr )
56 {
57 }
58 
60 {
61  operator=( rh );
62 }
63 
65 {
66  if ( &rh == this )
67  return *this;
68 
69  mFlags = rh.mFlags;
70  mFilter = rh.mFilter;
74  if ( rh.mFilterExpression )
75  {
77  }
78  else
79  {
80  mFilterExpression.reset( nullptr );
81  }
85  mAttrs = rh.mAttrs;
87  mLimit = rh.mLimit;
88  mOrderBy = rh.mOrderBy;
89  mCrs = rh.mCrs;
92  mTimeout = rh.mTimeout;
94  return *this;
95 }
96 
98 {
99  mFilterRect = rect;
100  return *this;
101 }
102 
104 {
105  mFilter = FilterFid;
106  mFilterFid = fid;
107  return *this;
108 }
109 
111 {
113  mFilterFids = fids;
114  return *this;
115 }
116 
118 {
119  mInvalidGeometryFilter = check;
120  return *this;
121 }
122 
123 QgsFeatureRequest &QgsFeatureRequest::setInvalidGeometryCallback( const std::function<void ( const QgsFeature & )> &callback )
124 {
125  mInvalidGeometryCallback = callback;
126  return *this;
127 }
128 
130 {
132  mFilterExpression.reset( new QgsExpression( expression ) );
133  return *this;
134 }
135 
137 {
138  if ( mFilterExpression )
139  {
140  setFilterExpression( QStringLiteral( "(%1) AND (%2)" ).arg( mFilterExpression->expression(), expression ) );
141  }
142  else
143  {
144  setFilterExpression( expression );
145  }
146  return *this;
147 }
148 
150 {
151  mExpressionContext = context;
152  return *this;
153 }
154 
155 QgsFeatureRequest &QgsFeatureRequest::addOrderBy( const QString &expression, bool ascending )
156 {
157  mOrderBy.append( OrderByClause( expression, ascending ) );
158  return *this;
159 }
160 
161 QgsFeatureRequest &QgsFeatureRequest::addOrderBy( const QString &expression, bool ascending, bool nullsfirst )
162 {
163  mOrderBy.append( OrderByClause( expression, ascending, nullsfirst ) );
164  return *this;
165 }
166 
168 {
169  return mOrderBy;
170 }
171 
173 {
174  mOrderBy = orderBy;
175  return *this;
176 }
177 
179 {
180  mLimit = limit;
181  return *this;
182 }
183 
184 QgsFeatureRequest &QgsFeatureRequest::setFlags( QgsFeatureRequest::Flags flags )
185 {
186  mFlags = flags;
187  return *this;
188 }
189 
191 {
193  mAttrs = attrs;
194  return *this;
195 }
196 
198 {
200 }
201 
202 QgsFeatureRequest &QgsFeatureRequest::setSubsetOfAttributes( const QStringList &attrNames, const QgsFields &fields )
203 {
204  if ( attrNames.contains( QgsFeatureRequest::ALL_ATTRIBUTES ) )
205  {
206  //attribute string list contains the all attributes flag, so we must fetch all attributes
207  return *this;
208  }
209 
211  mAttrs.clear();
212 
213  const auto constAttrNames = attrNames;
214  for ( const QString &attrName : constAttrNames )
215  {
216  int attrNum = fields.lookupField( attrName );
217  if ( attrNum != -1 && !mAttrs.contains( attrNum ) )
218  mAttrs.append( attrNum );
219  }
220 
221  return *this;
222 }
223 
224 QgsFeatureRequest &QgsFeatureRequest::setSubsetOfAttributes( const QSet<QString> &attrNames, const QgsFields &fields )
225 {
226  if ( attrNames.contains( QgsFeatureRequest::ALL_ATTRIBUTES ) )
227  {
228  //attribute string list contains the all attributes flag, so we must fetch all attributes
229  return *this;
230  }
231 
233  mAttrs.clear();
234 
235  const auto constAttrNames = attrNames;
236  for ( const QString &attrName : constAttrNames )
237  {
238  int attrNum = fields.lookupField( attrName );
239  if ( attrNum != -1 && !mAttrs.contains( attrNum ) )
240  mAttrs.append( attrNum );
241  }
242 
243  return *this;
244 }
245 
247 {
249  return *this;
250 }
251 
252 
254 {
255  return mCrs;
256 }
257 
259 {
260  return mTransformContext;
261 }
262 
264 {
265  mCrs = crs;
266  mTransformContext = context;
267  return *this;
268 }
269 
270 QgsFeatureRequest &QgsFeatureRequest::setTransformErrorCallback( const std::function<void ( const QgsFeature & )> &callback )
271 {
272  mTransformErrorCallback = callback;
273  return *this;
274 }
275 
277 {
278  if ( !mFilterRect.isNull() )
279  {
280  if ( !feature.hasGeometry() ||
281  (
282  ( mFlags & ExactIntersect && !feature.geometry().intersects( mFilterRect ) )
283  ||
285  )
286  )
287  return false;
288  }
289 
290  switch ( mFilter )
291  {
293  return true;
294 
296  return ( feature.id() == mFilterFid );
297 
299  mExpressionContext.setFeature( feature );
300  return ( mFilterExpression->evaluate( &mExpressionContext ).toBool() );
301 
303  return ( mFilterFids.contains( feature.id() ) );
304  }
305 
306  return true;
307 }
308 
310 {
311  return mTimeout;
312 }
313 
315 {
317  return *this;
318 }
319 
321 {
322  return mTimeout;
323 }
324 
326 {
327  mTimeout = timeout;
328  return *this;
329 }
330 
332 {
333  return mRequestMayBeNested;
334 }
335 
337 {
339  return *this;
340 }
341 
342 
343 #include "qgsfeatureiterator.h"
344 #include "qgslogger.h"
345 
347 {
348  while ( !mActiveIterators.empty() )
349  {
351  QgsDebugMsgLevel( QStringLiteral( "closing active iterator" ), 2 );
352  it->close();
353  }
354 }
355 
357 {
358  mActiveIterators.insert( it );
359 }
360 
362 {
363  mActiveIterators.remove( it );
364 }
365 
366 
367 
368 QgsFeatureRequest::OrderByClause::OrderByClause( const QString &expression, bool ascending )
369  : mExpression( expression )
370  , mAscending( ascending )
371 {
372  // postgres behavior: default for ASC: NULLS LAST, default for DESC: NULLS FIRST
373  mNullsFirst = !ascending;
374 }
375 
376 QgsFeatureRequest::OrderByClause::OrderByClause( const QString &expression, bool ascending, bool nullsfirst )
377  : mExpression( expression )
378  , mAscending( ascending )
379  , mNullsFirst( nullsfirst )
380 {
381 }
382 
384  : mExpression( expression )
385  , mAscending( ascending )
386 {
387  // postgres behavior: default for ASC: NULLS LAST, default for DESC: NULLS FIRST
388  mNullsFirst = !ascending;
389 }
390 
391 QgsFeatureRequest::OrderByClause::OrderByClause( const QgsExpression &expression, bool ascending, bool nullsfirst )
392  : mExpression( expression )
393  , mAscending( ascending )
394  , mNullsFirst( nullsfirst )
395 {
396 
397 }
398 
400 {
401  return mAscending;
402 }
403 
405 {
406  mAscending = ascending;
407 }
408 
410 {
411  return mNullsFirst;
412 }
413 
415 {
416  mNullsFirst = nullsFirst;
417 }
418 
420 {
421  return QStringLiteral( "%1 %2 %3" )
422  .arg( mExpression.expression(),
423  mAscending ? "ASC" : "DESC",
424  mNullsFirst ? "NULLS FIRST" : "NULLS LAST" );
425 }
426 
428 {
429  return mExpression;
430 }
431 
433 {
434  return mExpression.prepare( context );
435 }
436 
438 
439 QgsFeatureRequest::OrderBy::OrderBy( const QList<QgsFeatureRequest::OrderByClause> &other )
440 {
441  const auto constOther = other;
442  for ( const QgsFeatureRequest::OrderByClause &clause : constOther )
443  {
444  append( clause );
445  }
446 }
447 
448 QList<QgsFeatureRequest::OrderByClause> QgsFeatureRequest::OrderBy::list() const
449 {
450  return *this;
451 }
452 
453 void QgsFeatureRequest::OrderBy::save( QDomElement &elem ) const
454 {
455  QDomDocument doc = elem.ownerDocument();
456  QList<OrderByClause>::ConstIterator it;
457  for ( it = constBegin(); it != constEnd(); ++it )
458  {
459  const OrderByClause &clause = *it;
460  QDomElement clauseElem = doc.createElement( QStringLiteral( "orderByClause" ) );
461  clauseElem.setAttribute( QStringLiteral( "asc" ), clause.ascending() );
462  clauseElem.setAttribute( QStringLiteral( "nullsFirst" ), clause.nullsFirst() );
463  clauseElem.appendChild( doc.createTextNode( clause.expression().expression() ) );
464 
465  elem.appendChild( clauseElem );
466  }
467 }
468 
469 void QgsFeatureRequest::OrderBy::load( const QDomElement &elem )
470 {
471  clear();
472 
473  QDomNodeList clauses = elem.childNodes();
474 
475  for ( int i = 0; i < clauses.size(); ++i )
476  {
477  QDomElement clauseElem = clauses.at( i ).toElement();
478  QString expression = clauseElem.text();
479  bool asc = clauseElem.attribute( QStringLiteral( "asc" ) ).toInt() != 0;
480  bool nullsFirst = clauseElem.attribute( QStringLiteral( "nullsFirst" ) ).toInt() != 0;
481 
482  append( OrderByClause( expression, asc, nullsFirst ) );
483  }
484 }
485 
487 {
488  QSet<QString> usedAttributes;
489 
490  QList<OrderByClause>::ConstIterator it;
491  for ( it = constBegin(); it != constEnd(); ++it )
492  {
493  const OrderByClause &clause = *it;
494 
495  usedAttributes.unite( clause.expression().referencedColumns() );
496  }
497 
498  return usedAttributes;
499 }
500 
502 {
503  QSet<int> usedAttributeIdx;
504  for ( const OrderByClause &clause : *this )
505  {
506  const auto referencedColumns = clause.expression().referencedColumns();
507  for ( const QString &fieldName : referencedColumns )
508  {
509  int idx = fields.lookupField( fieldName );
510  if ( idx >= 0 )
511  {
512  usedAttributeIdx.insert( idx );
513  }
514  }
515  }
516  return usedAttributeIdx;
517 }
518 
520 {
521  QStringList results;
522 
523  QList<OrderByClause>::ConstIterator it;
524  for ( it = constBegin(); it != constEnd(); ++it )
525  {
526  const OrderByClause &clause = *it;
527 
528  results << clause.dump();
529  }
530 
531  return results.join( QStringLiteral( ", " ) );
532 }
QgsFeatureRequest::mSimplifyMethod
QgsSimplifyMethod mSimplifyMethod
Definition: qgsfeaturerequest.h:732
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
qgsfields.h
QgsFeatureRequest::OrderByClause
Definition: qgsfeaturerequest.h:142
QgsFeatureRequest::FilterFid
@ FilterFid
Filter using feature ID.
Definition: qgsfeaturerequest.h:106
QgsFeatureRequest::OrderByClause::expression
QgsExpression expression() const
The expression.
Definition: qgsfeaturerequest.cpp:427
QgsFeatureRequest::mInvalidGeometryFilter
InvalidGeometryCheck mInvalidGeometryFilter
Definition: qgsfeaturerequest.h:735
QgsFeatureRequest::setInvalidGeometryCheck
QgsFeatureRequest & setInvalidGeometryCheck(InvalidGeometryCheck check)
Sets invalid geometry checking behavior.
Definition: qgsfeaturerequest.cpp:117
QgsCoordinateTransformContext
Definition: qgscoordinatetransformcontext.h:57
qgsfeaturerequest.h
QgsSimplifyMethod
Definition: qgssimplifymethod.h:28
QgsFeatureRequest::mFilterFids
QgsFeatureIds mFilterFids
Definition: qgsfeaturerequest.h:727
QgsFeatureRequest::addOrderBy
QgsFeatureRequest & addOrderBy(const QString &expression, bool ascending=true)
Adds a new OrderByClause, appending it as the least important one.
Definition: qgsfeaturerequest.cpp:155
QgsFeatureRequest::transformContext
QgsCoordinateTransformContext transformContext() const
Returns the transform context, for use when a destinationCrs() has been set and reprojection is requi...
Definition: qgsfeaturerequest.cpp:258
QgsFeatureRequest::ExactIntersect
@ ExactIntersect
Use exact geometry intersection (slower) instead of bounding boxes.
Definition: qgsfeaturerequest.h:109
QgsFeatureRequest::acceptFeature
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
Definition: qgsfeaturerequest.cpp:276
QgsAbstractFeatureSource::~QgsAbstractFeatureSource
virtual ~QgsAbstractFeatureSource()
Definition: qgsfeaturerequest.cpp:346
QgsExpression::referencedColumns
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
Definition: qgsexpression.cpp:217
QgsFeatureRequest::OrderBy::OrderBy
CORE_EXPORT OrderBy()
Create a new empty order by.
QgsFeatureRequest::OrderByClause::setAscending
void setAscending(bool ascending)
Set if ascending order is requested.
Definition: qgsfeaturerequest.cpp:404
QgsDebugMsgLevel
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
QgsFeatureRequest::OrderBy::save
void CORE_EXPORT save(QDomElement &elem) const
Serialize to XML.
Definition: qgsfeaturerequest.cpp:453
QgsFeatureRequest::operator=
QgsFeatureRequest & operator=(const QgsFeatureRequest &rh)
Assignment operator.
Definition: qgsfeaturerequest.cpp:64
QgsFeatureRequest::flags
const Flags & flags() const
Definition: qgsfeaturerequest.h:516
QgsFeatureRequest::timeout
int timeout() const
Returns the timeout (in milliseconds) for the maximum time we should wait during feature requests bef...
Definition: qgsfeaturerequest.cpp:320
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsFeatureRequest::mCrs
QgsCoordinateReferenceSystem mCrs
Definition: qgsfeaturerequest.h:738
qgsfeatureiterator.h
QgsFields
Definition: qgsfields.h:44
QgsFeatureRequest::FilterFids
@ FilterFids
Filter using feature IDs.
Definition: qgsfeaturerequest.h:108
QgsFeature::geometry
QgsGeometry geometry
Definition: qgsfeature.h:71
QgsAbstractFeatureSource::mActiveIterators
QSet< QgsAbstractFeatureIterator * > mActiveIterators
Definition: qgsfeaturerequest.h:758
QgsFeatureRequest::setInvalidGeometryCallback
QgsFeatureRequest & setInvalidGeometryCallback(const std::function< void(const QgsFeature &)> &callback)
Sets a callback function to use when encountering an invalid geometry and invalidGeometryCheck() is s...
Definition: qgsfeaturerequest.cpp:123
QgsFeatureRequest::destinationCrs
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for feature's geometries, or an invalid QgsCoordi...
Definition: qgsfeaturerequest.cpp:253
QgsFeatureRequest::setSubsetOfAttributes
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
Definition: qgsfeaturerequest.cpp:190
QgsFeatureRequest::InvalidGeometryCheck
InvalidGeometryCheck
Handling of features with invalid geometries.
Definition: qgsfeaturerequest.h:112
QgsAttributeList
QList< int > QgsAttributeList
Definition: qgsfield.h:26
QgsFeatureRequest::OrderByClause::prepare
bool prepare(QgsExpressionContext *context)
Prepare the expression with the given context.
Definition: qgsfeaturerequest.cpp:432
QgsRectangle
Definition: qgsrectangle.h:41
QgsFeatureRequest::SubsetOfAttributes
@ SubsetOfAttributes
Fetch only a subset of attributes (setSubsetOfAttributes sets this flag)
Definition: qgsfeaturerequest.h:108
QgsFeatureRequest::OrderBy::usedAttributes
QSet< QString > CORE_EXPORT usedAttributes() const
Returns a set of used attributes.
Definition: qgsfeaturerequest.cpp:486
QgsFeatureRequest::mRequestMayBeNested
int mRequestMayBeNested
Definition: qgsfeaturerequest.h:741
QgsFeatureRequest::setExpressionContext
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
Definition: qgsfeaturerequest.cpp:149
QgsFeatureRequest::setFilterFid
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets feature ID that should be fetched.
Definition: qgsfeaturerequest.cpp:103
QgsFeatureRequest::setFilterExpression
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
Definition: qgsfeaturerequest.cpp:129
QgsFeatureRequest::OrderByClause::setNullsFirst
void setNullsFirst(bool nullsFirst)
Set if NULLS should be returned first.
Definition: qgsfeaturerequest.cpp:414
QgsFeatureRequest::QgsFeatureRequest
QgsFeatureRequest()
construct a default request: for all features get attributes and geometries
Definition: qgsfeaturerequest.cpp:25
QgsFeatureRequest::OrderByClause::dump
QString dump() const
Dumps the content to an SQL equivalent.
Definition: qgsfeaturerequest.cpp:419
QgsFeatureRequest::mExpressionContext
QgsExpressionContext mExpressionContext
Definition: qgsfeaturerequest.h:729
QgsFeatureRequest::setFilterRect
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
Definition: qgsfeaturerequest.cpp:97
QgsFeatureRequest::ALL_ATTRIBUTES
static const QString ALL_ATTRIBUTES
A special attribute that if set matches all attributes.
Definition: qgsfeaturerequest.h:295
QgsFeature::id
QgsFeatureId id
Definition: qgsfeature.h:68
QgsFeatureRequest
Definition: qgsfeaturerequest.h:75
QgsGeometry::intersects
bool intersects(const QgsRectangle &rectangle) const
Returns true if this geometry exactly intersects with a rectangle.
Definition: qgsgeometry.cpp:1144
QgsFeatureRequest::setConnectionTimeout
Q_DECL_DEPRECATED QgsFeatureRequest & setConnectionTimeout(int connectionTimeout)
Sets the timeout (in milliseconds) for how long we should wait for a connection if none is available ...
Definition: qgsfeaturerequest.cpp:314
QgsFeatureRequest::mFilterExpression
std::unique_ptr< QgsExpression > mFilterExpression
Definition: qgsfeaturerequest.h:728
QgsFeatureRequest::combineFilterExpression
QgsFeatureRequest & combineFilterExpression(const QString &expression)
Modifies the existing filter expression to add an additional expression filter.
Definition: qgsfeaturerequest.cpp:136
QgsFeatureRequest::setTransformErrorCallback
QgsFeatureRequest & setTransformErrorCallback(const std::function< void(const QgsFeature &)> &callback)
Sets a callback function to use when encountering a transform error when iterating features and a des...
Definition: qgsfeaturerequest.cpp:270
QgsFeatureRequest::OrderByClause::ascending
bool ascending() const
Order ascending.
Definition: qgsfeaturerequest.cpp:399
QgsFeatureRequest::OrderBy::load
void CORE_EXPORT load(const QDomElement &elem)
Deserialize from XML.
Definition: qgsfeaturerequest.cpp:469
QgsFeatureRequest::mFlags
Flags mFlags
Definition: qgsfeaturerequest.h:730
QgsFeatureRequest::requestMayBeNested
bool requestMayBeNested() const
In case this request may be run nested within another already running iteration on the same connectio...
Definition: qgsfeaturerequest.cpp:331
QgsFeatureRequest::mOrderBy
OrderBy mOrderBy
Definition: qgsfeaturerequest.h:734
QgsFeatureRequest::setFilterFids
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
Definition: qgsfeaturerequest.cpp:110
QgsAbstractFeatureSource::iteratorClosed
void iteratorClosed(QgsAbstractFeatureIterator *it)
Definition: qgsfeaturerequest.cpp:361
QgsFeatureRequest::mFilterRect
QgsRectangle mFilterRect
Definition: qgsfeaturerequest.h:725
QgsFeatureRequest::mTransformContext
QgsCoordinateTransformContext mTransformContext
Definition: qgsfeaturerequest.h:739
QgsFeatureRequest::setSimplifyMethod
QgsFeatureRequest & setSimplifyMethod(const QgsSimplifyMethod &simplifyMethod)
Set a simplification method for geometries that will be fetched.
Definition: qgsfeaturerequest.cpp:246
QgsFeatureRequest::FilterExpression
@ FilterExpression
Filter using expression.
Definition: qgsfeaturerequest.h:107
QgsFeatureRequest::mFilterFid
QgsFeatureId mFilterFid
Definition: qgsfeaturerequest.h:726
QgsFeatureRequest::setTimeout
QgsFeatureRequest & setTimeout(int timeout)
Sets the timeout (in milliseconds) for the maximum time we should wait during feature requests before...
Definition: qgsfeaturerequest.cpp:325
QgsFeatureRequest::setNoAttributes
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
Definition: qgsfeaturerequest.cpp:197
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:34
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsFeatureRequest::OrderBy::usedAttributeIndices
QSet< int > CORE_EXPORT usedAttributeIndices(const QgsFields &fields) const
Returns a set of used, validated attribute indices.
Definition: qgsfeaturerequest.cpp:501
QgsFeatureRequest::mInvalidGeometryCallback
std::function< void(const QgsFeature &) > mInvalidGeometryCallback
Definition: qgsfeaturerequest.h:736
QgsFeatureRequest::OrderByClause::OrderByClause
OrderByClause(const QString &expression, bool ascending=true)
Creates a new OrderByClause for a QgsFeatureRequest.
Definition: qgsfeaturerequest.cpp:368
QgsFeatureRequest::OrderByClause::nullsFirst
bool nullsFirst() const
Set if NULLS should be returned first.
Definition: qgsfeaturerequest.cpp:409
QgsFeatureRequest::setRequestMayBeNested
QgsFeatureRequest & setRequestMayBeNested(bool requestMayBeNested)
In case this request may be run nested within another already running iteration on the same connectio...
Definition: qgsfeaturerequest.cpp:336
qgsgeometry.h
QgsFeatureRequest::OrderBy
Definition: qgsfeaturerequest.h:242
QgsFeatureRequest::orderBy
OrderBy orderBy() const
Returns a list of order by clauses specified for this feature request.
Definition: qgsfeaturerequest.cpp:167
QgsFeature::hasGeometry
bool hasGeometry() const
Returns true if the feature has an associated geometry.
Definition: qgsfeature.cpp:197
QgsFeatureRequest::setLimit
QgsFeatureRequest & setLimit(long limit)
Set the maximum number of features to request.
Definition: qgsfeaturerequest.cpp:178
QgsFeatureRequest::OrderBy::list
QList< QgsFeatureRequest::OrderByClause > CORE_EXPORT list() const
Gets a copy as a list of OrderByClauses.
Definition: qgsfeaturerequest.cpp:448
QgsAbstractFeatureSource::iteratorOpened
void iteratorOpened(QgsAbstractFeatureIterator *it)
Definition: qgsfeaturerequest.cpp:356
QgsFeatureRequest::OrderBy::dump
QString CORE_EXPORT dump() const
Dumps the content to an SQL equivalent syntax.
Definition: qgsfeaturerequest.cpp:519
QgsFeatureRequest::mTransformErrorCallback
std::function< void(const QgsFeature &) > mTransformErrorCallback
Definition: qgsfeaturerequest.h:737
QgsFeatureRequest::simplifyMethod
const QgsSimplifyMethod & simplifyMethod() const
Gets simplification method for geometries that will be fetched.
Definition: qgsfeaturerequest.h:557
QgsFeatureRequest::setOrderBy
QgsFeatureRequest & setOrderBy(const OrderBy &orderBy)
Set a list of order by clauses.
Definition: qgsfeaturerequest.cpp:172
QgsFeatureRequest::connectionTimeout
Q_DECL_DEPRECATED int connectionTimeout() const
Returns the timeout (in milliseconds) for how long we should wait for a connection if none is availab...
Definition: qgsfeaturerequest.cpp:309
QgsFeatureRequest::mAttrs
QgsAttributeList mAttrs
Definition: qgsfeaturerequest.h:731
QgsFeatureRequest::FilterNone
@ FilterNone
No filter is applied.
Definition: qgsfeaturerequest.h:105
QgsFeature
Definition: qgsfeature.h:55
QgsFeatureRequest::setDestinationCrs
QgsFeatureRequest & setDestinationCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets the destination crs for feature's geometries.
Definition: qgsfeaturerequest.cpp:263
QgsFeatureRequest::mTimeout
int mTimeout
Definition: qgsfeaturerequest.h:740
qgslogger.h
QgsFields::lookupField
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
Definition: qgsfields.cpp:324
QgsExpression
Definition: qgsexpression.h:113
QgsFeatureRequest::setFlags
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
Definition: qgsfeaturerequest.cpp:184
QgsAbstractFeatureIterator
Definition: qgsfeatureiterator.h:28
QgsExpression::expression
QString expression() const
Returns the original, unmodified expression string.
Definition: qgsexpression.cpp:57
QgsAbstractFeatureIterator::close
virtual bool close()=0
end of iterating: free the resources / lock
QgsRectangle::isNull
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
Definition: qgsrectangle.h:447
QgsGeometry::boundingBoxIntersects
bool boundingBoxIntersects(const QgsRectangle &rectangle) const
Returns true if the bounding box of this geometry intersects with a rectangle.
Definition: qgsgeometry.cpp:1172
QgsFeatureRequest::mFilter
FilterType mFilter
Definition: qgsfeaturerequest.h:724
QgsFeatureRequest::mLimit
long mLimit
Definition: qgsfeaturerequest.h:733
QgsFeatureId
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
QgsExpressionContext::setFeature
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Definition: qgsexpressioncontext.cpp:521
QgsFeatureRequest::limit
long limit() const
Returns the maximum number of features to request, or -1 if no limit set.
Definition: qgsfeaturerequest.h:512