QGIS API Documentation
2.2.0-Valmiera
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
qgsfeatureiterator.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfeatureiterator.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 QGSFEATUREITERATOR_H
16
#define QGSFEATUREITERATOR_H
17
18
#include "
qgsfeaturerequest.h
"
19
#include "
qgslogger.h
"
20
21
class
QgsAbstractGeometrySimplifier
;
22
26
class
CORE_EXPORT
QgsAbstractFeatureIterator
27
{
28
public
:
30
QgsAbstractFeatureIterator
(
const
QgsFeatureRequest
& request );
31
33
virtual
~
QgsAbstractFeatureIterator
();
34
36
virtual
bool
nextFeature(
QgsFeature
& f );
37
39
virtual
bool
rewind() = 0;
41
virtual
bool
close() = 0;
42
43
protected
:
51
virtual
bool
fetchFeature(
QgsFeature
& f ) = 0;
52
63
virtual
bool
nextFeatureFilterExpression(
QgsFeature
&f );
64
76
virtual
bool
nextFeatureFilterFids(
QgsFeature
& f );
77
79
QgsFeatureRequest
mRequest
;
80
82
bool
mClosed
;
83
85
int
refs
;
86
void
ref();
87
void
deref();
88
friend
class
QgsFeatureIterator
;
89
91
virtual
bool
prepareSimplification(
const
QgsSimplifyMethod
& simplifyMethod );
92
93
private
:
95
QgsAbstractGeometrySimplifier
*
mGeometrySimplifier
;
97
bool
mLocalSimplification
;
98
100
virtual
bool
providerCanSimplify(
QgsSimplifyMethod::MethodType
methodType )
const
;
101
103
virtual
bool
simplify(
QgsFeature
& feature );
104
};
105
106
111
class
CORE_EXPORT
QgsFeatureIterator
112
{
113
public
:
115
QgsFeatureIterator
();
117
QgsFeatureIterator
(
QgsAbstractFeatureIterator
* iter );
119
QgsFeatureIterator
(
const
QgsFeatureIterator
& fi );
121
~
QgsFeatureIterator
();
122
123
QgsFeatureIterator
& operator=(
const
QgsFeatureIterator
& other );
124
125
bool
nextFeature(
QgsFeature
& f );
126
bool
rewind();
127
bool
close();
128
130
bool
isClosed()
const
;
131
132
friend
bool
operator==
(
const
QgsFeatureIterator
&fi1,
const
QgsFeatureIterator
&fi2 );
133
friend
bool
operator!=
(
const
QgsFeatureIterator
&fi1,
const
QgsFeatureIterator
&fi2 );
134
135
protected
:
136
QgsAbstractFeatureIterator
*
mIter
;
137
};
138
140
141
inline
QgsFeatureIterator::QgsFeatureIterator
()
142
: mIter( NULL )
143
{
144
}
145
146
inline
QgsFeatureIterator::QgsFeatureIterator
(
QgsAbstractFeatureIterator
* iter )
147
: mIter( iter )
148
{
149
if
( iter )
150
iter->
ref
();
151
}
152
153
inline
QgsFeatureIterator::QgsFeatureIterator
(
const
QgsFeatureIterator
& fi )
154
: mIter( fi.mIter )
155
{
156
if
(
mIter
)
157
mIter
->
ref
();
158
}
159
160
inline
QgsFeatureIterator::~QgsFeatureIterator
()
161
{
162
if
(
mIter
)
163
mIter
->
deref
();
164
}
165
166
inline
bool
QgsFeatureIterator::nextFeature
(
QgsFeature
& f )
167
{
168
return
mIter
?
mIter
->
nextFeature
( f ) :
false
;
169
}
170
171
inline
bool
QgsFeatureIterator::rewind
()
172
{
173
return
mIter
?
mIter
->
rewind
() :
false
;
174
}
175
176
inline
bool
QgsFeatureIterator::close
()
177
{
178
return
mIter
?
mIter
->
close
() :
false
;
179
}
180
181
inline
bool
QgsFeatureIterator::isClosed
()
const
182
{
183
return
mIter
?
mIter
->
mClosed
:
true
;
184
}
185
186
inline
bool
operator==
(
const
QgsFeatureIterator
&fi1,
const
QgsFeatureIterator
&fi2 )
187
{
188
return
( fi1.
mIter
== fi2.
mIter
);
189
}
190
191
inline
bool
operator!=
(
const
QgsFeatureIterator
&fi1,
const
QgsFeatureIterator
&fi2 )
192
{
193
return
!( fi1 == fi2 );
194
}
195
196
#endif // QGSFEATUREITERATOR_H
Generated on Sun Feb 23 2014 14:27:19 for QGIS API Documentation by
1.8.1.2