QGIS API Documentation  2.12.0-Lyon
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( rhs.mFields )
24  , mCrs( rhs.mCrs )
25  , mFeatures( rhs.mFeatures )
26  , mParams( rhs.mParams )
27 {
28 }
29 
31  : mFields( fields )
32  , mCrs( crs )
33 {
34 }
35 
37 {
38 }
39 
40 void QgsFeatureStore::setFields( const QgsFields & fields )
41 {
42  mFields = fields;
43  QgsFeatureList::iterator it = mFeatures.begin();
44  for ( ; it != mFeatures.end(); ++it )
45  {
46  ( *it ).setFields( mFields );
47  }
48 }
49 
51 {
52  QgsFeature f( feature );
53  f.setFields( mFields );
54  mFeatures.append( f );
55 }
Container for features with the same fields and crs.
~QgsFeatureStore()
Destructor.
QgsFeatureStore()
Constructor.
void addFeature(const QgsFeature &feature)
Add feature.
Container of fields for a vector layer.
Definition: qgsfield.h:177
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:176
void append(const T &value)
void setFields(const QgsFields &fields)
Set fields.
Q_DECL_DEPRECATED 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:149
iterator end()
Class for storing a coordinate reference system (CRS)
QgsFields & fields()
Get fields list.
iterator begin()