QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
96  private slots:
97 
102  void timeSlider_valueChanged( int value );
103 
107  void settings_clicked();
108 
112  void setDates( const QgsDateTimeRange &range );
113 
117  void setDatesToAllLayers();
118 
124  void setDatesToProjectTime();
125 
129  void updateSlider( const QgsDateTimeRange &range );
130 
134  void updateRangeLabel( const QgsDateTimeRange &range );
135 
139  void updateTemporalExtent();
140 
144  void updateFrameDuration();
145 
146  void setWidgetStateFromProject();
147 
148  void mNavigationOff_clicked();
149  void mNavigationFixedRange_clicked();
150  void mNavigationAnimated_clicked();
151  void setWidgetStateFromNavigationMode( const QgsTemporalNavigationObject::NavigationMode mode );
152 
153  void onLayersAdded( const QList<QgsMapLayer *> &layers );
154  void onProjectCleared();
155 
156  void startEndDateTime_changed();
157  void fixedRangeStartEndDateTime_changed();
158 
159  void saveRangeToProject();
160 
161  void aboutToShowRangeMenu();
162 
163  void mRangeSetToProjectAction_triggered();
164  void mRangeSetToAllLayersAction_triggered();
165 };
166 
167 #endif // QGSTEMPORALCONTROLLERWIDGET_H
QgsTemporalControllerWidget::exportAnimation
void exportAnimation()
Triggered when an animation should be exported.
qgstemporalnavigationobject.h
qgsrange.h
QgsTemporalNavigationObject::NavigationMode
NavigationMode
Represents the current temporal navigation mode.
Definition: qgstemporalnavigationobject.h:52
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsTemporalControllerWidget
A widget for controlling playback properties of a QgsTemporalController.
Definition: qgstemporalcontrollerwidget.h:40
QgsTemporalController
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
Definition: qgstemporalcontroller.h:42
QgsPanelWidget::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
Definition: qgspanelwidget.cpp:112
QgsTemporalNavigationObject
Implements a temporal controller based on a frame by frame navigation and animation.
Definition: qgstemporalnavigationobject.h:40
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsInterval
A representation of the interval between two datetime values.
Definition: qgsinterval.h:41
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsMapLayerModel
The QgsMapLayerModel class is a model to display layers in widgets.
Definition: qgsmaplayermodel.h:37