Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-05-23 16:12:51 +02:00
commit 84b0b30500

View file

@ -183,7 +183,6 @@ public class MapRenderingTypes {
rType = MapRulType.createAdditional(tag, val); rType = MapRulType.createAdditional(tag, val);
rType.additional = true; rType.additional = true;
rType.order = parent.order; rType.order = parent.order;
rType.applyToTagValue = parent.applyToTagValue;
rType.onlyMap = parent.onlyMap; rType.onlyMap = parent.onlyMap;
rType.onlyPoi = parent.onlyPoi; rType.onlyPoi = parent.onlyPoi;
rType.onlyPoint = parent.onlyPoint; rType.onlyPoint = parent.onlyPoint;
@ -216,24 +215,11 @@ public class MapRenderingTypes {
if(rType == nameEnRuleType && Algorithms.objectEquals(val, tags.get(OSMTagKey.NAME))) { if(rType == nameEnRuleType && Algorithms.objectEquals(val, tags.get(OSMTagKey.NAME))) {
continue; continue;
} }
if(rType.targetTagValue != null) {
rType = rType.targetTagValue;
}
if (rType.isAdditionalOrText()) { if (rType.isAdditionalOrText()) {
boolean applied = rType.applyToTagValue == null; if (!rType.isText() && !Algorithms.isEmpty(rType.tagValuePattern.value)) {
if(!applied) { val = rType.tagValuePattern.value;
Iterator<TagValuePattern> it = rType.applyToTagValue.iterator();
while(!applied && it.hasNext()) {
TagValuePattern nv = it.next();
applied = nv.isApplicable(tags);
}
}
if (applied) {
if (!rType.isText() && !Algorithms.isEmpty(rType.tagValuePattern.value)) {
val = rType.tagValuePattern.value;
}
map.put(rType.tagValuePattern.tag, val);
} }
map.put(rType.tagValuePattern.tag, val);
} }
} }
} }
@ -373,32 +359,13 @@ public class MapRenderingTypes {
if(filterOnlyMap && rtype.onlyMap) { if(filterOnlyMap && rtype.onlyMap) {
return null; return null;
} }
String targetTag = parser.getAttributeValue("", "target_tag");
String targetValue = parser.getAttributeValue("", "target_value");
if (targetTag != null || targetValue != null) {
if (targetTag == null) {
targetTag = rtype.getTag();
}
if (targetValue == null) {
targetValue = rtype.getValue();
}
rtype.targetTagValue = types.get(constructRuleKey(targetTag, targetValue));
if (rtype.targetTagValue == null) {
throw new RuntimeException("Illegal target tag/value " + targetTag + " " + targetValue + " for " + tag + " / " + value);
}
}
String order = parser.getAttributeValue("", "order"); String order = parser.getAttributeValue("", "order");
if(!Algorithms.isEmpty(order)) { if(!Algorithms.isEmpty(order)) {
rtype.order = Integer.parseInt(order); rtype.order = Integer.parseInt(order);
} else if (parentCategory != null) { } else if (parentCategory != null) {
rtype.order = parentCategory.order; rtype.order = parentCategory.order;
} }
String applyTo = parser.getAttributeValue("", "apply_to");
String applyValue = parser.getAttributeValue("", "apply_value");
if (applyTo != null || applyValue != null) {
rtype.applyToTagValue = new HashSet<TagValuePattern>();
rtype.applyToTagValue.add(new TagValuePattern(applyTo, applyValue));
}
if(!rtype.onlyMap) { if(!rtype.onlyMap) {
rtype = registerRuleType(rtype); rtype = registerRuleType(rtype);
} }
@ -449,8 +416,6 @@ public class MapRenderingTypes {
tagName = rtype.namePrefix + tagName; tagName = rtype.namePrefix + tagName;
} }
MapRulType mt = MapRulType.createText(tagName); MapRulType mt = MapRulType.createText(tagName);
mt.applyToTagValue = new HashSet<TagValuePattern>();
mt.applyToTagValue.add(rtype.tagValuePattern);
mt = registerRuleType(mt); mt = registerRuleType(mt);
rtype.names[i] = mt; rtype.names[i] = mt;
} }
@ -468,17 +433,6 @@ public class MapRenderingTypes {
MapRulType mapRulType = types.get(keyVal); MapRulType mapRulType = types.get(keyVal);
if(mapRulType.isAdditional() || mapRulType.isText() ) { if(mapRulType.isAdditional() || mapRulType.isText() ) {
rt.id = mapRulType.id; rt.id = mapRulType.id;
if(rt.applyToTagValue != null ){
if(mapRulType.applyToTagValue == null) {
rt.applyToTagValue = null;
} else {
rt.applyToTagValue.addAll(mapRulType.applyToTagValue);
mapRulType.applyToTagValue.addAll(rt.applyToTagValue);
}
} else {
mapRulType.applyToTagValue = null;
}
if(rt.isMain()) { if(rt.isMain()) {
mapRulType.main = true; mapRulType.main = true;
if(rt.minzoom != 0) { if(rt.minzoom != 0) {
@ -613,7 +567,6 @@ public class MapRenderingTypes {
protected boolean additionalText; protected boolean additionalText;
protected boolean main; protected boolean main;
protected int order = 50; protected int order = 50;
protected Set<TagValuePattern> applyToTagValue = null;
protected String category = null; protected String category = null;
protected String poiPrefix; protected String poiPrefix;
@ -622,9 +575,6 @@ public class MapRenderingTypes {
// poi_category was specially removed for one tag/value, to skip unnecessary objects // poi_category was specially removed for one tag/value, to skip unnecessary objects
protected boolean poiSpecified; protected boolean poiSpecified;
protected MapRulType targetTagValue;
protected boolean relation; protected boolean relation;
// creation of only section // creation of only section
protected boolean onlyMap; protected boolean onlyMap;
@ -720,10 +670,6 @@ public class MapRenderingTypes {
this.targetId = targetId; this.targetId = targetId;
} }
public MapRulType getTargetTagValue() {
return targetTagValue;
}
public String getValue() { public String getValue() {
return tagValuePattern.value; return tagValuePattern.value;
} }