Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-11-30 20:46:30 +01:00
commit a56fd95f7f
3 changed files with 16 additions and 13 deletions

View file

@ -289,14 +289,13 @@ public class MapRenderingTypes {
return nameEnRuleType; return nameEnRuleType;
} }
public Map<String, String> getAmenityAdditionalInfo(Entity e, AmenityType type, String subtype) { public Map<String, String> getAmenityAdditionalInfo(Map<String, String> tags, AmenityType type, String subtype) {
Map<String, String> map = new LinkedHashMap<String, String>(); Map<String, String> map = new LinkedHashMap<String, String>();
Collection<String> tagKeySet = e.getTagKeySet(); for (String tag : tags.keySet()) {
for (String tag : tagKeySet) { String val = tags.get(tag);
String val = e.getTag(tag);
MapRulType rType = getAmenityRuleType(tag, val); MapRulType rType = getAmenityRuleType(tag, val);
if (rType != null && val.length() > 0) { if (rType != null && val.length() > 0) {
if(rType == nameEnRuleType && Algorithms.objectEquals(val, e.getTag(OSMTagKey.NAME))) { if(rType == nameEnRuleType && Algorithms.objectEquals(val, tags.get(OSMTagKey.NAME))) {
continue; continue;
} }
if(rType.targetTagValue != null) { if(rType.targetTagValue != null) {
@ -308,7 +307,7 @@ public class MapRenderingTypes {
Iterator<TagValuePattern> it = rType.applyToTagValue.iterator(); Iterator<TagValuePattern> it = rType.applyToTagValue.iterator();
while(!applied && it.hasNext()) { while(!applied && it.hasNext()) {
TagValuePattern nv = it.next(); TagValuePattern nv = it.next();
applied = nv.isApplicable(e); applied = nv.isApplicable(tags);
} }
} }
if (applied) { if (applied) {
@ -599,11 +598,11 @@ public class MapRenderingTypes {
} }
} }
public boolean isApplicable(Entity e ){ public boolean isApplicable(Map<String, String> e ){
if(value == null) { if(value == null) {
return e.getTag(tag) != null; return e.get(tag) != null;
} }
return value.equals(e.getTag(tag)); return value.equals(e.get(tag));
} }
@Override @Override

View file

@ -63,12 +63,16 @@ public class EntityParser {
mo.setName(op); mo.setName(op);
} }
public static Amenity parseAmenity(Entity entity, AmenityType type, String subtype, MapRenderingTypes types) { public static Amenity parseAmenity(Entity entity, AmenityType type, String subtype, Map<String, String> tagValues,
MapRenderingTypes types) {
Amenity am = new Amenity(); Amenity am = new Amenity();
parseMapObject(am, entity); parseMapObject(am, entity);
if(tagValues == null) {
tagValues = entity.getTags();
}
am.setType(type); am.setType(type);
am.setSubType(subtype); am.setSubType(subtype);
am.setAdditionalInfo(types.getAmenityAdditionalInfo(entity, type, subtype)); am.setAdditionalInfo(types.getAmenityAdditionalInfo(tagValues, type, subtype));
am.setAdditionalInfo("website", getWebSiteURL(entity)); am.setAdditionalInfo("website", getWebSiteURL(entity));
return am; return am;
} }
@ -116,7 +120,7 @@ public class EntityParser {
: renderingTypes.getAmenityType(e.getKey(), e.getValue()); : renderingTypes.getAmenityType(e.getKey(), e.getValue());
if (type != null) { if (type != null) {
String subtype = renderingTypes.getAmenitySubtype(e.getKey(), e.getValue()); String subtype = renderingTypes.getAmenitySubtype(e.getKey(), e.getValue());
Amenity a = parseAmenity(entity, type, subtype, renderingTypes); Amenity a = parseAmenity(entity, type, subtype, tags, renderingTypes);
if (checkAmenitiesToAdd(a, amenitiesList) && !"no".equals(subtype)) { if (checkAmenitiesToAdd(a, amenitiesList) && !"no".equals(subtype)) {
amenitiesList.add(a); amenitiesList.add(a);
} }

View file

@ -129,7 +129,7 @@ public class EditingPOIActivity implements DialogProvider {
} }
private void showPOIDialog(int dialogID, Node n, AmenityType type, String subType) { private void showPOIDialog(int dialogID, Node n, AmenityType type, String subType) {
Amenity a = EntityParser.parseAmenity(n, type, subType, MapRenderingTypes.getDefault()); Amenity a = EntityParser.parseAmenity(n, type, subType, null, MapRenderingTypes.getDefault());
dialogBundle.putSerializable(KEY_AMENITY, a); dialogBundle.putSerializable(KEY_AMENITY, a);
dialogBundle.putSerializable(KEY_AMENITY_NODE, n); dialogBundle.putSerializable(KEY_AMENITY_NODE, n);
ctx.showDialog(dialogID); ctx.showDialog(dialogID);