QGIS API Documentation  2.99.0-Master (25b0421)
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 
55  QgsRasterDataProvider *sourceProvider,
56  const QgsRectangle &currentExtent,
57  const QgsCoordinateReferenceSystem &layerCrs,
58  const QgsCoordinateReferenceSystem &currentCrs,
59  QWidget *parent SIP_TRANSFERTHIS = nullptr,
60  Qt::WindowFlags f = 0 );
61 
62  Mode mode() const;
63  int nColumns() const;
64  int nRows() const;
65  double xResolution() const;
66  double yResolution() const;
67  int maximumTileSizeX() const;
68  int maximumTileSizeY() const;
69  bool tileMode() const;
70  bool addToCanvas() const;
71  QString outputFileName() const;
72  QString outputFormat() const;
73  QgsCoordinateReferenceSystem outputCrs();
74  QStringList createOptions() const;
75  QgsRectangle outputRectangle() const;
76  QgsRasterRangeList noData() const;
77 
78  QList< int > pyramidsList() const;
79  QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
80  QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
81  QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
82  QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
83 
84  void hideFormat();
85  void hideOutput();
86 
87  public slots:
88  virtual void accept() override { if ( validate() ) return QDialog::accept(); }
89 
90  private slots:
91  void mRawModeRadioButton_toggled( bool );
92  void mBrowseButton_clicked();
93  void mSaveAsLineEdit_textChanged( const QString &text );
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 };
143 
144 
145 #endif // QGSRASTERLAYERSAVEASDIALOG_H
146 
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.