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

Last change on this file since 12275 was 12171, checked in by michael2402, 7 years ago

Fixed checkstyle warnings.

  • Property svn:eol-style set to native
File size: 2.3 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 * Returns the number of times this track has been changed.
41 * @return Number of times this track has been changed. Always 0 for read-only tracks
42 * @deprecated since 12156 Replaced by change listeners.
43 */
44 @Deprecated
45 default int getUpdateCount() {
46 // to allow removal
47 return 0;
48 }
49
50 /**
51 * Add a listener that listens to changes in the GPX track.
52 * @param l The listener
53 */
54 default void addListener(GpxTrackChangeListener l) {
55 // nop
56 }
57
58 /**
59 * Remove a listener that listens to changes in the GPX track.
60 * @param l The listener
61 */
62 default void removeListener(GpxTrackChangeListener l) {
63 // nop
64 }
65
66 /**
67 * A listener that listens to GPX track changes.
68 * @author Michael Zangl
69 * @since 12156
70 */
71 @FunctionalInterface
72 interface GpxTrackChangeListener {
73 /**
74 * Called when the gpx data changed.
75 * @param e The event
76 */
77 void gpxDataChanged(GpxTrackChangeEvent e);
78 }
79
80 /**
81 * A track change event for the current track.
82 * @author Michael Zangl
83 * @since 12156
84 */
85 class GpxTrackChangeEvent {
86 private final GpxTrack source;
87
88 GpxTrackChangeEvent(GpxTrack source) {
89 super();
90 this.source = source;
91 }
92
93 /**
94 * Get the track that was changed.
95 * @return The track.
96 */
97 public GpxTrack getSource() {
98 return source;
99 }
100 }
101}
Note: See TracBrowser for help on using the repository browser.