Changeset 11553 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint
- Timestamp:
- 2017-02-12T16:32:18+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r11212 r11553 3 3 4 4 import java.util.Arrays; 5 import java.util.Optional; 5 6 6 7 import org.openstreetmap.josm.data.osm.Storage; … … 44 45 45 46 int idx = getIndex(selected); 46 DividedScale<StyleElementList> ds = s.states[idx]; 47 if (ds == null) { 48 ds = new DividedScale<>(); 49 } 50 s.states[idx] = ds.put(o, r); 47 s.states[idx] = Optional.ofNullable(s.states[idx]).orElseGet(DividedScale::new).put(o, r); 51 48 return s.intern(); 52 49 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java
r10599 r11553 163 163 164 164 private static List<String> buildNameTags(List<String> nameTags) { 165 if (nameTags == null) {166 nameTags = Collections.emptyList();167 }168 165 List<String> result = new ArrayList<>(); 169 for (String tag: nameTags) { 170 if (tag == null) { 171 continue; 172 } 173 tag = tag.trim(); 174 if (tag.isEmpty()) { 175 continue; 176 } 177 result.add(tag); 166 if (nameTags != null) { 167 for (String tag: nameTags) { 168 if (tag == null) { 169 continue; 170 } 171 tag = tag.trim(); 172 if (tag.isEmpty()) { 173 continue; 174 } 175 result.add(tag); 176 } 178 177 } 179 178 return result; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java
r11452 r11553 6 6 import java.util.Arrays; 7 7 import java.util.Objects; 8 import java.util.Optional; 8 9 9 10 import org.openstreetmap.josm.Main; … … 357 358 if (casingWidth == null) 358 359 return null; 359 width = getWidth(c, WIDTH, getWidth(cDef, WIDTH, null)); 360 if (width == null) { 361 width = 0f; 362 } 363 width += 2 * casingWidth; 360 width = Optional.ofNullable(getWidth(c, WIDTH, getWidth(cDef, WIDTH, null))).orElse(0f) + 2 * casingWidth; 364 361 break; 365 362 case LEFT_CASING: … … 378 375 379 376 /* if we have a "width" tag, try use it */ 380 String widthTag = env.osm.get("width"); 381 if (widthTag == null) { 382 widthTag = env.osm.get("est_width"); 383 } 377 String widthTag = Optional.ofNullable(env.osm.get("width")).orElseGet(() -> env.osm.get("est_width")); 384 378 if (widthTag != null) { 385 379 try { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r10875 r11553 167 167 sizeOnDefault = null; 168 168 } 169 Float size = getWidth(c, "symbol-size", sizeOnDefault); 170 171 if (size == null) { 172 size = 10f; 173 } 174 169 Float size = Optional.ofNullable(getWidth(c, "symbol-size", sizeOnDefault)).orElse(10f); 175 170 if (size <= 0) 176 171 return null;
Note:
See TracChangeset
for help on using the changeset viewer.