source: josm/trunk/src/org/openstreetmap/josm/data/gpx/SingleSegmentGpxTrack.java@ 2907

Last change on this file since 2907 was 2907, checked in by jttt, 14 years ago

Gpx refactoring - GpxTrack and GpxTrackSegment is now interface, implementations for specific use can be provided (currently JOSM supports immutable gpx track, livegps plugin supports append only track).

  • track length and bounds are precalculated
  • GpxLayer paints only currently visible segments
  • Property svn:mime-type set to text/plain
File size: 925 bytes
Line 
1package org.openstreetmap.josm.data.gpx;
2
3import java.util.Collection;
4import java.util.Collections;
5import java.util.Map;
6
7import org.openstreetmap.josm.data.Bounds;
8import org.openstreetmap.josm.data.gpx.GpxTrack;
9import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
10
11public class SingleSegmentGpxTrack implements GpxTrack {
12
13 private final Map<String, Object> attributes;
14 private final GpxTrackSegment trackSegment;
15
16 public SingleSegmentGpxTrack(GpxTrackSegment trackSegment, Map<String, Object> attributes) {
17 this.attributes = Collections.unmodifiableMap(attributes);
18 this.trackSegment = trackSegment;
19 }
20
21
22 public Map<String, Object> getAttributes() {
23 return attributes;
24 }
25
26 public Bounds getBounds() {
27 return trackSegment.getBounds();
28 }
29
30 public Collection<GpxTrackSegment> getSegments() {
31 return Collections.singleton(trackSegment);
32 }
33
34 public double length() {
35 return trackSegment.length();
36 }
37
38}
Note: See TracBrowser for help on using the repository browser.