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