diff --git a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java index 807bd447c5..73ec2ac6be 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java @@ -64,8 +64,34 @@ public class MapRenderingTypes { init(); } } + + public void getAmenityTagValue(AmenityType type, String subType, StringBuilder tag, StringBuilder value) { + tag.setLength(0); + tag.append(type.getDefaultTag()); + value.setLength(0); + value.append(subType); + Map> m = getAmenityTypeNameToTagVal(); + if (m.containsKey(type)) { + Map map = m.get(type); + if (map.containsKey(subType)) { + String res = map.get(subType); + if (res != null) { + int i = res.indexOf(' '); + if (i != -1) { + tag.setLength(0); + tag.append(res.substring(0, i)); + value.setLength(0); + value.append(res.substring(i + 1)); + } else { + tag.setLength(0); + tag.append(res); + } + } + } + } + } - public Map> getAmenityTypeNameToTagVal() { + private Map> getAmenityTypeNameToTagVal() { if (amenityTypeNameToTagVal == null) { Map types = getAmenityEncodingRuleTypes(); amenityTypeNameToTagVal = new LinkedHashMap>(); @@ -90,6 +116,7 @@ public class MapRenderingTypes { } + public Map getAmenityNameToType(){ if(amenityNameToType == null){ amenityNameToType = new LinkedHashMap(); @@ -320,6 +347,6 @@ public class MapRenderingTypes { protected boolean poiSpecified; protected AmenityRuleType targetTagValue; } - + } diff --git a/OsmAnd/res/drawable-large/map_compass_white.png b/OsmAnd/res/drawable-large/map_compass_white.png new file mode 100644 index 0000000000..320c2b50d2 Binary files /dev/null and b/OsmAnd/res/drawable-large/map_compass_white.png differ diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java index 34a0259207..c2c88dad2f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditingPOIActivity.java @@ -434,27 +434,11 @@ public class EditingPOIActivity implements DialogProvider { final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources .getString(R.string.poi_action_change); OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY; - Map> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal(); - AmenityType type = a.getType(); - String tag = type.getDefaultTag(); + StringBuilder tag = new StringBuilder(); + StringBuilder value = new StringBuilder(); String subType = typeText.getText().toString(); - String val = subType; - if (typeNameToTagVal.containsKey(type)) { - Map map = typeNameToTagVal.get(type); - if (map.containsKey(subType)) { - String res = map.get(subType); - if (res != null) { - int i = res.indexOf(' '); - if (i != -1) { - tag = res.substring(0, i); - val = res.substring(i + 1); - } else { - tag = res; - } - } - } - } - n.putTag(tag, val); + MapRenderingTypes.getDefault().getAmenityTagValue(a.getType(), subType, tag, value); + n.putTag(tag.toString(), value.toString()); String name = nameText.getText().toString(); if(name.length() > 0) { n.putTag(OSMTagKey.NAME.getValue(), name); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index 3591872bf7..19d3628e9e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -62,28 +62,10 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { Node entity = new Node(n.getLocation().getLatitude(), n.getLocation().getLongitude(), nodeId); - - Map> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal(); - AmenityType type = n.getType(); - String tag = type.getDefaultTag(); - String subType = n.getSubType(); - String val = subType; - if (typeNameToTagVal.containsKey(type)) { - Map map = typeNameToTagVal.get(type); - if (map.containsKey(subType)) { - String res = map.get(subType); - if (res != null) { - int i = res.indexOf(' '); - if (i != -1) { - tag = res.substring(0, i); - val = res.substring(i + 1); - } else { - tag = res; - } - } - } - } - entity.putTag(tag, val); + StringBuilder tag = new StringBuilder(); + StringBuilder value = new StringBuilder(); + MapRenderingTypes.getDefault().getAmenityTagValue(n.getType(), n.getSubType(), tag, value); + entity.putTag(tag.toString(), value.toString()); entity.putTag(OSMTagKey.NAME.getValue(), n.getName()); entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours()); diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 6886bf4ca3..29079b2e07 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -10,6 +10,7 @@ import net.osmand.access.AccessibleToast; import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.data.LatLon; +import net.osmand.osm.MapRenderingTypes; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick; import net.osmand.plus.OsmAndFormatter; @@ -181,10 +182,13 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon canvas.drawCircle(x, y, r, pointAltUI); canvas.drawCircle(x, y, r, point); String id = null; - if (RenderingIcons.containsIcon(o.getType().getDefaultTag() + "_" + o.getSubType())) { - id = o.getType().getDefaultTag() + "_" + o.getSubType(); - } else if(RenderingIcons.containsIcon(o.getSubType())){ - id = o.getSubType(); + StringBuilder tag = new StringBuilder(); + StringBuilder value = new StringBuilder(); + MapRenderingTypes.getDefault().getAmenityTagValue(o.getType(), o.getSubType(), tag, value); + if (RenderingIcons.containsIcon(tag + "_" + value)) { + id = tag + "_" + value; + } else if(RenderingIcons.containsIcon(tag.toString())){ + id = tag.toString(); } if(id != null){ Bitmap bmp = RenderingIcons.getIcon(view.getContext(), id);