42 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), mStackedWidget, &QStackedWidget::setCurrentIndex );
44 mStartTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
45 mEndTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
47 mSingleFieldComboBox->setLayer( layer );
48 mStartFieldComboBox->setLayer( layer );
49 mEndFieldComboBox->setLayer( layer );
50 mDurationStartFieldComboBox->setLayer( layer );
51 mDurationFieldComboBox->setLayer( layer );
54 mStartFieldComboBox->setAllowEmptyFieldName(
true );
56 mEndFieldComboBox->setAllowEmptyFieldName(
true );
60 mFixedDurationSpinBox->setMinimum( 0 );
61 mFixedDurationSpinBox->setClearValue( 0 );
79 mDurationUnitsComboBox->addItem( title, u );
80 mFixedDurationUnitsComboBox->addItem( title, u );
83 mFixedDurationUnitsComboBox->setEnabled( !mAccumulateCheckBox->isChecked() );
84 mFixedDurationSpinBox->setEnabled( !mAccumulateCheckBox->isChecked() );
85 connect( mAccumulateCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
87 mFixedDurationUnitsComboBox->setEnabled( !checked );
88 mFixedDurationSpinBox->setEnabled( !checked );
91 mStartExpressionWidget->setAllowEmptyFieldName(
true );
92 mEndExpressionWidget->setAllowEmptyFieldName(
true );
93 mStartExpressionWidget->setLayer( layer );
94 mEndExpressionWidget->setLayer( layer );
95 mStartExpressionWidget->registerExpressionContextGenerator(
this );
96 mEndExpressionWidget->registerExpressionContextGenerator(
this );
105 properties->
setIsActive( mTemporalGroupBox->isChecked() );
108 QgsDateTimeRange normalRange = QgsDateTimeRange( mStartTemporalDateTimeEdit->dateTime(),
109 mEndTemporalDateTimeEdit->dateTime() );
113 switch ( properties->
mode() )
119 properties->
setStartField( mSingleFieldComboBox->currentField() );
124 properties->
setStartField( mStartFieldComboBox->currentField() );
129 properties->
setStartField( mDurationStartFieldComboBox->currentField() );
134 properties->
setEndField( mEndFieldComboBox->currentField() );
152 mTemporalGroupBox->setChecked( properties->
isActive() );
154 mModeComboBox->setCurrentIndex( mModeComboBox->findData( properties->
mode() ) );
155 mStackedWidget->setCurrentIndex(
static_cast< int >( properties->
mode() ) );
160 mFixedDurationSpinBox->setValue( properties->
fixedDuration() );
162 mSingleFieldComboBox->setField( properties->
startField() );
163 mStartFieldComboBox->setField( properties->
startField() );
164 mDurationStartFieldComboBox->setField( properties->
startField() );
165 mEndFieldComboBox->setField( properties->
endField() );
166 mDurationFieldComboBox->setField( properties->
durationField() );
167 mDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
168 mFixedDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
173 mEndExpressionWidget->setField( properties->
endExpression() );
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 appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
@ DateTime
Datetime fieldss.
@ Date
Date or datetime fields.
@ Numeric
All numeric fields.
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
static QString capitalize(const QString &string, Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
bool isActive() const
Returns true if the temporal property is active.
void setIsActive(bool active)
Sets whether the temporal property is active.
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
TemporalUnit
Temporal units.
@ TemporalMilliseconds
Milliseconds.
@ TemporalDecades
Decades.
@ TemporalCenturies
Centuries.
@ TemporalSeconds
Seconds.
@ TemporalMinutes
Minutes.
Implementation of map layer temporal properties for vector layers.
QString endExpression() const
Returns the expression for the end time for the feature's time spans.
void setDurationField(const QString &field)
Sets the name of the duration field, which contains the duration of the event.
void setStartExpression(const QString &expression)
Sets the expression to use for the start time for the feature's time spans.
void setMode(TemporalMode mode)
Sets the temporal properties mode.
const QgsDateTimeRange & fixedTemporalRange() const
Returns the fixed temporal range for the layer.
double fixedDuration() const
Returns the fixed duration length, which contains the duration of the event.
bool accumulateFeatures() const
Returns true if features will be accumulated over time (i.e.
void setFixedTemporalRange(const QgsDateTimeRange &range)
Sets a temporal range to apply to the whole layer.
QgsUnitTypes::TemporalUnit durationUnits() const
Returns the units of the event's duration.
void setEndExpression(const QString &endExpression)
Sets the expression to use for the end time for the feature's time spans.
TemporalMode
Mode of the vector temporal properties.
@ ModeFeatureDateTimeStartAndDurationFromFields
Mode when features have a field for start time and a field for event duration.
@ ModeFeatureDateTimeInstantFromField
Mode when features have a datetime instant taken from a single field.
@ ModeFixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
@ ModeFeatureDateTimeStartAndEndFromFields
Mode when features have separate fields for start and end times.
@ ModeRedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when symbology or...
@ ModeFeatureDateTimeStartAndEndFromExpressions
Mode when features use expressions for start and end times.
QString durationField() const
Returns the name of the duration field, which contains the duration of the event.
QString endField() const
Returns the name of the end datetime field, which contains the end time for the feature's time spans.
void setDurationUnits(QgsUnitTypes::TemporalUnit units)
Sets the units of the event's duration.
TemporalMode mode() const
Returns the temporal properties mode.
void setAccumulateFeatures(bool accumulate)
Sets whether features will be accumulated over time (i.e.
void setFixedDuration(double duration)
Sets the fixed event duration, which contains the duration of the event.
void setEndField(const QString &field)
Sets the name of the end datetime field, which contains the end time for the feature's time spans.
QString startField() const
Returns the name of the start datetime field, which contains the start time for the feature's time sp...
void setStartField(const QString &field)
Sets the name of the start datetime field, which contains the start time for the feature's time spans...
QString startExpression() const
Returns the expression for the start time for the feature's time spans.
Represents a vector layer which manages a vector based data sets.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns temporal properties associated with the vector layer.