QGIS API Documentation 3.43.0-Master (c67cf405802)
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 QStringList createOptions() const;
92 QgsRectangle outputRectangle() const;
93 QgsRasterRangeList noData() const;
94
95 QList<int> pyramidsList() const;
96
100 Qgis::RasterBuildPyramidOption buildPyramidsFlag() const;
101
102 QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
103
107 Qgis::RasterPyramidFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
108
109 QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
110
111 void hideFormat();
112 void hideOutput();
113
114 public slots:
115 void accept() override;
116
117 private slots:
118 void mRawModeRadioButton_toggled( bool );
119 void mFormatComboBox_currentIndexChanged( const QString &text );
120 void mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
121 void mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
122 void mXResolutionLineEdit_textEdited( const QString & )
123 {
124 mResolutionState = UserResolution;
125 recalcSize();
126 }
127 void mYResolutionLineEdit_textEdited( const QString & )
128 {
129 mResolutionState = UserResolution;
130 recalcSize();
131 }
132
133 void mOriginalSizePushButton_clicked() { setOriginalSize(); }
134 void mColumnsLineEdit_textEdited( const QString & )
135 {
136 mResolutionState = UserResolution;
137 recalcResolution();
138 }
139 void mRowsLineEdit_textEdited( const QString & )
140 {
141 mResolutionState = UserResolution;
142 recalcResolution();
143 }
144
145 void mAddNoDataManuallyToolButton_clicked();
146 void mLoadTransparentNoDataToolButton_clicked();
147 void mRemoveSelectedNoDataToolButton_clicked();
148 void mRemoveAllNoDataToolButton_clicked();
149 void noDataCellTextEdited( const QString &text );
150 void mTileModeCheckBox_toggled( bool toggled );
151 void mPyramidsGroupBox_toggled( bool toggled );
152 void populatePyramidsLevels();
153 void extentChanged();
154 void crsChanged();
155 void showHelp();
156
157 private:
158 QgsRasterLayer *mRasterLayer = nullptr;
159 QgsRasterDataProvider *mDataProvider = nullptr;
160 QgsRectangle mCurrentExtent;
161 QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
163 QgsCoordinateReferenceSystem mPreviousCrs;
164 ResolutionState mResolutionState;
165 QVector<bool> mNoDataToEdited;
166
167 void setValidators();
168 void toggleResolutionSize();
169 void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs );
170 void setOriginalResolution();
171 void setOriginalSize();
172 void recalcSize();
173 void recalcResolution();
174 void updateResolutionStateMsg();
175 void recalcResolutionSize();
176
177 void addNoDataRow( double min, double max );
178 void setNoDataToEdited( int row );
179 double noDataCellValue( int row, int column ) const;
180 void adjustNoDataCellWidth( int row, int column );
181 bool validate() const;
182 // Returns true if the output layer already exists.
183 bool outputLayerExists() const;
184
185 void insertAvailableOutputFormats();
186
187 friend class TestQgsRasterLayerSaveAsDialog;
188};
189
190
191#endif // QGSRASTERLAYERSAVEASDIALOG_H
RasterPyramidFormat
Raster pyramid formats.
Definition qgis.h:4632
RasterBuildPyramidOption
Raster pyramid building options.
Definition qgis.h:4647
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