QGIS API Documentation  2.99.0-Master (64819bc)
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 "qgsrectangle.h"
23 
24 #include "qgsraster.h"
25 #include "qgsrasterminmaxorigin.h"
26 #include "qgscontrastenhancement.h"
27 #include "qgis_gui.h"
28 
29 class QgsMapCanvas;
30 class QgsRasterLayer;
31 
35 class GUI_EXPORT QgsRasterMinMaxWidget: public QWidget, private Ui::QgsRasterMinMaxWidgetBase
36 {
37  Q_OBJECT
38  public:
39  QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget *parent = nullptr );
40 
46  void setExtent( const QgsRectangle & theExtent ) { mExtent = theExtent; }
47 
55  void setMapCanvas( QgsMapCanvas* canvas );
56 
62  QgsMapCanvas* mapCanvas();
63 
64  void setBands( const QList<int> & theBands );
65 
69  QgsRectangle extent();
70 
72  int sampleSize() { return cboAccuracy->currentIndex() == 0 ? 250000 : 0; }
73 
75  void setFromMinMaxOrigin( const QgsRasterMinMaxOrigin& );
76 
78  QgsRasterMinMaxOrigin minMaxOrigin();
79 
81  void hideUpdatedExtent();
82 
84  void doComputations();
85 
87  void userHasSetManualMinMaxValues();
88 
90  bool isCollapsed() const { return mLoadMinMaxValuesGroupBox->isCollapsed(); }
91 
93  void setCollapsed( bool b ) { mLoadMinMaxValuesGroupBox->setCollapsed( b ); }
94 
95  signals:
96 
101  void widgetChanged();
102 
104  void load( int theBandNo, double theMin, double theMax );
105 
106  private slots:
107 
108  void on_mUserDefinedRadioButton_toggled( bool );
109  void on_mMinMaxRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
110  void on_mStdDevRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
111  void on_mCumulativeCutRadioButton_toggled( bool b ) { if ( b ) emit widgetChanged(); }
112  void on_mStatisticsExtentCombo_currentIndexChanged( int ) { emit widgetChanged(); }
113  void on_mCumulativeCutLowerDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
114  void on_mCumulativeCutUpperDoubleSpinBox_valueChanged( double ) { emit widgetChanged(); }
115  void on_mStdDevSpinBox_valueChanged( double ) { emit widgetChanged(); }
116  void on_cboAccuracy_currentIndexChanged( int ) { emit widgetChanged(); }
117 
118  private:
119  QgsRasterLayer* mLayer = nullptr;
120  QList<int> mBands;
121  QgsRectangle mExtent;
122 
123  QgsMapCanvas* mCanvas = nullptr;
124 
125  bool mLastRectangleValid;
126  QgsRectangle mLastRectangle;
127  QgsRasterMinMaxOrigin mLastMinMaxOrigin;
128 
129  bool mBandsChanged;
130 };
131 
132 #endif // QGSRASTERMINMAXWIDGET_H
A rectangle specified with double values.
Definition: qgsrectangle.h:36
bool isCollapsed() const
Return if the widget is collaped.
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:72
This class describes the origin of min/max values.
void setExtent(const QgsRectangle &theExtent)
Sets the extent to use for minimum and maximum value calculation.
int sampleSize()
Return the selected sample size.