QGIS API Documentation 3.41.0-Master (02257426e5a)
Loading...
Searching...
No Matches
qgsrasterlayertemporalpropertieswidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsrasterlayertemporalpropertieswidget.cpp
3 ------------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Samweli Mwakisambwe
6 email : samweli at kartoza dot com
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
19#include "moc_qgsrasterlayertemporalpropertieswidget.cpp"
21#include "qgsrasterlayer.h"
24#include "qgsdatetimeedit.h"
27#include "qgsunittypes.h"
28#include "qgsapplication.h"
30#include "qgsrasterrenderer.h"
31
32#include <QMenu>
33#include <QAction>
34
36 : QWidget( parent )
37 , mLayer( layer )
38{
39 Q_ASSERT( mLayer );
40 setupUi( this );
41
42 // make a useful default expression for per band ranges, just to give users some hints about how to do this...
43 mFixedRangeLowerExpression = QStringLiteral( "make_datetime(%1,1,1,0,0,0) + make_interval(days:=@band)" ).arg( QDate::currentDate().year() );
44 mFixedRangeUpperExpression = QStringLiteral( "make_datetime(%1,1,1,23,59,59) + make_interval(days:=@band)" ).arg( QDate::currentDate().year() );
45
46 mExtraWidgetLayout = new QVBoxLayout();
47 mExtraWidgetLayout->setContentsMargins( 0, 0, 0, 0 );
48 mExtraWidgetLayout->addStretch();
49 mExtraWidgetContainer->setLayout( mExtraWidgetLayout );
50
52 {
53 mModeComboBox->addItem( tr( "Automatic" ), QVariant::fromValue( Qgis::RasterTemporalMode::TemporalRangeFromDataProvider ) );
54 }
55 mModeComboBox->addItem( tr( "Fixed Time Range" ), QVariant::fromValue( Qgis::RasterTemporalMode::FixedTemporalRange ) );
56 mModeComboBox->addItem( tr( "Fixed Time Range Per Band" ), QVariant::fromValue( Qgis::RasterTemporalMode::FixedRangePerBand ) );
57 mModeComboBox->addItem( tr( "Represents Temporal Values" ), QVariant::fromValue( Qgis::RasterTemporalMode::RepresentsTemporalValues ) );
58 mModeComboBox->addItem( tr( "Redraw Layer Only" ), QVariant::fromValue( Qgis::RasterTemporalMode::RedrawLayerOnly ) );
59
60 for ( const Qgis::TemporalUnit unit :
61 {
72 } )
73 {
74 mScaleUnitComboBox->addItem( QgsUnitTypes::toString( unit ), static_cast<int>( unit ) );
75 }
76 mScaleUnitComboBox->setCurrentIndex( mScaleUnitComboBox->findData( static_cast<int>( Qgis::TemporalUnit::Days ) ) );
77
78 mStackedWidget->setSizeMode( QgsStackedWidget::SizeMode::CurrentPageOnly );
79
80 mFixedRangePerBandModel = new QgsRasterBandFixedTemporalRangeModel( this );
81 mBandRangesTable->verticalHeader()->setVisible( false );
82 mBandRangesTable->setModel( mFixedRangePerBandModel );
83 QgsFixedTemporalRangeDelegate *tableDelegate = new QgsFixedTemporalRangeDelegate( mBandRangesTable );
84 mBandRangesTable->setItemDelegateForColumn( 1, tableDelegate );
85 mBandRangesTable->setItemDelegateForColumn( 2, tableDelegate );
86
87 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsRasterLayerTemporalPropertiesWidget::modeChanged );
88
89 connect( mTemporalGroupBox, &QGroupBox::toggled, this, &QgsRasterLayerTemporalPropertiesWidget::temporalGroupBoxChecked );
90
91 mStartTemporalDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
92 mEndTemporalDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
93 mOffsetDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
94
95 QMenu *calculateFixedRangePerBandMenu = new QMenu( mCalculateFixedRangePerBandButton );
96 mCalculateFixedRangePerBandButton->setMenu( calculateFixedRangePerBandMenu );
97 mCalculateFixedRangePerBandButton->setPopupMode( QToolButton::InstantPopup );
98 QAction *calculateLowerAction = new QAction( "Calculate Beginning by Expression…", calculateFixedRangePerBandMenu );
99 calculateFixedRangePerBandMenu->addAction( calculateLowerAction );
100 connect( calculateLowerAction, &QAction::triggered, this, [this] {
101 calculateRangeByExpression( false );
102 } );
103 QAction *calculateUpperAction = new QAction( "Calculate End by Expression…", calculateFixedRangePerBandMenu );
104 calculateFixedRangePerBandMenu->addAction( calculateUpperAction );
105 connect( calculateUpperAction, &QAction::triggered, this, [this] {
106 calculateRangeByExpression( true );
107 } );
108
109
110 syncToLayer();
111}
112
114{
115 mLayer->temporalProperties()->setIsActive( mTemporalGroupBox->isChecked() );
116
117 QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast<QgsRasterLayerTemporalProperties *>( mLayer->temporalProperties() );
118
119 temporalProperties->setMode( mModeComboBox->currentData().value<Qgis::RasterTemporalMode>() );
120 temporalProperties->setBandNumber( mBandComboBox->currentBand() );
121
122 const QgsDateTimeRange normalRange = QgsDateTimeRange( mStartTemporalDateTimeEdit->dateTime(), mEndTemporalDateTimeEdit->dateTime() );
123 temporalProperties->setFixedTemporalRange( normalRange );
124
125 temporalProperties->setFixedRangePerBand( mFixedRangePerBandModel->rangeData() );
126
127 temporalProperties->setTemporalRepresentationOffset( mOffsetDateTimeEdit->dateTime() );
128
129 const QgsInterval scale( mScaleSpinBox->value(), static_cast<Qgis::TemporalUnit>( mScaleUnitComboBox->currentData().toInt() ) );
130 temporalProperties->setTemporalRepresentationScale( scale );
131
132 for ( QgsMapLayerConfigWidget *widget : std::as_const( mExtraWidgets ) )
133 {
134 widget->apply();
135 }
136}
137
139{
140 const QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast<const QgsRasterLayerTemporalProperties *>( mLayer->temporalProperties() );
141 mModeComboBox->setCurrentIndex( mModeComboBox->findData( QVariant::fromValue( temporalProperties->mode() ) ) );
142 switch ( temporalProperties->mode() )
143 {
145 mStackedWidget->setCurrentWidget( mPageAutomatic );
146 break;
148 mStackedWidget->setCurrentWidget( mPageFixedRange );
149 break;
151 mStackedWidget->setCurrentWidget( mPageRedrawOnly );
152 break;
154 mStackedWidget->setCurrentWidget( mPageFixedRangePerBand );
155 break;
157 mStackedWidget->setCurrentWidget( mPageRepresentsTemporalValues );
158 break;
159 }
160
162 {
163 mWidgetFixedRangePerBand->hide();
164 mFixedRangePerBandLabel->setText( tr( "This mode cannot be used with a multi-band renderer." ) );
165 }
166
167 mBandComboBox->setLayer( mLayer );
168 mBandComboBox->setBand( temporalProperties->bandNumber() );
169
170 mStartTemporalDateTimeEdit->setDateTime( temporalProperties->fixedTemporalRange().begin() );
171 mEndTemporalDateTimeEdit->setDateTime( temporalProperties->fixedTemporalRange().end() );
172
173 mFixedRangePerBandModel->setLayerData( mLayer, temporalProperties->fixedRangePerBand() );
174 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
175 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
176 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
177
178 mOffsetDateTimeEdit->setDateTime( temporalProperties->temporalRepresentationOffset() );
179
180 mScaleSpinBox->setValue( temporalProperties->temporalRepresentationScale().originalDuration() );
181 mScaleUnitComboBox->setCurrentIndex( mScaleUnitComboBox->findData( static_cast<int>( temporalProperties->temporalRepresentationScale().originalUnit() ) ) );
182
183 mTemporalGroupBox->setChecked( temporalProperties->isActive() );
184
185 for ( QgsMapLayerConfigWidget *widget : std::as_const( mExtraWidgets ) )
186 {
187 widget->syncToLayer( mLayer );
188 }
189}
190
192{
193 mExtraWidgets << widget;
194 mExtraWidgetLayout->insertWidget( mExtraWidgetLayout->count() - 1, widget );
195}
196
197void QgsRasterLayerTemporalPropertiesWidget::temporalGroupBoxChecked( bool checked )
198{
199 for ( QgsMapLayerConfigWidget *widget : std::as_const( mExtraWidgets ) )
200 {
201 widget->emit dynamicTemporalControlToggled( checked );
202 }
203}
204
205void QgsRasterLayerTemporalPropertiesWidget::modeChanged()
206{
207 if ( mModeComboBox->currentData().isValid() )
208 {
209 switch ( mModeComboBox->currentData().value<Qgis::RasterTemporalMode>() )
210 {
212 mStackedWidget->setCurrentWidget( mPageAutomatic );
213 break;
215 mStackedWidget->setCurrentWidget( mPageFixedRange );
216 break;
218 mStackedWidget->setCurrentWidget( mPageRedrawOnly );
219 break;
221 mStackedWidget->setCurrentWidget( mPageFixedRangePerBand );
222 break;
224 mStackedWidget->setCurrentWidget( mPageRepresentsTemporalValues );
225 break;
226 }
227 }
228}
229
230void QgsRasterLayerTemporalPropertiesWidget::calculateRangeByExpression( bool isUpper )
231{
232 QgsExpressionContext expressionContext;
234 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band" ), 1, true, false, tr( "Band number" ) ) );
235 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_name" ), mLayer->dataProvider()->displayBandName( 1 ), true, false, tr( "Band name" ) ) );
236 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( 1 ), true, false, tr( "Band description" ) ) );
237
238 expressionContext.appendScope( bandScope );
240 expressionContext.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } );
241
242 QgsExpressionBuilderDialog dlg = QgsExpressionBuilderDialog( nullptr, isUpper ? mFixedRangeUpperExpression : mFixedRangeLowerExpression, this, QStringLiteral( "generic" ), expressionContext );
243 dlg.setExpectedOutputFormat( !isUpper ? tr( "Temporal range start date / time" ) : tr( "Temporal range end date / time" ) );
244
245 QList<QPair<QString, QVariant>> bandChoices;
246 for ( int band = 1; band <= mLayer->bandCount(); ++band )
247 {
248 bandChoices << qMakePair( mLayer->dataProvider()->displayBandName( band ), band );
249 }
250 dlg.expressionBuilder()->setCustomPreviewGenerator( tr( "Band" ), bandChoices, [this]( const QVariant &value ) -> QgsExpressionContext {
251 return createExpressionContextForBand( value.toInt() );
252 } );
253
254 if ( dlg.exec() )
255 {
256 if ( isUpper )
257 mFixedRangeUpperExpression = dlg.expressionText();
258 else
259 mFixedRangeLowerExpression = dlg.expressionText();
260
261 QgsExpression exp( dlg.expressionText() );
262 exp.prepare( &expressionContext );
263 for ( int band = 1; band <= mLayer->bandCount(); ++band )
264 {
265 bandScope->setVariable( QStringLiteral( "band" ), band );
266 bandScope->setVariable( QStringLiteral( "band_name" ), mLayer->dataProvider()->displayBandName( band ) );
267 bandScope->setVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( band ) );
268
269 const QVariant res = exp.evaluate( &expressionContext );
270 mFixedRangePerBandModel->setData( mFixedRangePerBandModel->index( band - 1, isUpper ? 2 : 1 ), res, Qt::EditRole );
271 }
272 }
273}
274
275QgsExpressionContext QgsRasterLayerTemporalPropertiesWidget::createExpressionContextForBand( int band ) const
276{
277 QgsExpressionContext context;
280 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band" ), band, true, false, tr( "Band number" ) ) );
281 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_name" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->displayBandName( band ) : QString(), true, false, tr( "Band name" ) ) );
282 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->bandDescription( band ) : QString(), true, false, tr( "Band description" ) ) );
283 context.appendScope( bandScope );
284 context.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } );
285 return context;
286}
287
289
290//
291// QgsRasterBandFixedTemporalRangeModel
292//
293
294QgsRasterBandFixedTemporalRangeModel::QgsRasterBandFixedTemporalRangeModel( QObject *parent )
295 : QAbstractItemModel( parent )
296{
297}
298
299int QgsRasterBandFixedTemporalRangeModel::columnCount( const QModelIndex & ) const
300{
301 return 3;
302}
303
304int QgsRasterBandFixedTemporalRangeModel::rowCount( const QModelIndex &parent ) const
305{
306 if ( parent.isValid() )
307 return 0;
308 return mBandCount;
309}
310
311QModelIndex QgsRasterBandFixedTemporalRangeModel::index( int row, int column, const QModelIndex &parent ) const
312{
313 if ( hasIndex( row, column, parent ) )
314 {
315 return createIndex( row, column, row );
316 }
317
318 return QModelIndex();
319}
320
321QModelIndex QgsRasterBandFixedTemporalRangeModel::parent( const QModelIndex &child ) const
322{
323 Q_UNUSED( child )
324 return QModelIndex();
325}
326
327Qt::ItemFlags QgsRasterBandFixedTemporalRangeModel::flags( const QModelIndex &index ) const
328{
329 if ( !index.isValid() )
330 return Qt::ItemFlags();
331
332 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
333 return Qt::ItemFlags();
334
335 switch ( index.column() )
336 {
337 case 0:
338 return Qt::ItemFlag::ItemIsEnabled;
339 case 1:
340 case 2:
341 return Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsSelectable;
342 default:
343 break;
344 }
345
346 return Qt::ItemFlags();
347}
348
349QVariant QgsRasterBandFixedTemporalRangeModel::data( const QModelIndex &index, int role ) const
350{
351 if ( !index.isValid() )
352 return QVariant();
353
354 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
355 return QVariant();
356
357 const int band = index.row() + 1;
358 const QgsDateTimeRange range = mRanges.value( band );
359
360 switch ( role )
361 {
362 case Qt::DisplayRole:
363 case Qt::EditRole:
364 case Qt::ToolTipRole:
365 {
366 switch ( index.column() )
367 {
368 case 0:
369 return mBandNames.value( band, QString::number( band ) );
370
371 case 1:
372 return range.begin().isValid() ? range.begin() : QVariant();
373
374 case 2:
375 return range.end().isValid() ? range.end() : QVariant();
376
377 default:
378 break;
379 }
380 break;
381 }
382
383 case Qt::TextAlignmentRole:
384 {
385 switch ( index.column() )
386 {
387 case 0:
388 return static_cast<Qt::Alignment::Int>( Qt::AlignLeft | Qt::AlignVCenter );
389
390 case 1:
391 case 2:
392 return static_cast<Qt::Alignment::Int>( Qt::AlignRight | Qt::AlignVCenter );
393 default:
394 break;
395 }
396 break;
397 }
398
399 default:
400 break;
401 }
402 return QVariant();
403}
404
405QVariant QgsRasterBandFixedTemporalRangeModel::headerData( int section, Qt::Orientation orientation, int role ) const
406{
407 if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
408 {
409 switch ( section )
410 {
411 case 0:
412 return tr( "Band" );
413 case 1:
414 return tr( "Begin" );
415 case 2:
416 return tr( "End" );
417 default:
418 break;
419 }
420 }
421 return QAbstractItemModel::headerData( section, orientation, role );
422}
423
424bool QgsRasterBandFixedTemporalRangeModel::setData( const QModelIndex &index, const QVariant &value, int role )
425{
426 if ( !index.isValid() )
427 return false;
428
429 if ( index.row() > mBandCount || index.row() < 0 )
430 return false;
431
432 const int band = index.row() + 1;
433 const QgsDateTimeRange range = mRanges.value( band );
434
435 switch ( role )
436 {
437 case Qt::EditRole:
438 {
439 const QDateTime newValue = value.toDateTime();
440 if ( !newValue.isValid() )
441 return false;
442
443 switch ( index.column() )
444 {
445 case 1:
446 {
447 mRanges[band] = QgsDateTimeRange( newValue, range.end(), range.includeBeginning(), range.includeEnd() );
448 emit dataChanged( index, index, QVector<int>() << role );
449 break;
450 }
451
452 case 2:
453 mRanges[band] = QgsDateTimeRange( range.begin(), newValue, range.includeBeginning(), range.includeEnd() );
454 emit dataChanged( index, index, QVector<int>() << role );
455 break;
456
457 default:
458 break;
459 }
460 return true;
461 }
462
463 default:
464 break;
465 }
466
467 return false;
468}
469
470void QgsRasterBandFixedTemporalRangeModel::setLayerData( QgsRasterLayer *layer, const QMap<int, QgsDateTimeRange> &ranges )
471{
472 beginResetModel();
473
474 mBandCount = layer->bandCount();
475 mRanges = ranges;
476
477 mBandNames.clear();
478 for ( int band = 1; band <= mBandCount; ++band )
479 {
480 mBandNames[band] = layer->dataProvider()->displayBandName( band );
481 }
482
483 endResetModel();
484}
485
486//
487// QgsFixedTemporalRangeDelegate
488//
489
490QgsFixedTemporalRangeDelegate::QgsFixedTemporalRangeDelegate( QObject *parent )
491 : QStyledItemDelegate( parent )
492{
493}
494
495QWidget *QgsFixedTemporalRangeDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const
496{
497 QgsDateTimeEdit *editor = new QgsDateTimeEdit( parent );
498 editor->setAllowNull( true );
499 return editor;
500}
501
502void QgsFixedTemporalRangeDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
503{
504 if ( QgsDateTimeEdit *dateTimeEdit = qobject_cast<QgsDateTimeEdit *>( editor ) )
505 {
506 model->setData( index, dateTimeEdit->dateTime() );
507 }
508}
TemporalUnit
Temporal units.
Definition qgis.h:4886
@ Milliseconds
Milliseconds.
@ Centuries
Centuries.
RasterTemporalMode
Raster layer temporal modes.
Definition qgis.h:2516
@ RepresentsTemporalValues
Pixel values represent an datetime.
@ RedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when raster symbo...
@ FixedRangePerBand
Layer has a fixed temporal range per band.
@ TemporalRangeFromDataProvider
Mode when raster layer delegates temporal range handling to the dataprovider.
@ FixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
@ UsesMultipleBands
The renderer utilizes multiple raster bands for color data (note that alpha bands are not considered ...
static QgsRasterRendererRegistry * rasterRendererRegistry()
Returns the application's raster renderer registry, used for managing raster layer renderers.
bool hasTemporalCapabilities() const
Returns true if the provider has temporal capabilities available.
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
void setAllowNull(bool allowNull)
Determines if the widget allows setting null date/time.
A generic dialog for building expression strings.
void setExpectedOutputFormat(const QString &expected)
Set the expected format string, which is shown in the dialog.
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
void setCustomPreviewGenerator(const QString &label, const QList< QPair< QString, QVariant > > &choices, const std::function< QgsExpressionContext(const QVariant &)> &previewContextGenerator)
Sets the widget to run using a custom preview generator.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
void setVariable(const QString &name, const QVariant &value, bool isStatic=false)
Convenience method for setting a variable in the context scope by name name and value.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
void appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
Class for parsing and evaluation of expressions (formerly called "search strings").
A representation of the interval between two datetime values.
Definition qgsinterval.h:46
double originalDuration() const
Returns the original interval duration.
Qgis::TemporalUnit originalUnit() const
Returns the original interval temporal unit.
A panel widget that can be shown in the map style dock.
QgsRasterDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
virtual QString bandDescription(int bandNumber)
Returns the description for band bandNumber, or an empty string if the band is not valid or has not d...
QString displayBandName(int bandNumber) const
Generates a friendly, descriptive name for the specified bandNumber.
void addWidget(QgsMapLayerConfigWidget *widget)
Adds a child widget to the properties widget.
void syncToLayer()
Updates the widget state to match the current layer state.
void saveTemporalProperties()
Save widget temporal properties inputs.
QgsRasterLayerTemporalPropertiesWidget(QWidget *parent=nullptr, QgsRasterLayer *layer=nullptr)
Constructor for QgsRasterLayerTemporalPropertiesWidget.
Implementation of map layer temporal properties for raster layers.
QDateTime temporalRepresentationOffset() const
Returns the temporal offset, which is a fixed datetime which should be added to individual pixel valu...
void setTemporalRepresentationOffset(const QDateTime &offset)
Sets the temporal offset, which is a fixed datetime which should be added to individual pixel values ...
const QgsInterval & temporalRepresentationScale() const
Returns the scale, which is an interval factor which should be applied to individual pixel values fro...
Qgis::RasterTemporalMode mode() const
Returns the temporal properties mode.
void setTemporalRepresentationScale(const QgsInterval &scale)
Sets the scale, which is an interval factor which should be applied to individual pixel values from t...
void setMode(Qgis::RasterTemporalMode mode)
Sets the temporal properties mode.
void setFixedTemporalRange(const QgsDateTimeRange &range)
Sets a temporal range to apply to the whole layer.
void setFixedRangePerBand(const QMap< int, QgsDateTimeRange > &ranges)
Sets the fixed temporal range for each band.
QMap< int, QgsDateTimeRange > fixedRangePerBand() const
Returns the fixed temporal range for each band.
int bandNumber() const
Returns the band number from which temporal values should be taken.
const QgsDateTimeRange & fixedTemporalRange() const
Returns the fixed temporal range for the layer.
void setBandNumber(int number)
Sets the band number from which temporal values should be taken.
Represents a raster layer.
int bandCount() const
Returns the number of bands in this layer.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Qgis::RasterRendererCapabilities rendererCapabilities(const QString &rendererName) const
Returns the capabilities for the renderer with the specified name.
virtual QString type() const
Returns a unique string representation of the renderer type.
@ CurrentPageOnly
Only the size of the current page is considered when calculating the stacked widget size.
bool isActive() const
Returns true if the temporal property is active.
void setIsActive(bool active)
Sets whether the temporal property is active.
T begin() const
Returns the beginning of the range.
Definition qgsrange.h:450
T end() const
Returns the upper bound of the range.
Definition qgsrange.h:457
bool includeEnd() const
Returns true if the end is inclusive, or false if the end is exclusive.
Definition qgsrange.h:472
bool includeBeginning() const
Returns true if the beginning is inclusive, or false if the beginning is exclusive.
Definition qgsrange.h:465
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:748
Single variable definition for use within a QgsExpressionContextScope.