QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsquicksimulatedpositionsource.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquicksimulatedpositionsource.h
3  --------------------------------------
4  Date : Dec. 2017
5  Copyright : (C) 2017 Peter Petrik
6  Email : zilolv at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSQUICKSIMULATEDPOSITIONSOURCE_H
17 #define QGSQUICKSIMULATEDPOSITIONSOURCE_H
18 
20 
21 //
22 // W A R N I N G
23 // -------------
24 //
25 // This file is not part of the QGIS API. It exists purely as an
26 // implementation detail. This header file may change from version to
27 // version without notice, or even be removed.
28 //
29 
30 #include "qgis_quick.h"
31 #include <QObject>
32 #include <QTimer>
33 #include <QtPositioning>
34 #include <qgspoint.h>
35 
51 class QUICK_NO_EXPORT QgsQuickSimulatedPositionSource : public QGeoPositionInfoSource
52 {
53  Q_OBJECT
54  public:
55  QgsQuickSimulatedPositionSource( QObject *parent, double longitude, double latitude, double flightRadius );
56 
57  QGeoPositionInfo lastKnownPosition( bool /*fromSatellitePositioningMethodsOnly = false*/ ) const { return mLastPosition; }
58  PositioningMethods supportedPositioningMethods() const { return AllPositioningMethods; }
59  int minimumUpdateInterval() const { return 1000; }
60  Error error() const { return QGeoPositionInfoSource::NoError; }
61 
62  public slots:
63  virtual void startUpdates();
64  virtual void stopUpdates();
65 
66  virtual void requestUpdate( int timeout = 5000 );
67 
68  private slots:
69  void readNextPosition();
70 
71  private:
72  void readRandomPosition();
73  void readConstantPosition();
74 
75  std::unique_ptr< QTimer > mTimer;
76  QGeoPositionInfo mLastPosition;
77  double mAngle = 0;
78 
79  double mFlightRadius = 0;
80  double mLongitude = 0;
81  double mLatitude = 0;
82 };
83 
85 
86 #endif // QGSQUICKSIMULATEDPOSITIONSOURCE_H
qgspoint.h