Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterManager.java
r12403 r12407 18 18 import java.util.TreeSet; 19 19 import java.util.function.Consumer; 20 import java.util.regex.Matcher; 21 import java.util.regex.Pattern; 20 22 21 23 import org.openstreetmap.josm.Main; … … 175 177 if (ds != null) { 176 178 BBox bbox = Main.map.mapView.getState().getViewArea().getLatLonBoundsBox().toBBox(); 177 Consumer<OsmPrimitive> consumer = o -> { 178 String value = o.get(key); 179 if (value != null) { 180 for (String v : value.split(";")) { 179 Consumer<OsmPrimitive> consumer = getTagValuesConsumer(key, values); 180 ds.searchNodes(bbox).forEach(consumer); 181 ds.searchWays(bbox).forEach(consumer); 182 ds.searchRelations(bbox).forEach(consumer); 183 } 184 return values; 185 } 186 187 static Consumer<OsmPrimitive> getTagValuesConsumer(String key, Set<String> values) { 188 return o -> { 189 String value = o.get(key); 190 if (value != null) { 191 Pattern p = Pattern.compile("(-?[0-9]+)-(-?[0-9]+)"); 192 for (String v : value.split(";")) { 193 Matcher m = p.matcher(v); 194 if (m.matches()) { 195 int a = Integer.parseInt(m.group(1)); 196 int b = Integer.parseInt(m.group(2)); 197 for (int i = Math.min(a, b); i <= Math.max(a, b); i++) { 198 values.add(Integer.toString(i)); 199 } 200 } else { 181 201 values.add(v); 182 202 } 183 203 } 184 }; 185 ds.searchNodes(bbox).forEach(consumer); 186 ds.searchWays(bbox).forEach(consumer); 187 ds.searchRelations(bbox).forEach(consumer); 188 } 189 return values; 204 } 205 }; 190 206 } 191 207
Note:
See TracChangeset
for help on using the changeset viewer.