QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 "qgshelp.h"
24 #include "qgsfields.h"
25 #include "qgsvectorfilewriter.h"
26 #include "qgis_gui.h"
27 
28 #define SIP_NO_FILE
29 
30 class QgsVectorLayer;
31 
38 class GUI_EXPORT QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSaveAsDialogBase
39 {
40  Q_OBJECT
41 
42  public:
43 
45  enum Option
46  {
47  Symbology = 1,
48  DestinationCrs = 1 << 2,
49  Fields = 1 << 3,
50  AddToCanvas = 1 << 4,
51  SelectedOnly = 1 << 5,
52  GeometryType = 1 << 6,
53  Extent = 1 << 7,
54  Metadata = 1 << 8,
55  AllOptions = ~0
56  };
57  Q_DECLARE_FLAGS( Options, Option )
58 
59 
64  Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
65 
69  QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, Options options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
70 
75  QString format() const;
76 
80  QString encoding() const;
81 
85  QString filename() const;
86 
90  QString layername() const;
91 
96  QStringList datasourceOptions() const;
97 
102  QStringList layerOptions() const;
103 
109  Q_DECL_DEPRECATED long crs() const;
110 
115  QgsCoordinateReferenceSystem crsObject() const;
116 
120  QgsAttributeList selectedAttributes() const;
122  QgsAttributeList attributesAsDisplayedValues() const;
123 
127  QStringList attributesExportNames() const;
128 
134  bool addToCanvas() const;
135 
142  void setAddToCanvas( bool checked );
143 
150  int symbologyExport() const;
151 
156  double scale() const;
157 
161  void setMapCanvas( QgsMapCanvas *canvas );
162 
167  bool hasFilterExtent() const;
168 
173  QgsRectangle filterExtent() const;
174 
178  void setOnlySelected( bool onlySelected );
179 
183  bool onlySelected() const;
184 
190  bool persistMetadata() const;
191 
198  QgsWkbTypes::Type geometryType() const;
199 
204  bool automaticGeometryType() const;
205 
210  bool forceMulti() const;
211 
215  void setForceMulti( bool checked );
216 
221  bool includeZ() const;
222 
226  void setIncludeZ( bool checked );
227 
229  QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
230 
231  private slots:
232 
233  void mFormatComboBox_currentIndexChanged( int idx );
234  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
235  void showHelp();
236  void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
237  void mGeometryTypeComboBox_currentIndexChanged( int index );
238  void accept() override;
239  void mSelectAllAttributes_clicked();
240  void mDeselectAllAttributes_clicked();
241  void mUseAliasesForExportedName_stateChanged( int state );
242  void mReplaceRawFieldValues_stateChanged( int state );
243  void mAttributeTable_itemChanged( QTableWidgetItem *item );
244 
245  private:
246 
247  enum class ColumnIndex : int
248  {
249  Name = 0,
250  ExportName = 1,
251  Type = 2,
252  ExportAsDisplayedValue = 3
253  };
254 
255  void setup();
256  QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
257 
258  QgsCoordinateReferenceSystem mSelectedCrs;
259 
260  QgsRectangle mLayerExtent;
262  QgsVectorLayer *mLayer = nullptr;
263  QgsMapCanvas *mMapCanvas = nullptr;
264  QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
265  Options mOptions = AllOptions;
266 };
267 
268 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsVectorLayerSaveAsDialog::Options )
269 
270 
271 #endif // QGSVECTORLAYERSAVEASDIALOG_H
qgsfields.h
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:69
QgsVectorLayerSaveAsDialog
Class to select destination file, type and CRS for ogr layers.
Definition: qgsvectorlayersaveasdialog.h:38
QgsAttributeList
QList< int > QgsAttributeList
Definition: qgsfield.h:26
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Q_DECLARE_OPERATORS_FOR_FLAGS
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.
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsVectorFileWriter::ActionOnExistingFile
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
Definition: qgsvectorfilewriter.h:276
qgsvectorfilewriter.h
QgsVectorLayerSaveAsDialog::Option
Option
Bitmask of options to be shown.
Definition: qgsvectorlayersaveasdialog.h:45
qgshelp.h