GPXTrackWriter (API Reference)
Class GPXTrackWriter
- All Implemented Interfaces:
LocationListener
Writes GPX track points to GPXTrack.
The instance of the class should be added as a listener to the
LocationEngine for GPX track recording.
Appends the new location to the back segment of the track whenever the listener is called.
The following data (if provided) can be recorded and inserted into the resulting GPXTrack: latitude, longitude, altitude, time, bearingInDegrees, pitchInDegrees, speedInMetersPerSecond, horizontalAccuracyInMeters, verticalAccuracyInMeters, bearingAccuracyInDegrees, speedAccuracyInMetersPerSecond and locationTechnology.
Use case examples:
A user wants to create and save a new GPXDocument with one GPXTrack:
- create GPXTrackWriter and add it as a location listener to LocationEngine.
- set user parameters to getTrack() (e.g. GPXTrack.getName() or GPXTrack.getDescription()).
- when writing is completed, create a new GPXDocument with a list of one GPXTrack and save the document via GPXDocument.save(java.lang.String).
A user wants to modify and save GPXTrack in the existing GPXDocument:
- load GPXDocument from a file by the relevant constructor.
- create GPXTrackWriter with the required track in the list GPXDocument.getTracks(),
add the created instance as a location listener to LocationEngine.
- when writing is completed, save the document via GPXDocument.save(java.lang.String).
The GPXDocument including all tracks is saved in the GPX file format. Hence, once saved, it can be easily shared with other applications that understand the GPX file format.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of GPXTrackWriter with an empty track inside.GPXTrackWriter(GPXTrack track) Creates a new instance ofGPXTrackWriterwithGPXTrack. -
Method Summary
Modifier and TypeMethodDescriptiongetTrack()Gets the GPX track into which GPX track points are written.voidonLocationUpdated(Location location) Called each time a new location is available.
-
Constructor Details
-
GPXTrackWriter
public GPXTrackWriter()Creates a new instance of GPXTrackWriter with an empty track inside.
-
-
Method Details
-
getTrack
Gets the GPX track into which GPX track points are written.
- Returns:
GPX track into which GPX track points are written.
-
onLocationUpdated
Called each time a new location is available. In a navigation context while using the
NavigatororVisualNavigator, it's required to set theLocation.timeparameter for eachLocationobject so that the HERE SDK can map-match the locations properly. If theLocation.timeparameter is missing, the location will be ignored. For navigation, it is also recommended to provide thebearingandspeedparameters for eachLocationobject. Invoked on the main thread.- Specified by:
onLocationUpdatedin interfaceLocationListener- Parameters:
location-Current location.
-