Changeset 15842 in josm for trunk/src/org
- Timestamp:
- 2020-02-11T20:31:02+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterRule.java
r15839 r15842 2 2 package org.openstreetmap.josm.gui.autofilter; 3 3 4 import java.text.DecimalFormat; 4 5 import java.util.Arrays; 5 6 import java.util.Objects; … … 122 123 Matcher m = p.matcher(v); 123 124 if (m.matches()) { 124 int a = Integer.parseInt(m.group(1));125 int b = Integer.parseInt(m.group(2));125 int a = valueExtractor.applyAsInt(m.group(1)); 126 int b = valueExtractor.applyAsInt(m.group(2)); 126 127 return IntStream.rangeClosed(Math.min(a, b), Math.max(a, b)); 127 128 } else { … … 144 145 public static AutoFilterRule[] defaultRules() { 145 146 return new AutoFilterRule[]{ 146 new AutoFilterRule("level", 17), 147 new AutoFilterRule("level", 17) 148 // #17109, support values like 0.5 or 1.5 - level values are multiplied by 2 when parsing, values are divided by 2 for formatting 149 .setValueExtractor(s -> (int) (Double.parseDouble(s) * 2.)) 150 .setValueFormatter(v -> DecimalFormat.getInstance().format(v / 2.)), 147 151 new AutoFilterRule("layer", 16) 148 152 .setDefaultValueSupplier(AutoFilterRule::defaultLayer),
Note:
See TracChangeset
for help on using the changeset viewer.