QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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
29#include <QMenu>
30#include <QAction>
31
33 : QWidget( parent )
34 , mLayer( layer )
35{
36 Q_ASSERT( mLayer );
37 setupUi( this );
38
39 // make a useful default expression for per band ranges, just to give users some hints about how to do this...
40 mFixedRangeLowerExpression = QStringLiteral( "make_datetime(%1,1,1,0,0,0) + make_interval(days:=@band)" ).arg( QDate::currentDate().year() );
41 mFixedRangeUpperExpression = QStringLiteral( "make_datetime(%1,1,1,23,59,59) + make_interval(days:=@band)" ).arg( QDate::currentDate().year() );
42
43 mExtraWidgetLayout = new QVBoxLayout();
44 mExtraWidgetLayout->setContentsMargins( 0, 0, 0, 0 );
45 mExtraWidgetLayout->addStretch();
46 mExtraWidgetContainer->setLayout( mExtraWidgetLayout );
47
49 {
50 mModeComboBox->addItem( tr( "Automatic" ), QVariant::fromValue( Qgis::RasterTemporalMode::TemporalRangeFromDataProvider ) );
51 }
52 mModeComboBox->addItem( tr( "Fixed Time Range" ), QVariant::fromValue( Qgis::RasterTemporalMode::FixedTemporalRange ) );
53 mModeComboBox->addItem( tr( "Fixed Time Range Per Band" ), QVariant::fromValue( Qgis::RasterTemporalMode::FixedRangePerBand ) );
54 mModeComboBox->addItem( tr( "Represents Temporal Values" ), QVariant::fromValue( Qgis::RasterTemporalMode::RepresentsTemporalValues ) );
55 mModeComboBox->addItem( tr( "Redraw Layer Only" ), QVariant::fromValue( Qgis::RasterTemporalMode::RedrawLayerOnly ) );
56
57 for ( const Qgis::TemporalUnit unit :
58 {
69 } )
70 {
71 mScaleUnitComboBox->addItem( QgsUnitTypes::toString( unit ), static_cast< int >( unit ) );
72 }
73 mScaleUnitComboBox->setCurrentIndex( mScaleUnitComboBox->findData( static_cast< int >( Qgis::TemporalUnit::Days ) ) );
74
75 mStackedWidget->setSizeMode( QgsStackedWidget::SizeMode::CurrentPageOnly );
76
77 mFixedRangePerBandModel = new QgsRasterBandFixedTemporalRangeModel( this );
78 mBandRangesTable->verticalHeader()->setVisible( false );
79 mBandRangesTable->setModel( mFixedRangePerBandModel );
80 QgsFixedTemporalRangeDelegate *tableDelegate = new QgsFixedTemporalRangeDelegate( mBandRangesTable );
81 mBandRangesTable->setItemDelegateForColumn( 1, tableDelegate );
82 mBandRangesTable->setItemDelegateForColumn( 2, tableDelegate );
83
84 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), this, &QgsRasterLayerTemporalPropertiesWidget::modeChanged );
85
86 connect( mTemporalGroupBox, &QGroupBox::toggled, this, &QgsRasterLayerTemporalPropertiesWidget::temporalGroupBoxChecked );
87
88 mStartTemporalDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
89 mEndTemporalDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
90 mOffsetDateTimeEdit->setDisplayFormat( QStringLiteral( "yyyy-MM-dd HH:mm:ss" ) );
91
92 QMenu *calculateFixedRangePerBandMenu = new QMenu( mCalculateFixedRangePerBandButton );
93 mCalculateFixedRangePerBandButton->setMenu( calculateFixedRangePerBandMenu );
94 mCalculateFixedRangePerBandButton->setPopupMode( QToolButton::InstantPopup );
95 QAction *calculateLowerAction = new QAction( "Calculate Beginning by Expression…", calculateFixedRangePerBandMenu );
96 calculateFixedRangePerBandMenu->addAction( calculateLowerAction );
97 connect( calculateLowerAction, &QAction::triggered, this, [this]
98 {
99 calculateRangeByExpression( false );
100 } );
101 QAction *calculateUpperAction = new QAction( "Calculate End by Expression…", calculateFixedRangePerBandMenu );
102 calculateFixedRangePerBandMenu->addAction( calculateUpperAction );
103 connect( calculateUpperAction, &QAction::triggered, this, [this]
104 {
105 calculateRangeByExpression( true );
106 } );
107
108
109 syncToLayer();
110}
111
113{
114 mLayer->temporalProperties()->setIsActive( mTemporalGroupBox->isChecked() );
115
116 QgsRasterLayerTemporalProperties *temporalProperties = qobject_cast< QgsRasterLayerTemporalProperties * >( mLayer->temporalProperties() );
117
118 temporalProperties->setMode( mModeComboBox->currentData().value< Qgis::RasterTemporalMode >() );
119 temporalProperties->setBandNumber( mBandComboBox->currentBand() );
120
121 const QgsDateTimeRange normalRange = QgsDateTimeRange( mStartTemporalDateTimeEdit->dateTime(),
122 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
161 mBandComboBox->setLayer( mLayer );
162 mBandComboBox->setBand( temporalProperties->bandNumber() );
163
164 mStartTemporalDateTimeEdit->setDateTime( temporalProperties->fixedTemporalRange().begin() );
165 mEndTemporalDateTimeEdit->setDateTime( temporalProperties->fixedTemporalRange().end() );
166
167 mFixedRangePerBandModel->setLayerData( mLayer, temporalProperties->fixedRangePerBand() );
168 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
169 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
170 mBandRangesTable->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
171
172 mOffsetDateTimeEdit->setDateTime( temporalProperties->temporalRepresentationOffset() );
173
174 mScaleSpinBox->setValue( temporalProperties->temporalRepresentationScale().originalDuration() );
175 mScaleUnitComboBox->setCurrentIndex( mScaleUnitComboBox->findData( static_cast< int >( temporalProperties->temporalRepresentationScale().originalUnit() ) ) );
176
177 mTemporalGroupBox->setChecked( temporalProperties->isActive() );
178
179 for ( QgsMapLayerConfigWidget *widget : std::as_const( mExtraWidgets ) )
180 {
181 widget->syncToLayer( mLayer );
182 }
183}
184
186{
187 mExtraWidgets << widget;
188 mExtraWidgetLayout->insertWidget( mExtraWidgetLayout->count() - 1, widget );
189}
190
191void QgsRasterLayerTemporalPropertiesWidget::temporalGroupBoxChecked( bool checked )
192{
193 for ( QgsMapLayerConfigWidget *widget : std::as_const( mExtraWidgets ) )
194 {
195 widget->emit dynamicTemporalControlToggled( checked );
196 }
197}
198
199void QgsRasterLayerTemporalPropertiesWidget::modeChanged()
200{
201 if ( mModeComboBox->currentData().isValid() )
202 {
203 switch ( mModeComboBox->currentData().value< Qgis::RasterTemporalMode >() )
204 {
206 mStackedWidget->setCurrentWidget( mPageAutomatic );
207 break;
209 mStackedWidget->setCurrentWidget( mPageFixedRange );
210 break;
212 mStackedWidget->setCurrentWidget( mPageRedrawOnly );
213 break;
215 mStackedWidget->setCurrentWidget( mPageFixedRangePerBand );
216 break;
218 mStackedWidget->setCurrentWidget( mPageRepresentsTemporalValues );
219 break;
220 }
221 }
222}
223
224void QgsRasterLayerTemporalPropertiesWidget::calculateRangeByExpression( bool isUpper )
225{
226 QgsExpressionContext expressionContext;
228 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band" ), 1, true, false, tr( "Band number" ) ) );
229 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_name" ), mLayer->dataProvider()->displayBandName( 1 ), true, false, tr( "Band name" ) ) );
230 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( 1 ), true, false, tr( "Band description" ) ) );
231
232 expressionContext.appendScope( bandScope );
233 expressionContext.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" )} );
234
235 QgsExpressionBuilderDialog dlg = QgsExpressionBuilderDialog( nullptr, isUpper ? mFixedRangeUpperExpression : mFixedRangeLowerExpression, this, QStringLiteral( "generic" ), expressionContext );
236 dlg.setExpectedOutputFormat( !isUpper ? tr( "Temporal range start date / time" ) : tr( "Temporal range end date / time" ) );
237
238 QList<QPair<QString, QVariant> > bandChoices;
239 for ( int band = 1; band <= mLayer->bandCount(); ++band )
240 {
241 bandChoices << qMakePair( mLayer->dataProvider()->displayBandName( band ), band );
242 }
243 dlg.expressionBuilder()->setCustomPreviewGenerator( tr( "Band" ), bandChoices, [this]( const QVariant & value )-> QgsExpressionContext
244 {
245 return createExpressionContextForBand( value.toInt() );
246 } );
247
248 if ( dlg.exec() )
249 {
250 if ( isUpper )
251 mFixedRangeUpperExpression = dlg.expressionText();
252 else
253 mFixedRangeLowerExpression = dlg.expressionText();
254
255 QgsExpression exp( dlg.expressionText() );
256 exp.prepare( &expressionContext );
257 for ( int band = 1; band <= mLayer->bandCount(); ++band )
258 {
259 bandScope->setVariable( QStringLiteral( "band" ), band );
260 bandScope->setVariable( QStringLiteral( "band_name" ), mLayer->dataProvider()->displayBandName( band ) );
261 bandScope->setVariable( QStringLiteral( "band_description" ), mLayer->dataProvider()->bandDescription( band ) );
262
263 const QVariant res = exp.evaluate( &expressionContext );
264 mFixedRangePerBandModel->setData( mFixedRangePerBandModel->index( band - 1, isUpper ? 2 : 1 ), res, Qt::EditRole );
265 }
266 }
267}
268
269QgsExpressionContext QgsRasterLayerTemporalPropertiesWidget::createExpressionContextForBand( int band ) const
270{
271 QgsExpressionContext context;
274 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band" ), band, true, false, tr( "Band number" ) ) );
275 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_name" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->displayBandName( band ) : QString(), true, false, tr( "Band name" ) ) );
276 bandScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "band_description" ), ( mLayer && mLayer->dataProvider() ) ? mLayer->dataProvider()->bandDescription( band ) : QString(), true, false, tr( "Band description" ) ) );
277 context.appendScope( bandScope );
278 context.setHighlightedVariables( { QStringLiteral( "band" ), QStringLiteral( "band_name" ), QStringLiteral( "band_description" )} );
279 return context;
280}
281
283
284//
285// QgsRasterBandFixedTemporalRangeModel
286//
287
288QgsRasterBandFixedTemporalRangeModel::QgsRasterBandFixedTemporalRangeModel( QObject *parent )
289 : QAbstractItemModel( parent )
290{
291
292}
293
294int QgsRasterBandFixedTemporalRangeModel::columnCount( const QModelIndex & ) const
295{
296 return 3;
297}
298
299int QgsRasterBandFixedTemporalRangeModel::rowCount( const QModelIndex &parent ) const
300{
301 if ( parent.isValid() )
302 return 0;
303 return mBandCount;
304}
305
306QModelIndex QgsRasterBandFixedTemporalRangeModel::index( int row, int column, const QModelIndex &parent ) const
307{
308 if ( hasIndex( row, column, parent ) )
309 {
310 return createIndex( row, column, row );
311 }
312
313 return QModelIndex();
314}
315
316QModelIndex QgsRasterBandFixedTemporalRangeModel::parent( const QModelIndex &child ) const
317{
318 Q_UNUSED( child )
319 return QModelIndex();
320}
321
322Qt::ItemFlags QgsRasterBandFixedTemporalRangeModel::flags( const QModelIndex &index ) const
323{
324 if ( !index.isValid() )
325 return Qt::ItemFlags();
326
327 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
328 return Qt::ItemFlags();
329
330 switch ( index.column() )
331 {
332 case 0:
333 return Qt::ItemFlag::ItemIsEnabled;
334 case 1:
335 case 2:
336 return Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsEditable | Qt::ItemFlag::ItemIsSelectable;
337 default:
338 break;
339 }
340
341 return Qt::ItemFlags();
342}
343
344QVariant QgsRasterBandFixedTemporalRangeModel::data( const QModelIndex &index, int role ) const
345{
346 if ( !index.isValid() )
347 return QVariant();
348
349 if ( index.row() < 0 || index.row() >= mBandCount || index.column() < 0 || index.column() >= columnCount() )
350 return QVariant();
351
352 const int band = index.row() + 1;
353 const QgsDateTimeRange range = mRanges.value( band );
354
355 switch ( role )
356 {
357 case Qt::DisplayRole:
358 case Qt::EditRole:
359 case Qt::ToolTipRole:
360 {
361 switch ( index.column() )
362 {
363 case 0:
364 return mBandNames.value( band, QString::number( band ) );
365
366 case 1:
367 return range.begin().isValid() ? range.begin() : QVariant();
368
369 case 2:
370 return range.end().isValid() ? range.end() : QVariant();
371
372 default:
373 break;
374 }
375 break;
376 }
377
378 case Qt::TextAlignmentRole:
379 {
380 switch ( index.column() )
381 {
382 case 0:
383 return static_cast<Qt::Alignment::Int>( Qt::AlignLeft | Qt::AlignVCenter );
384
385 case 1:
386 case 2:
387 return static_cast<Qt::Alignment::Int>( Qt::AlignRight | Qt::AlignVCenter );
388 default:
389 break;
390 }
391 break;
392 }
393
394 default:
395 break;
396 }
397 return QVariant();
398}
399
400QVariant QgsRasterBandFixedTemporalRangeModel::headerData( int section, Qt::Orientation orientation, int role ) const
401{
402 if ( role == Qt::DisplayRole && orientation == Qt::Horizontal )
403 {
404 switch ( section )
405 {
406 case 0:
407 return tr( "Band" );
408 case 1:
409 return tr( "Begin" );
410 case 2:
411 return tr( "End" );
412 default:
413 break;
414 }
415 }
416 return QAbstractItemModel::headerData( section, orientation, role );
417}
418
419bool QgsRasterBandFixedTemporalRangeModel::setData( const QModelIndex &index, const QVariant &value, int role )
420{
421 if ( !index.isValid() )
422 return false;
423
424 if ( index.row() > mBandCount || index.row() < 0 )
425 return false;
426
427 const int band = index.row() + 1;
428 const QgsDateTimeRange range = mRanges.value( band );
429
430 switch ( role )
431 {
432 case Qt::EditRole:
433 {
434 const QDateTime newValue = value.toDateTime();
435 if ( !newValue.isValid() )
436 return false;
437
438 switch ( index.column() )
439 {
440 case 1:
441 {
442 mRanges[band] = QgsDateTimeRange( newValue, range.end(), range.includeBeginning(), range.includeEnd() );
443 emit dataChanged( index, index, QVector<int>() << role );
444 break;
445 }
446
447 case 2:
448 mRanges[band] = QgsDateTimeRange( range.begin(), newValue, range.includeBeginning(), range.includeEnd() );
449 emit dataChanged( index, index, QVector<int>() << role );
450 break;
451
452 default:
453 break;
454 }
455 return true;
456 }
457
458 default:
459 break;
460 }
461
462 return false;
463}
464
465void QgsRasterBandFixedTemporalRangeModel::setLayerData( QgsRasterLayer *layer, const QMap<int, QgsDateTimeRange> &ranges )
466{
467 beginResetModel();
468
469 mBandCount = layer->bandCount();
470 mRanges = ranges;
471
472 mBandNames.clear();
473 for ( int band = 1; band <= mBandCount; ++band )
474 {
475 mBandNames[band] = layer->dataProvider()->displayBandName( band );
476 }
477
478 endResetModel();
479}
480
481//
482// QgsFixedTemporalRangeDelegate
483//
484
485QgsFixedTemporalRangeDelegate::QgsFixedTemporalRangeDelegate( QObject *parent )
486 : QStyledItemDelegate( parent )
487{
488
489}
490
491QWidget *QgsFixedTemporalRangeDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const
492{
493 QgsDateTimeEdit *editor = new QgsDateTimeEdit( parent );
494 editor->setAllowNull( true );
495 return editor;
496}
497
498void QgsFixedTemporalRangeDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
499{
500 if ( QgsDateTimeEdit *dateTimeEdit = qobject_cast< QgsDateTimeEdit * >( editor ) )
501 {
502 model->setData( index, dateTimeEdit->dateTime() );
503 }
504}
TemporalUnit
Temporal units.
Definition qgis.h:4815
@ Milliseconds
Milliseconds.
@ Centuries
Centuries.
RasterTemporalMode
Raster layer temporal modes.
Definition qgis.h:2453
@ 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.
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.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
@ 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.