QGIS API Documentation  2.5.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  QString outputFileName() const;
63  QString outputFormat() const;
64  QgsCoordinateReferenceSystem outputCrs();
65  QStringList createOptions() const;
66  QgsRectangle outputRectangle() const;
67  QgsRasterRangeList noData() const;
68 
69  QList< int > pyramidsList() const;
70  QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
71  QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
72  QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsOptionsWidget->pyramidsFormat(); }
73  QStringList pyramidsConfigOptions() const { return mPyramidsOptionsWidget->configOptions(); }
74 
75  void hideFormat();
76  void hideOutput();
77 
78  public slots:
79  virtual void accept() { if ( validate() ) return QDialog::accept(); }
80 
81  private slots:
82  void on_mRawModeRadioButton_toggled( bool );
83  void on_mBrowseButton_clicked();
84  void on_mSaveAsLineEdit_textChanged( const QString& text );
85  void on_mFormatComboBox_currentIndexChanged( const QString& text );
86  void on_mResolutionRadioButton_toggled( bool ) { toggleResolutionSize(); }
87  void on_mOriginalResolutionPushButton_clicked() { setOriginalResolution(); }
88  void on_mXResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
89  void on_mYResolutionLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcSize(); }
90 
91  void on_mOriginalSizePushButton_clicked() { setOriginalSize(); }
92  void on_mColumnsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
93  void on_mRowsLineEdit_textEdited( const QString & ) { mResolutionState = UserResolution; recalcResolution(); }
94 
95  void on_mChangeCrsPushButton_clicked();
96 
97  void on_mCrsComboBox_currentIndexChanged( int ) { crsChanged(); }
98 
99  void on_mAddNoDataManuallyToolButton_clicked();
100  void on_mLoadTransparentNoDataToolButton_clicked();
101  void on_mRemoveSelectedNoDataToolButton_clicked();
102  void on_mRemoveAllNoDataToolButton_clicked();
103  void noDataCellTextEdited( const QString & text );
104  void on_mTileModeCheckBox_toggled( bool toggled );
105  void on_mPyramidsGroupBox_toggled( bool toggled );
106  void populatePyramidsLevels();
107  void extentChanged();
108 
109  private:
113  QgsCoordinateReferenceSystem mLayerCrs; // may differ from provider CRS
118  QVector<bool> mNoDataToEdited;
119 
120  void setValidators();
121  void toggleResolutionSize();
122  void setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem& srcCrs );
123  void setOriginalResolution();
124  void setOriginalSize();
125  void recalcSize();
126  void recalcResolution();
127  void updateResolutionStateMsg();
128  void recalcResolutionSize();
129  void crsChanged();
130  void updateCrsGroup();
131 
132  void addNoDataRow( double min, double max );
133  void setNoDataToEdited( int row );
134  double noDataCellValue( int row, int column ) const;
135  void adjustNoDataCellWidth( int row, int column );
136  bool validate() const;
137 };
138 
139 
140 #endif // QGSRASTERLAYERSAVEASDIALOG_H
141 
void on_mXResolutionLineEdit_textEdited(const QString &)
QgsCoordinateReferenceSystem mCurrentCrs
QgsCoordinateReferenceSystem mPreviousCrs
A rectangle specified with double values.
Definition: qgsrectangle.h:35
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void on_mColumnsLineEdit_textEdited(const QString &)
void on_mRowsLineEdit_textEdited(const QString &)
void on_mYResolutionLineEdit_textEdited(const QString &)
QgsCoordinateReferenceSystem mUserCrs
QStringList pyramidsConfigOptions() const
QgsRasterDataProvider * mDataProvider
int min(int a, int b)
Definition: util.h:93
QList< QgsRasterRange > QgsRasterRangeList
Class for storing a coordinate reference system (CRS)
RasterBuildPyramids
Definition: qgsraster.h:71
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
QgsCoordinateReferenceSystem mLayerCrs
RasterPyramidsFormat
Definition: qgsraster.h:78
int max(int a, int b)
Definition: util.h:87
Base class for raster data providers.