QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
32class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSaveAsDialogBase
33{
34 Q_OBJECT
35
36 public:
40 enum class Option : int SIP_ENUM_BASETYPE( IntFlag )
41 {
42 Symbology = 1,
43 DestinationCrs = 1 << 2,
44 Fields = 1 << 3,
45 AddToCanvas = 1 << 4,
46 SelectedOnly = 1 << 5,
47 GeometryType = 1 << 6,
48 Extent = 1 << 7,
49 Metadata = 1 << 8,
50 AllOptions = ~0
51 };
52 Q_ENUM( Option )
53
54
57 Q_DECLARE_FLAGS( Options, Option )
58 Q_FLAG( Options )
59
65 Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ) SIP_SKIP;
66
70 QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, QgsVectorLayerSaveAsDialog::Options options = QgsVectorLayerSaveAsDialog::Option::AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
71
77 QString format() const;
78
82 QString encoding() const;
83
89 QString fileName() const;
90
96 QString layerName() const;
97
104 QStringList datasourceOptions() const;
105
112 QStringList layerOptions() const;
113
120
124 QgsAttributeList selectedAttributes() const;
125
130 QgsAttributeList attributesAsDisplayedValues() const;
131
135 QStringList attributesExportNames() const;
136
142 bool addToCanvas() const;
143
150 void setAddToCanvas( bool checked );
151
155 Qgis::FeatureSymbologyExport symbologyExport() const;
156
161 double scale() const;
162
166 void setMapCanvas( QgsMapCanvas *canvas );
167
172 bool hasFilterExtent() const;
173
178 QgsRectangle filterExtent() const;
179
185 void setOnlySelected( bool onlySelected );
186
192 bool onlySelected() const;
193
199 bool persistMetadata() const;
200
207 Qgis::WkbType geometryType() const;
208
213 bool automaticGeometryType() const;
214
221 bool forceMulti() const;
222
228 void setForceMulti( bool checked );
229
236 bool includeZ() const;
237
243 void setIncludeZ( bool checked );
244
248 QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
249
250 void accept() override;
251
252 private slots:
253
254 void mFormatComboBox_currentIndexChanged( int idx );
255 void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
256 void showHelp();
257 void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
258 void mGeometryTypeComboBox_currentIndexChanged( int index );
259 void mSelectAllAttributes_clicked();
260 void mDeselectAllAttributes_clicked();
261 void mUseAliasesForExportedName_stateChanged( int state );
262 void mReplaceRawFieldValues_stateChanged( int state );
263 void mAttributeTable_itemChanged( QTableWidgetItem *item );
264
265 private:
266 enum class ColumnIndex : int
267 {
268 Name = 0,
269 ExportName = 1,
270 Type = 2,
271 ExportAsDisplayedValue = 3
272 };
273
274 void setup();
275 QList<QPair<QLabel *, QWidget *>> createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
276
277 QgsCoordinateReferenceSystem mSelectedCrs;
278
279 QgsRectangle mLayerExtent;
281 QgsVectorLayer *mLayer = nullptr;
282 QgsMapCanvas *mMapCanvas = nullptr;
283 QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
284 Options mOptions = Option::AllOptions;
285 QString mDefaultOutputLayerNameFromInputLayerName;
286 bool mAddToCanvasStateOnOpenCompatibleDriver = true;
287};
288
290
291
292#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
Enumeration to describe how to handle existing files.
Class to select destination file, type and CRS for ogr layers.
QFlags< Option > Options
Available dialog options.
Represents a vector layer which manages a vector based data sets.
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:278
#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