QGIS API Documentation  3.0.2-Girona (307d082)
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 #include "qgis_gui.h"
23 #include "qgshelp.h"
24 
25 class QgsRasterLayer;
27 class QgsRasterFormatOptionsWidget;
28 
33 class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
34 {
35  Q_OBJECT
36  public:
37  enum Mode
38  {
40  RenderedImageMode
41  };
42  enum CrsState
43  {
46  UserCrs
47  };
49  {
51  UserResolution
52  };
53 
56  QgsRasterDataProvider *sourceProvider,
57  const QgsRectangle &currentExtent,
58  const QgsCoordinateReferenceSystem &layerCrs,
59  const QgsCoordinateReferenceSystem &currentCrs,
60  QWidget *parent SIP_TRANSFERTHIS = nullptr,
61  Qt::WindowFlags f = nullptr );
62  ~QgsRasterLayerSaveAsDialog() override;
63 
64  Mode mode() const;
65  int nColumns() const;
66  int nRows() const;
67  double xResolution() const;
68  double yResolution() const;
69  int maximumTileSizeX() const;
70  int maximumTileSizeY() const;
71  bool tileMode() const;
72  bool addToCanvas() const;
73  QString outputFileName() const;
74  QString outputFormat() const;
75  QgsCoordinateReferenceSystem outputCrs();
76  QStringList createOptions() const;
77  QgsRectangle outputRectangle() const;
78  QgsRasterRangeList noData() const;
79 
80  QList< int > pyramidsList() const;
81  QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
82  QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
83  QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
84  QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
85 
86  void hideFormat();
87  void hideOutput();
88 
89  public slots:
90  void accept() override { if ( validate() ) QDialog::accept(); }
91 
92  private slots:
93  void mRawModeRadioButton_toggled( bool );
94  void mFormatComboBox_currentIndexChanged( const QString &text );
95  void mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
96  void mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
97  void mXResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
98  void mYResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
99 
100  void mOriginalSizePushButton_clicked() { setOriginalSize(); }
101  void mColumnsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
102  void mRowsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
103 
104  void mAddNoDataManuallyToolButton_clicked();
105  void mLoadTransparentNoDataToolButton_clicked();
106  void mRemoveSelectedNoDataToolButton_clicked();
107  void mRemoveAllNoDataToolButton_clicked();
108  void noDataCellTextEdited( const QString &text );
109  void mTileModeCheckBox_toggled( bool toggled );
110  void mPyramidsGroupBox_toggled( bool toggled );
111  void populatePyramidsLevels();
112  void extentChanged();
113  void crsChanged();
114  void showHelp();
115 
116  private:
117  QgsRasterLayer *mRasterLayer = nullptr;
118  QgsRasterDataProvider *mDataProvider = nullptr;
119  QgsRectangle mCurrentExtent;
120  QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
121  QgsCoordinateReferenceSystem mCurrentCrs;
122  QgsCoordinateReferenceSystem mPreviousCrs;
123  ResolutionState mResolutionState;
124  QVector<bool> mNoDataToEdited;
125 
126  void setValidators();
127  void toggleResolutionSize();
128  void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs );
129  void setOriginalResolution();
130  void setOriginalSize();
131  void recalcSize();
132  void recalcResolution();
133  void updateResolutionStateMsg();
134  void recalcResolutionSize();
135 
136  void addNoDataRow( double min, double max );
137  void setNoDataToEdited( int row );
138  double noDataCellValue( int row, int column ) const;
139  void adjustNoDataCellWidth( int row, int column );
140  bool validate() const;
141 
142  void insertAvailableOutputFormats();
143 };
144 
145 
146 #endif // QGSRASTERLAYERSAVEASDIALOG_H
147 
A rectangle specified with double values.
Definition: qgsrectangle.h:39
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
QList< QgsRasterRange > QgsRasterRangeList
This class represents a coordinate reference system (CRS).
RasterBuildPyramids
Definition: qgsraster.h:74
RasterPyramidsFormat
Definition: qgsraster.h:81
Base class for raster data providers.