Changeset 8460 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-06-03T13:43:59+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r8419 r8460 147 147 } 148 148 149 if (ways.size() == 1 && ways.get(0).firstNode() != ways.get(0).lastNode()) {149 if (ways.size() == 1 && !ways.get(0).isClosed()) { 150 150 // Case 1 151 151 Way w = ways.get(0); … … 379 379 protected static boolean checkWaysArePolygon(Collection<Way> ways) { 380 380 // For each way, nodes strictly between first and last should't be reference by an other way 381 for (Way way: ways) {382 for (Node node: way.getNodes()) {383 if (node == way.firstNode() || node == way.lastNode()) continue;384 for (Way wayOther: ways) {385 if (way == wayOther) continue;386 if (node.getReferrers().contains(wayOther)) return false;381 for (Way way: ways) { 382 for (Node node: way.getNodes()) { 383 if (way.isFirstLastNode(node)) continue; 384 for (Way wayOther: ways) { 385 if (way == wayOther) continue; 386 if (node.getReferrers().contains(wayOther)) return false; 387 387 } 388 388 } … … 392 392 Node startNode = null, endNode = null; 393 393 int used = 0; 394 while (true) {394 while (true) { 395 395 Way nextWay = null; 396 for (Way w: ways) {397 if (w.firstNode() == w.lastNode()) return ways.size() == 1;398 if (w == currentWay) continue;399 if (currentWay == null) {396 for (Way w: ways) { 397 if (w.isClosed()) return ways.size() == 1; 398 if (w == currentWay) continue; 399 if (currentWay == null) { 400 400 nextWay = w; 401 401 startNode = w.firstNode(); … … 403 403 break; 404 404 } 405 if (w.firstNode() == endNode) {405 if (w.firstNode() == endNode) { 406 406 nextWay = w; 407 407 endNode = w.lastNode(); 408 408 break; 409 409 } 410 if (w.lastNode() == endNode) {410 if (w.lastNode() == endNode) { 411 411 nextWay = w; 412 412 endNode = w.firstNode(); … … 414 414 } 415 415 } 416 if (nextWay == null) return false;416 if (nextWay == null) return false; 417 417 used += 1; 418 418 currentWay = nextWay; 419 if (endNode == startNode) return used == ways.size();419 if (endNode == startNode) return used == ways.size(); 420 420 } 421 421 } -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r8459 r8460 235 235 Set<Node> nodes = new HashSet<>(); 236 236 Map<Way, Line> lines = new HashMap<>(); 237 for (Way w: ways) {238 if (w.firstNode() == w.lastNode())237 for (Way w: ways) { 238 if (w.isClosed()) 239 239 throw new InvalidSelection(tr("Can not align a polygon. Abort.")); 240 240 nodes.addAll(w.getNodes()); … … 243 243 Collection<Command> cmds = new ArrayList<>(nodes.size()); 244 244 List<Way> referers = new ArrayList<>(ways.size()); 245 for (Node n: nodes) {245 for (Node n: nodes) { 246 246 referers.clear(); 247 for (OsmPrimitive o: n.getReferrers())248 if (ways.contains(o))247 for (OsmPrimitive o: n.getReferrers()) 248 if (ways.contains(o)) 249 249 referers.add((Way) o); 250 if (referers.size() == 1) {250 if (referers.size() == 1) { 251 251 Way way = referers.get(0); 252 if (n == way.firstNode() || n == way.lastNode()) continue;252 if (way.isFirstLastNode(n)) continue; 253 253 cmds.add(lines.get(way).projectionCommand(n)); 254 } else if (referers.size() == 2) {254 } else if (referers.size() == 2) { 255 255 Command cmd = lines.get(referers.get(0)).intersectionCommand(n, lines.get(referers.get(1))); 256 256 cmds.add(cmd); -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r8459 r8460 1070 1070 // Remove all of these way to make the next work. 1071 1071 List<WayInPolygon> cleanMultigonWays = new ArrayList<>(); 1072 for (WayInPolygon way: multigonWays)1073 if (way.way.getNodesCount() == 2 && way.way.firstNode() == way.way.lastNode())1072 for (WayInPolygon way: multigonWays) 1073 if (way.way.getNodesCount() == 2 && way.way.isClosed()) 1074 1074 discardedWays.add(way); 1075 1075 else -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r8456 r8460 441 441 return delete(layer, Collections.singleton(ws.way), false); 442 442 443 if (ws.way.firstNode() == ws.way.lastNode()) { 444 // If the way is circular (first and last nodes are the same), 445 // the way shouldn't be splitted 443 if (ws.way.isClosed()) { 444 // If the way is circular (first and last nodes are the same), the way shouldn't be splitted 446 445 447 446 List<Node> n = new ArrayList<>(); … … 456 455 } 457 456 458 List<Node> n1 = new ArrayList<>(), n2 = new ArrayList<>(); 457 List<Node> n1 = new ArrayList<>(); 458 List<Node> n2 = new ArrayList<>(); 459 459 460 460 n1.addAll(ws.way.getNodes().subList(0, ws.lowerIndex + 1)); -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r8444 r8460 391 391 boolean locked = writeLock(); 392 392 try { 393 boolean closed = lastNode() == firstNode() && selection.contains(lastNode());393 boolean closed = isClosed() && selection.contains(lastNode()); 394 394 List<Node> copy = new ArrayList<>(); 395 395 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSortUtils.java
r7937 r8460 34 34 w.getNode(1) != null && 35 35 w.getNode(2) != null && 36 w. firstNode() == w.lastNode()) {36 w.isClosed()) { 37 37 /** do some simple determinant / cross pruduct test on the first 3 nodes 38 38 to see, if the roundabout goes clock wise or ccw */
Note:
See TracChangeset
for help on using the changeset viewer.