QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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
26class QgsVectorLayer;
27
33class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSaveAsDialogBase
34{
35 Q_OBJECT
36
37 public:
38
42 enum class Option : int
43 {
44 Symbology = 1,
45 DestinationCrs = 1 << 2,
46 Fields = 1 << 3,
47 AddToCanvas = 1 << 4,
48 SelectedOnly = 1 << 5,
49 GeometryType = 1 << 6,
50 Extent = 1 << 7,
51 Metadata = 1 << 8,
52 AllOptions = ~0
53 };
54 Q_ENUM( Option )
55
56
59 Q_DECLARE_FLAGS( Options, Option )
60 Q_FLAG( Options )
61
62
67 Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ) SIP_SKIP;
68
72 QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, QgsVectorLayerSaveAsDialog::Options options = QgsVectorLayerSaveAsDialog::Option::AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
73
79 QString format() const;
80
84 QString encoding() const;
85
91 QString fileName() const;
92
98 QString layerName() const;
99
106 QStringList datasourceOptions() const;
107
114 QStringList layerOptions() const;
115
122
126 QgsAttributeList selectedAttributes() const;
127
133 QgsAttributeList attributesAsDisplayedValues() const;
134
138 QStringList attributesExportNames() const;
139
145 bool addToCanvas() const;
146
153 void setAddToCanvas( bool checked );
154
158 Qgis::FeatureSymbologyExport symbologyExport() const;
159
164 double scale() const;
165
169 void setMapCanvas( QgsMapCanvas *canvas );
170
175 bool hasFilterExtent() const;
176
181 QgsRectangle filterExtent() const;
182
188 void setOnlySelected( bool onlySelected );
189
195 bool onlySelected() const;
196
202 bool persistMetadata() const;
203
210 Qgis::WkbType geometryType() const;
211
216 bool automaticGeometryType() const;
217
224 bool forceMulti() const;
225
231 void setForceMulti( bool checked );
232
239 bool includeZ() const;
240
246 void setIncludeZ( bool checked );
247
251 QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
252
253 void accept() override;
254
255 private slots:
256
257 void mFormatComboBox_currentIndexChanged( int idx );
258 void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
259 void showHelp();
260 void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
261 void mGeometryTypeComboBox_currentIndexChanged( int index );
262 void mSelectAllAttributes_clicked();
263 void mDeselectAllAttributes_clicked();
264 void mUseAliasesForExportedName_stateChanged( int state );
265 void mReplaceRawFieldValues_stateChanged( int state );
266 void mAttributeTable_itemChanged( QTableWidgetItem *item );
267
268 private:
269
270 enum class ColumnIndex : int
271 {
272 Name = 0,
273 ExportName = 1,
274 Type = 2,
275 ExportAsDisplayedValue = 3
276 };
277
278 void setup();
279 QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
280
281 QgsCoordinateReferenceSystem mSelectedCrs;
282
283 QgsRectangle mLayerExtent;
285 QgsVectorLayer *mLayer = nullptr;
286 QgsMapCanvas *mMapCanvas = nullptr;
287 QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
288 Options mOptions = Option::AllOptions;
289 QString mDefaultOutputLayerNameFromInputLayerName;
290 bool mAddToCanvasStateOnOpenCompatibleDriver = true;
291};
292
293Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorLayerSaveAsDialog::Options )
294
295
296#endif // QGSVECTORLAYERSAVEASDIALOG_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
This class represents a coordinate reference system (CRS).
Map canvas is a class for displaying all GIS data types on a canvas.
A rectangle specified with double values.
A convenience class for writing vector layers to disk based formats (e.g.
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
Class to select destination file, type and CRS for ogr layers.
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition qgis_sip.h:126
QList< int > QgsAttributeList
Definition qgsfield.h:27
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
const QgsCoordinateReferenceSystem & crs