QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsfeaturestore.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsfeaturestore.cpp
3 --------------------------------------
4 Date : February 2013
5 Copyright : (C) 2013 by Radim Blazek
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
16#include "qgsfeaturestore.h"
17
19 : mFields( fields )
20 , mCrs( crs )
21{
22}
23
25{
26 mFields = fields;
27 QgsFeatureList::iterator it = mFeatures.begin();
28 for ( ; it != mFeatures.end(); ++it )
29 {
30 ( *it ).setFields( mFields );
31 }
32}
33
35{
36 QgsFeature f( feature );
37 f.setFields( mFields );
38 mFeatures.append( f );
39 return true;
40}
41
43{
44 QgsFeatureList::iterator fIt = features.begin();
45 for ( ; fIt != features.end(); ++fIt )
46 {
47 addFeature( *fIt, flags );
48 }
49 return true;
50}
Represents a coordinate reference system (CRS).
QFlags< Flag > Flags
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
QgsFeatureList features() const
Returns the list of features contained in the store.
QgsFields fields() const
Returns the store's field list.
void setFields(const QgsFields &fields)
Sets the store's fields.
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
QgsCoordinateReferenceSystem crs() const
Returns the store's coordinate reference system.
QgsFeatureStore()=default
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
void setFields(const QgsFields &fields, bool initAttributes=false)
Assigns a field map with the feature to allow attribute access by attribute name.
Container of fields for a vector layer.
Definition qgsfields.h:46
QList< QgsFeature > QgsFeatureList