QGIS API Documentation  2.17.0-Master (2f94c66)
qgsrasterlayersaveasdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterlayersaveasdialog.h
3  ---------------------
4  begin : May 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSRASTERLAYERSAVEASDIALOG_H
16 #define QGSRASTERLAYERSAVEASDIALOG_H
17 
18 #include "ui_qgsrasterlayersaveasdialogbase.h"
19 #include "qgsrectangle.h"
21 #include "qgsrasterrange.h"
22 
23 class QgsRasterLayer;
25 class QgsRasterFormatOptionsWidget;
26 
30 class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
31 {
32  Q_OBJECT
33  public:
34  enum Mode
35  {
37  RenderedImageMode
38  };
39  enum CrsState
40  {
43  UserCrs
44  };
46  {
48  UserResolution
49  };
50 
52  QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
53  const QgsCoordinateReferenceSystem& layerCrs, const QgsCoordinateReferenceSystem& currentCrs,
54  QWidget* parent = nullptr, const Qt::WindowFlags& f = nullptr );
56 
57  Mode mode() const;
58  int nColumns() const;
59  int nRows() const;
60  double xResolution() const;
61  double yResolution() const;
62  int maximumTileSizeX() const;
63  int maximumTileSizeY() const;
64  bool tileMode() const;
65  bool addToCanvas() const;
66  QString outputFileName() const;
67  QString outputFormat() const;
68  QgsCoordinateReferenceSystem outputCrs();
69  QStringList createOptions() const;
70  QgsRectangle outputRectangle() const;
71  QgsRasterRangeList noData() const;
72 
73  QList< int > pyramidsList() const;
74  QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
75  QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
76  QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
77  QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
78 
79  void hideFormat();
80  void hideOutput();
81 
82  public slots:
83  virtual void accept() override { if ( validate() ) return QDialog::accept(); }
84 
85  private slots:
86  void on_mRawModeRadioButton_toggled( bool );
87  void on_mBrowseButton_clicked();
88  void on_mSaveAsLineEdit_textChanged( const QString& text );
89  void on_mFormatComboBox_currentIndexChanged( const QString& text );
90  void on_mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
91  void on_mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
92  void on_mXResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
93  void on_mYResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
94 
95  void on_mOriginalSizePushButton_clicked() { setOriginalSize(); }
96  void on_mColumnsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
97  void on_mRowsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
98 
99  void on_mAddNoDataManuallyToolButton_clicked();
100  void on_mLoadTransparentNoDataToolButton_clicked();
101  void on_mRemoveSelectedNoDataToolButton_clicked();
102  void on_mRemoveAllNoDataToolButton_clicked();
103  void noDataCellTextEdited( const QString & text );
104  void on_mTileModeCheckBox_toggled( bool toggled );
105  void on_mPyramidsGroupBox_toggled( bool toggled );
106  void populatePyramidsLevels();
107  void extentChanged();
108 
109  private:
110  QgsRasterLayer* mRasterLayer;
111  QgsRasterDataProvider* mDataProvider;
112  QgsRectangle mCurrentExtent;
113  QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
114  QgsCoordinateReferenceSystem mCurrentCrs;
115  QgsCoordinateReferenceSystem mPreviousCrs;
116  ResolutionState mResolutionState;
117  QVector<bool> mNoDataToEdited;
118 
119  void setValidators();
120  void toggleResolutionSize();
121  void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem& srcCrs );
122  void setOriginalResolution();
123  void setOriginalSize();
124  void recalcSize();
125  void recalcResolution();
126  void updateResolutionStateMsg();
127  void recalcResolutionSize();
128 
129  void addNoDataRow( double min, double max );
130  void setNoDataToEdited( int row );
131  double noDataCellValue( int row, int column ) const;
132  void adjustNoDataCellWidth( int row, int column );
133  bool validate() const;
134 
135  private slots:
136  void crsChanged();
137 };
138 
139 
140 #endif // QGSRASTERLAYERSAVEASDIALOG_H
141 
A rectangle specified with double values.
Definition: qgsrectangle.h:35
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
QStringList pyramidsConfigOptions() const
virtual void accept()
Class for storing a coordinate reference system (CRS)
RasterBuildPyramids
Definition: qgsraster.h:71
typedef WindowFlags
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
RasterPyramidsFormat
Definition: qgsraster.h:78
Base class for raster data providers.