QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
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 
42  void setMapCanvas( QgsMapCanvas *canvas ) override;
43 
47  void setFromRenderer( const QgsRasterRenderer *r );
48 
49  QString min( int index = 0 ) override { Q_UNUSED( index ) return mMinLineEdit->text(); }
50  QString max( int index = 0 ) override { Q_UNUSED( index ) return mMaxLineEdit->text(); }
51  void setMin( const QString &value, int index = 0 ) override;
52  void setMax( const QString &value, int index = 0 ) override;
53  int selectedBand( int index = 0 ) override { Q_UNUSED( index ) return mGrayBandComboBox->currentBand(); }
54 
57 
58  void doComputations() override;
59  QgsRasterMinMaxWidget *minMaxWidget() override { return mMinMaxWidget; }
60 
61  public slots:
63  void loadMinMax( int bandNo, double min, double max );
64 
65  private slots:
66  void bandChanged();
67  void mMinLineEdit_textChanged( const QString & );
68  void mMaxLineEdit_textChanged( const QString & );
69  void showLegendSettings();
70 
71  private:
72  QgsRasterMinMaxWidget *mMinMaxWidget = nullptr;
73  bool mDisableMinMaxWidgetRefresh;
74  QgsColorRampLegendNodeSettings mLegendSettings;
75 
76  void minMaxModified();
77 };
78 
79 #endif // QGSSINGLEBANDGRAYRENDERERWIDGET_H
Settings for a color ramp legend node.
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
Represents a raster layer.
Abstract base class for widgets which configure a QgsRasterRenderer.
virtual void setMax(const QString &value, int index=0)
virtual void setContrastEnhancementAlgorithm(QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm)
Sets the contrast enhancement algorithm to be used by the raster renderer.
virtual void setMin(const QString &value, int index=0)
virtual QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
Returns the contrast enhancement algorithm to be used by the raster renderer.
virtual QgsRasterRenderer * renderer()=0
Creates a new renderer, using the properties defined in the widget.
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.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_FACTORY
Definition: qgis_sip.h:76