QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
42 connect( mModeComboBox, qgis::overload<int>::of( &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() );
164 mSingleFieldComboBox->setField( properties->
startField() );
165 mStartFieldComboBox->setField( properties->
startField() );
166 mDurationStartFieldComboBox->setField( properties->
startField() );
168 if ( !properties->
endField().isEmpty() )
170 mEndFieldComboBox->setField( properties->
endField() );
172 mDurationFieldComboBox->setField( properties->
durationField() );
173 mDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
174 mFixedDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
179 mEndExpressionWidget->setField( properties->
endExpression() );
@ Numeric
All numeric fields.
@ TemporalDecades
Decades.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setStartField(const QString &field)
Sets the name of the start datetime field, which contains the start time for the feature's time spans...
void appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
QString endField() const
Returns the name of the end datetime field, which contains the end time for the feature's time spans.
const QgsDateTimeRange & fixedTemporalRange() const
Returns the fixed temporal range for the layer.
void setEndField(const QString &field)
Sets the name of the end datetime field, which contains the end time for the feature's time spans.
QgsUnitTypes::TemporalUnit durationUnits() const
Returns the units of the event's duration.
@ DateTime
Datetime fieldss.
void setStartExpression(const QString &expression)
Sets the expression to use for the start time for the feature's time spans.
@ Date
Date or datetime fields.
@ ModeFixedTemporalRange
Mode when temporal properties have fixed start and end datetimes.
static QgsGui::HigFlags higFlags()
Returns the platform's HIG flags.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
@ HigDialogTitleIsTitleCase
Dialog titles should be title case.
@ ModeFeatureDateTimeStartAndEndFromExpressions
Mode when features use expressions for start and end times.
TemporalUnit
Temporal units.
@ ModeFeatureDateTimeStartAndEndFromFields
Mode when features have separate fields for start and end times.
void setDurationField(const QString &field)
Sets the name of the duration field, which contains the duration of the event.
QString startExpression() const
Returns the expression for the start time for the feature's time spans.
@ TemporalSeconds
Seconds.
QString durationField() const
Returns the name of the duration field, which contains the duration of the event.
void setAccumulateFeatures(bool accumulate)
Sets whether features will be accumulated over time (i.e.
@ ModeFeatureDateTimeInstantFromField
Mode when features have a datetime instant taken from a single field.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns temporal properties associated with the vector layer.
bool isActive() const
Returns true if the temporal property is active.
void setFixedDuration(double duration)
Sets the fixed event duration, which contains the duration of the event.
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
QString endExpression() const
Returns the expression for the end time for the feature's time spans.
Implementation of map layer temporal properties for vector layers.
QString startField() const
Returns the name of the start datetime field, which contains the start time for the feature's time sp...
double fixedDuration() const
Returns the fixed duration length, which contains the duration of the event.
static QString capitalize(const QString &string, Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
void setIsActive(bool active)
Sets whether the temporal property is active.
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
TemporalMode mode() const
Returns the temporal properties mode.
void setDurationUnits(QgsUnitTypes::TemporalUnit units)
Sets the units of the event's duration.
@ ModeFeatureDateTimeStartAndDurationFromFields
Mode when features have a field for start time and a field for event duration.
@ TemporalMinutes
Minutes.
@ TemporalMilliseconds
Milliseconds.
@ TemporalCenturies
Centuries.
Represents a vector layer which manages a vector based data sets.
void setMode(TemporalMode mode)
Sets the temporal properties mode.
@ ModeRedrawLayerOnly
Redraw the layer when temporal range changes, but don't apply any filtering. Useful when symbology or...
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.
void setFixedTemporalRange(const QgsDateTimeRange &range)
Sets a temporal range to apply to the whole layer.
bool accumulateFeatures() const
Returns true if features will be accumulated over time (i.e.