QGIS API Documentation 3.41.0-Master (3440c17df1d)
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:
37
41 enum class Option : int SIP_ENUM_BASETYPE( IntFlag )
42 {
43 Symbology = 1,
44 DestinationCrs = 1 << 2,
45 Fields = 1 << 3,
46 AddToCanvas = 1 << 4,
47 SelectedOnly = 1 << 5,
48 GeometryType = 1 << 6,
49 Extent = 1 << 7,
50 Metadata = 1 << 8,
51 AllOptions = ~0
52 };
53 Q_ENUM( Option )
54
55
58 Q_DECLARE_FLAGS( Options, Option )
59 Q_FLAG( Options )
60
66 Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ) SIP_SKIP;
67
71 QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, QgsVectorLayerSaveAsDialog::Options options = QgsVectorLayerSaveAsDialog::Option::AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
72
78 QString format() const;
79
83 QString encoding() const;
84
90 QString fileName() const;
91
97 QString layerName() const;
98
105 QStringList datasourceOptions() const;
106
113 QStringList layerOptions() const;
114
121
125 QgsAttributeList selectedAttributes() const;
126
131 QgsAttributeList attributesAsDisplayedValues() const;
132
136 QStringList attributesExportNames() const;
137
143 bool addToCanvas() const;
144
151 void setAddToCanvas( bool checked );
152
156 Qgis::FeatureSymbologyExport symbologyExport() const;
157
162 double scale() const;
163
167 void setMapCanvas( QgsMapCanvas *canvas );
168
173 bool hasFilterExtent() const;
174
179 QgsRectangle filterExtent() const;
180
186 void setOnlySelected( bool onlySelected );
187
193 bool onlySelected() const;
194
200 bool persistMetadata() const;
201
208 Qgis::WkbType geometryType() const;
209
214 bool automaticGeometryType() const;
215
222 bool forceMulti() const;
223
229 void setForceMulti( bool checked );
230
237 bool includeZ() const;
238
244 void setIncludeZ( bool checked );
245
249 QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
250
251 void accept() override;
252
253 private slots:
254
255 void mFormatComboBox_currentIndexChanged( int idx );
256 void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
257 void showHelp();
258 void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
259 void mGeometryTypeComboBox_currentIndexChanged( int index );
260 void mSelectAllAttributes_clicked();
261 void mDeselectAllAttributes_clicked();
262 void mUseAliasesForExportedName_stateChanged( int state );
263 void mReplaceRawFieldValues_stateChanged( int state );
264 void mAttributeTable_itemChanged( QTableWidgetItem *item );
265
266 private:
267
268 enum class ColumnIndex : int
269 {
270 Name = 0,
271 ExportName = 1,
272 Type = 2,
273 ExportAsDisplayedValue = 3
274 };
275
276 void setup();
277 QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
278
279 QgsCoordinateReferenceSystem mSelectedCrs;
280
281 QgsRectangle mLayerExtent;
283 QgsVectorLayer *mLayer = nullptr;
284 QgsMapCanvas *mMapCanvas = nullptr;
285 QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
286 Options mOptions = Option::AllOptions;
287 QString mDefaultOutputLayerNameFromInputLayerName;
288 bool mAddToCanvasStateOnOpenCompatibleDriver = true;
289};
290
292
293
294#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