Changeset 23103 in osm for applications/editors/josm/plugins/wayselector
- Timestamp:
- 2010-09-10T21:51:20+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/wayselector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wayselector/build.xml
r23100 r23103 31 31 32 32 <!-- enter the SVN commit message --> 33 <property name="commit.message" value=" Do not mutate the collection of selected ways. Convert TAB to spaces." />33 <property name="commit.message" value="Optimize WaySelection.findWay()." /> 34 34 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 35 35 <property name="plugin.main.version" value="3095" /> -
applications/editors/josm/plugins/wayselector/src/org/openstreetmap/josm/plugins/wayselector/WaySelection.java
r23100 r23103 69 69 @param node perimeter node from which to extend the selection 70 70 @return a way by which to extend the selection, or null */ 71 private Way findWay(Collection<OsmPrimitive> selection, Node node) {72 TreeSet<Way> foundWays = new TreeSet<Way>();71 private static Way findWay(Collection<OsmPrimitive> selection, Node node) { 72 Way foundWay = null; 73 73 74 74 for (Way way : OsmPrimitive.getFilteredList(node.getReferrers(), 75 Way.class)) 76 if (way.getNodesCount() >= 2 && !selection.contains(way) &&77 way.isFirstLastNode(node))78 foundWays.add(way);75 Way.class)) { 76 if (way.getNodesCount() < 2 || !way.isFirstLastNode(node) 77 || selection.contains(way)) 78 continue; 79 79 80 return foundWays.size() == 1 ? foundWays.first() : null; 80 /* A previously unselected way was found that is connected 81 to the node. */ 82 if (foundWay != null) 83 /* This is not the only qualifying way. There is a 84 branch at the node, and we cannot extend the selection. */ 85 return null; 86 87 /* Remember the first found qualifying way. */ 88 foundWay = way; 89 } 90 91 /* Return the only way found, or null if none was found. */ 92 return foundWay; 81 93 } 82 94
Note:
See TracChangeset
for help on using the changeset viewer.