Changeset 11608 in josm for trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
- Timestamp:
- 2017-02-25T03:14:20+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r10991 r11608 169 169 } 170 170 if (n == null) { 171 String s; 172 if ( (s = node.get("addr:housename"))!= null) {171 String s = node.get("addr:housename"); 172 if (s != null) { 173 173 /* I18n: name of house as parameter */ 174 174 n = tr("House {0}", s); … … 250 250 } 251 251 if (n == null) { 252 n = (way.get("highway") != null) ? tr("highway") :253 (way.get("railway") != null) ? tr("railway") :254 (way.get("waterway") != null) ? tr("waterway") :255 (way.get("landuse") != null) ? tr("landuse") : null;252 n = way.hasKey("highway") ? tr("highway") : 253 way.hasKey("railway") ? tr("railway") : 254 way.hasKey("waterway") ? tr("waterway") : 255 way.hasKey("landuse") ? tr("landuse") : null; 256 256 } 257 257 if (n == null) { 258 String s; 259 if ( (s = way.get("addr:housename"))!= null) {258 String s = way.get("addr:housename"); 259 if (s != null) { 260 260 /* I18n: name of house as parameter */ 261 261 n = tr("House {0}", s); … … 273 273 } 274 274 } 275 if (n == null && way.get("building") != null) n = tr("building"); 275 if (n == null && way.hasKey("building")) { 276 n = tr("building"); 277 } 276 278 if (n == null || n.isEmpty()) { 277 279 n = String.valueOf(way.getId()); … … 407 409 String name = trc("Relation type", relation.get("type")); 408 410 if (name == null) { 409 name = (relation.get("public_transport") != null) ? tr("public transport") : null;411 name = relation.hasKey("public_transport") ? tr("public transport") : null; 410 412 } 411 413 if (name == null) { … … 573 575 if (sb.length() == 0) { 574 576 sb.append( 575 (way.get("highway") != null) ? tr("highway") :576 (way.get("railway") != null) ? tr("railway") :577 (way.get("waterway") != null) ? tr("waterway") :578 (way.get("landuse") != null) ? tr("landuse") : ""577 way.hasKey("highway") ? tr("highway") : 578 way.hasKey("railway") ? tr("railway") : 579 way.hasKey("waterway") ? tr("waterway") : 580 way.hasKey("landuse") ? tr("landuse") : "" 579 581 ); 580 582 } 581 583 582 int nodesNo = way.isClosed() ? way.getNumNodes() -1 : way.getNumNodes(); 584 int nodesNo = way.isClosed() ? (way.getNumNodes() -1) : way.getNumNodes(); 583 585 String nodes = trn("{0} node", "{0} nodes", nodesNo, nodesNo); 584 586 if (sb.length() == 0) { … … 587 589 /* note: length == 0 should no longer happen, but leave the bracket code 588 590 nevertheless, who knows what future brings */ 589 sb.append((sb.length() > 0) ? " ("+nodes+')' : nodes); 591 sb.append((sb.length() > 0) ? (" ("+nodes+')') : nodes); 590 592 decorateNameWithId(sb, way); 591 593 return sb.toString(); … … 595 597 public String format(HistoryRelation relation) { 596 598 StringBuilder sb = new StringBuilder(); 597 if (relation.get("type") != null) { 598 sb.append(relation.get("type")); 599 String type = relation.get("type"); 600 if (type != null) { 601 sb.append(type); 599 602 } else { 600 603 sb.append(tr("relation"));
Note:
See TracChangeset
for help on using the changeset viewer.
