QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  QgsTemporalController *temporalController();
55 
56 #ifndef SIP_RUN
57 
58  signals:
59 
64 
65 #endif
66 
67  protected:
68 
69  void keyPressEvent( QKeyEvent *e ) override;
70 
71  private:
72 
74  QgsTemporalNavigationObject *mNavigationObject = nullptr;
75 
76  int mBlockSettingUpdates = 0;
77  int mBlockFrameDurationUpdates = 0;
78 
79  bool mHasTemporalLayersLoaded = false;
80 
81  void togglePlayForward();
82  void togglePlayBackward();
83  void togglePause();
84  bool mPlayingForward = true;
85 
86  std::unique_ptr< QMenu > mRangeMenu;
87  QAction *mRangeSetToProjectAction = nullptr;
88  QAction *mRangeSetToAllLayersAction = nullptr;
89 
90  std::unique_ptr< QMenu > mRangeLayersSubMenu;
91  QgsMapLayerModel *mMapLayerModel = nullptr;
92 
93  void firstTemporalLayerLoaded( QgsMapLayer *layer );
94  void setTimeStep( const QgsInterval &timeStep );
95 
111  void updateTimeStepInputs( const QgsInterval &timeStep );
112 
113  private slots:
114 
119  void timeSlider_valueChanged( int value );
120 
124  void settings_clicked();
125 
129  void setDates( const QgsDateTimeRange &range );
130 
134  void setDatesToAllLayers();
135 
141  void setDatesToProjectTime();
142 
146  void updateSlider( const QgsDateTimeRange &range );
147 
151  void updateRangeLabel( const QgsDateTimeRange &range );
152 
156  void updateTemporalExtent();
157 
161  void updateFrameDuration();
162 
163  void setWidgetStateFromProject();
164 
165  void mNavigationOff_clicked();
166  void mNavigationFixedRange_clicked();
167  void mNavigationAnimated_clicked();
168  void setWidgetStateFromNavigationMode( const QgsTemporalNavigationObject::NavigationMode mode );
169 
170  void onLayersAdded( const QList<QgsMapLayer *> &layers );
171  void onProjectCleared();
172 
173  void startEndDateTime_changed();
174  void fixedRangeStartEndDateTime_changed();
175 
176  void saveRangeToProject();
177 
178  void aboutToShowRangeMenu();
179 
180  void mRangeSetToProjectAction_triggered();
181  void mRangeSetToAllLayersAction_triggered();
182 };
183 
184 #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:85
Base class for any widget that can be shown as a inline panel.
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