QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 = Qt::WindowFlags() );
63 
67  QgsVectorLayerSaveAsDialog( QgsVectorLayer *layer, int options = AllOptions, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
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 
143  int symbologyExport() const;
144 
149  double scale() const;
150 
154  void setMapCanvas( QgsMapCanvas *canvas );
155 
160  bool hasFilterExtent() const;
161 
166  QgsRectangle filterExtent() const;
167 
171  void setOnlySelected( bool onlySelected );
172 
176  bool onlySelected() const;
177 
184  QgsWkbTypes::Type geometryType() const;
185 
190  bool automaticGeometryType() const;
191 
196  bool forceMulti() const;
197 
201  void setForceMulti( bool checked );
202 
207  bool includeZ() const;
208 
212  void setIncludeZ( bool checked );
213 
215  QgsVectorFileWriter::ActionOnExistingFile creationActionOnExistingFile() const;
216 
217  private slots:
218 
219  void mFormatComboBox_currentIndexChanged( int idx );
220  void mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs );
221  void showHelp();
222  void mSymbologyExportComboBox_currentIndexChanged( const QString &text );
223  void mGeometryTypeComboBox_currentIndexChanged( int index );
224  void accept() override;
225  void mSelectAllAttributes_clicked();
226  void mDeselectAllAttributes_clicked();
227  void mReplaceRawFieldValues_stateChanged( int state );
228  void mAttributeTable_itemChanged( QTableWidgetItem *item );
229 
230  private:
231  void setup();
232  QList< QPair< QLabel *, QWidget * > > createControls( const QMap<QString, QgsVectorFileWriter::Option *> &options );
233 
234  QgsCoordinateReferenceSystem mSelectedCrs;
235 
236  QgsRectangle mLayerExtent;
238  QgsVectorLayer *mLayer = nullptr;
239  QgsMapCanvas *mMapCanvas = nullptr;
240  bool mAttributeTableItemChangedSlotEnabled;
241  bool mReplaceRawFieldValuesStateChangedSlotEnabled;
242  QgsVectorFileWriter::ActionOnExistingFile mActionOnExistingFile;
243  Options mOptions = AllOptions;
244 };
245 
246 #endif // QGSVECTORLAYERSAVEASDIALOG_H
qgsfields.h
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:51
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
QgsWkbTypes::Type
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:70
QgsVectorLayerSaveAsDialog
Class to select destination file, type and CRS for ogr layers.
Definition: qgsvectorlayersaveasdialog.h:39
QgsAttributeList
QList< int > QgsAttributeList
Definition: qgsfield.h:26
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsVectorLayerSaveAsDialog::Options
Options
Bitmask of options to be shown.
Definition: qgsvectorlayersaveasdialog.h:46
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsVectorFileWriter::ActionOnExistingFile
ActionOnExistingFile
Combination of CanAddNewLayer, CanAppendToExistingLayer, CanAddNewFieldsToExistingLayer or CanDeleteL...
Definition: qgsvectorfilewriter.h:264
qgsvectorfilewriter.h
qgshelp.h