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

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

code cleanup

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