source: josm/trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java@ 13388

Last change on this file since 13388 was 12289, checked in by Don-vip, 7 years ago

sonar - squid:CallToDeprecatedMethod - "@Deprecated" code should not be used

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.gpx;
3
4import java.util.Collection;
5import java.util.Map;
6
7import org.openstreetmap.josm.data.Bounds;
8
9/**
10 * Read-only gpx track. Implementations doesn't have to be immutable, but should always be thread safe.
11 * @since 444
12 */
13public interface GpxTrack extends IWithAttributes {
14
15 /**
16 * Returns the track segments.
17 * @return the track segments
18 */
19 Collection<GpxTrackSegment> getSegments();
20
21 /**
22 * Returns the track attributes.
23 * @return the track attributes
24 */
25 Map<String, Object> getAttributes();
26
27 /**
28 * Returns the track bounds.
29 * @return the track bounds
30 */
31 Bounds getBounds();
32
33 /**
34 * Returns the track length.
35 * @return the track length
36 */
37 double length();
38
39 /**
40 * Add a listener that listens to changes in the GPX track.
41 * @param l The listener
42 */
43 default void addListener(GpxTrackChangeListener l) {
44 // nop
45 }
46
47 /**
48 * Remove a listener that listens to changes in the GPX track.
49 * @param l The listener
50 */
51 default void removeListener(GpxTrackChangeListener l) {
52 // nop
53 }
54
55 /**
56 * A listener that listens to GPX track changes.
57 * @author Michael Zangl
58 * @since 12156
59 */
60 @FunctionalInterface
61 interface GpxTrackChangeListener {
62 /**
63 * Called when the gpx data changed.
64 * @param e The event
65 */
66 void gpxDataChanged(GpxTrackChangeEvent e);
67 }
68
69 /**
70 * A track change event for the current track.
71 * @author Michael Zangl
72 * @since 12156
73 */
74 class GpxTrackChangeEvent {
75 private final GpxTrack source;
76
77 GpxTrackChangeEvent(GpxTrack source) {
78 super();
79 this.source = source;
80 }
81
82 /**
83 * Get the track that was changed.
84 * @return The track.
85 */
86 public GpxTrack getSource() {
87 return source;
88 }
89 }
90}
Note: See TracBrowser for help on using the repository browser.