QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsrendererrasterpropertieswidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrendererrasterpropertieswidget.cpp
3  ---------------------
4  begin : May 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email : woodrow dot nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
16 
17 #include "qgis.h"
18 #include "qgsmapcanvas.h"
20 #include "qgshuesaturationfilter.h"
22 #include "qgsrasterlayer.h"
32 #include "qgsapplication.h"
33 #include "qgscolorrampimpl.h"
34 #include "qgsproject.h"
35 #include "qgsprojectutils.h"
36 
37 #include "qgsmessagelog.h"
38 
39 static void _initRendererWidgetFunctions()
40 {
41  static bool sInitialized = false;
42  if ( sInitialized )
43  return;
44 
51 
52  sInitialized = true;
53 }
54 
55 
56 
58  : QgsMapLayerConfigWidget( layer, canvas, parent )
59  , mRasterLayer( qobject_cast<QgsRasterLayer *>( layer ) )
60 {
61  if ( !mRasterLayer )
62  return;
63 
64  setupUi( this );
65  connect( mResetColorRenderingBtn, &QToolButton::clicked, this, &QgsRendererRasterPropertiesWidget::mResetColorRenderingBtn_clicked );
66 
67  _initRendererWidgetFunctions();
68 
69  mResamplingUtils.initWidgets( mRasterLayer, mZoomedInResamplingComboBox, mZoomedOutResamplingComboBox, mMaximumOversamplingSpinBox, mCbEarlyResampling );
70 
71  connect( cboRenderers, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRendererRasterPropertiesWidget::rendererChanged );
72 
73  connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
74  connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
75  mBrightnessSpinBox->setClearValue( 0 );
76 
77  connect( mSliderContrast, &QAbstractSlider::valueChanged, mContrastSpinBox, &QSpinBox::setValue );
78  connect( mContrastSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderContrast, &QAbstractSlider::setValue );
79  mContrastSpinBox->setClearValue( 0 );
80 
81  connect( mSliderGamma, &QAbstractSlider::valueChanged, this, &QgsRendererRasterPropertiesWidget::updateGammaSpinBox );
82  connect( mGammaSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsRendererRasterPropertiesWidget::updateGammaSlider );
83  mGammaSpinBox->setClearValue( 1.0 );
84 
85  // Connect saturation slider and spin box
86  connect( sliderSaturation, &QAbstractSlider::valueChanged, spinBoxSaturation, &QSpinBox::setValue );
87  connect( spinBoxSaturation, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderSaturation, &QAbstractSlider::setValue );
88  spinBoxSaturation->setClearValue( 0 );
89 
90  // Connect colorize strength slider and spin box
91  connect( sliderColorizeStrength, &QAbstractSlider::valueChanged, spinColorizeStrength, &QSpinBox::setValue );
92  connect( spinColorizeStrength, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), sliderColorizeStrength, &QAbstractSlider::setValue );
93  spinColorizeStrength->setClearValue( 100 );
94 
95  // enable or disable saturation slider and spin box depending on grayscale combo choice
96  connect( comboGrayscale, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRendererRasterPropertiesWidget::toggleSaturationControls );
97 
98  // enable or disable colorize colorbutton with colorize checkbox
99  connect( mColorizeCheck, &QAbstractButton::toggled, this, &QgsRendererRasterPropertiesWidget::toggleColorizeControls );
100 
101  // Just connect the spin boxes because the sliders update the spinners
102  connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
103  connect( mContrastSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
104  connect( mGammaSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
105  connect( spinBoxSaturation, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
106  connect( spinColorizeStrength, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
107  connect( btnColorizeColor, &QgsColorButton::colorChanged, this, &QgsPanelWidget::widgetChanged );
108  connect( mInvertColorsCheck, &QAbstractButton::toggled, this, &QgsPanelWidget::widgetChanged );
109 
110  connect( mBlendModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
111  connect( mZoomedInResamplingComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
112  connect( mZoomedOutResamplingComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPanelWidget::widgetChanged );
113  connect( mMaximumOversamplingSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsPanelWidget::widgetChanged );
114  connect( mCbEarlyResampling, &QAbstractButton::toggled, this, &QgsPanelWidget::widgetChanged );
115 
116  // finally sync to the layer - even though some actions may emit widgetChanged signal,
117  // this is not a problem - nobody is listening to our signals yet
118  syncToLayer( mRasterLayer );
119 
120  connect( mRasterLayer, &QgsMapLayer::styleChanged, this, &QgsRendererRasterPropertiesWidget::refreshAfterStyleChanged );
121 }
122 
124 {
125  mMapCanvas = canvas;
126 }
127 
129 {
130  const QString rendererName = cboRenderers->currentData().toString();
131  setRendererWidget( rendererName );
132  emit widgetChanged();
133 }
134 
136 {
137  if ( QgsBrightnessContrastFilter *brightnessFilter = mRasterLayer->brightnessFilter() )
138  {
139  brightnessFilter->setBrightness( mSliderBrightness->value() );
140  brightnessFilter->setContrast( mSliderContrast->value() );
141  brightnessFilter->setGamma( mGammaSpinBox->value() );
142  }
143 
144  if ( QgsRasterRendererWidget *rendererWidget = dynamic_cast<QgsRasterRendererWidget *>( stackedWidget->currentWidget() ) )
145  {
146  rendererWidget->doComputations();
147 
148  if ( QgsRasterRenderer *newRenderer = rendererWidget->renderer() )
149  {
150  // there are transparency related data stored in renderer instances, but they
151  // are not configured in the widget, so we need to copy them over from existing renderer
152  if ( QgsRasterRenderer *oldRenderer = mRasterLayer->renderer() )
153  newRenderer->copyCommonProperties( oldRenderer, false );
154  mRasterLayer->setRenderer( newRenderer );
155  }
156  }
157 
158  // Hue and saturation controls
159  if ( QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter() )
160  {
161  hueSaturationFilter->setSaturation( sliderSaturation->value() );
162  hueSaturationFilter->setGrayscaleMode( ( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
163  hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
164  hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
165  hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
166  hueSaturationFilter->setInvertColors( mInvertColorsCheck->isChecked() );
167  }
168 
169  mResamplingUtils.refreshLayerFromWidgets();
170 
171  mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
172 }
173 
175 {
176  mRasterLayer = layer;
177 
178  cboRenderers->blockSignals( true );
179  cboRenderers->clear();
181  const auto constRenderersList = QgsApplication::rasterRendererRegistry()->renderersList();
182  for ( const QString &name : constRenderersList )
183  {
184  if ( QgsApplication::rasterRendererRegistry()->rendererData( name, entry ) )
185  {
186  if ( ( mRasterLayer->rasterType() != QgsRasterLayer::ColorLayer && entry.name != QLatin1String( "singlebandcolordata" ) ) ||
187  ( mRasterLayer->rasterType() == QgsRasterLayer::ColorLayer && entry.name == QLatin1String( "singlebandcolordata" ) ) )
188  {
189  cboRenderers->addItem( entry.icon(), entry.visibleName, entry.name );
190  }
191  }
192  }
193  cboRenderers->setCurrentIndex( -1 );
194  cboRenderers->blockSignals( false );
195 
196  if ( QgsRasterRenderer *renderer = mRasterLayer->renderer() )
197  {
198  setRendererWidget( renderer->type() );
199  }
200 
201  if ( QgsBrightnessContrastFilter *brightnessFilter = mRasterLayer->brightnessFilter() )
202  {
203  mSliderBrightness->setValue( brightnessFilter->brightness() );
204  mSliderContrast->setValue( brightnessFilter->contrast() );
205  mGammaSpinBox->setValue( brightnessFilter->gamma() );
206  }
207 
208  btnColorizeColor->setColorDialogTitle( tr( "Select Color" ) );
209  btnColorizeColor->setContext( QStringLiteral( "symbology" ) );
210 
211  // Hue and saturation color control
212  //set hue and saturation controls to current values
213  if ( const QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter() )
214  {
215  sliderSaturation->setValue( hueSaturationFilter->saturation() );
216  comboGrayscale->setCurrentIndex( ( int ) hueSaturationFilter->grayscaleMode() );
217 
218  // Set initial state of saturation controls based on grayscale mode choice
219  toggleSaturationControls( static_cast<int>( hueSaturationFilter->grayscaleMode() ) );
220 
221  // Set initial state of colorize controls
222  mColorizeCheck->setChecked( hueSaturationFilter->colorizeOn() );
223  btnColorizeColor->setColor( hueSaturationFilter->colorizeColor() );
224  toggleColorizeControls( hueSaturationFilter->colorizeOn() );
225  sliderColorizeStrength->setValue( hueSaturationFilter->colorizeStrength() );
226 
227  mInvertColorsCheck->setChecked( hueSaturationFilter->invertColors() );
228  }
229 
230  //blend mode
231  mBlendModeComboBox->setShowClippingModes( QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject::instance(), mRasterLayer ) );
232  mBlendModeComboBox->setBlendMode( mRasterLayer->blendMode() );
233 
234  //set combo boxes to current resampling types
235  mResamplingUtils.refreshWidgetsFromLayer();
236 }
237 
238 void QgsRendererRasterPropertiesWidget::mResetColorRenderingBtn_clicked()
239 {
240  mBlendModeComboBox->setBlendMode( QPainter::CompositionMode_SourceOver );
241  mSliderBrightness->setValue( 0 );
242  mSliderContrast->setValue( 0 );
243  mGammaSpinBox->setValue( 1.0 );
244  sliderSaturation->setValue( 0 );
245  comboGrayscale->setCurrentIndex( ( int ) QgsHueSaturationFilter::GrayscaleOff );
246  mColorizeCheck->setChecked( false );
247  sliderColorizeStrength->setValue( 100 );
248  mInvertColorsCheck->setChecked( false );
249 }
250 
251 void QgsRendererRasterPropertiesWidget::toggleSaturationControls( int grayscaleMode )
252 {
253  // Enable or disable saturation controls based on choice of grayscale mode
254  if ( grayscaleMode == 0 )
255  {
256  sliderSaturation->setEnabled( true );
257  spinBoxSaturation->setEnabled( true );
258  }
259  else
260  {
261  sliderSaturation->setEnabled( false );
262  spinBoxSaturation->setEnabled( false );
263  }
264  emit widgetChanged();
265 }
266 
267 void QgsRendererRasterPropertiesWidget::toggleColorizeControls( bool colorizeEnabled )
268 {
269  // Enable or disable colorize controls based on checkbox
270  btnColorizeColor->setEnabled( colorizeEnabled );
271  sliderColorizeStrength->setEnabled( colorizeEnabled );
272  spinColorizeStrength->setEnabled( colorizeEnabled );
273  emit widgetChanged();
274 }
275 
276 void QgsRendererRasterPropertiesWidget::setRendererWidget( const QString &rendererName )
277 {
278  QgsDebugMsgLevel( "rendererName = " + rendererName, 3 );
279  QgsRasterRendererWidget *oldWidget = mRendererWidget;
280 
281  int alphaBand = -1;
282  double opacity = 1;
283  QColor nodataColor;
284  if ( QgsRasterRenderer *oldRenderer = mRasterLayer->renderer() )
285  {
286  // Retain alpha band and opacity when switching renderer
287  alphaBand = oldRenderer->alphaBand();
288  opacity = oldRenderer->opacity();
289  nodataColor = oldRenderer->nodataColor();
290  }
291 
292  QgsRasterRendererRegistryEntry rendererEntry;
293  if ( QgsApplication::rasterRendererRegistry()->rendererData( rendererName, rendererEntry ) )
294  {
295  if ( rendererEntry.widgetCreateFunction ) // Single band color data renderer e.g. has no widget
296  {
297  QgsDebugMsgLevel( QStringLiteral( "renderer has widgetCreateFunction" ), 3 );
298  // Current canvas extent (used to calc min/max) in layer CRS
301  : mRasterLayer->extent();
302  if ( oldWidget )
303  {
304  std::unique_ptr< QgsRasterRenderer > oldRenderer( oldWidget->renderer() );
305  if ( !oldRenderer || oldRenderer->type() != rendererName )
306  {
307  if ( rendererName == QLatin1String( "singlebandgray" ) )
308  {
309  whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::SingleBandGray, mRasterLayer->dataProvider() ) );
310  whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
311  }
312  else if ( rendererName == QLatin1String( "multibandcolor" ) )
313  {
314  whileBlocking( mRasterLayer )->setRenderer( QgsApplication::rasterRendererRegistry()->defaultRendererForDrawingStyle( QgsRaster::MultiBandColor, mRasterLayer->dataProvider() ) );
315  whileBlocking( mRasterLayer )->setDefaultContrastEnhancement();
316  }
317  }
318  }
319  mRasterLayer->renderer()->setAlphaBand( alphaBand );
320  mRasterLayer->renderer()->setOpacity( opacity );
321  mRasterLayer->renderer()->setNodataColor( nodataColor );
322  mRendererWidget = rendererEntry.widgetCreateFunction( mRasterLayer, myExtent );
323  mRendererWidget->setMapCanvas( mMapCanvas );
324  connect( mRendererWidget, &QgsRasterRendererWidget::widgetChanged, this, &QgsPanelWidget::widgetChanged );
325  stackedWidget->addWidget( mRendererWidget );
326  stackedWidget->setCurrentWidget( mRendererWidget );
327  if ( oldWidget )
328  {
329  // Compare used bands in new and old renderer and reset transparency dialog if different
330  QgsRasterRenderer *oldRenderer = oldWidget->renderer();
331  QgsRasterRenderer *newRenderer = mRendererWidget->renderer();
332 #if 0
333  QList<int> oldBands = oldRenderer->usesBands();
334  QList<int> newBands = newRenderer->usesBands();
335 
336  if ( oldBands != newBands )
337  {
338  populateTransparencyTable( newRenderer );
339  }
340 #endif
341 
342  delete oldRenderer;
343  delete newRenderer;
344  }
345  }
346  }
347 
348  if ( mRendererWidget != oldWidget )
349  delete oldWidget;
350 
351  const int widgetIndex = cboRenderers->findData( rendererName );
352  if ( widgetIndex != -1 )
353  {
354  whileBlocking( cboRenderers )->setCurrentIndex( widgetIndex );
355  }
356 
357 }
358 
359 void QgsRendererRasterPropertiesWidget::refreshAfterStyleChanged()
360 {
361  if ( mRendererWidget )
362  {
363  QgsRasterRenderer *renderer = mRasterLayer->renderer();
364  if ( QgsMultiBandColorRenderer *mbcr = dynamic_cast<QgsMultiBandColorRenderer *>( renderer ) )
365  {
366  const QgsContrastEnhancement *redCe = mbcr->redContrastEnhancement();
367  if ( redCe )
368  {
369  mRendererWidget->setMin( QLocale().toString( redCe->minimumValue() ), 0 );
370  mRendererWidget->setMax( QLocale().toString( redCe->maximumValue() ), 0 );
371  }
372  const QgsContrastEnhancement *greenCe = mbcr->greenContrastEnhancement();
373  if ( greenCe )
374  {
375  mRendererWidget->setMin( QLocale().toString( greenCe->minimumValue() ), 1 );
376  mRendererWidget->setMax( QLocale().toString( greenCe->maximumValue() ), 1 );
377  }
378  const QgsContrastEnhancement *blueCe = mbcr->blueContrastEnhancement();
379  if ( blueCe )
380  {
381  mRendererWidget->setMin( QLocale().toString( blueCe->minimumValue() ), 2 );
382  mRendererWidget->setMax( QLocale().toString( blueCe->maximumValue() ), 2 );
383  }
384  }
385  else if ( QgsSingleBandGrayRenderer *sbgr = dynamic_cast<QgsSingleBandGrayRenderer *>( renderer ) )
386  {
387  const QgsContrastEnhancement *ce = sbgr->contrastEnhancement();
388  if ( ce )
389  {
390  mRendererWidget->setMin( QLocale().toString( ce->minimumValue() ) );
391  mRendererWidget->setMax( QLocale().toString( ce->maximumValue() ) );
392  }
393  }
394  }
395 }
396 
397 void QgsRendererRasterPropertiesWidget::updateGammaSpinBox( int value )
398 {
399  mGammaSpinBox->setValue( value / 100.0 );
400 }
401 
402 void QgsRendererRasterPropertiesWidget::updateGammaSlider( double value )
403 {
404  mSliderGamma->setValue( value * 100 );
405 }
QgsContrastEnhancement::maximumValue
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
Definition: qgscontrastenhancement.h:155
QgsApplication::rasterRendererRegistry
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers.
Definition: qgsapplication.cpp:2325
QgsMapLayer::crs
QgsCoordinateReferenceSystem crs
Definition: qgsmaplayer.h:79
QgsRasterContourRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Widget creation function (mainly for the use by the renderer registry)
Definition: qgsrastercontourrendererwidget.h:50
qgscolorrampimpl.h
qgspalettedrendererwidget.h
QgsProjectUtils::layerIsContainedInGroupLayer
static bool layerIsContainedInGroupLayer(QgsProject *project, QgsMapLayer *layer)
Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
Definition: qgsprojectutils.cpp:57
QgsMapCanvas::extent
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
Definition: qgsmapcanvas.cpp:1331
qgsrasterlayer.h
QgsContrastEnhancement::minimumValue
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
Definition: qgscontrastenhancement.h:158
QgsPalettedRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Definition: qgspalettedrendererwidget.h:188
qgsmapcanvas.h
QgsDebugMsgLevel
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
QgsMapLayer::blendMode
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
Definition: qgsmaplayer.cpp:320
QgsMapCanvas::mapSettings
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
Definition: qgsmapcanvas.cpp:437
QgsMapSettings::outputExtentToLayerExtent
QgsRectangle outputExtentToLayerExtent(const QgsMapLayer *layer, QgsRectangle extent) const
transform bounding box from output CRS to layer's CRS
Definition: qgsmapsettings.cpp:553
QgsRaster::SingleBandGray
@ SingleBandGray
Definition: qgsraster.h:105
QgsRasterLayer::ColorLayer
@ ColorLayer
Definition: qgsrasterlayer.h:200
QgsRasterRendererRegistryEntry::name
QString name
Definition: qgsrasterrendererregistry.h:53
QgsRasterRendererRegistryEntry
Registry for raster renderer entries.
Definition: qgsrasterrendererregistry.h:44
QgsHueSaturationFilter::GrayscaleMode
GrayscaleMode
Definition: qgshuesaturationfilter.h:36
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsRendererRasterPropertiesWidget::QgsRendererRasterPropertiesWidget
QgsRendererRasterPropertiesWidget(QgsMapLayer *layer, QgsMapCanvas *canvas, QWidget *parent=nullptr)
A widget to hold the renderer properties for a raster layer.
Definition: qgsrendererrasterpropertieswidget.cpp:57
qgis.h
QgsSingleBandGrayRenderer
Raster renderer pipe for single band gray.
Definition: qgssinglebandgrayrenderer.h:35
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:480
QgsRasterRendererWidget::setMax
virtual void setMax(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:91
QgsMapLayer::setBlendMode
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
Definition: qgsmaplayer.cpp:310
qgsrasterrendererregistry.h
QgsRasterRendererRegistry::insertWidgetFunction
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
Definition: qgsrasterrendererregistry.cpp:73
QgsRendererRasterPropertiesWidget::apply
void apply() override
Apply the changes from the dialog to the layer.
Definition: qgsrendererrasterpropertieswidget.cpp:135
QgsSingleBandPseudoColorRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Creates new raster renderer widget.
Definition: qgssinglebandpseudocolorrendererwidget.h:49
QgsRasterRenderer::usesBands
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
Definition: qgsrasterrenderer.h:151
qgsrasterrendererwidget.h
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsRasterLayer::setRenderer
void setRenderer(QgsRasterRenderer *renderer)
Sets the raster's renderer.
Definition: qgsrasterlayer.cpp:1745
QgsRendererRasterPropertiesWidget::rendererChanged
void rendererChanged()
called when user changes renderer type
Definition: qgsrendererrasterpropertieswidget.cpp:128
qgsmultibandcolorrendererwidget.h
QgsSingleBandGrayRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Definition: qgssinglebandgrayrendererwidget.h:39
QgsMapLayerConfigWidget
A panel widget that can be shown in the map style dock.
Definition: qgsmaplayerconfigwidget.h:115
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
qgsapplication.h
QgsRasterLayer::renderer
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
Definition: qgsrasterlayer.cpp:1758
QgsCoordinateTransform::isTransformationPossible
static bool isTransformationPossible(const QgsCoordinateReferenceSystem &source, const QgsCoordinateReferenceSystem &destination)
Returns true if it is theoretically possible to transform between source and destination CRSes.
Definition: qgscoordinatetransform.cpp:170
qgsprojectutils.h
QgsRasterLayer::brightnessFilter
QgsBrightnessContrastFilter * brightnessFilter() const
Returns the raster's brightness/contrast filter.
Definition: qgsrasterlayer.cpp:1768
QgsRasterRendererWidget::setMapCanvas
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgsrasterrendererwidget.cpp:23
QgsRasterLayer::hueSaturationFilter
QgsHueSaturationFilter * hueSaturationFilter() const
Returns the raster's hue/saturation filter.
Definition: qgsrasterlayer.cpp:1773
qgssinglebandpseudocolorrendererwidget.h
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:2191
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:40
QgsRasterRendererRegistryEntry::icon
QIcon icon()
Definition: qgsrasterrendererregistry.cpp:44
QgsMapLayer::styleChanged
void styleChanged()
Signal emitted whenever a change affects the layer's style.
QgsMapLayer::extent
virtual QgsRectangle extent() const
Returns the extent of the layer.
Definition: qgsmaplayer.cpp:305
QgsRasterRenderer::setAlphaBand
void setAlphaBand(int band)
Definition: qgsrasterrenderer.h:118
QgsPanelWidget::widgetChanged
void widgetChanged()
Emitted when the widget state changes.
qgsrendererrasterpropertieswidget.h
QgsRasterRendererRegistryEntry::visibleName
QString visibleName
Definition: qgsrasterrendererregistry.h:54
QgsHueSaturationFilter
Color and saturation filter pipe for rasters.
Definition: qgshuesaturationfilter.h:31
QgsMultiBandColorRenderer
Renderer for multiband images with the color components.
Definition: qgsmultibandcolorrenderer.h:32
QgsRasterLayer
Represents a raster layer.
Definition: qgsrasterlayer.h:76
qgsrastercontourrendererwidget.h
qgsbrightnesscontrastfilter.h
QgsContrastEnhancement
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
Definition: qgscontrastenhancement.h:42
QgsMultiBandColorRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Definition: qgsmultibandcolorrendererwidget.h:42
qgssinglebandgrayrenderer.h
QgsHillshadeRendererWidget::create
static QgsRasterRendererWidget * create(QgsRasterLayer *layer, const QgsRectangle &extent)
Factory method to create the renderer for this type.
Definition: qgshillshaderendererwidget.h:62
QgsMapSettings::destinationCrs
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
Definition: qgsmapsettings.cpp:358
qgshuesaturationfilter.h
qgssinglebandgrayrendererwidget.h
QgsMapLayerConfigWidget::mMapCanvas
QgsMapCanvas * mMapCanvas
Definition: qgsmaplayerconfigwidget.h:183
QgsBrightnessContrastFilter
Brightness/contrast and gamma correction filter pipe for rasters.
Definition: qgsbrightnesscontrastfilter.h:31
qgshillshaderendererwidget.h
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsHueSaturationFilter::GrayscaleOff
@ GrayscaleOff
Definition: qgshuesaturationfilter.h:38
qgsmultibandcolorrenderer.h
QgsRaster::MultiBandColor
@ MultiBandColor
Definition: qgsraster.h:113
QgsRasterRendererWidget::setMin
virtual void setMin(const QString &value, int index=0)
Definition: qgsrasterrendererwidget.h:90
QgsRendererRasterPropertiesWidget::syncToLayer
void syncToLayer(QgsRasterLayer *layer)
Sync the widget to the given layer.
Definition: qgsrendererrasterpropertieswidget.cpp:174
QgsRasterRenderer::setNodataColor
void setNodataColor(const QColor &color)
Sets the color to use for shading nodata pixels.
Definition: qgsrasterrenderer.h:113
QgsRendererRasterPropertiesWidget::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog.
Definition: qgsrendererrasterpropertieswidget.cpp:123
QgsRasterRendererWidget
Abstract base class for widgets which configure a QgsRasterRenderer.
Definition: qgsrasterrendererwidget.h:39
QgsRasterRendererWidget::widgetChanged
void widgetChanged()
Emitted when something on the widget has changed.
QgsRasterRendererWidget::renderer
virtual QgsRasterRenderer * renderer()=0
Creates a new renderer, using the properties defined in the widget.
QgsRasterLayer::rasterType
LayerType rasterType()
Returns the raster layer type (which is a read only property).
Definition: qgsrasterlayer.h:235
QgsRasterRenderer::setOpacity
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
Definition: qgsrasterrenderer.h:83
QgsRasterRendererRegistry::renderersList
QStringList renderersList() const
Definition: qgsrasterrendererregistry.cpp:93
qgsproject.h
QgsRasterLayer::dataProvider
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Definition: qgsrasterlayer.cpp:257
qgsmessagelog.h
QgsRasterRendererRegistryEntry::widgetCreateFunction
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
Definition: qgsrasterrendererregistry.h:57