 Timestamp:
 20150409T22:17:16+02:00 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r8061 r8181 95 95 96 96 /** 97 * @param ways 97 * Combine multiple ways into one. 98 * @param ways the way to combine to one way 98 99 * @return null if ways cannot be combined. Otherwise returns the combined 99 100 * ways and the commands to combine … … 114 115 // ways 115 116 // 116 NodeGraph graph = NodeGraph.create UndirectedGraphFromNodeWays(ways);117 NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ways); 117 118 List<Node> path = graph.buildSpanningPath(); 118 119 if (path == null) { … … 421 422 } 422 423 424 /** 425 * Create an undirected graph from the given ways. 426 * @param ways Ways to build the graph from 427 * @return node graph structure 428 */ 423 429 public static NodeGraph createUndirectedGraphFromNodeList(List<NodePair> pairs) { 424 430 NodeGraph graph = new NodeGraph(); … … 430 436 } 431 437 438 /** 439 * Create an undirected graph from the given ways, but prevent reversing of all 440 * nonnew ways by fix one direction. 441 * @param ways Ways to build the graph from 442 * @return node graph structure 443 * @since 8181 444 */ 432 445 public static NodeGraph createUndirectedGraphFromNodeWays(Collection<Way> ways) { 446 boolean dir = true; 433 447 NodeGraph graph = new NodeGraph(); 434 448 for (Way w: ways) { 435 449 graph.add(buildNodePairs(w, false /* undirected */)); 450 } 451 return graph; 452 } 453 454 public static NodeGraph createNearlyUndirectedGraphFromNodeWays(Collection<Way> ways) { 455 boolean dir = true; 456 NodeGraph graph = new NodeGraph(); 457 for (Way w: ways) { 458 if(!w.isNew()) { 459 /* let the first nonnew way give the direction (see #5880) */ 460 graph.add(buildNodePairs(w, dir)); 461 dir = false; 462 } else { 463 graph.add(buildNodePairs(w, false /* undirected */)); 464 } 436 465 } 437 466 return graph; … … 604 633 /** 605 634 * Tries to find a path through the graph which visits each edge (i.e. 606 * the segment of a way) exactly on e.635 * the segment of a way) exactly once. 607 636 * 608 637 * @return the path; null, if no path was found
Note:
See TracChangeset
for help on using the changeset viewer.