35 mModeComboBox->addItem( tr(
"Fixed Time Range" ),
static_cast< int >( Qgis::VectorTemporalMode::FixedTemporalRange ) );
36 mModeComboBox->addItem( tr(
"Single Field with Date/Time" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField ) );
37 mModeComboBox->addItem( tr(
"Separate Fields for Start and End Date/Time" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields ) );
38 mModeComboBox->addItem( tr(
"Separate Fields for Start and Event Duration" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields ) );
39 mModeComboBox->addItem( tr(
"Start and End Date/Time from Expressions" ),
static_cast< int >( Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions ) );
40 mModeComboBox->addItem( tr(
"Redraw Layer Only" ),
static_cast< int >( Qgis::VectorTemporalMode::RedrawLayerOnly ) );
42 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), mStackedWidget, &QStackedWidget::setCurrentIndex );
43 connect( mModeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [ = ]
47 case Qgis::VectorTemporalMode::FixedTemporalRange:
48 case Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField:
49 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields:
50 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields:
51 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions:
52 mLimitsComboBox->show();
55 case Qgis::VectorTemporalMode::RedrawLayerOnly:
56 mLimitsComboBox->hide();
65 mStartTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
66 mEndTemporalDateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
68 mSingleFieldComboBox->setLayer( layer );
69 mStartFieldComboBox->setLayer( layer );
70 mEndFieldComboBox->setLayer( layer );
71 mDurationStartFieldComboBox->setLayer( layer );
72 mDurationFieldComboBox->setLayer( layer );
75 mStartFieldComboBox->setAllowEmptyFieldName(
true );
77 mEndFieldComboBox->setAllowEmptyFieldName(
true );
81 mFixedDurationSpinBox->setMinimum( 0 );
82 mFixedDurationSpinBox->setClearValue( 0 );
100 mDurationUnitsComboBox->addItem( title, u );
101 mFixedDurationUnitsComboBox->addItem( title, u );
104 mFixedDurationUnitsComboBox->setEnabled( !mAccumulateCheckBox->isChecked() );
105 mFixedDurationSpinBox->setEnabled( !mAccumulateCheckBox->isChecked() );
106 connect( mAccumulateCheckBox, &QCheckBox::toggled,
this, [ = ](
bool checked )
108 mFixedDurationUnitsComboBox->setEnabled( !checked );
109 mFixedDurationSpinBox->setEnabled( !checked );
112 mStartExpressionWidget->setAllowEmptyFieldName(
true );
113 mEndExpressionWidget->setAllowEmptyFieldName(
true );
114 mStartExpressionWidget->setLayer( layer );
115 mEndExpressionWidget->setLayer( layer );
116 mStartExpressionWidget->registerExpressionContextGenerator(
this );
117 mEndExpressionWidget->registerExpressionContextGenerator(
this );
126 properties->
setIsActive( mTemporalGroupBox->isChecked() );
130 const QgsDateTimeRange normalRange = QgsDateTimeRange( mStartTemporalDateTimeEdit->dateTime(),
131 mEndTemporalDateTimeEdit->dateTime() );
135 switch ( properties->
mode() )
137 case Qgis::VectorTemporalMode::FeatureDateTimeInstantFromField:
138 case Qgis::VectorTemporalMode::FixedTemporalRange:
139 case Qgis::VectorTemporalMode::RedrawLayerOnly:
140 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromExpressions:
141 properties->
setStartField( mSingleFieldComboBox->currentField() );
145 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndEndFromFields:
146 properties->
setStartField( mStartFieldComboBox->currentField() );
150 case Qgis::VectorTemporalMode::FeatureDateTimeStartAndDurationFromFields:
151 properties->
setStartField( mDurationStartFieldComboBox->currentField() );
156 properties->
setEndField( mEndFieldComboBox->currentField() );
174 mTemporalGroupBox->setChecked( properties->
isActive() );
176 mModeComboBox->setCurrentIndex( mModeComboBox->findData(
static_cast< int >( properties->
mode() ) ) );
177 mStackedWidget->setCurrentIndex(
static_cast< int >( properties->
mode() ) );
179 mLimitsComboBox->setCurrentIndex( mLimitsComboBox->findData(
static_cast< int >( properties->
limitMode() ) ) );
184 mFixedDurationSpinBox->setValue( properties->
fixedDuration() );
186 mSingleFieldComboBox->setField( properties->
startField() );
187 mStartFieldComboBox->setField( properties->
startField() );
188 mDurationStartFieldComboBox->setField( properties->
startField() );
189 mEndFieldComboBox->setField( properties->
endField() );
190 mDurationFieldComboBox->setField( properties->
durationField() );
191 mDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
192 mFixedDurationUnitsComboBox->setCurrentIndex( mDurationUnitsComboBox->findData( properties->
durationUnits() ) );
197 mEndExpressionWidget->setField( properties->
endExpression() );