QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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"
24#include "qgsinterval.h"
25#include "qgsrange.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
56
63
70
76 Qgis::TemporalNavigationMode navigationMode() const { return mNavigationMode; }
77
86 void setTemporalExtents( const QgsDateTimeRange &extents );
87
94 QgsDateTimeRange temporalExtents() const;
95
105 void setAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );
106
116 QList< QgsDateTimeRange > availableTemporalRanges() const;
117
126 void setCurrentFrameNumber( long long frame );
127
133 long long currentFrameNumber() const;
134
142 void setFrameDuration( const QgsInterval &duration );
143
149 QgsInterval frameDuration() const;
150
157 QgsDateTimeRange dateTimeRangeForFrameNumber( long long frame ) const;
158
167 void setFramesPerSecond( double rate );
168
177 double framesPerSecond() const;
178
184 void setTemporalRangeCumulative( bool state );
185
191 bool temporalRangeCumulative() const;
192
196 long long totalFrameCount() const;
197
203 bool isLooping() const;
204
210 void setLooping( bool loop );
211
215 long long findBestFrameNumberForFrameStart( const QDateTime &frameStart ) const;
216
218
229 long long totalMovieFrames() const;
230
241 void setTotalMovieFrames( long long frames );
242
243 signals:
244
248 void stateChanged( Qgis::AnimationState state );
249
253 void navigationModeChanged( Qgis::TemporalNavigationMode mode );
254
259
264
275 void totalMovieFramesChanged( long long frames );
276
277 public slots:
278
283 void play();
284
294 void pause();
295
299 void playForward();
300
304 void playBackward();
305
312 void next();
313
320 void previous();
321
325 void rewindToStart();
326
330 void skipToEnd();
331
332 private slots:
333
335 void timerTimeout();
336
337 private:
338
340 QgsDateTimeRange mTemporalExtents;
341
343 QList< QgsDateTimeRange > mAllRanges;
344
345 Qgis::TemporalNavigationMode mNavigationMode = Qgis::TemporalNavigationMode::Disabled;
346
348 long long mCurrentFrameNumber = 0;
349
351 QgsInterval mFrameDuration = QgsInterval( 1.0, Qgis::TemporalUnit::Hours );
352
354 double mFramesPerSecond = 1;
355
357 QTimer *mNewFrameTimer = nullptr;
358
360 Qgis::AnimationState mPlayBackMode = Qgis::AnimationState::Idle;
361
362 bool mLoopAnimation = false;
363
364 bool mCumulativeTemporalRange = false;
365
366 int mBlockUpdateTemporalRangeSignal = 0;
367
369 long long mTotalMovieFrames = 100;
370
372 QgsTemporalNavigationObject &operator= ( const QgsTemporalNavigationObject & ) = delete;
373};
374
375#endif // QGSTEMPORALNAVIGATIONOBJECT_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
TemporalNavigationMode
Temporal navigation modes.
Definition qgis.h:2534
AnimationState
Animation states.
Definition qgis.h:2550
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:47
Base class for all map layer types.
Definition qgsmaplayer.h:80
QgsTemporalController(QObject *parent=nullptr)
Constructor for QgsTemporalController, with the specified parent object.
void stateChanged(Qgis::AnimationState state)
Emitted whenever the animation state changes.
void previous()
Jumps back to the previous frame.
void navigationModeChanged(Qgis::TemporalNavigationMode mode)
Emitted whenever the navigation mode changes.
void setNavigationMode(const Qgis::TemporalNavigationMode mode)
Sets the temporal navigation mode.
void playForward()
Starts the animation playing in a forward direction up till the end of all frames.
void rewindToStart()
Rewinds the temporal navigation to start of the temporal extent.
void pause()
Pauses the temporal navigation.
Qgis::AnimationState animationState() const
Returns the current animation state.
void skipToEnd()
Skips the temporal navigation to end of the temporal extent.
void temporalFrameDurationChanged(const QgsInterval &interval)
Emitted whenever the frameDuration interval of the controller changes.
void next()
Advances to the next frame.
void totalMovieFramesChanged(long long frames)
Emitted whenever the total number of frames in the movie is changed.
Qgis::TemporalNavigationMode navigationMode() const
Returns the current temporal navigation mode.
void play()
Starts playing the temporal navigation from its current frame, using the direction specified by anima...
void playBackward()
Starts the animation playing in a reverse direction until the beginning of the time range.
void temporalExtentsChanged(const QgsDateTimeRange &extent)
Emitted whenever the temporalExtent extent changes.
QgsTemporalNavigationObject(QObject *parent=nullptr)
Constructor for QgsTemporalNavigationObject, with the specified parent object.
void setAnimationState(Qgis::AnimationState state)
Sets the current animation state.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:84
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:761