QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgstemporalcontrollerwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstemporalcontrollerwidget.h
3  ---------------
4  begin : February 2020
5  copyright : (C) 2020 by Samweli Mwakisambwe
6  email : samweli at kartoza dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSTEMPORALCONTROLLERWIDGET_H
19 #define QGSTEMPORALCONTROLLERWIDGET_H
20 
21 #include "ui_qgstemporalcontrollerwidgetbase.h"
22 
23 #include "qgis_gui.h"
24 #include "qgsrange.h"
26 
27 class QgsMapLayer;
28 class QgsMapLayerModel;
31 class QgsInterval;
32 
39 class GUI_EXPORT QgsTemporalControllerWidget : public QgsPanelWidget, private Ui::QgsTemporalControllerWidgetBase
40 {
41  Q_OBJECT
42  public:
43 
47  QgsTemporalControllerWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
48 
54  QgsTemporalNavigationObject *temporalController();
55 
56  bool applySizeConstraintsToStack() const override;
57 
58 #ifndef SIP_RUN
59 
60  signals:
61 
66 
67 #endif
68 
69  protected:
70 
71  void keyPressEvent( QKeyEvent *e ) override;
72 
73  private:
74 
76  QgsTemporalNavigationObject *mNavigationObject = nullptr;
77 
78  int mBlockSettingUpdates = 0;
79  int mBlockFrameDurationUpdates = 0;
80 
81  bool mHasTemporalLayersLoaded = false;
82 
83  void togglePlayForward();
84  void togglePlayBackward();
85  void togglePause();
86  bool mPlayingForward = true;
87 
88  std::unique_ptr< QMenu > mRangeMenu;
89  QAction *mRangeSetToProjectAction = nullptr;
90  QAction *mRangeSetToAllLayersAction = nullptr;
91 
92  std::unique_ptr< QMenu > mRangeLayersSubMenu;
93  QgsMapLayerModel *mMapLayerModel = nullptr;
94 
95  void firstTemporalLayerLoaded( QgsMapLayer *layer );
96  void setTimeStep( const QgsInterval &timeStep );
97 
113  void updateTimeStepInputs( const QgsInterval &timeStep );
114 
115  private slots:
116 
121  void timeSlider_valueChanged( int value );
122 
126  void settings_clicked();
127 
131  void setDates( const QgsDateTimeRange &range );
132 
136  void setDatesToAllLayers();
137 
143  void setDatesToProjectTime();
144 
148  void updateSlider( const QgsDateTimeRange &range );
149 
153  void updateRangeLabel( const QgsDateTimeRange &range );
154 
158  void updateTemporalExtent();
159 
163  void updateFrameDuration();
164 
165  void setWidgetStateFromProject();
166 
167  void mNavigationOff_clicked();
168  void mNavigationFixedRange_clicked();
169  void mNavigationAnimated_clicked();
170  void setWidgetStateFromNavigationMode( const QgsTemporalNavigationObject::NavigationMode mode );
171 
172  void onLayersAdded( const QList<QgsMapLayer *> &layers );
173  void onProjectCleared();
174 
175  void startEndDateTime_changed();
176  void fixedRangeStartEndDateTime_changed();
177 
178  void saveRangeToProject();
179 
180  void aboutToShowRangeMenu();
181 
182  void mRangeSetToProjectAction_triggered();
183  void mRangeSetToAllLayersAction_triggered();
184 };
185 
186 #endif // QGSTEMPORALCONTROLLERWIDGET_H
A representation of the interval between two datetime values.
Definition: qgsinterval.h:42
The QgsMapLayerModel class is a model to display layers in widgets.
Base class for all map layer types.
Definition: qgsmaplayer.h:70
Base class for any widget that can be shown as a inline panel.
virtual bool applySizeConstraintsToStack() const
Returns true if the size constraints and hints for the panel widget should be applied to the parent Q...
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
A widget for controlling playback properties of a QgsTemporalController.
void exportAnimation()
Triggered when an animation should be exported.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
Implements a temporal controller based on a frame by frame navigation and animation.
NavigationMode
Represents the current temporal navigation mode.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53