QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
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"
23#include "qgis.h"
24
25#include <QWidget>
26#include "qgis_gui.h"
27
28class QgsRasterLayer;
30class QgsMapCanvas;
32
39class GUI_EXPORT QgsRasterRendererWidget : public QWidget
40{
41 Q_OBJECT
42
43 public:
44 //TODO QGIS 4.0 - remove extent parameter, replace with map canvas parameter
45
52 : mRasterLayer( layer )
53 , mExtent( extent )
54 {}
55
62
68 void setRasterLayer( QgsRasterLayer *layer ) { mRasterLayer = layer; }
69
75 const QgsRasterLayer *rasterLayer() const { return mRasterLayer; }
76
83 virtual void setMapCanvas( QgsMapCanvas *canvas );
84
89 QgsMapCanvas *mapCanvas();
90
91 virtual QString min( int index = 0 )
92 {
93 Q_UNUSED( index )
94 return QString();
95 }
96 virtual QString max( int index = 0 )
97 {
98 Q_UNUSED( index )
99 return QString();
100 }
101 virtual void setMin( const QString &value, int index = 0 )
102 {
103 Q_UNUSED( index )
104 Q_UNUSED( value );
105 }
106 virtual void setMax( const QString &value, int index = 0 )
107 {
108 Q_UNUSED( index )
109 Q_UNUSED( value );
110 }
111 virtual QString stdDev() { return QString(); }
112 virtual void setStdDev( const QString &value ) { Q_UNUSED( value ) }
113 virtual int selectedBand( int index = 0 )
114 {
115 Q_UNUSED( index )
116 return -1;
117 }
118
120 virtual void doComputations() {}
121
123 virtual QgsRasterMinMaxWidget *minMaxWidget() { return nullptr; }
124
130
140
141 signals:
142
148
149 protected:
150 QgsRasterLayer *mRasterLayer = nullptr;
151
154
156 QgsMapCanvas *mCanvas = nullptr;
157};
158
159#endif // QGSRASTERRENDERERWIDGET_H
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used.
@ NoEnhancement
Default color scaling algorithm, no scaling is applied.
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 QgsRasterMinMaxWidget * minMaxWidget()
Returns min/max widget when it exists.
virtual int selectedBand(int index=0)
virtual void setMax(const QString &value, int index=0)
const QgsRasterLayer * rasterLayer() const
Returns the raster layer associated with the widget.
virtual QString max(int index=0)
virtual void setStdDev(const QString &value)
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 QString min(int index=0)
QgsRectangle mExtent
Current extent.
virtual QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
Returns the contrast enhancement algorithm to be used by the raster renderer.
void setRasterLayer(QgsRasterLayer *layer)
Sets the raster layer associated with the widget.
virtual void doComputations()
Load programmatically with current values.
QgsRasterRendererWidget(QgsRasterLayer *layer, const QgsRectangle &extent)
Constructor for QgsRasterRendererWidget.
virtual QgsRasterRenderer * renderer()=0
Creates a new renderer, using the properties defined in the widget.
void widgetChanged()
Emitted when something on the widget has changed.
Raster renderer pipe that applies colors to a raster.
A rectangle specified with double values.
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