QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
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
38class GUI_EXPORT QgsSingleBandPseudoColorRendererWidget : public QgsRasterRendererWidget, private Ui::QgsSingleBandPseudoColorRendererWidgetBase
39{
40 Q_OBJECT
41
42 public:
49
51 static QgsRasterRendererWidget *create( QgsRasterLayer *layer, const QgsRectangle &extent ) SIP_FACTORY { return new QgsSingleBandPseudoColorRendererWidget( layer, extent ); }
52
54 void setMapCanvas( QgsMapCanvas *canvas ) override;
55 void doComputations() override;
56 QgsRasterMinMaxWidget *minMaxWidget() override;
57
61 void setFromRenderer( const QgsRasterRenderer *r );
62
63 QString min( int index = 0 ) override
64 {
65 Q_UNUSED( index )
66 return mMinLineEdit->text();
67 }
68 QString max( int index = 0 ) override
69 {
70 Q_UNUSED( index )
71 return mMaxLineEdit->text();
72 }
73 void setMin( const QString &value, int index = 0 ) override;
74 void setMax( const QString &value, int index = 0 ) override;
75 int selectedBand( int index = 0 ) override
76 {
77 Q_UNUSED( index )
78 return mBandComboBox->currentBand();
79 }
80
81 public slots:
83 void loadMinMax( int bandNo, double min, double max );
85 void loadMinMaxFromTree( double min, double max );
86
87 private slots:
88 void bandChanged();
89 void mMinLineEdit_textChanged( const QString & );
90 void mMaxLineEdit_textChanged( const QString & );
91 void mMinLineEdit_textEdited( const QString &text );
92 void mMaxLineEdit_textEdited( const QString &text );
93
94 private:
95 void setLineEditValue( QLineEdit *lineEdit, double value );
96 double lineEditValue( const QLineEdit *lineEdit ) const;
97
98 QgsRasterMinMaxWidget *mMinMaxWidget = nullptr;
99 int mMinMaxOrigin;
100
101 void minMaxModified();
102
103 // Convert min/max to localized display value with maximum precision for the current data type
104 QString displayValueWithMaxPrecision( const double value );
105
106 friend class TestQgsSingleBandPseudoColorRendererWidget;
107};
108
109#endif // QGSSINGLEBANDCOLORRENDERERWIDGET_H
Map canvas is a class for displaying all GIS data types on a canvas.
Represents a raster layer.
A widget for configuring how the minimum and maximum value of a raster layer is determined.
Abstract base class for widgets which configure a QgsRasterRenderer.
virtual void setMax(const QString &value, int index=0)
virtual void setMin(const QString &value, int index=0)
virtual QgsRasterRenderer * renderer()=0
Creates a new renderer, using the properties defined in the widget.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
Single band pseudo color renderer widget consists of a color ramp shader widget, a raster min max wid...
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Creates new raster renderer widget.
#define SIP_FACTORY
Definition qgis_sip.h:76