QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
62  Q_DECL_DEPRECATED QgsVectorLayerSaveAsDialog( long srsid, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr );
63 
67  QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, int options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr );
68 
73  QString format() const;
74 
78  QString encoding() const;
79 
83  QString filename() const;
84 
88  QString layername() const;
89 
94  QStringList datasourceOptions() const;
95 
100  QStringList layerOptions() const;
101 
107  Q_DECL_DEPRECATED long crs() const;
108 
113  QgsCoordinateReferenceSystem crsObject() const;
114 
118  QgsAttributeList selectedAttributes() const;
120  QgsAttributeList attributesAsDisplayedValues() const;
121 
127  bool addToCanvas() const;
128 
135  void setAddToCanvas( bool checked );
136 
142  int symbologyExport() const;
143 
148  double scale() const;
149 
153  void setMapCanvas( QgsMapCanvas *canvas );
154 
159  bool hasFilterExtent() const;
160 
165  QgsRectangle filterExtent() const;
166 
170  void setOnlySelected( bool onlySelected );
171 
175  bool onlySelected() const;
176 
183  QgsWkbTypes::Type geometryType() const;
184 
189  bool automaticGeometryType() const;
190 
195  bool forceMulti() const;
196 
200  void setForceMulti( bool checked );
201 
206  bool includeZ() const;
207 
211  void setIncludeZ( bool checked );
212 
214  QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
215 
216  private slots:
217 
218  void mFormatComboBox_currentIndexChanged( int idx );
219  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
220  void showHelp();
221  void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
222  void mGeometryTypeComboBox_currentIndexChanged( int index );
223  void accept() override;
224  void mSelectAllAttributes_clicked();
225  void mDeselectAllAttributes_clicked();
226  void mReplaceRawFieldValues_stateChanged( int state );
227  void mAttributeTable_itemChanged( QTableWidgetItem *item );
228 
229  private:
230  void setup();
231  QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
232 
233  QgsCoordinateReferenceSystem mSelectedCrs;
234 
235  QgsRectangle mLayerExtent;
237  QgsVectorLayer *mLayer = nullptr;
238  QgsMapCanvas *mMapCanvas = nullptr;
239  bool mAttributeTableItemChangedSlotEnabled;
240  bool mReplaceRawFieldValuesStateChangedSlotEnabled;
241  QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
242  Options mOptions = AllOptions;
243 };
244 
245 #endif // QGSVECTORLAYERSAVEASDIALOG_H
qgsfields.h
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:68
QgsVectorLayerSaveAsDialog
Definition: qgsvectorlayersaveasdialog.h:38
QgsAttributeList
QList< int > QgsAttributeList
Definition: qgsfield.h:26
QgsRectangle
Definition: qgsrectangle.h:41
QgsVectorLayerSaveAsDialog::Options
Options
Bitmask of options to be shown.
Definition: qgsvectorlayersaveasdialog.h:45
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsVectorFileWriter::ActionOnExistingFile
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
Definition: qgsvectorfilewriter.h:261
qgsvectorfilewriter.h
qgshelp.h