QGIS API Documentation  2.99.0-Master (69af2f5)
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, private Ui::QgsRasterFormatSaveOptionsWidgetBase
31 {
32  Q_OBJECT
33 
34  public:
35 
36  enum Type
37  {
38  Default, // everything except profile buttons (save as dlg)
39  Full, // everything (options dlg)
40  Table, // just table
41  LineEdit, // just the line edit
42  ProfileLineEdit // Profile + LineEdit
43  };
44 
45  QgsRasterFormatSaveOptionsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr,
46  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() SIP_FORCE;
120  void on_mProfileDeleteButton_clicked() SIP_FORCE;
121  void on_mProfileResetButton_clicked() SIP_FORCE;
122  void on_mOptionsAddButton_clicked() SIP_FORCE;
123  void on_mOptionsDeleteButton_clicked() SIP_FORCE;
124  void on_mOptionsLineEdit_editingFinished() SIP_FORCE;
125  void optionsTableChanged() SIP_FORCE;
126  void optionsTableEnableDeleteButton() SIP_FORCE;
127  void updateOptions() SIP_FORCE;
128  void swapOptionsUI( int newIndex = -1 ) SIP_FORCE;
129  void updateControls() SIP_FORCE;
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 SIP_FORCE;
149  QString currentProfileKey() const SIP_FORCE;
150  QString createOptions( const QString &profile ) const SIP_FORCE;
151  void deleteCreateOptions( const QString &profile ) SIP_FORCE;
152  void setCreateOptions() SIP_FORCE;
153  void setCreateOptions( const QString &profile, const QString &options ) SIP_FORCE;
154  void setCreateOptions( const QString &profile, const QStringList &list ) SIP_FORCE;
155  QStringList profiles() const SIP_FORCE;
156  bool eventFilter( QObject *obj, QEvent *event ) override SIP_FORCE;
157  QString pseudoFormat() const SIP_FORCE;
158 
159 };
160 
161 #endif // QGSRASTERLAYERSAVEASDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:34
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:112
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:80