QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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"
27
28#include <QList>
29#include <QTimer>
30
31class QgsMapLayer;
32
40{
41 Q_OBJECT
42
43 public:
44
48 QgsTemporalNavigationObject( QObject *parent SIP_TRANSFERTHIS = nullptr );
49
52 {
56 };
57
60 {
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
121 void setAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );
122
132 QList< QgsDateTimeRange > availableTemporalRanges() const;
133
142 void setCurrentFrameNumber( long long frame );
143
149 long long currentFrameNumber() const;
150
158 void setFrameDuration( const QgsInterval &duration );
159
165 QgsInterval frameDuration() const;
166
173 QgsDateTimeRange dateTimeRangeForFrameNumber( long long frame ) const;
174
183 void setFramesPerSecond( double rate );
184
193 double framesPerSecond() const;
194
200 void setTemporalRangeCumulative( bool state );
201
207 bool temporalRangeCumulative() const;
208
212 long long totalFrameCount() const;
213
219 bool isLooping() const;
220
226 void setLooping( bool loop );
227
231 long long findBestFrameNumberForFrameStart( const QDateTime &frameStart ) const;
232
234
235 signals:
236
240 void stateChanged( QgsTemporalNavigationObject::AnimationState state );
241
245 void navigationModeChanged( QgsTemporalNavigationObject::NavigationMode mode );
246
250 void temporalExtentsChanged( const QgsDateTimeRange &extent );
251
255 void temporalFrameDurationChanged( const QgsInterval &interval );
256
257
258 public slots:
259
264 void play();
265
275 void pause();
276
280 void playForward();
281
285 void playBackward();
286
293 void next();
294
301 void previous();
302
306 void rewindToStart();
307
311 void skipToEnd();
312
313 private slots:
314
316 void timerTimeout();
317
318 private:
319
321 QgsDateTimeRange mTemporalExtents;
322
324 QList< QgsDateTimeRange > mAllRanges;
325
326 NavigationMode mNavigationMode = NavigationOff;
327
329 long long mCurrentFrameNumber = 0;
330
332 QgsInterval mFrameDuration = QgsInterval( 1.0, QgsUnitTypes::TemporalUnit::TemporalHours );
333
335 double mFramesPerSecond = 1;
336
338 QTimer *mNewFrameTimer = nullptr;
339
341 AnimationState mPlayBackMode = Idle;
342
343 bool mLoopAnimation = false;
344
345 bool mCumulativeTemporalRange = false;
346
347 int mBlockUpdateTemporalRangeSignal = 0;
348
350 QgsTemporalNavigationObject &operator= ( const QgsTemporalNavigationObject & ) = delete;
351};
352
353#endif // QGSTEMPORALNAVIGATIONOBJECT_H
Abstract interface for generating an expression context scope.
virtual QgsExpressionContextScope * createExpressionContextScope() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Single scope for storing variables and functions for use within a QgsExpressionContext.
A representation of the interval between two datetime values.
Definition: qgsinterval.h:42
Base class for all map layer types.
Definition: qgsmaplayer.h:73
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.
@ NavigationOff
Temporal navigation is disabled.
@ FixedRange
Temporal navigation relies on a fixed datetime range.
@ Animated
Temporal navigation relies on frames within a datetime range.
AnimationState
Represents the current animation state.
@ Forward
Animation is playing forward.
@ Reverse
Animation is playing in reverse.
NavigationMode navigationMode() const
Returns the current temporal navigation mode.
Helper functions for various unit types.
Definition: qgsunittypes.h:39
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_FACTORY
Definition: qgis_sip.h:76