QGIS API Documentation  2.99.0-Master (ef89a62)
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 
36 class GUI_EXPORT QgsRasterMinMaxWidget: public QWidget, private Ui::QgsRasterMinMaxWidgetBase
37 {
38  Q_OBJECT
39  public:
40  QgsRasterMinMaxWidget( QgsRasterLayer *layer, QWidget *parent SIP_TRANSFERTHIS = 0 );
41 
47  void setExtent( const QgsRectangle &extent ) { mExtent = extent; }
48 
56  void setMapCanvas( QgsMapCanvas *canvas );
57 
63  QgsMapCanvas *mapCanvas();
64 
65  void setBands( const QList<int> &bands );
66 
70  QgsRectangle extent();
71 
73  int sampleSize() { return cboAccuracy->currentIndex() == 0 ? 250000 : 0; }
74 
76  void setFromMinMaxOrigin( const QgsRasterMinMaxOrigin & );
77 
79  QgsRasterMinMaxOrigin minMaxOrigin();
80 
82  void hideUpdatedExtent();
83 
85  void doComputations();
86 
88  void userHasSetManualMinMaxValues();
89 
91  bool isCollapsed() const { return mLoadMinMaxValuesGroupBox->isCollapsed(); }
92 
94  void setCollapsed( bool b ) { mLoadMinMaxValuesGroupBox->setCollapsed( b ); }
95 
96  signals:
97 
102  void widgetChanged();
103 
105  void load( int bandNo, double min, double max );
106 
107  private slots:
108 
109  void on_mUserDefinedRadioButton_toggled( bool );
110  void on_mMinMaxRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
111  void on_mStdDevRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
112  void on_mCumulativeCutRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
113  void on_mStatisticsExtentCombo_currentIndexChanged( int ) { emit widgetChanged(); }
114  void on_mCumulativeCutLowerDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
115  void on_mCumulativeCutUpperDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
116  void on_mStdDevSpinBox_valueChanged( double ) { emit widgetChanged(); }
117  void on_cboAccuracy_currentIndexChanged( int ) { emit widgetChanged(); }
118 
119  private:
120  QgsRasterLayer *mLayer = nullptr;
121  QList<int> mBands;
122  QgsRectangle mExtent;
123 
124  QgsMapCanvas *mCanvas = nullptr;
125 
126  bool mLastRectangleValid;
127  QgsRectangle mLastRectangle;
128  QgsRasterMinMaxOrigin mLastMinMaxOrigin;
129 
130  bool mBandsChanged;
131 };
132 
133 #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:38
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:73
This class describes the origin of min/max values.
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
Definition: MathUtils.cc:451
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
Definition: MathUtils.cc:436
int sampleSize()
Return the selected sample size.