private Map<OsmPrimitive, List<TagCorrection>> getTagCorrectionsForWay(String middleNodeTags) { final OsmPrimitive n1 = OsmUtils.createPrimitive("node"); final OsmPrimitive n2 = OsmUtils.createPrimitive("node " + middleNodeTags); final OsmPrimitive n3 = OsmUtils.createPrimitive("node"); final Way w = new Way(); Stream.of(n1, n2, n3).map(Node.class::cast).forEach(w::addNode); return ReverseWayTagCorrector.getTagCorrectionsMap(w); }
private String getRelationTypeName(IRelation relation) { String name = trc("Relation type", relation.get("type")); if (name == null) { name = (relation.get("public_transport") != null) ? tr("public transport") : null; } if (name == null) { String building = relation.get("building"); if (OsmUtils.isTrue(building)) { name = tr("building"); } else if (building != null) { name = tr(building); // translate tag! } } if (name == null) { name = trc("Place type", relation.get("place")); } if (name == null) { name = tr("relation"); } String admin_level = relation.get("admin_level"); if (admin_level != null) { name += "[" + admin_level + "]"; } for (NameFormatterHook hook : formatHooks) { String hookResult = hook.checkRelationTypeName(relation, name); if (hookResult != null) return hookResult; } return name; }
private String getNameTagValue(IRelation relation, String nameTag) { if (nameTag.equals("name")) { if (Main.pref.getBoolean("osm-primitives.localize-name", true)) return relation.getLocalName(); else return relation.getName(); } else if (nameTag.equals(":LocationCode")) { for (String m : relation.keySet()) { if (m.endsWith(nameTag)) return relation.get(m); } return null; } else if (nameTag.startsWith("?") && OsmUtils.isTrue(relation.get(nameTag.substring(1)))) { return tr(nameTag.substring(1)); } else if (nameTag.startsWith("?") && OsmUtils.isFalse(relation.get(nameTag.substring(1)))) { return null; } else { return trc_lazy(nameTag, I18n.escape(relation.get(nameTag))); } }