Changeset 33455 in osm for applications
- Timestamp:
- 2017-07-18T13:34:16+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/EdgeSelectionAction.java
r33429 r33455 11 11 import java.util.List; 12 12 import java.util.Set; 13 import java.util.stream.Collectors; 13 14 14 15 import org.openstreetmap.josm.Main; … … 16 17 import org.openstreetmap.josm.data.osm.DataSet; 17 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.data.osm.RelationMember; 18 20 import org.openstreetmap.josm.data.osm.Way; 21 import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter; 19 22 import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils; 20 23 import org.openstreetmap.josm.tools.ImageProvider; … … 30 33 public class EdgeSelectionAction extends MapMode { 31 34 32 private static final String mapModeName= "Edge Selection";35 private static final String MAP_MODE_NAME = "Edge Selection"; 33 36 private static final long serialVersionUID = 2414977774504904238L; 34 37 … … 39 42 40 43 public EdgeSelectionAction() { 41 super(tr( mapModeName), "edgeSelection", tr(mapModeName),44 super(tr(MAP_MODE_NAME), "edgeSelection", tr(MAP_MODE_NAME), 42 45 Shortcut.registerShortcut("mapmode:edge_selection", 43 tr("Mode: {0}", tr( mapModeName)),46 tr("Mode: {0}", tr(MAP_MODE_NAME)), 44 47 KeyEvent.VK_K, Shortcut.CTRL), 45 48 ImageProvider.getCursor("normal", "selection")); … … 80 83 81 84 edge.add(initial); 85 edge = sortEdgeWays(edge); 82 86 return edge; 87 } 88 89 private List<Way> sortEdgeWays(List<Way> edge) { 90 List<RelationMember> members = 91 edge.stream() 92 .map(w -> new RelationMember("", w)) 93 .collect(Collectors.toList()); 94 List<RelationMember> sorted = new RelationSorter().sortMembers(members); 95 return sorted.stream() 96 .map(RelationMember::getWay) 97 .collect(Collectors.toList()); 83 98 } 84 99
Note:
See TracChangeset
for help on using the changeset viewer.