QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
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 : radim.blazek@gmail.com
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
18
QgsFeatureStore::QgsFeatureStore
(
const
QgsFields
&
fields
,
const
QgsCoordinateReferenceSystem
&
crs
)
19
: mFields(
fields
)
20
, mCrs(
crs
)
21
{}
22
23
void
QgsFeatureStore::setFields
(
const
QgsFields
&
fields
)
24
{
25
mFields =
fields
;
26
QgsFeatureList::iterator it = mFeatures.begin();
27
for
( ; it != mFeatures.end(); ++it )
28
{
29
( *it ).setFields( mFields );
30
}
31
}
32
33
bool
QgsFeatureStore::addFeature
(
QgsFeature
&feature,
Flags
)
34
{
35
QgsFeature
f( feature );
36
f.
setFields
( mFields );
37
mFeatures.append( f );
38
return
true
;
39
}
40
41
bool
QgsFeatureStore::addFeatures
(
QgsFeatureList
&
features
,
Flags
flags )
42
{
43
QgsFeatureList::iterator fIt =
features
.begin();
44
for
( ; fIt !=
features
.end(); ++fIt )
45
{
46
addFeature
( *fIt, flags );
47
}
48
return
true
;
49
}
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsFeatureSink::Flags
QFlags< Flag > Flags
Definition
qgsfeaturesink.h:78
QgsFeatureStore::addFeatures
bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
Definition
qgsfeaturestore.cpp:41
QgsFeatureStore::features
QgsFeatureList features() const
Returns the list of features contained in the store.
Definition
qgsfeaturestore.h:97
QgsFeatureStore::fields
QgsFields fields() const
Returns the store's field list.
Definition
qgsfeaturestore.h:45
QgsFeatureStore::setFields
void setFields(const QgsFields &fields)
Sets the store's fields.
Definition
qgsfeaturestore.cpp:23
QgsFeatureStore::addFeature
bool addFeature(QgsFeature &feature, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a single feature to the sink.
Definition
qgsfeaturestore.cpp:33
QgsFeatureStore::crs
QgsCoordinateReferenceSystem crs() const
Returns the store's coordinate reference system.
Definition
qgsfeaturestore.h:57
QgsFeatureStore::QgsFeatureStore
QgsFeatureStore()=default
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsFeature::setFields
void setFields(const QgsFields &fields, bool initAttributes=false)
Assigns a field map with the feature to allow attribute access by attribute name.
Definition
qgsfeature.cpp:198
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:45
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition
qgsfeature.h:1289
qgsfeaturestore.h
Generated on
for QGIS API Documentation by
1.17.0