public class GpxData extends WithAttributes implements Data
Modifier and Type | Class and Description |
---|---|
static class |
GpxData.LinesIterator
Iterates over all track segments and then over all routes.
|
Modifier and Type | Field and Description |
---|---|
java.lang.String |
creator
Creator (usually software)
|
java.util.Set<DataSource> |
dataSources
All data sources (bounds of downloaded bounds) of this GpxData.
Not part of GPX standard but rather a JOSM extension, needed by the fact that OSM API does not provide <bounds> element in its GPX reply. |
boolean |
fromServer |
java.util.Collection<GpxRoute> |
routes
Routes
|
java.io.File |
storageFile |
java.util.Collection<GpxTrack> |
tracks
Tracks
|
java.util.Collection<WayPoint> |
waypoints
Waypoints
|
attr
FIX_VALUES, GPX_CMT, GPX_DESC, GPX_NAME, GPX_SRC, JOSM_EXTENSIONS_NAMESPACE_URI, META_AUTHOR_EMAIL, META_AUTHOR_LINK, META_AUTHOR_NAME, META_BOUNDS, META_COPYRIGHT_AUTHOR, META_COPYRIGHT_LICENSE, META_COPYRIGHT_YEAR, META_DESC, META_EXTENSIONS, META_KEYWORDS, META_LINKS, META_NAME, META_PREFIX, META_TIME, PT_AGEOFDGPSDATA, PT_DGPSID, PT_ELE, PT_FIX, PT_GEOIDHEIGHT, PT_HDOP, PT_MAGVAR, PT_PDOP, PT_SAT, PT_SYM, PT_TIME, PT_TYPE, PT_VDOP, RTE_TRK_KEYS, WPT_KEYS
Constructor and Description |
---|
GpxData() |
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Area |
getDataSourceArea()
Returns the total area of downloaded data (the "yellow rectangles").
|
java.util.List<Bounds> |
getDataSourceBounds()
Replies the list of data source bounds.
|
java.util.Collection<DataSource> |
getDataSources()
Returns the collection of data sources.
|
java.lang.Iterable<java.util.Collection<WayPoint>> |
getLinesIterable(boolean[] trackVisibility)
Iterate over all track segments and over all routes.
|
Bounds |
getMetaBounds()
Returns the bounds defining the extend of this data, as read in metadata, if any.
|
java.util.Date[] |
getMinMaxTimeForAllTracks()
Returns minimum and maximum timestamps for all tracks
Warning: there are lot of track with broken timestamps,
so we just ingore points from future and from year before 1970 in this method
works correctly @since 5815
|
static java.util.Date[] |
getMinMaxTimeForTrack(GpxTrack trk)
returns minimum and maximum timestamps in the track
|
boolean |
hasRoutePoints()
Determines if this GPX data has one or more route points
|
boolean |
hasTrackPoints()
Determines if this GPX data has one or more track points
|
boolean |
isEmpty()
Determines if this GPX data is empty (i.e.
|
double |
length()
calculates the sum of the lengths of all track segments
|
void |
mergeFrom(GpxData other)
Merges data from another object.
|
WayPoint |
nearestPointOnTrack(EastNorth P,
double tolerance)
Makes a WayPoint at the projection of point P onto the track providing P is less than
tolerance away from the track
|
Bounds |
recalculateBounds()
Calculates the bounding box of available data and returns it.
|
void |
resetEastNorthCache()
Resets the internal caches of east/north coordinates.
|
addExtension, get, getCollection, getString, put
public java.io.File storageFile
public boolean fromServer
public java.lang.String creator
public final java.util.Set<DataSource> dataSources
<bounds>
element in its GPX reply.public GpxData()
public void mergeFrom(GpxData other)
other
- existing GPX datapublic boolean hasTrackPoints()
true
if this GPX data has track points, false
otherwisepublic boolean hasRoutePoints()
true
if this GPX data has route points, false
otherwisepublic boolean isEmpty()
true
if this GPX data is empty, false
otherwisepublic Bounds getMetaBounds()
null
is returned. There is no guarantee
that data entirely fit in this bounds, as it is not recalculated. To get recalculated bounds,
see recalculateBounds()
. To get downloaded areas, see dataSources
.null
.recalculateBounds()
,
dataSources
public Bounds recalculateBounds()
getMetaBounds()
.dataSources
.getMetaBounds()
,
dataSources
public double length()
public static java.util.Date[] getMinMaxTimeForTrack(GpxTrack trk)
trk
- track to analyzepublic java.util.Date[] getMinMaxTimeForAllTracks()
public WayPoint nearestPointOnTrack(EastNorth P, double tolerance)
P
- : the point to determine the projection fortolerance
- : must be no further than this from the trackpublic java.lang.Iterable<java.util.Collection<WayPoint>> getLinesIterable(boolean[] trackVisibility)
trackVisibility
- An array indicating which tracks should be
included in the iteration. Can be null, then all tracks are included.public void resetEastNorthCache()
public java.util.Collection<DataSource> getDataSources()
Data
getDataSources
in interface Data
public java.awt.geom.Area getDataSourceArea()
Data
getDataSourceArea
in interface Data
public java.util.List<Bounds> getDataSourceBounds()
Data
Replies the list of data source bounds.
Dataset maintains a list of data sources which have been merged into the data set. Each of these sources can optionally declare a bounding box of the data it supplied to the dataset.
This method replies the list of defined (non null
) bounding boxes.
getDataSourceBounds
in interface Data