QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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
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 = Qt::WindowFlags() );
62
63 Mode mode() const;
64 int nColumns() const;
65 int nRows() const;
66 double xResolution() const;
67 double yResolution() const;
68 int maximumTileSizeX() const;
69 int maximumTileSizeY() const;
70 bool tileMode() const;
71
77 bool addToCanvas() const;
78
85 void setAddToCanvas( bool checked );
86
87 QString outputFileName() const;
88
93 QString outputLayerName() const;
94 QString outputFormat() const;
96 QStringList createOptions() const;
97 QgsRectangle outputRectangle() const;
98 QgsRasterRangeList noData() const;
99
100 QList< int > pyramidsList() const;
101
105 Qgis::RasterBuildPyramidOption buildPyramidsFlag() const;
106
107 QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
108
112 Qgis::RasterPyramidFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
113
114 QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
115
116 void hideFormat();
117 void hideOutput();
118
119 public slots:
120 void accept() override;
121
122 private slots:
123 void mRawModeRadioButton_toggled( bool );
124 void mFormatComboBox_currentIndexChanged( const QString &text );
125 void mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
126 void mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
127 void mXResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
128 void mYResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
129
130 void mOriginalSizePushButton_clicked() { setOriginalSize(); }
131 void mColumnsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
132 void mRowsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
133
134 void mAddNoDataManuallyToolButton_clicked();
135 void mLoadTransparentNoDataToolButton_clicked();
136 void mRemoveSelectedNoDataToolButton_clicked();
137 void mRemoveAllNoDataToolButton_clicked();
138 void noDataCellTextEdited( const QString &text );
139 void mTileModeCheckBox_toggled( bool toggled );
140 void mPyramidsGroupBox_toggled( bool toggled );
141 void populatePyramidsLevels();
142 void extentChanged();
143 void crsChanged();
144 void showHelp();
145
146 private:
147 QgsRasterLayer *mRasterLayer = nullptr;
148 QgsRasterDataProvider *mDataProvider = nullptr;
149 QgsRectangle mCurrentExtent;
150 QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
152 QgsCoordinateReferenceSystem mPreviousCrs;
153 ResolutionState mResolutionState;
154 QVector<bool> mNoDataToEdited;
155
156 void setValidators();
157 void toggleResolutionSize();
158 void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs );
159 void setOriginalResolution();
160 void setOriginalSize();
161 void recalcSize();
162 void recalcResolution();
163 void updateResolutionStateMsg();
164 void recalcResolutionSize();
165
166 void addNoDataRow( double min, double max );
167 void setNoDataToEdited( int row );
168 double noDataCellValue( int row, int column ) const;
169 void adjustNoDataCellWidth( int row, int column );
170 bool validate() const;
171 // Returns true if the output layer already exists.
172 bool outputLayerExists() const;
173
174 void insertAvailableOutputFormats();
175
176 friend class TestQgsRasterLayerSaveAsDialog;
177};
178
179
180#endif // QGSRASTERLAYERSAVEASDIALOG_H
181
RasterPyramidFormat
Raster pyramid formats.
Definition qgis.h:4466
RasterBuildPyramidOption
Raster pyramid building options.
Definition qgis.h:4481
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