QGIS API Documentation
4.3.0-Master (4ecdf0f3f59)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsfeaturesink.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfeaturesink.cpp
3
------------------
4
begin : April 2017
5
copyright : (C) 2017 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#include "
qgsfeaturestore.h
"
19
20
void
QgsFeatureSink::finalize
()
21
{
22
flushBuffer
();
23
}
24
25
bool
QgsFeatureSink::addFeature
(
QgsFeature
&feature,
QgsFeatureSink::Flags
flags )
26
{
27
QgsFeatureList
features;
28
features << feature;
29
const
bool
result =
addFeatures
( features, flags );
30
31
if
( !( flags &
FastInsert
) )
32
{
33
// need to update the passed feature reference to the updated copy from the features list
34
feature = features.at( 0 );
35
}
36
return
result;
37
}
38
39
bool
QgsFeatureSink::addFeatures
(
QgsFeatureIterator
&iterator,
QgsFeatureSink::Flags
flags )
40
{
41
QgsFeature
f;
42
bool
result =
true
;
43
while
( iterator.
nextFeature
( f ) )
44
{
45
result = result &&
addFeature
( f, flags );
46
}
47
return
result;
48
}
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition
qgsfeatureiterator.h:284
QgsFeatureIterator::nextFeature
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
Definition
qgsfeatureiterator.h:401
QgsFeatureSink::flushBuffer
virtual bool flushBuffer()
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to...
Definition
qgsfeaturesink.h:113
QgsFeatureSink::addFeature
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
Definition
qgsfeaturesink.cpp:25
QgsFeatureSink::FastInsert
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
Definition
qgsfeaturesink.h:68
QgsFeatureSink::addFeatures
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
QgsFeatureSink::finalize
virtual void finalize()
Finalizes the sink, flushing any buffered features to the destination.
Definition
qgsfeaturesink.cpp:20
QgsFeatureSink::Flags
QFlags< Flag > Flags
Definition
qgsfeaturesink.h:78
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition
qgsfeature.h:1289
qgsfeaturestore.h
Generated on
for QGIS API Documentation by
1.17.0