QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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
33class GUI_EXPORT QgsRasterLayerSaveAsDialog : public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
34{
35 Q_OBJECT
36 public:
37 enum Mode
38 {
40 RenderedImageMode
41 };
43 {
46 UserCrs
47 };
49 {
51 UserResolution
52 };
53
55 QgsRasterLayerSaveAsDialog( QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem &currentCrs, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
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
71 bool addToCanvas() const;
72
79 void setAddToCanvas( bool checked );
80
81 QString outputFileName() const;
82
87 QString outputLayerName() const;
88 QString outputFormat() const;
90 QStringList createOptions() const;
91 QgsRectangle outputRectangle() const;
92 QgsRasterRangeList noData() const;
93
94 QList<int> pyramidsList() const;
95
99 Qgis::RasterBuildPyramidOption buildPyramidsFlag() const;
100
101 QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
102
106 Qgis::RasterPyramidFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
107
108 QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
109
110 void hideFormat();
111 void hideOutput();
112
113 public slots:
114 void accept() override;
115
116 private slots:
117 void mRawModeRadioButton_toggled( bool );
118 void mFormatComboBox_currentIndexChanged( const QString &text );
119 void mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
120 void mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
121 void mXResolutionLineEdit_textEdited( const QString & )
122 {
123 mResolutionState = UserResolution;
124 recalcSize();
125 }
126 void mYResolutionLineEdit_textEdited( const QString & )
127 {
128 mResolutionState = UserResolution;
129 recalcSize();
130 }
131
132 void mOriginalSizePushButton_clicked() { setOriginalSize(); }
133 void mColumnsLineEdit_textEdited( const QString & )
134 {
135 mResolutionState = UserResolution;
136 recalcResolution();
137 }
138 void mRowsLineEdit_textEdited( const QString & )
139 {
140 mResolutionState = UserResolution;
141 recalcResolution();
142 }
143
144 void mAddNoDataManuallyToolButton_clicked();
145 void mLoadTransparentNoDataToolButton_clicked();
146 void mRemoveSelectedNoDataToolButton_clicked();
147 void mRemoveAllNoDataToolButton_clicked();
148 void noDataCellTextEdited( const QString &text );
149 void mTileModeCheckBox_toggled( bool toggled );
150 void mPyramidsGroupBox_toggled( bool toggled );
151 void populatePyramidsLevels();
152 void extentChanged();
153 void crsChanged();
154 void showHelp();
155
156 private:
157 QgsRasterLayer *mRasterLayer = nullptr;
158 QgsRasterDataProvider *mDataProvider = nullptr;
159 QgsRectangle mCurrentExtent;
160 QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
162 QgsCoordinateReferenceSystem mPreviousCrs;
163 ResolutionState mResolutionState;
164 QVector<bool> mNoDataToEdited;
165
166 void setValidators();
167 void toggleResolutionSize();
168 void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs );
169 void setOriginalResolution();
170 void setOriginalSize();
171 void recalcSize();
172 void recalcResolution();
173 void updateResolutionStateMsg();
174 void recalcResolutionSize();
175
176 void addNoDataRow( double min, double max );
177 void setNoDataToEdited( int row );
178 double noDataCellValue( int row, int column ) const;
179 void adjustNoDataCellWidth( int row, int column );
180 bool validate() const;
181 // Returns true if the output layer already exists.
182 bool outputLayerExists() const;
183
184 void insertAvailableOutputFormats();
185
186 friend class TestQgsRasterLayerSaveAsDialog;
187};
188
189
190#endif // QGSRASTERLAYERSAVEASDIALOG_H
RasterPyramidFormat
Raster pyramid formats.
Definition qgis.h:4511
RasterBuildPyramidOption
Raster pyramid building options.
Definition qgis.h:4526
This class represents a coordinate reference system (CRS).
Base class for raster data providers.
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