QGIS API Documentation
2.0.1-Dufour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
qgsvectorlayerimport.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvectorlayerimport.cpp
3
vector layer importer
4
-------------------
5
begin : Thu Aug 25 2011
6
copyright : (C) 2011 by Giuseppe Sucameli
7
email : brush.tyler at gmail.com
8
***************************************************************************/
9
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
19
#ifndef _QGSVECTORLAYERIMPORT_H_
20
#define _QGSVECTORLAYERIMPORT_H_
21
22
#include "
qgsvectordataprovider.h
"
23
#include "
qgsvectorlayer.h
"
24
25
class
QProgressDialog;
26
36
class
CORE_EXPORT
QgsVectorLayerImport
37
{
38
public
:
39
40
enum
ImportError
41
{
42
NoError = 0,
43
ErrDriverNotFound
,
44
ErrCreateDataSource
,
45
ErrCreateLayer
,
46
ErrAttributeTypeUnsupported
,
47
ErrAttributeCreationFailed
,
48
ErrProjection
,
49
ErrFeatureWriteFailed
,
50
ErrInvalidLayer
,
51
ErrInvalidProvider
,
52
ErrProviderUnsupportedFeature
,
53
ErrConnectionFailed
54
};
55
57
static
ImportError importLayer(
QgsVectorLayer
* layer,
58
const
QString& uri,
59
const
QString& providerKey,
60
const
QgsCoordinateReferenceSystem
*destCRS,
61
bool
onlySelected =
false
,
62
QString *errorMessage = 0,
63
bool
skipAttributeCreation =
false
,
64
QMap<QString, QVariant> *options = 0,
65
QProgressDialog *progress = 0
66
);
67
69
QgsVectorLayerImport
(
const
QString &uri,
70
const
QString &provider,
71
const
QgsFields
&fields,
72
QGis::WkbType
geometryType,
73
const
QgsCoordinateReferenceSystem
* crs,
74
bool
overwrite =
false
,
75
const
QMap<QString, QVariant> *options = 0,
76
QProgressDialog *progress = 0
77
);
78
80
ImportError hasError();
81
83
QString errorMessage();
84
85
int
errorCount
()
const
{
return
mErrorCount; }
86
88
bool
addFeature(
QgsFeature
& feature );
89
91
~
QgsVectorLayerImport
();
92
93
protected
:
95
bool
flushBuffer();
96
98
bool
createSpatialIndex();
99
101
ImportError
mError
;
102
QString
mErrorMessage
;
103
104
int
mErrorCount
;
105
106
QgsVectorDataProvider
*
mProvider
;
107
109
QMap<int, int>
mOldToNewAttrIdx
;
110
int
mAttributeCount
;
111
112
QgsFeatureList
mFeatureBuffer
;
113
QProgressDialog *
mProgress
;
114
};
115
116
#endif
Generated on Tue Sep 24 2013 14:41:47 for QGIS API Documentation by
1.8.1.2