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

Last change on this file was 36120, checked in by stoecker, 19 months ago

code cleanup

  • Property svn:mime-type set to text/plain
File size: 1.2 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
13/**
14 * LiveGPS track which gets step by step expanded with new data
15 */
16public class SingleSegmentGpxTrack extends WithAttributes implements IGpxTrack {
17
18 private final IGpxTrackSegment trackSegment;
19
20 public SingleSegmentGpxTrack(IGpxTrackSegment trackSegment, Map<String, Object> attributes) {
21 this.attr = Collections.unmodifiableMap(attributes);
22 this.trackSegment = trackSegment;
23 }
24
25 @Override
26 public Map<String, Object> getAttributes() {
27 return attr;
28 }
29
30 @Override
31 public Bounds getBounds() {
32 return trackSegment.getBounds();
33 }
34
35 @Override
36 public Collection<IGpxTrackSegment> getSegments() {
37 return Collections.singleton(trackSegment);
38 }
39
40 @Override
41 public double length() {
42 return trackSegment.length();
43 }
44}
Note: See TracBrowser for help on using the repository browser.