Fall back to ref tag for displayed feature name

This commit is contained in:
John Firebaugh
2013-06-03 18:32:19 -07:00
parent 20a2c4055b
commit 6befa984db
4 changed files with 9 additions and 9 deletions
+5 -5
View File
@@ -104,7 +104,7 @@ iD.svg.Labels = function(projection, context) {
'startOffset': '50%',
'xlink:href': function(d) { return '#labelpath-' + d.id; }
})
.text(iD.util.localeName);
.text(iD.util.displayName);
texts.exit().remove();
@@ -140,8 +140,8 @@ iD.svg.Labels = function(projection, context) {
texts.attr('x', get(labels, 'x'))
.attr('y', get(labels, 'y'))
.style('text-anchor', get(labels, 'textAnchor'))
.text(iD.util.localeName)
.each(function(d, i) { textWidth(iD.util.localeName(d), labels[i].height, this); });
.text(iD.util.displayName)
.each(function(d, i) { textWidth(iD.util.displayName(d), labels[i].height, this); });
texts.exit().remove();
return texts;
@@ -267,7 +267,7 @@ iD.svg.Labels = function(projection, context) {
preset = geometry === 'area' && context.presets().match(entity, graph),
icon = preset && !blacklisted(preset) && preset.icon;
if ((iD.util.localeName(entity) || icon) && !(hidePoints && geometry === 'point')) {
if ((iD.util.displayName(entity) || icon) && !(hidePoints && geometry === 'point')) {
for (k = 0; k < label_stack.length; k ++) {
if (entity.geometry(graph) === label_stack[k][0] &&
@@ -296,7 +296,7 @@ iD.svg.Labels = function(projection, context) {
var font_size = font_sizes[k];
for (i = 0; i < labelable[k].length; i ++) {
entity = labelable[k][i];
var name = iD.util.localeName(entity),
var name = iD.util.displayName(entity),
width = name && textWidth(name, font_size),
p;
if (entity.geometry(graph) === 'point') {
+1 -1
View File
@@ -71,7 +71,7 @@ iD.ui.RawMemberEditor = function(context) {
$label.append('span')
.attr('class', 'member-entity-name')
.text(function(d) { return iD.util.localeName(d.member); });
.text(function(d) { return iD.util.displayName(d.member); });
} else {
d3.select(this).append('label')
+1 -1
View File
@@ -67,7 +67,7 @@ iD.ui.RawMembershipEditor = function(context) {
$label.append('span')
.attr('class', 'member-entity-name')
.text(function(d) { return iD.util.localeName(d.relation); });
.text(function(d) { return iD.util.displayName(d.relation); });
$enter.append('input')
.attr('class', 'member-role')
+2 -2
View File
@@ -10,9 +10,9 @@ iD.util.entitySelector = function(ids) {
return ids.length ? '.' + ids.join(',.') : 'nothing';
};
iD.util.localeName = function(entity) {
iD.util.displayName = function(entity) {
var localeName = 'name:' + iD.detect().locale.toLowerCase().split('-')[0];
return entity.tags[localeName] || entity.tags.name;
return entity.tags[localeName] || entity.tags.name || entity.tags.ref;
};
iD.util.stringQs = function(str) {