QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsproxyfeaturesink.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsproxyfeaturesink.cpp
3 ----------------------
4 begin : April 2020
5 copyright : (C) 2020 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 "qgsproxyfeaturesink.h"
19
20
24
26{
27 if ( !mSink )
28 return false;
29
30 return mSink->addFeature( feature, flags );
31}
32
34{
35 if ( !mSink )
36 return false;
37
38 return mSink->addFeatures( features, flags );
39}
40
42{
43 if ( !mSink )
44 return false;
45
46 return mSink->addFeatures( iterator, flags );
47}
48
50{
51 return mSink ? mSink->lastError() : QString();
52}
53
55{
56 if ( !mSink )
57 return false;
58
59 return mSink->flushBuffer();
60}
61
63{
64 if ( mSink )
65 {
66 mSink->finalize();
67 }
68}
Wrapper for iterator of features from vector data provider or vector layer.
An interface for objects which accept features via addFeature(s) methods.
virtual bool flushBuffer()
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to...
virtual bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())
Adds a single feature to the sink.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
virtual void finalize()
Finalizes the sink, flushing any buffered features to the destination.
QFlags< Flag > Flags
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
bool flushBuffer() override
Flushes any internal buffer which may exist in the sink, causing any buffered features to be added to...
QgsFeatureSink * mSink
Underlying destination sink.
QString lastError() const override
Returns the most recent error encountered by the sink, e.g.
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
void finalize() override
Finalizes the sink, flushing any buffered features to the destination.
QgsProxyFeatureSink(QgsFeatureSink *sink)
Constructs a new QgsProxyFeatureSink which forwards features onto a destination sink.
QList< QgsFeature > QgsFeatureList