19#include "moc_qgsvectorlayertemporalpropertieswidget.cpp"
41 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), mStackedWidget, &QStackedWidget::setCurrentIndex );
42 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ]
46 case Qgis::VectorTemporalMode::FixedTemporalRange:
47 case Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField:
48 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields:
49 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields:
50 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions:
51 mLimitsComboBox->show();
54 case Qgis::VectorTemporalMode::RedrawLayerOnly:
55 mLimitsComboBox->hide();
64 mStartTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
65 mEndTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
67 mSingleFieldComboBox->setLayer( layer );
68 mStartFieldComboBox->setLayer( layer );
69 mEndFieldComboBox->setLayer( layer );
70 mDurationStartFieldComboBox->setLayer( layer );
71 mDurationFieldComboBox->setLayer( layer );
74 mStartFieldComboBox->setAllowEmptyFieldName(
true );
76 mEndFieldComboBox->setAllowEmptyFieldName(
true );
80 mFixedDurationSpinBox->setMinimum( 0 );
81 mFixedDurationSpinBox->setClearValue( 0 );
99 mDurationUnitsComboBox->addItem( title,
static_cast< int >( u ) );
100 mFixedDurationUnitsComboBox->addItem( title,
static_cast< int >( u ) );
103 mFixedDurationUnitsComboBox->setEnabled( !mAccumulateCheckBox->isChecked() );
104 mFixedDurationSpinBox->setEnabled( !mAccumulateCheckBox->isChecked() );
105 connect( mAccumulateCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
107 mFixedDurationUnitsComboBox->setEnabled( !checked );
108 mFixedDurationSpinBox->setEnabled( !checked );
111 mStartExpressionWidget->setAllowEmptyFieldName(
true );
112 mEndExpressionWidget->setAllowEmptyFieldName(
true );
113 mStartExpressionWidget->setLayer( layer );
114 mEndExpressionWidget->setLayer( layer );
115 mStartExpressionWidget->registerExpressionContextGenerator(
this );
116 mEndExpressionWidget->registerExpressionContextGenerator(
this );
125 properties->
setIsActive( mTemporalGroupBox->isChecked() );
130 mEndTemporalDateTimeEdit->dateTime() );
134 switch ( properties->
mode() )
140 properties->
setStartField( mSingleFieldComboBox->currentField() );
145 properties->
setStartField( mStartFieldComboBox->currentField() );
150 properties->
setStartField( mDurationStartFieldComboBox->currentField() );
155 properties->
setEndField( mEndFieldComboBox->currentField() );
173 mTemporalGroupBox->setChecked( properties->
isActive() );
175 mModeComboBox->setCurrentIndex( mModeComboBox->findData(
static_cast< int >( properties->
mode() ) ) );
176 mStackedWidget->setCurrentIndex(
static_cast< int >( properties->
mode() ) );
178 mLimitsComboBox->setCurrentIndex( mLimitsComboBox->findData(
static_cast< int >( properties->
limitMode() ) ) );
183 mFixedDurationSpinBox->setValue( properties->
fixedDuration() );
185 mSingleFieldComboBox->setField( properties->
startField() );
186 mStartFieldComboBox->setField( properties->
startField() );
187 mDurationStartFieldComboBox->setField( properties->
startField() );
188 mEndFieldComboBox->setField( properties->
endField() );
189 mDurationFieldComboBox->setField( properties->
durationField() );
190 mDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData(
static_cast< int >( properties->
durationUnits() ) ) );
191 mFixedDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData(
static_cast< int >( properties->
durationUnits() ) ) );
196 mEndExpressionWidget->setField( properties->
endExpression() );
VectorTemporalMode
Vector layer temporal feature modes.
@ FeatureDateTimeStartAndDurationFromFields
Mode when features have a field for start time and a field for event duration.
@ RedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when symbology or...
@ FeatureDateTimeStartAndEndFromExpressions
Mode when features use expressions for start and end times.
@ FeatureDateTimeInstantFromField
Mode when features have a datetime instant taken from a single field.
@ FixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
@ FeatureDateTimeStartAndEndFromFields
Mode when features have separate fields for start and end times.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
TemporalUnit
Temporal units.
@ Milliseconds
Milliseconds.
VectorTemporalLimitMode
Mode for the handling of the limits of the filtering timeframe for vector features.
@ IncludeBeginExcludeEnd
Default mode: include the Begin limit, but exclude the End limit.
@ IncludeBeginIncludeEnd
Mode to include both limits of the filtering timeframe.
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 fields.
@ 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, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
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.
T end() const
Returns the upper bound of the range.
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
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 setMode(Qgis::VectorTemporalMode mode)
Sets the temporal properties mode.
void setStartExpression(const QString &expression)
Sets the expression to use for the start time for the feature's time spans.
Qgis::VectorTemporalLimitMode limitMode() const
Returns the temporal limit mode (to include or exclude begin/end limits).
void setLimitMode(Qgis::VectorTemporalLimitMode mode)
Sets the temporal limit mode (to include or exclude begin/end limits).
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.
void setEndExpression(const QString &endExpression)
Sets the expression to use for the end time for the feature's time spans.
QString durationField() const
Returns the name of the duration field, which contains the duration of the event.
void setDurationUnits(Qgis::TemporalUnit units)
Sets the units of the event's duration.
QString endField() const
Returns the name of the end datetime field, which contains the end time for the feature's time spans.
Qgis::TemporalUnit durationUnits() const
Returns the units of the event's duration.
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.
Qgis::VectorTemporalMode mode() const
Returns the temporal properties mode.
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 the layer's temporal properties.
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.