QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgstemporalnavigationobject.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstemporalnavigationobject.h
3  ---------------
4  begin : March 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 
19 #ifndef QGSTEMPORALNAVIGATIONOBJECT_H
20 #define QGSTEMPORALNAVIGATIONOBJECT_H
21 
22 #include "qgis_core.h"
23 #include "qgsrange.h"
24 #include "qgsinterval.h"
25 #include "qgstemporalcontroller.h"
27 
28 #include <QList>
29 #include <QTimer>
30 
31 class QgsMapLayer;
32 
40 {
41  Q_OBJECT
42 
43  public:
44 
48  QgsTemporalNavigationObject( QObject *parent SIP_TRANSFERTHIS = nullptr );
49 
52  {
56  };
57 
60  {
63  Idle,
64  };
65 
71  void setAnimationState( AnimationState state );
72 
78  AnimationState animationState() const;
79 
85  void setNavigationMode( const NavigationMode mode );
86 
92  NavigationMode navigationMode() const { return mNavigationMode; }
93 
102  void setTemporalExtents( const QgsDateTimeRange &extents );
103 
110  QgsDateTimeRange temporalExtents() const;
111 
120  void setCurrentFrameNumber( long long frame );
121 
127  long long currentFrameNumber() const;
128 
136  void setFrameDuration( QgsInterval duration );
137 
143  QgsInterval frameDuration() const;
144 
151  QgsDateTimeRange dateTimeRangeForFrameNumber( long long frame ) const;
152 
161  void setFramesPerSecond( double rate );
162 
171  double framesPerSecond() const;
172 
178  void setTemporalRangeCumulative( bool state );
179 
185  bool temporalRangeCumulative() const;
186 
190  long long totalFrameCount();
191 
197  bool isLooping() const;
198 
204  void setLooping( bool loop );
205 
207 
208  signals:
209 
213  void stateChanged( AnimationState state );
214 
218  void navigationModeChanged( NavigationMode mode );
219 
220  public slots:
221 
226  void play();
227 
237  void pause();
238 
242  void playForward();
243 
247  void playBackward();
248 
255  void next();
256 
263  void previous();
264 
268  void rewindToStart();
269 
273  void skipToEnd();
274 
275  private slots:
276 
278  void timerTimeout();
279 
280  private:
281 
283  QgsDateTimeRange mTemporalExtents;
284 
285  NavigationMode mNavigationMode = NavigationOff;
286 
288  long long mCurrentFrameNumber = 0;
289 
291  QgsInterval mFrameDuration;
292 
294  double mFramesPerSecond = 1;
295 
297  QTimer *mNewFrameTimer = nullptr;
298 
300  AnimationState mPlayBackMode = Idle;
301 
302  bool mLoopAnimation = false;
303 
304  bool mCumulativeTemporalRange = false;
305 
307  QgsTemporalNavigationObject &operator= ( const QgsTemporalNavigationObject & ) = delete;
308 };
309 
310 #endif // QGSTEMPORALNAVIGATIONOBJECT_H
QgsTemporalNavigationObject::Animated
@ Animated
Temporal navigation relies on frames within a datetime range.
Definition: qgstemporalnavigationobject.h:54
QgsTemporalNavigationObject::Reverse
@ Reverse
Animation is playing in reverse.
Definition: qgstemporalnavigationobject.h:62
qgsinterval.h
QgsTemporalNavigationObject::navigationMode
NavigationMode navigationMode() const
Returns the currenttemporal navigation mode.
Definition: qgstemporalnavigationobject.h:92
QgsExpressionContextScopeGenerator
Definition: qgsexpressioncontextscopegenerator.h:28
qgsrange.h
QgsTemporalNavigationObject::NavigationMode
NavigationMode
Represents the current temporal navigation mode.
Definition: qgstemporalnavigationobject.h:51
QgsTemporalNavigationObject::Forward
@ Forward
Animation is playing forward.
Definition: qgstemporalnavigationobject.h:61
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
qgstemporalcontroller.h
QgsTemporalController
Definition: qgstemporalcontroller.h:35
QgsTemporalNavigationObject::Idle
@ Idle
Animation is paused.
Definition: qgstemporalnavigationobject.h:63
QgsTemporalNavigationObject
Definition: qgstemporalnavigationobject.h:39
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:111
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsInterval
A representation of the interval between two datetime values.
Definition: qgsinterval.h:40
QgsTemporalNavigationObject::NavigationOff
@ NavigationOff
Temporal navigation is disabled.
Definition: qgstemporalnavigationobject.h:53
QgsTemporalNavigationObject::AnimationState
AnimationState
Represents the current animation state.
Definition: qgstemporalnavigationobject.h:59
qgsexpressioncontextscopegenerator.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsTemporalNavigationObject::FixedRange
@ FixedRange
Temporal navigation relies on a fixed datetime range.
Definition: qgstemporalnavigationobject.h:55
QgsExpressionContextScopeGenerator::createExpressionContextScope
virtual QgsExpressionContextScope * createExpressionContextScope() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...