QGIS API Documentation  2.99.0-Master (d55fa22)
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 
30 class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
31  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 = nullptr, const QString &format = "GTiff",
48  const QString &provider = "gdal" );
49 
54  void setFormat( const QString &format );
55 
60  void setProvider( const QString &provider );
61 
65  void setRasterLayer( QgsRasterLayer *rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); }
66 
70  void setRasterFileName( const QString &file ) { mRasterLayer = nullptr; mRasterFileName = file; }
71 
76  QStringList options() const;
77 
84  void setOptions( const QString &options );
85 
89  void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
90 
95  { mPyramids = true; mPyramidsFormat = format; }
96 
97  public slots:
98 
99  void apply();
100 
105  void helpOptions();
106 
110  QString validateOptions( bool gui = true, bool reportOk = true );
111 
115  void updateProfiles();
116 
117  private slots:
118 
119  void on_mProfileNewButton_clicked();
120  void on_mProfileDeleteButton_clicked();
121  void on_mProfileResetButton_clicked();
122  void on_mOptionsAddButton_clicked();
123  void on_mOptionsDeleteButton_clicked();
124  void on_mOptionsLineEdit_editingFinished();
125  void optionsTableChanged();
126  void optionsTableEnableDeleteButton();
127  void updateOptions();
128  void swapOptionsUI( int newIndex = -1 );
129  void updateControls();
130 
131  protected:
132  virtual void showEvent( QShowEvent *event ) override;
133 
134  signals:
135  void optionsChanged();
136 
137  private:
138 
139  QString mFormat;
140  QString mProvider;
141  QgsRasterLayer *mRasterLayer = nullptr;
142  QString mRasterFileName;
143  QMap< QString, QString> mOptionsMap;
144  static QMap< QString, QStringList > sBuiltinProfiles;
145  bool mPyramids;
146  QgsRaster::RasterPyramidsFormat mPyramidsFormat;
147 
148  QString settingsKey( QString profile ) const;
149  QString currentProfileKey() const;
150  QString createOptions( const QString &profile ) const;
151  void deleteCreateOptions( const QString &profile );
152  void setCreateOptions();
153  void setCreateOptions( const QString &profile, const QString &options );
154  void setCreateOptions( const QString &profile, const QStringList &list );
155  QStringList profiles() const;
156  bool eventFilter( QObject *obj, QEvent *event ) override;
157  QString pseudoFormat() const;
158 
159 };
160 
161 #endif // QGSRASTERLAYERSAVEASDIALOG_H
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void setRasterFileName(const QString &file)
Set output raster file name.
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:97