QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 Options
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  AllOptions = ~0
55  };
56 
60  QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr );
61 
65  QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, int options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr );
66 
71  QString format() const;
72 
76  QString encoding() const;
77 
81  QString filename() const;
82 
86  QString layername() const;
87 
92  QStringList datasourceOptions() const;
93 
98  QStringList layerOptions() const;
99 
104  long crs() const;
105 
109  QgsAttributeList selectedAttributes() const;
111  QgsAttributeList attributesAsDisplayedValues() const;
112 
118  bool addToCanvas() const;
119 
126  void setAddToCanvas( bool checked );
127 
133  int symbologyExport() const;
134 
139  double scale() const;
140 
144  void setMapCanvas( QgsMapCanvas *canvas );
145 
150  bool hasFilterExtent() const;
151 
156  QgsRectangle filterExtent() const;
157 
161  void setOnlySelected( bool onlySelected );
162 
166  bool onlySelected() const;
167 
174  QgsWkbTypes::Type geometryType() const;
175 
180  bool automaticGeometryType() const;
181 
186  bool forceMulti() const;
187 
191  void setForceMulti( bool checked );
192 
197  bool includeZ() const;
198 
202  void setIncludeZ( bool checked );
203 
205  QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
206 
207  private slots:
208 
209  void mFormatComboBox_currentIndexChanged( int idx );
210  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
211  void showHelp();
212  void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
213  void mGeometryTypeComboBox_currentIndexChanged( int index );
214  void accept() override;
215  void mSelectAllAttributes_clicked();
216  void mDeselectAllAttributes_clicked();
217  void mReplaceRawFieldValues_stateChanged( int state );
218  void mAttributeTable_itemChanged( QTableWidgetItem *item );
219 
220  private:
221  void setup();
222  QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
223 
224  long mCRS;
225 
226  QgsRectangle mLayerExtent;
228  QgsVectorLayer *mLayer = nullptr;
229  QgsMapCanvas *mMapCanvas = nullptr;
230  bool mAttributeTableItemChangedSlotEnabled;
231  bool mReplaceRawFieldValuesStateChangedSlotEnabled;
232  QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
233  Options mOptions = AllOptions;
234 };
235 
236 #endif // QGSVECTORLAYERSAVEASDIALOG_H
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Options
Bitmask of options to be shown.
const QgsCoordinateReferenceSystem & crs
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:68
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
This class represents a coordinate reference system (CRS).
QList< int > QgsAttributeList
Definition: qgsfield.h:27
Represents a vector layer which manages a vector based data sets.
Class to select destination file, type and CRS for ogr layers.