QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsrasterformatsaveoptionswidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterformatsaveoptionswidget.h
3  -------------------
4  begin : July 2012
5  copyright : (C) 2012 by Etienne Tourigny
6  email : etourigny dot dev at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSRASTERFORMATSAVEOPTIONSWIDGET_H
19 #define QGSRASTERFORMATSAVEOPTIONSWIDGET_H
20 
21 #include "ui_qgsrasterformatsaveoptionswidgetbase.h"
22 #include "qgsraster.h"
23 #include "qgis_gui.h"
24 
25 class QgsRasterLayer;
26 
31 class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget, private Ui::QgsRasterFormatSaveOptionsWidgetBase
32 {
33  Q_OBJECT
34 
35  public:
36 
37  enum Type
38  {
39  Default, // everything except profile buttons (save as dlg)
40  Full, // everything (options dlg)
41  Table, // just table
42  LineEdit, // just the line edit
43  ProfileLineEdit // Profile + LineEdit
44  };
45 
46  QgsRasterFormatSaveOptionsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr,
47  const QString &format = "GTiff",
49  const QString &provider = "gdal" );
50 
55  void setFormat( const QString &format );
56 
61  void setProvider( const QString &provider );
62 
66  void setRasterLayer( QgsRasterLayer *rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); }
67 
71  void setRasterFileName( const QString &file ) { mRasterLayer = nullptr; mRasterFileName = file; }
72 
77  QStringList options() const;
78 
85  void setOptions( const QString &options );
86 
90  void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
91 
96  { mPyramids = true; mPyramidsFormat = format; }
97 
98  public slots:
99 
100  void apply();
101 
106  void helpOptions();
107 
111  QString validateOptions( bool gui = true, bool reportOk = true );
112 
116  void updateProfiles();
117 
118  private slots:
119 
120  void mProfileNewButton_clicked() SIP_FORCE;
121  void mProfileDeleteButton_clicked() SIP_FORCE;
122  void mProfileResetButton_clicked() SIP_FORCE;
123  void mOptionsAddButton_clicked() SIP_FORCE;
124  void mOptionsDeleteButton_clicked() SIP_FORCE;
125  void mOptionsLineEdit_editingFinished() SIP_FORCE;
126  void optionsTableChanged() SIP_FORCE;
127  void optionsTableEnableDeleteButton() SIP_FORCE;
128  void updateOptions() SIP_FORCE;
129  void swapOptionsUI( int newIndex = -1 ) SIP_FORCE;
130  void updateControls() SIP_FORCE;
131 
132  protected:
133  void showEvent( QShowEvent *event ) override;
134 
135  signals:
136  void optionsChanged();
137 
138  private:
139 
140  QString mFormat;
141  QString mProvider;
142  QgsRasterLayer *mRasterLayer = nullptr;
143  QString mRasterFileName;
144  QMap< QString, QString> mOptionsMap;
145  static QMap< QString, QStringList > sBuiltinProfiles;
146  bool mPyramids = false;
148 
149  QString settingsKey( QString profile ) const SIP_FORCE;
150  QString currentProfileKey() const SIP_FORCE;
151  QString createOptions( const QString &profile ) const SIP_FORCE;
152  void deleteCreateOptions( const QString &profile ) SIP_FORCE;
153  void setCreateOptions() SIP_FORCE;
154  void setCreateOptions( const QString &profile, const QString &options ) SIP_FORCE;
155  void setCreateOptions( const QString &profile, const QStringList &list ) SIP_FORCE;
156  QStringList profiles() const SIP_FORCE;
157  bool eventFilter( QObject *obj, QEvent *event ) override SIP_FORCE;
158  QString pseudoFormat() const SIP_FORCE;
159 
160 };
161 
162 // clazy:excludeall=qstring-allocations
163 
164 #endif // QGSRASTERLAYERSAVEASDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void setRasterFileName(const QString &file)
Set output raster file name.
#define SIP_FORCE
Definition: qgis_sip.h:124
void setPyramidsFormat(QgsRaster::RasterPyramidsFormat format)
Set pyramids format to use.
A widget to select format-specific raster saving options.
void setRasterLayer(QgsRasterLayer *rasterLayer)
Set output raster layer.
RasterPyramidsFormat
Definition: qgsraster.h:81