QGIS API Documentation  3.21.0-Master (5b68dc587e)
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"
26 
28 
33 class GUI_EXPORT QgsSingleBandGrayRendererWidget: public QgsRasterRendererWidget, private Ui::QgsSingleBandGrayRendererWidgetBase
34 {
35  Q_OBJECT
36  public:
38 
39  static QgsRasterRendererWidget *create( QgsRasterLayer *layer, const QgsRectangle &extent ) SIP_FACTORY { return new QgsSingleBandGrayRendererWidget( layer, extent ); }
40 
41  QgsRasterRenderer *renderer() override;
42  void setMapCanvas( QgsMapCanvas *canvas ) override;
43 
44  void setFromRenderer( const QgsRasterRenderer *r );
45 
46  QString min( int index = 0 ) override { Q_UNUSED( index ) return mMinLineEdit->text(); }
47  QString max( int index = 0 ) override { Q_UNUSED( index ) return mMaxLineEdit->text(); }
48  void setMin( const QString &value, int index = 0 ) override;
49  void setMax( const QString &value, int index = 0 ) override;
50  int selectedBand( int index = 0 ) override { Q_UNUSED( index ) return mGrayBandComboBox->currentIndex() + 1; }
51  void doComputations() override;
52  QgsRasterMinMaxWidget *minMaxWidget() override { return mMinMaxWidget; }
53 
54  public slots:
56  void loadMinMax( int bandNo, double min, double max );
57 
58  private slots:
59  void bandChanged();
60  void mMinLineEdit_textChanged( const QString & );
61  void mMaxLineEdit_textChanged( const QString & );
62  void showLegendSettings();
63 
64  private:
65  QgsRasterMinMaxWidget *mMinMaxWidget = nullptr;
66  bool mDisableMinMaxWidgetRefresh;
67  QgsColorRampLegendNodeSettings mLegendSettings;
68 
69  void minMaxModified();
70 };
71 
72 #endif // QGSSINGLEBANDGRAYRENDERERWIDGET_H
Settings for a color ramp legend node.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:88
Represents a raster layer.
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
virtual void setMax(const QString &value, int index=0)
virtual void setMin(const QString &value, int index=0)
virtual QgsRasterRenderer * renderer()=0
virtual void doComputations()
Load programmatically with current values.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
QgsRasterMinMaxWidget * minMaxWidget() override
Returns min/max widget when it exists.
#define SIP_FACTORY
Definition: qgis_sip.h:76