source: osm/applications/editors/josm/plugins/livegps/src/livegps/SingleSegmentGpxTrack.java@ 35221

Last change on this file since 35221 was 35221, checked in by donvip, 5 years ago

see #josm16796 - update to JOSM 15502 - use IGpxTrack in GpxData (patch by Bjoeni)

  • Property svn:mime-type set to text/plain
File size: 1.1 KB
Line 
1// License: Public Domain. For details, see LICENSE file.
2package livegps;
3
4import java.util.Collection;
5import java.util.Collections;
6import java.util.Map;
7
8import org.openstreetmap.josm.data.Bounds;
9import org.openstreetmap.josm.data.gpx.IGpxTrack;
10import org.openstreetmap.josm.data.gpx.IGpxTrackSegment;
11import org.openstreetmap.josm.data.gpx.WithAttributes;
12
13public class SingleSegmentGpxTrack extends WithAttributes implements IGpxTrack {
14
15 private final IGpxTrackSegment trackSegment;
16
17 public SingleSegmentGpxTrack(IGpxTrackSegment trackSegment, Map<String, Object> attributes) {
18 this.attr = Collections.unmodifiableMap(attributes);
19 this.trackSegment = trackSegment;
20 }
21
22 @Override
23 public Map<String, Object> getAttributes() {
24 return attr;
25 }
26
27 @Override
28 public Bounds getBounds() {
29 return trackSegment.getBounds();
30 }
31
32 @Override
33 public Collection<IGpxTrackSegment> getSegments() {
34 return Collections.singleton(trackSegment);
35 }
36
37 @Override
38 public double length() {
39 return trackSegment.length();
40 }
41}
Note: See TracBrowser for help on using the repository browser.