QGIS API Documentation  2.99.0-Master (009e47e)
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
6  Email : [email protected]
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 {
20 }
21 
23  : mFields( fields )
24  , mCrs( crs )
25 {
26 }
27 
29 {
30  mFields = fields;
31  QgsFeatureList::iterator it = mFeatures.begin();
32  for ( ; it != mFeatures.end(); ++it )
33  {
34  ( *it ).setFields( mFields );
35  }
36 }
37 
39 {
40  QgsFeature f( feature );
41  f.setFields( mFields );
42  mFeatures.append( f );
43  return true;
44 }
45 
47 {
48  QgsFeatureList::iterator fIt = features.begin();
49  for ( ; fIt != features.end(); ++fIt )
50  {
51  addFeature( *fIt );
52  }
53  return true;
54 }
void setFields(const QgsFields &fields, bool initAttributes=false)
Assign a field map with the feature to allow attribute access by attribute name.
Definition: qgsfeature.cpp:155
QList< QgsFeature > QgsFeatureList
Definition: qgsfeature.h:524
QgsFeatureStore()
Constructor.
Container of fields for a vector layer.
Definition: qgsfields.h:41
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:61
bool addFeature(QgsFeature &feature) override
Adds a single feature to the sink.
void setFields(const QgsFields &fields)
Sets the store&#39;s fields.
QgsFields fields() const
Returns the store&#39;s field list.
bool addFeatures(QgsFeatureList &features) override
Adds a list of features to the sink.
This class represents a coordinate reference system (CRS).
QgsCoordinateReferenceSystem crs() const
Returns the store&#39;s coordinate reference system.
QgsFeatureList features() const
Returns the list of features contained in the store.