QGIS API Documentation  3.0.2-Girona (307d082)
qgsrasterminmaxwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterminmaxwidget.h
3  ---------------------------------
4  begin : July 2012
5  copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSRASTERMINMAXWIDGET_H
19 #define QGSRASTERMINMAXWIDGET_H
20 
21 #include "ui_qgsrasterminmaxwidgetbase.h"
22 #include "qgis.h"
23 #include "qgsrectangle.h"
24 
25 #include "qgsraster.h"
26 #include "qgsrasterminmaxorigin.h"
27 #include "qgscontrastenhancement.h"
28 #include "qgis_gui.h"
29 
30 class QgsMapCanvas;
31 class QgsRasterLayer;
32 
37 class GUI_EXPORT QgsRasterMinMaxWidget: public QWidget, private Ui::QgsRasterMinMaxWidgetBase
38 {
39  Q_OBJECT
40  public:
41 
43  QgsRasterMinMaxWidget( QgsRasterLayer *layer, QWidget *parent SIP_TRANSFERTHIS = nullptr );
44 
51  void setExtent( const QgsRectangle &extent ) { mExtent = extent; }
52 
61  void setMapCanvas( QgsMapCanvas *canvas );
62 
69  QgsMapCanvas *mapCanvas();
70 
71  void setBands( const QList<int> &bands );
72 
77  QgsRectangle extent();
78 
80  int sampleSize() { return cboAccuracy->currentIndex() == 0 ? 250000 : 0; }
81 
83  void setFromMinMaxOrigin( const QgsRasterMinMaxOrigin & );
84 
86  QgsRasterMinMaxOrigin minMaxOrigin();
87 
89  void hideUpdatedExtent();
90 
92  void doComputations();
93 
95  void userHasSetManualMinMaxValues();
96 
98  bool isCollapsed() const { return mLoadMinMaxValuesGroupBox->isCollapsed(); }
99 
101  void setCollapsed( bool b ) { mLoadMinMaxValuesGroupBox->setCollapsed( b ); }
102 
103  signals:
104 
109  void widgetChanged();
110 
112  void load( int bandNo, double min, double max );
113 
114  private slots:
115 
116  void mUserDefinedRadioButton_toggled( bool );
117  void mMinMaxRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
118  void mStdDevRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
119  void mCumulativeCutRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
120  void mStatisticsExtentCombo_currentIndexChanged( int ) { emit widgetChanged(); }
121  void mCumulativeCutLowerDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
122  void mCumulativeCutUpperDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
123  void mStdDevSpinBox_valueChanged( double ) { emit widgetChanged(); }
124  void cboAccuracy_currentIndexChanged( int ) { emit widgetChanged(); }
125 
126  private:
127  QgsRasterLayer *mLayer = nullptr;
128  QList<int> mBands;
129  QgsRectangle mExtent;
130 
131  QgsMapCanvas *mCanvas = nullptr;
132 
133  bool mLastRectangleValid;
134  QgsRectangle mLastRectangle;
135  QgsRasterMinMaxOrigin mLastMinMaxOrigin;
136 
137  bool mBandsChanged;
138 };
139 
140 #endif // QGSRASTERMINMAXWIDGET_H
void setExtent(const QgsRectangle &extent)
Sets the extent to use for minimum and maximum value calculation.
A rectangle specified with double values.
Definition: qgsrectangle.h:39
bool isCollapsed() const
Return if the widget is collaped.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
void setCollapsed(bool b)
Set collapsed state of widget.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
This class describes the origin of min/max values.
int sampleSize()
Return the selected sample size.