QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
src
core
providers
memory
qgsmemoryfeatureiterator.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmemoryfeatureiterator.h
3
---------------------
4
begin : Juli 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
#ifndef QGSMEMORYFEATUREITERATOR_H
16
#define QGSMEMORYFEATUREITERATOR_H
17
18
#define SIP_NO_FILE
19
20
#include "
qgsfeatureiterator.h
"
21
#include "
qgsexpressioncontext.h
"
22
#include "
qgsfields.h
"
23
#include "
qgsgeometry.h
"
24
#include "
qgscoordinatetransform.h
"
25
27
28
class
QgsMemoryProvider;
29
30
typedef
QMap<QgsFeatureId, QgsFeature>
QgsFeatureMap
;
31
32
class
QgsSpatialIndex
;
33
34
35
class
QgsMemoryFeatureSource final:
public
QgsAbstractFeatureSource
36
{
37
public
:
38
explicit
QgsMemoryFeatureSource(
const
QgsMemoryProvider *p );
39
40
QgsFeatureIterator
getFeatures
(
const
QgsFeatureRequest
&request )
override
;
41
42
QgsExpressionContext
*expressionContext();
43
44
private
:
45
QgsFields
mFields;
46
QgsFeatureMap
mFeatures;
47
std::unique_ptr< QgsSpatialIndex > mSpatialIndex;
48
QString mSubsetString;
49
std::unique_ptr< QgsExpressionContext > mExpressionContext;
50
QgsCoordinateReferenceSystem
mCrs;
51
52
friend
class
QgsMemoryFeatureIterator;
53
};
54
55
56
class
QgsMemoryFeatureIterator final:
public
QgsAbstractFeatureIteratorFromSource
<QgsMemoryFeatureSource>
57
{
58
public
:
59
QgsMemoryFeatureIterator( QgsMemoryFeatureSource *source,
bool
ownSource,
const
QgsFeatureRequest
&request );
60
61
~QgsMemoryFeatureIterator()
override
;
62
63
bool
rewind
()
override
;
64
bool
close
()
override
;
65
66
protected
:
67
68
bool
fetchFeature
(
QgsFeature
&feature )
override
;
69
70
private
:
71
bool
nextFeatureUsingList(
QgsFeature
&feature );
72
bool
nextFeatureTraverseAll(
QgsFeature
&feature );
73
74
QgsGeometry
mSelectRectGeom;
75
std::unique_ptr< QgsGeometryEngine > mSelectRectEngine;
76
QgsGeometry
mDistanceWithinGeom;
77
std::unique_ptr< QgsGeometryEngine > mDistanceWithinEngine;
78
QgsRectangle
mFilterRect;
79
QgsFeatureMap::const_iterator mSelectIterator;
80
bool
mUsingFeatureIdList =
false
;
81
QList<QgsFeatureId> mFeatureIdList;
82
QList<QgsFeatureId>::const_iterator mFeatureIdListIterator;
83
std::unique_ptr< QgsExpression > mSubsetExpression;
84
QgsCoordinateTransform
mTransform;
85
86
};
87
89
90
#endif // QGSMEMORYFEATUREITERATOR_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:406
qgsfields.h
qgsfeatureiterator.h
QgsFields
Container of fields for a vector layer.
Definition:
qgsfields.h:44
QgsRectangle
A rectangle specified with double values.
Definition:
qgsrectangle.h:41
QgsAbstractFeatureIteratorFromSource
Helper template that cares of two things: 1. automatic deletion of source if owned by iterator,...
Definition:
qgsfeatureiterator.h:259
QgsFeatureRequest
This class wraps a request for features to a vector layer (or directly its vector data provider).
Definition:
qgsfeaturerequest.h:83
qgsexpressioncontext.h
QgsAbstractFeatureSource
Base class that can be used for any class that is capable of returning features.
Definition:
qgsfeaturerequest.h:1009
qgscoordinatetransform.h
QgsSpatialIndex
A spatial index for QgsFeature objects.
Definition:
qgsspatialindex.h:67
QgsFeatureMap
QMap< QgsFeatureId, QgsFeature > QgsFeatureMap
Definition:
qgsvectorlayereditbuffer.h:31
QgsAbstractFeatureIterator::rewind
virtual bool rewind()=0
reset the iterator to the starting position
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition:
qgscoordinatereferencesystem.h:211
qgsgeometry.h
QgsGeometry
A geometry is the spatial representation of a feature.
Definition:
qgsgeometry.h:124
QgsAbstractFeatureIterator::fetchFeature
virtual bool fetchFeature(QgsFeature &f)=0
If you write a feature iterator for your provider, this is the method you need to implement!...
QgsAbstractFeatureSource::getFeatures
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Gets an iterator for features matching the specified request.
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition:
qgsfeature.h:55
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition:
qgscoordinatetransform.h:57
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition:
qgsfeatureiterator.h:289
QgsAbstractFeatureIterator::close
virtual bool close()=0
end of iterating: free the resources / lock
Generated on Sun Sep 11 2022 00:03:17 for QGIS API Documentation by
1.8.17