-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsmemoryfeatureiterator.h
80 lines (59 loc) · 2.55 KB
/
qgsmemoryfeatureiterator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/***************************************************************************
qgsmemoryfeatureiterator.h
---------------------
begin : Juli 2012
copyright : (C) 2012 by Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMEMORYFEATUREITERATOR_H
#define QGSMEMORYFEATUREITERATOR_H
#include "qgsfeatureiterator.h"
#include "qgsexpressioncontext.h"
#include "qgsfields.h"
#include "qgsgeometry.h"
///@cond PRIVATE
class QgsMemoryProvider;
typedef QMap<QgsFeatureId, QgsFeature> QgsFeatureMap;
class QgsSpatialIndex;
class QgsMemoryFeatureSource : public QgsAbstractFeatureSource
{
public:
explicit QgsMemoryFeatureSource( const QgsMemoryProvider *p );
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest &request ) override;
private:
QgsFields mFields;
QgsFeatureMap mFeatures;
std::unique_ptr< QgsSpatialIndex > mSpatialIndex;
QString mSubsetString;
QgsExpressionContext mExpressionContext;
friend class QgsMemoryFeatureIterator;
};
class QgsMemoryFeatureIterator : public QgsAbstractFeatureIteratorFromSource<QgsMemoryFeatureSource>
{
public:
QgsMemoryFeatureIterator( QgsMemoryFeatureSource *source, bool ownSource, const QgsFeatureRequest &request );
~QgsMemoryFeatureIterator();
virtual bool rewind() override;
virtual bool close() override;
protected:
virtual bool fetchFeature( QgsFeature &feature ) override;
private:
bool nextFeatureUsingList( QgsFeature &feature );
bool nextFeatureTraverseAll( QgsFeature &feature );
QgsGeometry mSelectRectGeom;
std::unique_ptr< QgsGeometryEngine > mSelectRectEngine;
QgsFeatureMap::const_iterator mSelectIterator;
bool mUsingFeatureIdList = false;
QList<QgsFeatureId> mFeatureIdList;
QList<QgsFeatureId>::const_iterator mFeatureIdListIterator;
QgsExpression *mSubsetExpression = nullptr;
};
///@endcond PRIVATE
#endif // QGSMEMORYFEATUREITERATOR_H