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