QGIS API Documentation  2.99.0-Master (b698612)
qgssinglebandgrayrendererwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglebandgrayrendererwidget.h
3  ---------------------------------
4  begin : March 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco at sourcepole dot ch
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 QGSSINGLEBANDGRAYRENDERERWIDGET_H
19 #define QGSSINGLEBANDGRAYRENDERERWIDGET_H
20 
22 #include "qgis_sip.h"
23 #include "ui_qgssinglebandgrayrendererwidgetbase.h"
24 #include "qgis_gui.h"
25 
27 
31 class GUI_EXPORT QgsSingleBandGrayRendererWidget: public QgsRasterRendererWidget, private Ui::QgsSingleBandGrayRendererWidgetBase
32 {
33  Q_OBJECT
34  public:
36 
37  static QgsRasterRendererWidget *create( QgsRasterLayer *layer, const QgsRectangle &extent ) SIP_FACTORY { return new QgsSingleBandGrayRendererWidget( layer, extent ); }
38 
39  QgsRasterRenderer *renderer() override;
40  void setMapCanvas( QgsMapCanvas *canvas ) override;
41 
42  void setFromRenderer( const QgsRasterRenderer *r );
43 
44  QString min( int index = 0 ) override { Q_UNUSED( index ); return mMinLineEdit->text(); }
45  QString max( int index = 0 ) override { Q_UNUSED( index ); return mMaxLineEdit->text(); }
46  void setMin( const QString &value, int index = 0 ) override;
47  void setMax( const QString &value, int index = 0 ) override;
48  int selectedBand( int index = 0 ) override { Q_UNUSED( index ); return mGrayBandComboBox->currentIndex() + 1; }
49  void doComputations() override;
50  QgsRasterMinMaxWidget *minMaxWidget() override { return mMinMaxWidget; }
51 
52  public slots:
54  void loadMinMax( int bandNo, double min, double max );
55 
56  private slots:
57  void bandChanged();
58  void on_mMinLineEdit_textChanged( const QString & );
59  void on_mMaxLineEdit_textChanged( const QString & );
60 
61  private:
62  QgsRasterMinMaxWidget *mMinMaxWidget = nullptr;
63  bool mDisableMinMaxWidgetRefresh;
64 
65  void minMaxModified();
66 };
67 
68 #endif // QGSSINGLEBANDGRAYRENDERERWIDGET_H
A rectangle specified with double values.
Definition: qgsrectangle.h:38
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
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
virtual void setMax(const QString &value, int index=0)
#define SIP_FACTORY
Definition: qgis_sip.h:57
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:452
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:437
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
virtual void doComputations()
Load programmatically with current values.
QgsRasterMinMaxWidget * minMaxWidget() override
Return min/max widget when it exists.
virtual void setMin(const QString &value, int index=0)
virtual QgsRasterRenderer * renderer()=0
Raster renderer pipe that applies colors to a raster.