- Timestamp:
- 2018-11-25T17:51:39+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r14341 r14451 840 840 * over all routes 841 841 */ 842 public Iterable< Collection<WayPoint>> getLinesIterable(final boolean... trackVisibility) {842 public Iterable<Line> getLinesIterable(final boolean... trackVisibility) { 843 843 return () -> new LinesIterator(this, trackVisibility); 844 844 } … … 863 863 * Iterates over all track segments and then over all routes. 864 864 */ 865 public static class LinesIterator implements Iterator< Collection<WayPoint>> {865 public static class LinesIterator implements Iterator<Line> { 866 866 867 867 private Iterator<GpxTrack> itTracks; … … 870 870 private final Iterator<GpxRoute> itRoutes; 871 871 872 private Collection<WayPoint>next;872 private Line next; 873 873 private final boolean[] trackVisibility; 874 private Map<String, Object> trackAttributes; 874 875 875 876 /** … … 893 894 894 895 @Override 895 public Collection<WayPoint>next() {896 public Line next() { 896 897 if (!hasNext()) { 897 898 throw new NoSuchElementException(); 898 899 } 899 Collection<WayPoint>current = next;900 Line current = next; 900 901 next = getNext(); 901 902 return current; 902 903 } 903 904 904 private Collection<WayPoint>getNext() {905 private Line getNext() { 905 906 if (itTracks != null) { 906 907 if (itTrackSegments != null && itTrackSegments.hasNext()) { 907 return itTrackSegments.next().getWayPoints();908 return new Line(itTrackSegments.next(), trackAttributes); 908 909 } else { 909 910 while (itTracks.hasNext()) { 910 911 GpxTrack nxtTrack = itTracks.next(); 912 trackAttributes = nxtTrack.getAttributes(); 911 913 idxTracks++; 912 914 if (trackVisibility != null && !trackVisibility[idxTracks]) … … 914 916 itTrackSegments = nxtTrack.getSegments().iterator(); 915 917 if (itTrackSegments.hasNext()) { 916 return itTrackSegments.next().getWayPoints();918 return new Line(itTrackSegments.next(), trackAttributes); 917 919 } 918 920 } 919 921 // if we get here, all the Tracks are finished; Continue with Routes 922 trackAttributes = null; 920 923 itTracks = null; 921 924 } 922 925 } 923 926 if (itRoutes.hasNext()) { 924 return itRoutes.next().routePoints;927 return new Line(itRoutes.next()); 925 928 } 926 929 return null; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r13206 r14451 24 24 import java.util.ArrayList; 25 25 import java.util.Arrays; 26 import java.util.Collection;27 26 import java.util.Collections; 28 27 import java.util.Date; … … 42 41 import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeEvent; 43 42 import org.openstreetmap.josm.data.gpx.GpxData.GpxDataChangeListener; 43 import org.openstreetmap.josm.data.gpx.Line; 44 44 import org.openstreetmap.josm.data.gpx.WayPoint; 45 45 import org.openstreetmap.josm.data.preferences.NamedColorProperty; … … 365 365 366 366 ensureTrackVisibilityLength(); 367 for ( Collection<WayPoint>segment : data.getLinesIterable(layer.trackVisibility)) {367 for (Line segment : data.getLinesIterable(layer.trackVisibility)) { 368 368 369 369 for (WayPoint pt : segment) { … … 501 501 if (colored == ColorMode.VELOCITY) { 502 502 final List<Double> velocities = new ArrayList<>(); 503 for ( Collection<WayPoint>segment : data.getLinesIterable(null)) {503 for (Line segment : data.getLinesIterable(null)) { 504 504 if (!forceLines) { 505 505 oldWp = null; … … 526 526 } 527 527 } else if (colored == ColorMode.HDOP) { 528 for ( Collection<WayPoint>segment : data.getLinesIterable(null)) {528 for (Line segment : data.getLinesIterable(null)) { 529 529 for (WayPoint trkPnt : segment) { 530 530 Object val = trkPnt.get(GpxConstants.PT_HDOP); … … 565 565 566 566 // Now the colors for all the points will be assigned 567 for ( Collection<WayPoint>segment : data.getLinesIterable(null)) {567 for (Line segment : data.getLinesIterable(null)) { 568 568 if (!forceLines) { // don't draw lines between segments, unless forced to 569 569 oldWp = null; … … 609 609 default: // Do nothing 610 610 } 611 if (!noDraw && (maxLineLength == -1 || dist <= maxLineLength)) {611 if (!noDraw && !segment.isUnordered() && (maxLineLength == -1 || dist <= maxLineLength)) { 612 612 trkPnt.drawLine = true; 613 613 double bearing = oldWp.getCoor().bearing(trkPnt.getCoor());
Note:
See TracChangeset
for help on using the changeset viewer.