QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsrasterrendererwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterrendererwidget.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 QGSRASTERRENDERERWIDGET_H
19 #define QGSRASTERRENDERERWIDGET_H
20 
21 #include "qgsrectangle.h"
22 #include "qgscontrastenhancement.h"
23 #include "qgis.h"
24 
25 #include <QWidget>
26 #include "qgis_gui.h"
27 
28 class QgsRasterLayer;
29 class QgsRasterRenderer;
30 class QgsMapCanvas;
32 
39 class GUI_EXPORT QgsRasterRendererWidget: public QWidget
40 {
41  Q_OBJECT
42 
43  public:
44 
45  //TODO QGIS 4.0 - remove extent parameter, replace with map canvas parameter
47  : mRasterLayer( layer )
48  , mExtent( extent )
49  {}
50 
56  virtual QgsRasterRenderer *renderer() = 0 SIP_FACTORY;
57 
63  void setRasterLayer( QgsRasterLayer *layer ) { mRasterLayer = layer; }
64 
70  const QgsRasterLayer *rasterLayer() const { return mRasterLayer; }
71 
79  virtual void setMapCanvas( QgsMapCanvas *canvas );
80 
86  QgsMapCanvas *mapCanvas();
87 
88  virtual QString min( int index = 0 ) { Q_UNUSED( index ) return QString(); }
89  virtual QString max( int index = 0 ) { Q_UNUSED( index ) return QString(); }
90  virtual void setMin( const QString &value, int index = 0 ) { Q_UNUSED( index ) Q_UNUSED( value ); }
91  virtual void setMax( const QString &value, int index = 0 ) { Q_UNUSED( index ) Q_UNUSED( value ); }
92  virtual QString stdDev() { return QString(); }
93  virtual void setStdDev( const QString &value ) { Q_UNUSED( value ) }
94  virtual int selectedBand( int index = 0 ) { Q_UNUSED( index ) return -1; }
95 
97  virtual void doComputations() {}
98 
100  virtual QgsRasterMinMaxWidget *minMaxWidget() { return nullptr; }
101 
107 
113 
114  signals:
115 
120  void widgetChanged();
121 
122  protected:
123  QgsRasterLayer *mRasterLayer = nullptr;
124 
127 
129  QgsMapCanvas *mCanvas = nullptr;
130 };
131 
132 #endif // QGSRASTERRENDERERWIDGET_H
QgsRasterRendererWidget::stdDev
virtual QString stdDev()
Definition: qgsrasterrendererwidget.h:92
qgsrectangle.h
algorithm
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
qgscontrastenhancement.h
QgsRasterRendererWidget::minMaxWidget
virtual QgsRasterMinMaxWidget * minMaxWidget()
Returns min/max widget when it exists.
Definition: qgsrasterrendererwidget.h:100
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
qgis.h
QgsRasterRendererWidget::setMax
virtual void setMax(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:91
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsRasterRendererWidget::QgsRasterRendererWidget
QgsRasterRendererWidget(QgsRasterLayer *layer, const QgsRectangle &extent)
Definition: qgsrasterrendererwidget.h:46
QgsRasterMinMaxWidget
Definition: qgsrasterminmaxwidget.h:37
QgsContrastEnhancement::ContrastEnhancementAlgorithm
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
Definition: qgscontrastenhancement.h:48
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:40
QgsRasterRendererWidget::mExtent
QgsRectangle mExtent
Current extent.
Definition: qgsrasterrendererwidget.h:126
QgsContrastEnhancement::NoEnhancement
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
Definition: qgscontrastenhancement.h:50
QgsRasterRendererWidget::contrastEnhancementAlgorithm
virtual QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
Returns the constrast enhancement algorithm to be used by the raster renderer.
Definition: qgsrasterrendererwidget.h:106
QgsRasterRendererWidget::min
virtual QString min(int index=0)
Definition: qgsrasterrendererwidget.h:88
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:76
QgsRasterRendererWidget::selectedBand
virtual int selectedBand(int index=0)
Definition: qgsrasterrendererwidget.h:94
QgsRasterRendererWidget::setRasterLayer
void setRasterLayer(QgsRasterLayer *layer)
Sets the raster layer associated with the widget.
Definition: qgsrasterrendererwidget.h:63
QgsRasterRendererWidget::setMin
virtual void setMin(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:90
QgsRasterRendererWidget::doComputations
virtual void doComputations()
Load programmatically with current values.
Definition: qgsrasterrendererwidget.h:97
QgsRasterRendererWidget::setContrastEnhancementAlgorithm
virtual void setContrastEnhancementAlgorithm(QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm)
Sets the constrast enhancement algorithm to be used by the raster renderer.
Definition: qgsrasterrendererwidget.h:112
QgsRasterRendererWidget
Abstract base class for widgets which configure a QgsRasterRenderer.
Definition: qgsrasterrendererwidget.h:39
QgsRasterRendererWidget::max
virtual QString max(int index=0)
Definition: qgsrasterrendererwidget.h:89
QgsRasterRendererWidget::setStdDev
virtual void setStdDev(const QString &value)
Definition: qgsrasterrendererwidget.h:93
QgsRasterRendererWidget::rasterLayer
const QgsRasterLayer * rasterLayer() const
Returns the raster layer associated with the widget.
Definition: qgsrasterrendererwidget.h:70