QGIS API Documentation 3.41.0-Master (cea29feecf2)
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"
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
55 void setAnimationState( Qgis::AnimationState state );
56
62 Qgis::AnimationState animationState() const;
63
69 void setNavigationMode( const Qgis::TemporalNavigationMode mode );
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
258 void temporalExtentsChanged( const QgsDateTimeRange &extent );
259
263 void temporalFrameDurationChanged( const QgsInterval &interval );
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
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
TemporalNavigationMode
Temporal navigation modes.
Definition qgis.h:2411
AnimationState
Animation states.
Definition qgis.h:2427
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:46
Base class for all map layer types.
Definition qgsmaplayer.h:76
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.
Qgis::TemporalNavigationMode navigationMode() const
Returns the current temporal navigation mode.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76