-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsvectorlayersaveasdialog.h
154 lines (128 loc) · 5.01 KB
/
qgsvectorlayersaveasdialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/***************************************************************************
qgsvectorlayersaveasdialog.h
Dialog to select destination, type and crs to save as ogr layers
-------------------
begin : Mon Mar 22 2010
copyright : (C) 2010 by Juergen E. Fischer
email : jef at norbit dot de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSVECTORLAYERSAVEASDIALOG_H
#define QGSVECTORLAYERSAVEASDIALOG_H
#include "ui_qgsvectorlayersaveasdialogbase.h"
#include <QDialog>
#include "qgshelp.h"
#include "qgsfields.h"
#include "qgsvectorfilewriter.h"
#include "qgis_gui.h"
#define SIP_NO_FILE
class QgsVectorLayer;
/**
* Class to select destination file, type and CRS for ogr layers
* \note not available in Python bindings
*/
class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSaveAsDialogBase
{
Q_OBJECT
public:
// bitmask of options to be shown
enum Options
{
Symbology = 1,
AllOptions = ~0
};
QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = 0 );
QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, int options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = 0 );
~QgsVectorLayerSaveAsDialog();
QString format() const;
QString encoding() const;
QString filename() const;
QString layername() const;
QStringList datasourceOptions() const;
QStringList layerOptions() const;
long crs() const;
QgsAttributeList selectedAttributes() const;
//! Return selected attributes that must be exported with their displayed values instead of their raw values. Added in QGIS 2.16
QgsAttributeList attributesAsDisplayedValues() const;
bool addToCanvas() const;
/**
* Returns type of symbology export.
0: No symbology
1: Feature symbology
2: Symbol level symbology*/
int symbologyExport() const;
/**
* Returns the specified map scale.
* The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
*/
double scale() const;
/**
* Sets a map \a canvas to associate with the dialog.
*/
void setMapCanvas( QgsMapCanvas *canvas );
bool hasFilterExtent() const;
QgsRectangle filterExtent() const;
bool onlySelected() const;
/**
* Returns the selected flat geometry type for the export.
* \see automaticGeometryType()
* \see forceMulti()
* \see includeZ()
*/
QgsWkbTypes::Type geometryType() const;
/**
* Returns true if geometry type is set to automatic.
* \see geometryType()
*/
bool automaticGeometryType() const;
/**
* Returns true if force multi geometry type is checked.
* \see includeZ()
*/
bool forceMulti() const;
/**
* Sets whether the force multi geometry checkbox should be checked.
*/
void setForceMulti( bool checked );
/**
* Returns true if include z dimension is checked.
* \see forceMulti()
*/
bool includeZ() const;
/**
* Sets whether the include z dimension checkbox should be checked.
*/
void setIncludeZ( bool checked );
//! Returns creation action
QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
private slots:
void mFormatComboBox_currentIndexChanged( int idx );
void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
void showHelp();
void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
void mGeometryTypeComboBox_currentIndexChanged( int index );
void accept() override;
void mSelectAllAttributes_clicked();
void mDeselectAllAttributes_clicked();
void mReplaceRawFieldValues_stateChanged( int state );
void mAttributeTable_itemChanged( QTableWidgetItem *item );
private:
void setup();
QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
long mCRS;
QgsRectangle mLayerExtent;
QgsCoordinateReferenceSystem mLayerCrs;
QgsVectorLayer *mLayer = nullptr;
QgsMapCanvas *mMapCanvas = nullptr;
bool mAttributeTableItemChangedSlotEnabled;
bool mReplaceRawFieldValuesStateChangedSlotEnabled;
QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
};
#endif // QGSVECTORLAYERSAVEASDIALOG_H