QGIS API Documentation  3.17.0-Master (a035f434f4)
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() const;
191 
197  bool isLooping() const;
198 
204  void setLooping( bool loop );
205 
209  long findBestFrameNumberForFrameStart( const QDateTime &frameStart ) const;
210 
212 
213  signals:
214 
218  void stateChanged( AnimationState state );
219 
223  void navigationModeChanged( NavigationMode mode );
224 
228  void temporalExtentsChanged( const QgsDateTimeRange &extent );
229 
233  void temporalFrameDurationChanged( const QgsInterval &interval );
234 
235 
236  public slots:
237 
242  void play();
243 
253  void pause();
254 
258  void playForward();
259 
263  void playBackward();
264 
271  void next();
272 
279  void previous();
280 
284  void rewindToStart();
285 
289  void skipToEnd();
290 
291  private slots:
292 
294  void timerTimeout();
295 
296  private:
297 
299  QgsDateTimeRange mTemporalExtents;
300 
301  NavigationMode mNavigationMode = NavigationOff;
302 
304  long long mCurrentFrameNumber = 0;
305 
307  QgsInterval mFrameDuration;
308 
310  double mFramesPerSecond = 1;
311 
313  QTimer *mNewFrameTimer = nullptr;
314 
316  AnimationState mPlayBackMode = Idle;
317 
318  bool mLoopAnimation = false;
319 
320  bool mCumulativeTemporalRange = false;
321 
322  int mBlockUpdateTemporalRangeSignal = 0;
323 
325  QgsTemporalNavigationObject &operator= ( const QgsTemporalNavigationObject & ) = delete;
326 };
327 
328 #endif // QGSTEMPORALNAVIGATIONOBJECT_H
Base class for all map layer types.
Definition: qgsmaplayer.h:83
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
NavigationMode navigationMode() const
Returns the currenttemporal navigation mode.
Temporal navigation relies on frames within a datetime range.
NavigationMode
Represents the current temporal navigation mode.
Implements a temporal controller based on a frame by frame navigation and animation.
#define SIP_FACTORY
Definition: qgis_sip.h:76
Single scope for storing variables and functions for use within a QgsExpressionContext.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
A representation of the interval between two datetime values.
Definition: qgsinterval.h:40
AnimationState
Represents the current animation state.
virtual QgsExpressionContextScope * createExpressionContextScope() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Abstract interface for generating an expression context scope.
Temporal navigation relies on a fixed datetime range.