QGIS API Documentation 3.43.0-Master (7996e1b587e)
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
25class QgsRasterLayer;
27class QgsRasterFormatOptionsWidget;
28
34class GUI_EXPORT QgsRasterLayerSaveAsDialog : public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
35{
36 Q_OBJECT
37 public:
38 enum Mode
39 {
41 RenderedImageMode
42 };
44 {
47 UserCrs
48 };
50 {
52 UserResolution
53 };
54
56 QgsRasterLayerSaveAsDialog( QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem &currentCrs, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
57
58 Mode mode() const;
59 int nColumns() const;
60 int nRows() const;
61 double xResolution() const;
62 double yResolution() const;
63 int maximumTileSizeX() const;
64 int maximumTileSizeY() const;
65 bool tileMode() const;
66
72 bool addToCanvas() const;
73
80 void setAddToCanvas( bool checked );
81
82 QString outputFileName() const;
83
88 QString outputLayerName() const;
89 QString outputFormat() const;
91
95 Q_DECL_DEPRECATED QStringList createOptions() const;
100 QStringList creationOptions() const;
101 QgsRectangle outputRectangle() const;
102 QgsRasterRangeList noData() const;
103
104 QList<int> pyramidsList() const;
105
109 Qgis::RasterBuildPyramidOption buildPyramidsFlag() const;
110
111 QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
112
116 Qgis::RasterPyramidFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
117
118 QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
119
120 void hideFormat();
121 void hideOutput();
122
123 public slots:
124 void accept() override;
125
126 private slots:
127 void mRawModeRadioButton_toggled( bool );
128 void mFormatComboBox_currentIndexChanged( const QString &text );
129 void mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
130 void mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
131 void mXResolutionLineEdit_textEdited( const QString & )
132 {
133 mResolutionState = UserResolution;
134 recalcSize();
135 }
136 void mYResolutionLineEdit_textEdited( const QString & )
137 {
138 mResolutionState = UserResolution;
139 recalcSize();
140 }
141
142 void mOriginalSizePushButton_clicked() { setOriginalSize(); }
143 void mColumnsLineEdit_textEdited( const QString & )
144 {
145 mResolutionState = UserResolution;
146 recalcResolution();
147 }
148 void mRowsLineEdit_textEdited( const QString & )
149 {
150 mResolutionState = UserResolution;
151 recalcResolution();
152 }
153
154 void mAddNoDataManuallyToolButton_clicked();
155 void mLoadTransparentNoDataToolButton_clicked();
156 void mRemoveSelectedNoDataToolButton_clicked();
157 void mRemoveAllNoDataToolButton_clicked();
158 void noDataCellTextEdited( const QString &text );
159 void mTileModeCheckBox_toggled( bool toggled );
160 void mPyramidsGroupBox_toggled( bool toggled );
161 void populatePyramidsLevels();
162 void extentChanged();
163 void crsChanged();
164 void showHelp();
165
166 private:
167 QgsRasterLayer *mRasterLayer = nullptr;
168 QgsRasterDataProvider *mDataProvider = nullptr;
169 QgsRectangle mCurrentExtent;
170 QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
172 QgsCoordinateReferenceSystem mPreviousCrs;
173 ResolutionState mResolutionState;
174 QVector<bool> mNoDataToEdited;
175
176 void setValidators();
177 void toggleResolutionSize();
178 void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs );
179 void setOriginalResolution();
180 void setOriginalSize();
181 void recalcSize();
182 void recalcResolution();
183 void updateResolutionStateMsg();
184 void recalcResolutionSize();
185
186 void addNoDataRow( double min, double max );
187 void setNoDataToEdited( int row );
188 double noDataCellValue( int row, int column ) const;
189 void adjustNoDataCellWidth( int row, int column );
190 bool validate() const;
191 // Returns true if the output layer already exists.
192 bool outputLayerExists() const;
193
194 void insertAvailableOutputFormats();
195
196 friend class TestQgsRasterLayerSaveAsDialog;
197};
198
199
200#endif // QGSRASTERLAYERSAVEASDIALOG_H
RasterPyramidFormat
Raster pyramid formats.
Definition qgis.h:4633
RasterBuildPyramidOption
Raster pyramid building options.
Definition qgis.h:4648
Represents a coordinate reference system (CRS).
Base class for raster data providers.
A dialog for configuring raster layer export parameters.
Qgis::RasterPyramidFormat pyramidsFormat() const
Returns the selected pyramid format.
Represents a raster layer.
A rectangle specified with double values.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
QList< QgsRasterRange > QgsRasterRangeList
const QgsCoordinateReferenceSystem & outputCrs