QGIS API Documentation 4.1.0-Master (60fea48833c)
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:
47 QgsTemporalNavigationObject( QObject *parent SIP_TRANSFERTHIS = nullptr );
48
55
62
69
75 Qgis::TemporalNavigationMode navigationMode() const { return mNavigationMode; }
76
85 void setTemporalExtents( const QgsDateTimeRange &extents );
86
93 QgsDateTimeRange temporalExtents() const;
94
104 void setAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );
105
115 QList< QgsDateTimeRange > availableTemporalRanges() const;
116
125 void setCurrentFrameNumber( long long frame );
126
132 long long currentFrameNumber() const;
133
141 void setFrameDuration( const QgsInterval &duration );
142
148 QgsInterval frameDuration() const;
149
156 QgsDateTimeRange dateTimeRangeForFrameNumber( long long frame ) const;
157
166 void setFramesPerSecond( double rate );
167
176 double framesPerSecond() const;
177
183 void setTemporalRangeCumulative( bool state );
184
190 bool temporalRangeCumulative() const;
191
195 long long totalFrameCount() const;
196
202 bool isLooping() const;
203
209 void setLooping( bool loop );
210
214 long long findBestFrameNumberForFrameStart( const QDateTime &frameStart ) const;
215
217
228 long long totalMovieFrames() const;
229
240 void setTotalMovieFrames( long long frames );
241
242 signals:
243
247 void stateChanged( Qgis::AnimationState state );
248
252 void navigationModeChanged( Qgis::TemporalNavigationMode mode );
253
258
263
274 void totalMovieFramesChanged( long long frames );
275
276 public slots:
277
282 void play();
283
293 void pause();
294
298 void playForward();
299
303 void playBackward();
304
311 void next();
312
319 void previous();
320
324 void rewindToStart();
325
329 void skipToEnd();
330
331 private slots:
332
334 void timerTimeout();
335
336 private:
338 QgsDateTimeRange mTemporalExtents;
339
341 QList< QgsDateTimeRange > mAllRanges;
342
343 Qgis::TemporalNavigationMode mNavigationMode = Qgis::TemporalNavigationMode::Disabled;
344
346 long long mCurrentFrameNumber = 0;
347
349 QgsInterval mFrameDuration = QgsInterval( 1.0, Qgis::TemporalUnit::Hours );
350
352 double mFramesPerSecond = 1;
353
355 QTimer *mNewFrameTimer = nullptr;
356
358 Qgis::AnimationState mPlayBackMode = Qgis::AnimationState::Idle;
359
360 bool mLoopAnimation = false;
361
362 bool mCumulativeTemporalRange = false;
363
364 int mBlockUpdateTemporalRangeSignal = 0;
365
367 long long mTotalMovieFrames = 100;
368
370 QgsTemporalNavigationObject &operator=( const QgsTemporalNavigationObject & ) = delete;
371};
372
373#endif // QGSTEMPORALNAVIGATIONOBJECT_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
TemporalNavigationMode
Temporal navigation modes.
Definition qgis.h:2623
AnimationState
Animation states.
Definition qgis.h:2639
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:52
Base class for all map layer types.
Definition qgsmaplayer.h:83
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:52
#define SIP_FACTORY
Definition qgis_sip.h:83
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:705