Updates the location using the positioning device. More...
Header: | #include <LocationDataSource> |
Since: | Esri::ArcGISRuntime 100.6 |
Inherits: | QObject |
This class was introduced in Esri::ArcGISRuntime 100.6.
Properties
- started : const bool
Public Functions
LocationDataSource(QObject *parent = nullptr) | |
virtual | ~LocationDataSource() override |
QCompass * | compass() const |
QGeoPositionInfoSource * | geoPositionSource() const |
bool | isStarted() const |
ArEnums::LocationTrackingMode | locationTrackingMode() const |
ArEnums::SensorStatus | sensorStatus() const |
void | setCompass(QCompass *compass) |
void | setGeoPositionSource(QGeoPositionInfoSource *geoPositionSource) |
void | setLocationTrackingMode(ArEnums::LocationTrackingMode locationTrackingMode) |
void | start() |
void | start(ArEnums::LocationTrackingMode locationTrackingMode) |
void | stop() |
Signals
void | compassChanged() |
void | geoPositionSourceChanged() |
void | headingChanged(double heading) |
void | isStartedChanged() |
void | locationChanged(double latitude, double longitude, double altitude) |
void | locationTrackingModeChanged() |
void | sensorStatusChanged() |
Detailed Description
LocationDataSource uses the Qt class QGeoPositionInfoSource to get the location and the heading of the device, using the GPS sensor.
LocationDataSource can be started using the function start and stopped using the function stop. When LocationDataSource is running, the signals headingChanged and locationChanged are emitted every time the values change.
Most of the time, it's not necessary to create an object of this class. A default LocationDataSource is created automatically by ArcGISArView when this is necessary. This class is public to give the possibility to override the class QGeoPositionInfoSource to support a custom GPS device.
See also {http://doc.qt.io/qt-5/qtpositioning-plugins.html}{Qt Positioning service plugins}.
Latitude and longitude
The latitude and longitude parameters hold the latitude and longitude in decimal degrees in the WGS84 datum format. The property is undefined (NaN
) if the latitude or longitude has not been set.
A positive latitude indicates the Northern Hemisphere, and a negative latitude indicates the Southern Hemisphere. A positive longitude indicates the Eastern Hemisphere, and a negative longitude indicates the Western Hemisphere.
To be valid, the latitude must be between -90 to 90 inclusive and the longitude must be between -180 to 180 inclusive.
Altitude
The altitude parameter holds the altitude in meters above sea level. The property is undefined (NaN
) if the altitude has not been set.
Heading
The azimuth of the device as degrees from magnetic north in a clockwise direction based on the top of the device, as defined by QScreen::nativeOrientation.
Tracking Mode
The tracking mode can be LocationTrackingode::Ignore
{ignore} (the location data are ignored), LocationTrackingode::Initial
{initial} (only the first location data are used) or LocationTrackingode::Continuous
{continuous} (all the location data are used).
If the tracking mode is not LocationTrackingode::Ignore
{ignore} and the user didn't provide QGeoPositionInfoSource and QCompass objects, default ones are created with the LocationDataSource as parent. If one of these objects is provided, the LocationDataSource doesn't take ownership of the object.
See also QCompass.
Property Documentation
started : const bool
Holds the property that indicates if the tracking has started.
Access functions:
bool | isStarted() const |
Notifier signal:
void | isStartedChanged() |
Member Function Documentation
LocationDataSource::LocationDataSource (QObject *parent = nullptr)
A constructor that accepts an optional parent.
[signal]
void LocationDataSource::compassChanged ()
Signal emitted when the compass property changes.
Note: Notifier signal for property compass.
[signal]
void LocationDataSource::geoPositionSourceChanged ()
Signal emitted when the geoPositionSource property changes.
Note: Notifier signal for property geoPositionSource.
[signal]
void LocationDataSource::headingChanged (double heading)
Signal emitted when the heading value changes.
[signal]
void LocationDataSource::isStartedChanged ()
Signal emitted when the isStarted property changes.
Note: Notifier signal for property started.
[signal]
void LocationDataSource::locationChanged (double latitude, double longitude, double altitude)
Signal emitted when the location values change.
- latitude latitude changed
- longitude longitude changed
- altitude altitude changed
[signal]
void LocationDataSource::locationTrackingModeChanged ()
Signal emitted when the locationTrackingMode property changes.
Note: Notifier signal for property locationTrackingMode.
[signal]
void LocationDataSource::sensorStatusChanged ()
Signal emitted when the sensorStatus property changes.
Note: Notifier signal for property sensorStatus.
[override virtual]
LocationDataSource::~LocationDataSource ()
The destructor.
QCompass *LocationDataSource::compass() const
Gets the compass object.
Note: Getter function for property compass.
See also setCompass().
QGeoPositionInfoSource *LocationDataSource::geoPositionSource () const
Gets the QGeoPositionInfoSource object.
Note: Getter function for property geoPositionSource.
See also setGeoPositionSource().
bool LocationDataSource::isStarted () const
Returns true
if the location data source is started.
Note: Getter function for property started.
ArEnums::LocationTrackingMode LocationDataSource::locationTrackingMode () const
Gets the location tracking mode.
Note: Getter function for property locationTrackingMode.
See also setLocationTrackingMode() and LocationTrackingMode.
ArEnums::SensorStatus LocationDataSource::sensorStatus () const
Gets the sensor status.
Note: Getter function for property sensorStatus.
void LocationDataSource::setCompass (QCompass *compass)
Sets the compass to compass.
The compass cannot be changed after tracking is started.
Note: Setter function for property compass.
See also compass().
void LocationDataSource::setGeoPositionSource (QGeoPositionInfoSource *geoPositionSource )
Sets the position source to geoPositionSource.
The geoposition source cannot be changed after tracking is started.
Note: Setter function for property geoPositionSource.
See also geoPositionSource().
void LocationDataSource::setLocationTrackingMode (ArEnums::LocationTrackingMode locationTrackingMode )
Sets the location tracking mode to locationTrackingMode.
The location tracking mode cannot be changed after tracking is started.
Note: Setter function for property locationTrackingMode.
See also locationTrackingMode() and LocationTrackingMode.
void LocationDataSource::start()
Starts the location data source.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void LocationDataSource::start(ArEnums::LocationTrackingMode locationTrackingMode )
Starts the location data source with a location tracking mode.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void LocationDataSource::stop()
Stops the location data source.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.