Ticket #17582: 17582.patch
| File 17582.patch, 4.9 KB (added by , 7 years ago) |
|---|
-
src/org/openstreetmap/josm/plugins/rex/actions/TagRoundaboutAction.java
35 35 import org.openstreetmap.josm.spi.preferences.Config; 36 36 import org.openstreetmap.josm.tools.Logging; 37 37 import org.openstreetmap.josm.tools.Shortcut; 38 import org.openstreetmap.josm.tools.Utils; 38 39 39 40 /** 40 41 * Expands to a roundabout … … 88 89 89 90 //Figure out what we have to work with: 90 91 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 91 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class);92 List<Way> selectedWays = OsmPrimitive.getFilteredList(selection, Way.class);92 List<Node> selectedNodes = new ArrayList<>(Utils.filteredCollection(selection, Node.class)); 93 List<Way> selectedWays = new ArrayList<>(Utils.filteredCollection(selection, Way.class)); 93 94 94 95 //If we have exactly one single node selected 95 96 if (selection.size() == 1 … … 210 211 211 212 //Copy tags from most prominent way. 212 213 //TODO Prioritize through ways over single ways. 213 List<Way> refWays = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);214 List<Way> refWays = new ArrayList<>(Utils.filteredCollection(node.getReferrers(), Way.class)); 214 215 Collections.sort(refWays, new HighComp(node)); 215 216 Map<String, String> tagsToCopy = new HashMap<>(); 216 217 if (!refWays.isEmpty()) { … … 304 305 */ 305 306 private void splitAll(Node node) { 306 307 //Find all ways connected to this node 307 List<Way> referedWays = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);308 List<Way> referedWays = new ArrayList<>(Utils.filteredCollection(node.getReferrers(), Way.class)); 308 309 //Walk through each and check if we are in the middle 309 310 for (Way from : referedWays) { 310 311 if (from.isClosed()) { … … 499 500 */ 500 501 public boolean moveWayEndNodeTowardsNextNode(Node node, double distance) { 501 502 //some verification: 502 List<Way> referedWays = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);503 List<Way> referedWays = new ArrayList<>(Utils.filteredCollection(node.getReferrers(), Way.class)); 503 504 504 505 //node must be member of exactly one way 505 506 if (referedWays.size() != 1) { … … 581 582 582 583 public boolean selectFlareCandidates() { 583 584 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 584 List<Way> selectedWays = OsmPrimitive.getFilteredList(selection, Way.class);585 List<Way> selectedWays = new ArrayList<>(Utils.filteredCollection(selection, Way.class)); 585 586 //pri("Selecting flare candidates"); 586 587 587 588 //We have exactly one way selected … … 596 597 List<Node> nodes2 = new ArrayList<>(); 597 598 List<Way> refWays; 598 599 for (Node node : nodes) { 599 refWays = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);600 refWays = new ArrayList<>(Utils.filteredCollection(node.getReferrers(), Way.class)); 600 601 for (Way hmmway : refWays) { 601 602 if (hmmway.isFirstLastNode(node) 602 603 && hmmway != way … … 631 632 */ 632 633 public boolean makeFlares() { 633 634 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 634 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class);635 List<Node> selectedNodes = new ArrayList<>(Utils.filteredCollection(selection, Node.class)); 635 636 636 637 //We have a reasonable amount of nodes selected 637 638 if (0 < selectedNodes.size() … … 642 643 if (commonWays.size() == 1) { 643 644 Way tWay = commonWays.iterator().next(); 644 645 for (Node cNode : selectedNodes) { 645 List<Way> iWayCandidates = OsmPrimitive.getFilteredList(cNode.getReferrers(), Way.class);646 List<Way> iWayCandidates = new ArrayList<>(Utils.filteredCollection(cNode.getReferrers(), Way.class)); 646 647 if (iWayCandidates.size() == 2) { 647 648 for (Way iWay : iWayCandidates) { 648 649 if (iWay != tWay) { … … 673 674 674 675 //We examine the referring ways of one of nodes 675 676 Node n = nodes.get(0); 676 List<Way> nodeReferringWays = OsmPrimitive.getFilteredList(n.getReferrers(), Way.class);677 List<Way> nodeReferringWays = new ArrayList<>(Utils.filteredCollection(n.getReferrers(), Way.class)); 677 678 for (Way referredWay : nodeReferringWays) { 678 679 //if all nodes are a member 679 680 if (wayContainsAllNodes(referredWay, nodes)) {
