/
qgsogrfeatureiterator.h
72 lines (52 loc) · 2.52 KB
/
qgsogrfeatureiterator.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
/***************************************************************************
qgsogrfeatureiterator.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 QGSOGRFEATUREITERATOR_H
#define QGSOGRFEATUREITERATOR_H
#include "qgsfeatureiterator.h"
#include <ogr_api.h>
class QgsOgrProvider;
class QgsOgrAbstractGeometrySimplifier;
class QgsOgrFeatureIterator : public QgsAbstractFeatureIterator
{
public:
QgsOgrFeatureIterator( QgsOgrProvider* p, const QgsFeatureRequest& request );
~QgsOgrFeatureIterator();
//! reset the iterator to the starting position
virtual bool rewind();
//! end of iterating: free the resources / lock
virtual bool close();
protected:
//! fetch next feature, return true on success
virtual bool fetchFeature( QgsFeature& feature );
//! Setup the simplification of geometries to fetch using the specified simplify method
virtual bool prepareSimplification( const QgsSimplifyMethod& simplifyMethod );
QgsOgrProvider* P;
void ensureRelevantFields();
bool readFeature( OGRFeatureH fet, QgsFeature& feature );
//! Get an attribute associated with a feature
void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature & f, int attindex );
bool mFeatureFetched;
OGRDataSourceH ogrDataSource;
OGRLayerH ogrLayer;
bool mSubsetStringSet;
//! Set to true, if geometry is in the requested columns
bool mFetchGeometry;
private:
//! optional object to simplify OGR-geometries fecthed by this feature iterator
QgsOgrAbstractGeometrySimplifier* mGeometrySimplifier;
//! returns whether the iterator can simplify on provider side the geometries to fetch using the specified method type
virtual bool providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const;
};
#endif // QGSOGRFEATUREITERATOR_H