Changeset 12505 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2017-07-24T19:24:44+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/OffsetIterator.java
r11992 r12505 23 23 public class OffsetIterator implements Iterator<MapViewPoint> { 24 24 private final MapViewState mapState; 25 private final List< Node> nodes;25 private final List<MapViewPoint> nodes; 26 26 private final double offset; 27 27 private int idx; … … 37 37 /** 38 38 * Creates a new offset iterator 39 * @param nodes The nodes of the original line 40 * @param offset The offset of the line. 41 */ 42 public OffsetIterator(List<MapViewPoint> nodes, double offset) { 43 if (nodes.size() < 2) { 44 throw new IllegalArgumentException("There must be at least 2 nodes."); 45 } 46 this.mapState = nodes.get(0).getMapViewState(); 47 this.nodes = nodes; 48 this.offset = offset; 49 } 50 51 /** 52 * Creates a new offset iterator 39 53 * @param mapState The map view state this iterator is for. 40 54 * @param nodes The nodes of the original line … … 43 57 public OffsetIterator(MapViewState mapState, List<Node> nodes, double offset) { 44 58 this.mapState = mapState; 45 this.nodes = nodes.stream().filter(Node::isLatLonKnown). collect(Collectors.toList());59 this.nodes = nodes.stream().filter(Node::isLatLonKnown).map(mapState::getPointFor).collect(Collectors.toList()); 46 60 this.offset = offset; 47 idx = 0;48 61 } 49 62 … … 160 173 161 174 private MapViewPoint getForIndex(int i) { 162 return mapState.getPointFor(nodes.get(i));175 return nodes.get(i); 163 176 } 164 177
Note:
See TracChangeset
for help on using the changeset viewer.