Changeset 17672 in josm
- Timestamp:
- 2021-03-26T22:41:28+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DefaultNameFormatter.java
r17671 r17672 178 178 TaggingPreset preset = TaggingPresetNameTemplateList.getInstance().findPresetTemplate(node); 179 179 if (preset == null || !(node instanceof TemplateEngineDataProvider)) { 180 String n; 181 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 182 n = node.getLocalName(); 183 } else { 184 n = node.getName(); 185 } 180 String n = formatLocalName(node); 186 181 if (n == null) { 187 182 n = formatAddress(node); … … 239 234 if (preset == null || !(way instanceof TemplateEngineDataProvider)) { 240 235 String n; 241 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 242 n = way.getLocalName(); 243 } else { 244 n = way.getName(); 245 } 236 n = formatLocalName(way); 246 237 if (n == null) { 247 238 n = way.get("ref"); … … 283 274 .findFirst().orElse(result); 284 275 276 } 277 278 private static String formatLocalName(IPrimitive osm) { 279 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 280 return osm.getLocalName(); 281 } else { 282 return osm.getName(); 283 } 284 } 285 286 private static String formatLocalName(HistoryOsmPrimitive osm) { 287 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 288 return osm.getLocalName(); 289 } else { 290 return osm.getName(); 291 } 285 292 } 286 293 … … 440 447 private static String getNameTagValue(IRelation<?> relation, String nameTag) { 441 448 if ("name".equals(nameTag)) { 442 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) 443 return relation.getLocalName(); 444 else 445 return relation.getName(); 449 return formatLocalName(relation); 446 450 } else if (":LocationCode".equals(nameTag)) { 447 451 return relation.keys() … … 534 538 public String format(HistoryNode node) { 535 539 StringBuilder sb = new StringBuilder(); 536 String name; 537 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 538 name = node.getLocalName(); 539 } else { 540 name = node.getName(); 541 } 540 String name = formatLocalName(node); 542 541 if (name == null) { 543 542 sb.append(node.getId()); … … 560 559 public String format(HistoryWay way) { 561 560 StringBuilder sb = new StringBuilder(); 562 String name; 563 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 564 name = way.getLocalName(); 565 } else { 566 name = way.getName(); 567 } 561 String name = formatLocalName(way); 568 562 if (name != null) { 569 563 sb.append(name); … … 608 602 // #3328: "note " and " note" are name tags too 609 603 if (namingTags.contains(n.trim())) { 610 if (Config.getPref().getBoolean("osm-primitives.localize-name", true)) { 611 nameTag = relation.getLocalName(); 612 } else { 613 nameTag = relation.getName(); 614 } 604 nameTag = formatLocalName(relation); 615 605 if (nameTag == null) { 616 606 nameTag = relation.get(n);
Note:
See TracChangeset
for help on using the changeset viewer.