- Timestamp:
- 2007-10-09T20:19:20+02:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/mapmode
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
r353 r356 219 219 * <code>null</code> otherwise. 220 220 */ 221 p rivateWay getWayForNode(Node n) {221 public static Way getWayForNode(Node n) { 222 222 Way way = null; 223 223 for (Way w : Main.ds.ways) { 224 224 if (w.nodes.size() < 1) continue; 225 int i = w.nodes.indexOf(n); 226 if (w.nodes.get(0) == n || w.nodes.get(w.nodes.size() - 1) == n) { 225 Node firstNode = w.nodes.get(0); 226 Node lastNode = w.nodes.get(w.nodes.size() - 1); 227 if ((firstNode == n || lastNode == n) && (firstNode != lastNode)) { 227 228 if (way != null) 228 229 return null; -
trunk/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java
r343 r356 123 123 124 124 /** 125 * @return If the node is the end of exactly one way, return this.126 * <code>null</code> otherwise.127 */128 private Way getWayForNode(Node n) {129 Way way = null;130 for (Way w : Main.ds.ways) {131 int i = w.nodes.indexOf(n);132 if (i == -1) continue;133 if (i == 0 || i == w.nodes.size() - 1) {134 if (way != null)135 return null;136 way = w;137 }138 }139 return way;140 }141 142 /**143 125 * Create the segment if first and second are different and there is 144 126 * not already a segment. … … 155 137 if (n1 == null || n2 == null || n1 == n2) return; 156 138 157 Way w = getWayForNode(n1);139 Way w = AddNodeAction.getWayForNode(n1); 158 140 Way wnew; 159 141 Collection<OsmPrimitive> sel = Main.ds.getSelected();
Note:
See TracChangeset
for help on using the changeset viewer.