33 mModeComboBox->addItem( tr(
"Fixed Time Range" ),
static_cast< int >( Qgis::VectorTemporalMode::FixedTemporalRange ) );
34 mModeComboBox->addItem( tr(
"Single Field with Date/Time" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField ) );
35 mModeComboBox->addItem( tr(
"Separate Fields for Start and End Date/Time" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields ) );
36 mModeComboBox->addItem( tr(
"Separate Fields for Start and Event Duration" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields ) );
37 mModeComboBox->addItem( tr(
"Start and End Date/Time from Expressions" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions ) );
38 mModeComboBox->addItem( tr(
"Redraw Layer Only" ),
static_cast< int >( Qgis::VectorTemporalMode::RedrawLayerOnly ) );
40 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), mStackedWidget, &QStackedWidget::setCurrentIndex );
41 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ]
45 case Qgis::VectorTemporalMode::FixedTemporalRange:
46 case Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField:
47 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields:
48 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields:
49 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions:
50 mLimitsComboBox->show();
53 case Qgis::VectorTemporalMode::RedrawLayerOnly:
54 mLimitsComboBox->hide();
63 mStartTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
64 mEndTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
66 mSingleFieldComboBox->setLayer( layer );
67 mStartFieldComboBox->setLayer( layer );
68 mEndFieldComboBox->setLayer( layer );
69 mDurationStartFieldComboBox->setLayer( layer );
70 mDurationFieldComboBox->setLayer( layer );
73 mStartFieldComboBox->setAllowEmptyFieldName(
true );
75 mEndFieldComboBox->setAllowEmptyFieldName(
true );
79 mFixedDurationSpinBox->setMinimum( 0 );
80 mFixedDurationSpinBox->setClearValue( 0 );
84 Qgis::TemporalUnit::Milliseconds,
85 Qgis::TemporalUnit::Seconds,
86 Qgis::TemporalUnit::Minutes,
87 Qgis::TemporalUnit::Hours,
88 Qgis::TemporalUnit::Days,
89 Qgis::TemporalUnit::Weeks,
90 Qgis::TemporalUnit::Months,
91 Qgis::TemporalUnit::Years,
92 Qgis::TemporalUnit::Decades,
93 Qgis::TemporalUnit::Centuries
98 mDurationUnitsComboBox->addItem( title,
static_cast< int >( u ) );
99 mFixedDurationUnitsComboBox->addItem( title,
static_cast< int >( u ) );
102 mFixedDurationUnitsComboBox->setEnabled( !mAccumulateCheckBox->isChecked() );
103 mFixedDurationSpinBox->setEnabled( !mAccumulateCheckBox->isChecked() );
104 connect( mAccumulateCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
106 mFixedDurationUnitsComboBox->setEnabled( !checked );
107 mFixedDurationSpinBox->setEnabled( !checked );
110 mStartExpressionWidget->setAllowEmptyFieldName(
true );
111 mEndExpressionWidget->setAllowEmptyFieldName(
true );
112 mStartExpressionWidget->setLayer( layer );
113 mEndExpressionWidget->setLayer( layer );
114 mStartExpressionWidget->registerExpressionContextGenerator(
this );
115 mEndExpressionWidget->registerExpressionContextGenerator(
this );
124 properties->
setIsActive( mTemporalGroupBox->isChecked() );
128 const QgsDateTimeRange normalRange = QgsDateTimeRange( mStartTemporalDateTimeEdit->dateTime(),
129 mEndTemporalDateTimeEdit->dateTime() );
133 switch ( properties->
mode() )
135 case Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField:
136 case Qgis::VectorTemporalMode::FixedTemporalRange:
137 case Qgis::VectorTemporalMode::RedrawLayerOnly:
138 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions:
139 properties->
setStartField( mSingleFieldComboBox->currentField() );
143 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields:
144 properties->
setStartField( mStartFieldComboBox->currentField() );
148 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields:
149 properties->
setStartField( mDurationStartFieldComboBox->currentField() );
154 properties->
setEndField( mEndFieldComboBox->currentField() );
172 mTemporalGroupBox->setChecked( properties->
isActive() );
174 mModeComboBox->setCurrentIndex( mModeComboBox->findData(
static_cast< int >( properties->
mode() ) ) );
175 mStackedWidget->setCurrentIndex(
static_cast< int >( properties->
mode() ) );
177 mLimitsComboBox->setCurrentIndex( mLimitsComboBox->findData(
static_cast< int >( properties->
limitMode() ) ) );
182 mFixedDurationSpinBox->setValue( properties->
fixedDuration() );
184 mSingleFieldComboBox->setField( properties->
startField() );
185 mStartFieldComboBox->setField( properties->
startField() );
186 mDurationStartFieldComboBox->setField( properties->
startField() );
187 mEndFieldComboBox->setField( properties->
endField() );
188 mDurationFieldComboBox->setField( properties->
durationField() );
189 mDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData(
static_cast< int >( properties->
durationUnits() ) ) );
190 mFixedDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData(
static_cast< int >( properties->
durationUnits() ) ) );
195 mEndExpressionWidget->setField( properties->
endExpression() );
VectorTemporalMode
Vector layer temporal feature modes.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
TemporalUnit
Temporal units.
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 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, 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.
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.