QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 );
239 expressionContext.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } );
240
241 QgsExpressionBuilderDialog dlg = QgsExpressionBuilderDialog( nullptr, isUpper ? mFixedRangeUpperExpression : mFixedRangeLowerExpression, this, QStringLiteral( "generic" ), expressionContext );
242 dlg.setExpectedOutputFormat( !isUpper ? tr( "Temporal range start date / time" ) : tr( "Temporal range end date / time" ) );
243
244 QList<QPair<QString, QVariant>> bandChoices;
245 for ( int band = 1; band <= mLayer->bandCount(); ++band )
246 {
247 bandChoices << qMakePair( mLayer->dataProvider()->displayBandName( band ), band );
248 }
249 dlg.expressionBuilder()->setCustomPreviewGenerator( tr( "Band" ), bandChoices, [this]( const QVariant &value ) -> QgsExpressionContext {
250 return createExpressionContextForBand( value.toInt() );
251 } );
252
253 if ( dlg.exec() )
254 {
255 if ( isUpper )
256 mFixedRangeUpperExpression = dlg.expressionText();
257 else
258 mFixedRangeLowerExpression = dlg.expressionText();
259
260 QgsExpression exp( dlg.expressionText() );
261 exp.prepare( &expressionContext );
262 for ( int band = 1; band <= mLayer->bandCount(); ++band )
263 {
264 bandScope->setVariable( QStringLiteral( "band" ), band );
265 bandScope->setVariable( QStringLiteral( "band_name" ), mLayer->dataProvider()->displayBandName( band ) );
266 bandScope->setVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( band ) );
267
268 const QVariant res = exp.evaluate( &expressionContext );
269 mFixedRangePerBandModel->setData( mFixedRangePerBandModel->index( band - 1, isUpper ? 2 : 1 ), res, Qt::EditRole );
270 }
271 }
272}
273
274QgsExpressionContext QgsRasterLayerTemporalPropertiesWidget::createExpressionContextForBand( int band ) const
275{
276 QgsExpressionContext context;
279 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band" ), band, true, false, tr( "Band number" ) ) );
280 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_name" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->displayBandName( band ) : QString(), true, false, tr( "Band name" ) ) );
281 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->bandDescription( band ) : QString(), true, false, tr( "Band description" ) ) );
282 context.appendScope( bandScope );
283 context.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" ) } );
284 return context;
285}
286
288
289//
290// QgsRasterBandFixedTemporalRangeModel
291//
292
293QgsRasterBandFixedTemporalRangeModel::QgsRasterBandFixedTemporalRangeModel( QObject *parent )
294 : QAbstractItemModel( parent )
295{
296}
297
298int QgsRasterBandFixedTemporalRangeModel::columnCount( const QModelIndex & ) const
299{
300 return 3;
301}
302
303int QgsRasterBandFixedTemporalRangeModel::rowCount( const QModelIndex &parent ) const
304{
305 if ( parent.isValid() )
306 return 0;
307 return mBandCount;
308}
309
310QModelIndex QgsRasterBandFixedTemporalRangeModel::index( int row, int column, const QModelIndex &parent ) const
311{
312 if ( hasIndex( row, column, parent ) )
313 {
314 return createIndex( row, column, row );
315 }
316
317 return QModelIndex();
318}
319
320QModelIndex QgsRasterBandFixedTemporalRangeModel::parent( const QModelIndex &child ) const
321{
322 Q_UNUSED( child )
323 return QModelIndex();
324}
325
326Qt::ItemFlags QgsRasterBandFixedTemporalRangeModel::flags( const QModelIndex &index ) const
327{
328 if ( !index.isValid() )
329 return Qt::ItemFlags();
330
331 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
332 return Qt::ItemFlags();
333
334 switch ( index.column() )
335 {
336 case 0:
337 return Qt::ItemFlag::ItemIsEnabled;
338 case 1:
339 case 2:
340 return Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsSelectable;
341 default:
342 break;
343 }
344
345 return Qt::ItemFlags();
346}
347
348QVariant QgsRasterBandFixedTemporalRangeModel::data( const QModelIndex &index, int role ) const
349{
350 if ( !index.isValid() )
351 return QVariant();
352
353 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
354 return QVariant();
355
356 const int band = index.row() + 1;
357 const QgsDateTimeRange range = mRanges.value( band );
358
359 switch ( role )
360 {
361 case Qt::DisplayRole:
362 case Qt::EditRole:
363 case Qt::ToolTipRole:
364 {
365 switch ( index.column() )
366 {
367 case 0:
368 return mBandNames.value( band, QString::number( band ) );
369
370 case 1:
371 return range.begin().isValid() ? range.begin() : QVariant();
372
373 case 2:
374 return range.end().isValid() ? range.end() : QVariant();
375
376 default:
377 break;
378 }
379 break;
380 }
381
382 case Qt::TextAlignmentRole:
383 {
384 switch ( index.column() )
385 {
386 case 0:
387 return static_cast<Qt::Alignment::Int>( Qt::AlignLeft | Qt::AlignVCenter );
388
389 case 1:
390 case 2:
391 return static_cast<Qt::Alignment::Int>( Qt::AlignRight | Qt::AlignVCenter );
392 default:
393 break;
394 }
395 break;
396 }
397
398 default:
399 break;
400 }
401 return QVariant();
402}
403
404QVariant QgsRasterBandFixedTemporalRangeModel::headerData( int section, Qt::Orientation orientation, int role ) const
405{
406 if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
407 {
408 switch ( section )
409 {
410 case 0:
411 return tr( "Band" );
412 case 1:
413 return tr( "Begin" );
414 case 2:
415 return tr( "End" );
416 default:
417 break;
418 }
419 }
420 return QAbstractItemModel::headerData( section, orientation, role );
421}
422
423bool QgsRasterBandFixedTemporalRangeModel::setData( const QModelIndex &index, const QVariant &value, int role )
424{
425 if ( !index.isValid() )
426 return false;
427
428 if ( index.row() > mBandCount || index.row() < 0 )
429 return false;
430
431 const int band = index.row() + 1;
432 const QgsDateTimeRange range = mRanges.value( band );
433
434 switch ( role )
435 {
436 case Qt::EditRole:
437 {
438 const QDateTime newValue = value.toDateTime();
439 if ( !newValue.isValid() )
440 return false;
441
442 switch ( index.column() )
443 {
444 case 1:
445 {
446 mRanges[band] = QgsDateTimeRange( newValue, range.end(), range.includeBeginning(), range.includeEnd() );
447 emit dataChanged( index, index, QVector<int>() << role );
448 break;
449 }
450
451 case 2:
452 mRanges[band] = QgsDateTimeRange( range.begin(), newValue, range.includeBeginning(), range.includeEnd() );
453 emit dataChanged( index, index, QVector<int>() << role );
454 break;
455
456 default:
457 break;
458 }
459 return true;
460 }
461
462 default:
463 break;
464 }
465
466 return false;
467}
468
469void QgsRasterBandFixedTemporalRangeModel::setLayerData( QgsRasterLayer *layer, const QMap<int, QgsDateTimeRange> &ranges )
470{
471 beginResetModel();
472
473 mBandCount = layer->bandCount();
474 mRanges = ranges;
475
476 mBandNames.clear();
477 for ( int band = 1; band <= mBandCount; ++band )
478 {
479 mBandNames[band] = layer->dataProvider()->displayBandName( band );
480 }
481
482 endResetModel();
483}
484
485//
486// QgsFixedTemporalRangeDelegate
487//
488
489QgsFixedTemporalRangeDelegate::QgsFixedTemporalRangeDelegate( QObject *parent )
490 : QStyledItemDelegate( parent )
491{
492}
493
494QWidget *QgsFixedTemporalRangeDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const
495{
496 QgsDateTimeEdit *editor = new QgsDateTimeEdit( parent );
497 editor->setAllowNull( true );
498 return editor;
499}
500
501void QgsFixedTemporalRangeDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
502{
503 if ( QgsDateTimeEdit *dateTimeEdit = qobject_cast<QgsDateTimeEdit *>( editor ) )
504 {
505 model->setData( index, dateTimeEdit->dateTime() );
506 }
507}
TemporalUnit
Temporal units.
Definition qgis.h:4868
@ Milliseconds
Milliseconds.
@ Centuries
Centuries.
RasterTemporalMode
Raster layer temporal modes.
Definition qgis.h:2498
@ 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:444
T end() const
Returns the upper bound of the range.
Definition qgsrange.h:451
bool includeEnd() const
Returns true if the end is inclusive, or false if the end is exclusive.
Definition qgsrange.h:466
bool includeBeginning() const
Returns true if the beginning is inclusive, or false if the beginning is exclusive.
Definition qgsrange.h:459
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:742
Single variable definition for use within a QgsExpressionContextScope.