QGIS API Documentation  2.99.0-Master (6a61179)
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 
24 class QgsRasterLayer;
25 
29 class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
30  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 = nullptr, const QString& format = "GTiff",
47  const QString& provider = "gdal" );
49 
50  void setFormat( const QString& format );
51  void setProvider( const QString& provider );
52  void setRasterLayer( QgsRasterLayer* rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); }
53  void setRasterFileName( const QString& file ) { mRasterLayer = nullptr; mRasterFileName = file; }
54  QStringList options() const;
55  void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
57  { mPyramids = true; mPyramidsFormat = format; }
58 
59  public slots:
60 
61  void apply();
62  void helpOptions();
63  QString validateOptions( bool gui = true, bool reportOk = true );
64  void updateProfiles();
65 
66  private slots:
67 
68  void on_mProfileNewButton_clicked();
69  void on_mProfileDeleteButton_clicked();
70  void on_mProfileResetButton_clicked();
71  void on_mOptionsAddButton_clicked();
72  void on_mOptionsDeleteButton_clicked();
73  void on_mOptionsLineEdit_editingFinished();
74  void optionsTableChanged();
75  void optionsTableEnableDeleteButton();
76  void updateOptions();
77  void swapOptionsUI( int newIndex = -1 );
78  void updateControls();
79 
80  protected:
81  virtual void showEvent( QShowEvent * event ) override;
82 
83  signals:
84  void optionsChanged();
85 
86  private:
87 
88  QString mFormat;
89  QString mProvider;
90  QgsRasterLayer* mRasterLayer;
91  QString mRasterFileName;
92  QMap< QString, QString> mOptionsMap;
93  static QMap< QString, QStringList > mBuiltinProfiles;
94  bool mPyramids;
95  QgsRaster::RasterPyramidsFormat mPyramidsFormat;
96 
97  QString settingsKey( QString profile ) const;
98  QString currentProfileKey() const;
99  QString createOptions( const QString& profile ) const;
100  void deleteCreateOptions( const QString& profile );
101  void setCreateOptions();
102  void setCreateOptions( const QString& profile, const QString& options );
103  void setCreateOptions( const QString& profile, const QStringList& list );
104  QStringList profiles() const;
105  bool eventFilter( QObject *obj, QEvent *event ) override;
106  QString pseudoFormat() const;
107 
108 };
109 
110 #endif // QGSRASTERLAYERSAVEASDIALOG_H
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void setPyramidsFormat(QgsRaster::RasterPyramidsFormat format)
A widget to select format-specific raster saving options.
void setRasterLayer(QgsRasterLayer *rasterLayer)
RasterPyramidsFormat
Definition: qgsraster.h:95