Track¶
struct nmeasim::core::track::Track · Library API
A sequence of points to follow, read from one GPX or KML file.
#include <nmeasim/core/track/track.hpp>
Declared in src/core/include/nmeasim/core/track/track.hpp (line 81)
All segments, routes or geometries of the source file are already concatenated in document order; nothing is reordered or deduplicated. A track returned by the readers has at least one point; a default-constructed one has none.
Summary¶
Public member functions
| Name | Description |
|---|---|
has_timestamps() |
Tells whether the track can be followed on its own timing. |
duration() |
Returns the time from the first to the last point. |
length_m() |
Returns the length of the track along the WGS 84 ellipsoid. |
Public data members
| Name | Description |
|---|---|
name |
Name given in the file; empty when it has none. |
kind |
The file format and element the points came from. |
points |
The points in sailing order. |
segment_count |
Number of source elements that were concatenated: <trkseg> elements for a GPX track, <rte> elements for a GPX route, <gx:Track> and <LineString> elements for KML. |
Public member functions¶
has_timestamps()¶
bool has_timestamps() const noexcept
Tells whether the track can be followed on its own timing.
Returns bool: True when there is at least one point, every point carries a time and the times never decrease (equal consecutive times are allowed); false otherwise, including for an empty track.
Declared in src/core/include/nmeasim/core/track/track.hpp:99 · defined in src/core/src/track/track.cpp:26
duration()¶
std::optional<std::chrono::milliseconds> duration() const
Returns the time from the first to the last point.
Returns std::optional<std::chrono::milliseconds>: The difference between the last and the first point time, truncated to milliseconds, or std::nullopt when has_timestamps() is false.
Declared in src/core/include/nmeasim/core/track/track.hpp:104 · defined in src/core/src/track/track.cpp:43
length_m()¶
double length_m() const
Returns the length of the track along the WGS 84 ellipsoid.
Returns double: The sum of the geodesic distances between consecutive points in metres, ignoring elevation; 0 for fewer than two points.
See also
Declared in src/core/include/nmeasim/core/track/track.hpp:110 · defined in src/core/src/track/track.cpp:51
Public data members¶
name¶
std::string name
Name given in the file; empty when it has none.
load_track replaces an empty name with the file name.
Declared in src/core/include/nmeasim/core/track/track.hpp:84
kind¶
TrackKind kind{TrackKind::GpxTrack}
The file format and element the points came from.
Declared in src/core/include/nmeasim/core/track/track.hpp:86
points¶
std::vector<TrackPoint> points
The points in sailing order.
Declared in src/core/include/nmeasim/core/track/track.hpp:88
segment_count¶
std::size_t segment_count{0}
Number of source elements that were concatenated: <trkseg> elements for a GPX track, <rte> elements for a GPX route, <gx:Track> and <LineString> elements for KML.
Elements without points are counted too.
Declared in src/core/include/nmeasim/core/track/track.hpp:92