Fix map generation
This commit is contained in:
parent
6fc2e88619
commit
9e6b9560dc
3 changed files with 16 additions and 13 deletions
|
@ -289,14 +289,13 @@ public class MapRenderingTypes {
|
|||
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>();
|
||||
Collection<String> tagKeySet = e.getTagKeySet();
|
||||
for (String tag : tagKeySet) {
|
||||
String val = e.getTag(tag);
|
||||
for (String tag : tags.keySet()) {
|
||||
String val = tags.get(tag);
|
||||
MapRulType rType = getAmenityRuleType(tag, val);
|
||||
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;
|
||||
}
|
||||
if(rType.targetTagValue != null) {
|
||||
|
@ -308,7 +307,7 @@ public class MapRenderingTypes {
|
|||
Iterator<TagValuePattern> it = rType.applyToTagValue.iterator();
|
||||
while(!applied && it.hasNext()) {
|
||||
TagValuePattern nv = it.next();
|
||||
applied = nv.isApplicable(e);
|
||||
applied = nv.isApplicable(tags);
|
||||
}
|
||||
}
|
||||
if (applied) {
|
||||
|
@ -599,11 +598,11 @@ public class MapRenderingTypes {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isApplicable(Entity e ){
|
||||
public boolean isApplicable(Map<String, String> e ){
|
||||
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
|
||||
|
|
|
@ -63,12 +63,16 @@ public class EntityParser {
|
|||
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();
|
||||
parseMapObject(am, entity);
|
||||
if(tagValues == null) {
|
||||
tagValues = entity.getTags();
|
||||
}
|
||||
am.setType(type);
|
||||
am.setSubType(subtype);
|
||||
am.setAdditionalInfo(types.getAmenityAdditionalInfo(entity, type, subtype));
|
||||
am.setAdditionalInfo(types.getAmenityAdditionalInfo(tagValues, type, subtype));
|
||||
am.setAdditionalInfo("website", getWebSiteURL(entity));
|
||||
return am;
|
||||
}
|
||||
|
@ -116,7 +120,7 @@ public class EntityParser {
|
|||
: renderingTypes.getAmenityType(e.getKey(), e.getValue());
|
||||
if (type != null) {
|
||||
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)) {
|
||||
amenitiesList.add(a);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class EditingPOIActivity implements DialogProvider {
|
|||
}
|
||||
|
||||
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_NODE, n);
|
||||
ctx.showDialog(dialogID);
|
||||
|
|
Loading…
Reference in a new issue