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

Last change on this file since 12867 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
RevLine 
[6380]1// License: GPL. For details, see LICENSE file.
[444]2package org.openstreetmap.josm.data.gpx;
3
4import java.util.Collection;
[2907]5import java.util.Map;
[444]6
[2907]7import org.openstreetmap.josm.data.Bounds;
[2151]8
[2907]9/**
10 * Read-only gpx track. Implementations doesn't have to be immutable, but should always be thread safe.
[9949]11 * @since 444
[2907]12 */
[5681]13public interface GpxTrack extends IWithAttributes {
[2907]14
[9949]15 /**
16 * Returns the track segments.
17 * @return the track segments
18 */
[2907]19 Collection<GpxTrackSegment> getSegments();
[8510]20
[9949]21 /**
22 * Returns the track attributes.
23 * @return the track attributes
24 */
[2907]25 Map<String, Object> getAttributes();
[8510]26
[9949]27 /**
28 * Returns the track bounds.
29 * @return the track bounds
30 */
[2907]31 Bounds getBounds();
[8510]32
[9949]33 /**
34 * Returns the track length.
35 * @return the track length
36 */
[2907]37 double length();
[7509]38
[3119]39 /**
[12156]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
[12171]61 interface GpxTrackChangeListener {
[12156]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 }
[444]90}
Note: See TracBrowser for help on using the repository browser.