Changeset 13717 in josm for trunk/src/org/openstreetmap/josm/data/osm/Way.java
- Timestamp:
- 2018-05-08T14:41:28+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r13670 r13717 10 10 import java.util.Map; 11 11 import java.util.Set; 12 import java.util.stream.Collectors; 12 13 13 14 import org.openstreetmap.josm.data.coor.LatLon; … … 26 27 * @since 64 27 28 */ 28 public final class Way extends OsmPrimitive implements IWay {29 public final class Way extends OsmPrimitive implements IWay<Node> { 29 30 30 31 /** 31 32 * All way nodes in this way 32 *33 33 */ 34 34 private Node[] nodes = new Node[0]; 35 35 private BBox bbox; 36 36 37 /** 38 * 39 * You can modify returned list but changes will not be propagated back 40 * to the Way. Use {@link #setNodes(List)} to update this way 41 * @return Nodes composing the way 42 * @since 1862 43 */ 37 @Override 44 38 public List<Node> getNodes() { 45 39 return new CopyList<>(nodes); … … 105 99 } 106 100 107 /** 108 * Replies the node at position <code>index</code>. 109 * 110 * @param index the position 111 * @return the node at position <code>index</code> 112 * @throws ArrayIndexOutOfBoundsException if <code>index</code> < 0 113 * or <code>index</code> >= {@link #getNodesCount()} 114 * @since 1862 115 */ 101 @Override 116 102 public Node getNode(int index) { 117 103 return nodes[index]; … … 121 107 public long getNodeId(int idx) { 122 108 return nodes[idx].getUniqueId(); 109 } 110 111 @Override 112 public List<Long> getNodeIds() { 113 return Arrays.stream(nodes).map(Node::getId).collect(Collectors.toList()); 123 114 } 124 115 … … 277 268 278 269 List<Node> newNodes = new ArrayList<>(wayData.getNodes().size()); 279 for (Long nodeId : wayData.getNode s()) {270 for (Long nodeId : wayData.getNodeIds()) { 280 271 Node node = (Node) getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE); 281 272 if (node != null) { … … 296 287 saveCommonAttributes(data); 297 288 for (Node node:nodes) { 298 data.getNode s().add(node.getUniqueId());289 data.getNodeIds().add(node.getUniqueId()); 299 290 } 300 291 return data;
Note:
See TracChangeset
for help on using the changeset viewer.