QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsogrutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsogrutils.h
3  -------------
4  begin : February 2016
5  copyright : (C) 2016 Nyall Dawson
6  email : nyall dot dawson at gmail dot 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 #ifndef QGSOGRUTILS_H
17 #define QGSOGRUTILS_H
18 
19 #include "qgsfeature.h"
20 
21 #include <ogr_api.h>
22 #include "cpl_conv.h"
23 #include "cpl_string.h"
24 
33 class CORE_EXPORT QgsOgrUtils
34 {
35  public:
36 
43  static QgsFeature readOgrFeature( OGRFeatureH ogrFet, const QgsFields &fields, QTextCodec* encoding );
44 
50  static QgsFields readOgrFields( OGRFeatureH ogrFet, QTextCodec* encoding );
51 
61  static QVariant getOgrFeatureAttribute( OGRFeatureH ogrFet, const QgsFields &fields, int attIndex, QTextCodec* encoding, bool* ok = 0 );
62 
71  static bool readOgrFeatureAttributes( OGRFeatureH ogrFet, const QgsFields &fields, QgsFeature& feature, QTextCodec* encoding );
72 
80  static bool readOgrFeatureGeometry( OGRFeatureH ogrFet, QgsFeature& feature );
81 
87  static QgsGeometry* ogrGeometryToQgsGeometry( OGRGeometryH geom );
88 
97  static QgsFeatureList stringToFeatureList( const QString& string, const QgsFields& fields, QTextCodec* encoding );
98 
105  static QgsFields stringToFields( const QString& string, QTextCodec* encoding );
106 };
107 
108 #endif // QGSOGRUTILS_H
Container of fields for a vector layer.
Definition: qgsfield.h:252
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:187
Utilities for working with OGR features and layers.
Definition: qgsogrutils.h:33