Changeset 15502 in josm for trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
- Timestamp:
- 2019-11-03T22:11:11+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r15497 r15502 73 73 * A list of tracks this file consists of 74 74 */ 75 private final ArrayList<GpxTrack> privateTracks = new ArrayList<>(); 75 private final ArrayList<IGpxTrack> privateTracks = new ArrayList<>(); 76 76 /** 77 77 * GPX routes in this file … … 100 100 * @see #getTracks() 101 101 */ 102 public final Collection<GpxTrack> tracks = new ListeningCollection<GpxTrack>(privateTracks, this::invalidate) { 102 public final Collection<IGpxTrack> tracks = new ListeningCollection<IGpxTrack>(privateTracks, this::invalidate) { 103 103 104 104 @Override 105 protected void removed(GpxTrack cursor) { 105 protected void removed(IGpxTrack cursor) { 106 106 cursor.removeListener(proxy); 107 107 super.removed(cursor); … … 109 109 110 110 @Override 111 protected void added(GpxTrack cursor) { 111 protected void added(IGpxTrack cursor) { 112 112 super.added(cursor); 113 113 cursor.addListener(proxy); … … 174 174 175 175 if (cutOverlapping) { 176 for (GpxTrack trk : other.privateTracks) { 176 for (IGpxTrack trk : other.privateTracks) { 177 177 cutOverlapping(trk, connect); 178 178 } … … 186 186 } 187 187 188 private void cutOverlapping(GpxTrack trk, boolean connect) { 188 private void cutOverlapping(IGpxTrack trk, boolean connect) { 189 189 List<IGpxTrackSegment> segsOld = new ArrayList<>(trk.getSegments()); 190 190 List<IGpxTrackSegment> segsNew = new ArrayList<>(); … … 366 366 if (segSpans == null) { 367 367 segSpans = new ArrayList<>(); 368 for (GpxTrack trk : privateTracks) { 368 for (IGpxTrack trk : privateTracks) { 369 369 for (IGpxTrackSegment seg : trk.getSegments()) { 370 370 GpxTrackSegmentSpan s = GpxTrackSegmentSpan.tryGetFromSegment(seg); … … 392 392 * @return The tracks. 393 393 */ 394 public synchronized Collection<GpxTrack> getTracks() { 394 public synchronized Collection<IGpxTrack> getTracks() { 395 395 return Collections.unmodifiableCollection(privateTracks); 396 396 } … … 418 418 * @since 12156 419 419 */ 420 public synchronized void addTrack(GpxTrack track) { 420 public synchronized void addTrack(IGpxTrack track) { 421 421 if (privateTracks.stream().anyMatch(t -> t == track)) { 422 422 throw new IllegalArgumentException(MessageFormat.format("The track was already added to this data: {0}", track)); … … 432 432 * @since 12156 433 433 */ 434 public synchronized void removeTrack(GpxTrack track) { 434 public synchronized void removeTrack(IGpxTrack track) { 435 435 if (!privateTracks.removeIf(t -> t == track)) { 436 436 throw new IllegalArgumentException(MessageFormat.format("The track was not in this data: {0}", track)); … … 626 626 * @return The stream 627 627 * @see #getTracks() 628 * @see GpxTrack#getSegments() 628 * @see IGpxTrack#getSegments() 629 629 * @see IGpxTrackSegment#getWayPoints() 630 630 * @since 12156 … … 698 698 } 699 699 } 700 for (GpxTrack trk : privateTracks) { 700 for (IGpxTrack trk : privateTracks) { 701 701 Bounds trkBounds = trk.getBounds(); 702 702 if (trkBounds != null) { … … 716 716 */ 717 717 public synchronized double length() { 718 return privateTracks.stream().mapToDouble(GpxTrack::length).sum(); 718 return privateTracks.stream().mapToDouble(IGpxTrack::length).sum(); 719 719 } 720 720 … … 724 724 * @return minimum and maximum dates in array of 2 elements 725 725 */ 726 public static Date[] getMinMaxTimeForTrack(GpxTrack trk) { 726 public static Date[] getMinMaxTimeForTrack(IGpxTrack trk) { 727 727 final LongSummaryStatistics statistics = trk.getSegments().stream() 728 728 .flatMap(seg -> seg.getWayPoints().stream()) … … 793 793 double py = p.north(); 794 794 double rx = 0.0, ry = 0.0, sx, sy, x, y; 795 for (GpxTrack track : privateTracks) { 795 for (IGpxTrack track : privateTracks) { 796 796 for (IGpxTrackSegment seg : track.getSegments()) { 797 797 WayPoint r = null; … … 907 907 public static class LinesIterator implements Iterator<Line> { 908 908 909 private Iterator<GpxTrack> itTracks; 909 private Iterator<IGpxTrack> itTracks; 910 910 private int idxTracks; 911 911 private Iterator<IGpxTrackSegment> itTrackSegments; … … 915 915 private final boolean[] trackVisibility; 916 916 private Map<String, Object> trackAttributes; 917 private GpxTrack curTrack; 917 private IGpxTrack curTrack; 918 918 919 919 /**
Note:
See TracChangeset
for help on using the changeset viewer.
