Skip to content
Permalink
Browse files

Access of QGeoPositionInfoSource from QgsQuickPostionKit (#8622)

  • Loading branch information
sklencar authored and wonder-sk committed Dec 7, 2018
1 parent 16922a3 commit d6701f24eb22ad3f0fd106ce4118d221ff46733d
Showing with 18 additions and 0 deletions.
  1. +6 −0 src/quickgui/qgsquickpositionkit.cpp
  2. +12 −0 src/quickgui/qgsquickpositionkit.h
@@ -59,6 +59,11 @@ QGeoPositionInfoSource *QgsQuickPositionKit::simulatedSource( double longitude,
return new QgsQuickSimulatedPositionSource( this, longitude, latitude, radius );
}

QGeoPositionInfoSource *QgsQuickPositionKit::source() const
{
return mSource.get();
}

void QgsQuickPositionKit::useSimulatedLocation( double longitude, double latitude, double radius )
{
std::unique_ptr<QGeoPositionInfoSource> source( simulatedSource( longitude, latitude, radius ) );
@@ -110,6 +115,7 @@ void QgsQuickPositionKit::replacePositionSource( QGeoPositionInfoSource *source
}

mSource.reset( source );
emit sourceChanged();

if ( mSource )
{
@@ -114,6 +114,12 @@ class QUICK_EXPORT QgsQuickPositionKit : public QObject
*/
Q_PROPERTY( QVector<double> simulatePositionLongLatRad READ simulatePositionLongLatRad WRITE setSimulatePositionLongLatRad NOTIFY simulatePositionLongLatRadChanged )

/**
* Internal source of GPS location data.
* Allows start/stop of its services or access properties.
*/
Q_PROPERTY( QGeoPositionInfoSource *source READ source NOTIFY sourceChanged )

public:
//! Creates new position kit
explicit QgsQuickPositionKit( QObject *parent = nullptr );
@@ -159,6 +165,9 @@ class QUICK_EXPORT QgsQuickPositionKit : public QObject
//! \copydoc QgsQuickPositionKit::simulatePositionLongLatRad
void setSimulatePositionLongLatRad( const QVector<double> &simulatePositionLongLatRad );

//! Returns pointer to the internal QGeoPositionInfoSource object used to receive GPS location.
QGeoPositionInfoSource *source() const;

/**
* Coordinate reference system of position - WGS84 (constant)
*/
@@ -218,6 +227,9 @@ class QUICK_EXPORT QgsQuickPositionKit : public QObject
//! \copydoc QgsQuickPositionKit::simulatePositionLongLatRad
void simulatePositionLongLatRadChanged( QVector<double> simulatePositionLongLatRad );

//! Emitted when the internal source of GPS location data has been replaced.
void sourceChanged();

private slots:
void onPositionUpdated( const QGeoPositionInfo &info );
void onMapSettingsUpdated();

0 comments on commit d6701f2

Please sign in to comment.
You can’t perform that action at this time.