Changeset 17054 in josm
- Timestamp:
- 2020-09-23T09:11:16+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GeoJSONReader.java
r16956 r17054 11 11 import java.io.StringReader; 12 12 import java.nio.charset.StandardCharsets; 13 import java.util.ArrayList; 13 14 import java.util.List; 14 15 import java.util.Map; … … 295 296 if (size > 1) { 296 297 if (latlons.get(0).equals(latlons.get(size - 1))) { 297 // Remove last coordinate, but later add first node to the end 298 latlons.remove(size - 1); 299 doAutoclose = true; 298 doAutoclose = false; // already closed 300 299 } else { 301 300 doAutoclose = autoClose; … … 307 306 final Way way = new Way(); 308 307 getDataSet().addPrimitive(way); 309 way.setNodes(latlons.stream().map(this::createNode).collect(Collectors.toList()));308 final List<Node> rawNodes = latlons.stream().map(this::createNode).collect(Collectors.toList()); 310 309 if (doAutoclose) { 311 way.addNode(way.getNode(0)); 312 } 310 rawNodes.add(rawNodes.get(0)); 311 } 312 // see #19833: remove duplicated references to the same node 313 final List<Node> wayNodes = new ArrayList<>(rawNodes.size()); 314 Node last = null; 315 for (Node curr : rawNodes) { 316 if (last != curr) 317 wayNodes.add(curr); 318 last = curr; 319 } 320 way.setNodes(wayNodes); 313 321 314 322 return Optional.of(way);
Note:
See TracChangeset
for help on using the changeset viewer.