QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
23 class QgsRasterLayer;
25 class QgsRasterFormatOptionsWidget;
26 
27 class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
28 {
29  Q_OBJECT
30  public:
31  enum Mode
32  {
34  RenderedImageMode
35  };
36  enum CrsState
37  {
40  UserCrs
41  };
43  {
45  UserResolution
46  };
47 
49  QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
50  const QgsCoordinateReferenceSystem& layerCrs, const QgsCoordinateReferenceSystem& currentCrs,
51  QWidget* parent = 0, Qt::WindowFlags f = 0 );
53 
54  Mode mode() const;
55  int nColumns() const;
56  int nRows() const;
57  double xResolution() const;
58  double yResolution() const;
59  int maximumTileSizeX() const;
60  int maximumTileSizeY() const;
61  bool tileMode() const;
62  bool addToCanvas() const;
63  QString outputFileName() const;
64  QString outputFormat() const;
65  QgsCoordinateReferenceSystem outputCrs();
66  QStringList createOptions() const;
67  QgsRectangle outputRectangle() const;
68  QgsRasterRangeList noData() const;
69 
70  QList< int > pyramidsList() const;
71  QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
72  QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
73  QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
74  QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
75 
76  void hideFormat();
77  void hideOutput();
78 
79  public slots:
80  virtual void accept() override { if ( validate() ) return QDialog::accept(); }
81 
82  private slots:
83  void on_mRawModeRadioButton_toggled( bool );
84  void on_mBrowseButton_clicked();
85  void on_mSaveAsLineEdit_textChanged( const QString& text );
86  void on_mFormatComboBox_currentIndexChanged( const QString& text );
87  void on_mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
88  void on_mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
89  void on_mXResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
90  void on_mYResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
91 
92  void on_mOriginalSizePushButton_clicked() { setOriginalSize(); }
93  void on_mColumnsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
94  void on_mRowsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
95 
96  void on_mAddNoDataManuallyToolButton_clicked();
97  void on_mLoadTransparentNoDataToolButton_clicked();
98  void on_mRemoveSelectedNoDataToolButton_clicked();
99  void on_mRemoveAllNoDataToolButton_clicked();
100  void noDataCellTextEdited( const QString & text );
101  void on_mTileModeCheckBox_toggled( bool toggled );
102  void on_mPyramidsGroupBox_toggled( bool toggled );
103  void populatePyramidsLevels();
104  void extentChanged();
105 
106  private:
107  QgsRasterLayer* mRasterLayer;
108  QgsRasterDataProvider* mDataProvider;
109  QgsRectangle mCurrentExtent;
110  QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
111  QgsCoordinateReferenceSystem mCurrentCrs;
112  QgsCoordinateReferenceSystem mPreviousCrs;
113  ResolutionState mResolutionState;
114  QVector<bool> mNoDataToEdited;
115 
116  void setValidators();
117  void toggleResolutionSize();
118  void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem& srcCrs );
119  void setOriginalResolution();
120  void setOriginalSize();
121  void recalcSize();
122  void recalcResolution();
123  void updateResolutionStateMsg();
124  void recalcResolutionSize();
125 
126  void addNoDataRow( double min, double max );
127  void setNoDataToEdited( int row );
128  double noDataCellValue( int row, int column ) const;
129  void adjustNoDataCellWidth( int row, int column );
130  bool validate() const;
131 
132  private slots:
133  void crsChanged();
134 };
135 
136 
137 #endif // QGSRASTERLAYERSAVEASDIALOG_H
138 
A rectangle specified with double values.
Definition: qgsrectangle.h:35
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
QStringList pyramidsConfigOptions() const
virtual void accept()
Class for storing a coordinate reference system (CRS)
RasterBuildPyramids
Definition: qgsraster.h:71
typedef WindowFlags
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
RasterPyramidsFormat
Definition: qgsraster.h:78
Base class for raster data providers.