QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
63  void exportAnimation();
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 
78  bool mHasTemporalLayersLoaded = false;
79 
80  void togglePlayForward();
81  void togglePlayBackward();
82  void togglePause();
83  bool mPlayingForward = true;
84 
85  std::unique_ptr< QMenu > mRangeMenu;
86  QAction *mRangeSetToProjectAction = nullptr;
87  QAction *mRangeSetToAllLayersAction = nullptr;
88 
89  std::unique_ptr< QMenu > mRangeLayersSubMenu;
90  QgsMapLayerModel *mMapLayerModel = nullptr;
91 
92  void firstTemporalLayerLoaded( QgsMapLayer *layer );
93  void setTimeStep( const QgsInterval &timeStep );
94 
95  private slots:
96 
101  void timeSlider_valueChanged( int value );
102 
106  void settings_clicked();
107 
111  void setDates( const QgsDateTimeRange &range );
112 
116  void setDatesToAllLayers();
117 
123  void setDatesToProjectTime();
124 
128  void updateSlider( const QgsDateTimeRange &range );
129 
133  void updateRangeLabel( const QgsDateTimeRange &range );
134 
138  void updateTemporalExtent();
139 
143  void updateFrameDuration();
144 
145  void setWidgetStateFromProject();
146 
147  void mNavigationOff_clicked();
148  void mNavigationFixedRange_clicked();
149  void mNavigationAnimated_clicked();
150  void setWidgetStateFromNavigationMode( const QgsTemporalNavigationObject::NavigationMode mode );
151 
152  void onLayersAdded( const QList<QgsMapLayer *> &layers );
153  void onProjectCleared();
154 
155  void startEndDateTime_changed();
156  void fixedRangeStartEndDateTime_changed();
157 
158  void saveRangeToProject();
159 
160  void aboutToShowRangeMenu();
161 
162  void mRangeSetToProjectAction_triggered();
163  void mRangeSetToAllLayersAction_triggered();
164 };
165 
166 #endif // QGSTEMPORALCONTROLLERWIDGET_H
qgstemporalnavigationobject.h
qgsrange.h
QgsTemporalNavigationObject::NavigationMode
NavigationMode
Represents the current temporal navigation mode.
Definition: qgstemporalnavigationobject.h:51
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsTemporalControllerWidget
Definition: qgstemporalcontrollerwidget.h:39
QgsTemporalController
Definition: qgstemporalcontroller.h:35
QgsPanelWidget::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
Definition: qgspanelwidget.cpp:112
QgsTemporalNavigationObject
Definition: qgstemporalnavigationobject.h:39
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsInterval
A representation of the interval between two datetime values.
Definition: qgsinterval.h:40
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:36