QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgssinglebandpseudocolorrendererwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglebandpseudocolorrendererwidget.h
3  ----------------------------------------
4  begin : February 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 QGSSINGLEBANDCOLORRENDERERWIDGET_H
19 #define QGSSINGLEBANDCOLORRENDERERWIDGET_H
20 
22 #include "qgis_sip.h"
23 #include "qgscolorrampshader.h"
24 #include "qgsrasterrenderer.h"
25 #include "ui_qgssinglebandpseudocolorrendererwidgetbase.h"
26 #include "qgis_gui.h"
27 
29 
38 class GUI_EXPORT QgsSingleBandPseudoColorRendererWidget: public QgsRasterRendererWidget, private Ui::QgsSingleBandPseudoColorRendererWidgetBase
39 {
40 
41  Q_OBJECT
42 
43  public:
44 
47 
49  static QgsRasterRendererWidget *create( QgsRasterLayer *layer, const QgsRectangle &extent ) SIP_FACTORY { return new QgsSingleBandPseudoColorRendererWidget( layer, extent ); }
50 
52  void setMapCanvas( QgsMapCanvas *canvas ) override;
53  void doComputations() override;
54  QgsRasterMinMaxWidget *minMaxWidget() override;
55 
59  void setFromRenderer( const QgsRasterRenderer *r );
60 
61  QString min( int index = 0 ) override { Q_UNUSED( index ) return mMinLineEdit->text(); }
62  QString max( int index = 0 ) override { Q_UNUSED( index ) return mMaxLineEdit->text(); }
63  void setMin( const QString &value, int index = 0 ) override;
64  void setMax( const QString &value, int index = 0 ) override;
65  int selectedBand( int index = 0 ) override { Q_UNUSED( index ) return mBandComboBox->currentBand(); }
66 
67  public slots:
69  void loadMinMax( int bandNo, double min, double max );
71  void loadMinMaxFromTree( double min, double max );
72 
73  private slots:
74  void bandChanged();
75  void mMinLineEdit_textChanged( const QString & );
76  void mMaxLineEdit_textChanged( const QString & );
77  void mMinLineEdit_textEdited( const QString &text );
78  void mMaxLineEdit_textEdited( const QString &text );
79 
80  private:
81  void setLineEditValue( QLineEdit *lineEdit, double value );
82  double lineEditValue( const QLineEdit *lineEdit ) const;
83 
84  QgsRasterMinMaxWidget *mMinMaxWidget = nullptr;
85  int mMinMaxOrigin;
86 
87  void minMaxModified();
88 
89  // Convert min/max to localized display value with maximum precision for the current data type
90  QString displayValueWithMaxPrecision( const double value );
91 
92  friend class TestQgsSingleBandPseudoColorRendererWidget;
93 };
94 
95 #endif // QGSSINGLEBANDCOLORRENDERERWIDGET_H
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsRasterRendererWidget::setMax
virtual void setMax(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:91
qgscolorrampshader.h
qgsrasterrenderer.h
QgsSingleBandPseudoColorRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Creates new raster renderer widget.
Definition: qgssinglebandpseudocolorrendererwidget.h:49
QgsSingleBandPseudoColorRendererWidget
Single band pseudo color renderer widget consists of a color ramp shader widget, a raster min max wid...
Definition: qgssinglebandpseudocolorrendererwidget.h:38
qgsrasterrendererwidget.h
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsRasterMinMaxWidget
Definition: qgsrasterminmaxwidget.h:37
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:40
qgis_sip.h
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:76
QgsRasterRendererWidget::setMin
virtual void setMin(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:90
QgsRasterRendererWidget
Abstract base class for widgets which configure a QgsRasterRenderer.
Definition: qgsrasterrendererwidget.h:39
QgsRasterRendererWidget::renderer
virtual QgsRasterRenderer * renderer()=0
Creates a new renderer, using the properties defined in the widget.
QgsSingleBandPseudoColorRendererWidget::max
QString max(int index=0) override
Definition: qgssinglebandpseudocolorrendererwidget.h:62
QgsSingleBandPseudoColorRendererWidget::selectedBand
int selectedBand(int index=0) override
Definition: qgssinglebandpseudocolorrendererwidget.h:65