QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgsvectorlayersaveasdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayersaveasdialog.h
3 Dialog to select destination, type and crs to save as ogr layers
4 -------------------
5 begin : Mon Mar 22 2010
6 copyright : (C) 2010 by Juergen E. Fischer
7 email : jef at norbit dot de
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#ifndef QGSVECTORLAYERSAVEASDIALOG_H
19#define QGSVECTORLAYERSAVEASDIALOG_H
20
21#include "ui_qgsvectorlayersaveasdialogbase.h"
22#include <QDialog>
23#include "qgsvectorfilewriter.h"
24#include "qgis_gui.h"
25
26#define SIP_NO_FILE
27
28class QgsVectorLayer;
29
36class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSaveAsDialogBase
37{
38 Q_OBJECT
39
40 public:
41
43 enum Option
44 {
45 Symbology = 1,
46 DestinationCrs = 1 << 2,
47 Fields = 1 << 3,
48 AddToCanvas = 1 << 4,
49 SelectedOnly = 1 << 5,
50 GeometryType = 1 << 6,
51 Extent = 1 << 7,
52 Metadata = 1 << 8,
53 AllOptions = ~0
54 };
55 Q_DECLARE_FLAGS( Options, Option )
56
57
62 Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
63
67 QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, Options options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
68
73 QString format() const;
74
78 QString encoding() const;
79
83 QString filename() const;
84
88 QString layername() const;
89
94 QStringList datasourceOptions() const;
95
100 QStringList layerOptions() const;
101
107 Q_DECL_DEPRECATED long crs() const;
108
113 QgsCoordinateReferenceSystem crsObject() const;
114
118 QgsAttributeList selectedAttributes() const;
120 QgsAttributeList attributesAsDisplayedValues() const;
121
125 QStringList attributesExportNames() const;
126
132 bool addToCanvas() const;
133
140 void setAddToCanvas( bool checked );
141
148 int symbologyExport() const;
149
154 double scale() const;
155
159 void setMapCanvas( QgsMapCanvas *canvas );
160
165 bool hasFilterExtent() const;
166
171 QgsRectangle filterExtent() const;
172
176 void setOnlySelected( bool onlySelected );
177
181 bool onlySelected() const;
182
188 bool persistMetadata() const;
189
196 Qgis::WkbType geometryType() const;
197
202 bool automaticGeometryType() const;
203
208 bool forceMulti() const;
209
213 void setForceMulti( bool checked );
214
219 bool includeZ() const;
220
224 void setIncludeZ( bool checked );
225
227 QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
228
229 private slots:
230
231 void mFormatComboBox_currentIndexChanged( int idx );
232 void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
233 void showHelp();
234 void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
235 void mGeometryTypeComboBox_currentIndexChanged( int index );
236 void accept() override;
237 void mSelectAllAttributes_clicked();
238 void mDeselectAllAttributes_clicked();
239 void mUseAliasesForExportedName_stateChanged( int state );
240 void mReplaceRawFieldValues_stateChanged( int state );
241 void mAttributeTable_itemChanged( QTableWidgetItem *item );
242
243 private:
244
245 enum class ColumnIndex : int
246 {
247 Name = 0,
248 ExportName = 1,
249 Type = 2,
250 ExportAsDisplayedValue = 3
251 };
252
253 void setup();
254 QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
255
256 QgsCoordinateReferenceSystem mSelectedCrs;
257
258 QgsRectangle mLayerExtent;
260 QgsVectorLayer *mLayer = nullptr;
261 QgsMapCanvas *mMapCanvas = nullptr;
262 QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
263 Options mOptions = AllOptions;
264 QString mDefaultOutputLayerNameFromInputLayerName;
265};
266
267Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorLayerSaveAsDialog::Options )
268
269
270#endif // QGSVECTORLAYERSAVEASDIALOG_H
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition: qgis.h:155
This class represents a coordinate reference system (CRS).
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
A rectangle specified with double values.
Definition: qgsrectangle.h:42
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
Class to select destination file, type and CRS for ogr layers.
Option
Bitmask of options to be shown.
Represents a vector layer which manages a vector based data sets.
QList< int > QgsAttributeList
Definition: qgsfield.h:26
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
const QgsCoordinateReferenceSystem & crs