From d99c5a9dca60d9ed16afdcba88ebd3e28455365e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 15 Jul 2013 00:21:48 +0200 Subject: [PATCH] Update rendering types --- .../src/net/osmand/osm/MapRenderingTypes.java | 31 ++++++++++++++++-- .../res/drawable-large/map_compass_white.png | Bin 0 -> 4739 bytes .../plus/osmedit/EditingPOIActivity.java | 24 +++----------- .../plus/osmedit/OpenstreetmapLocalUtil.java | 26 +++------------ .../net/osmand/plus/views/POIMapLayer.java | 12 ++++--- 5 files changed, 45 insertions(+), 48 deletions(-) create mode 100644 OsmAnd/res/drawable-large/map_compass_white.png 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 0000000000000000000000000000000000000000..320c2b50d2cda10be30ddfd79fa681a9d46bf265 GIT binary patch literal 4739 zcmZWr1yB@R*Ir=hRvLtrSfo=*SegX|0jZ^7=~zIzmhP06PH7Nj3BjdP_*fBX>6S*M zkzalP|DA86 z7Istw*jou#g^H3(-&(f|3mVO8rA$Q}9tNK#JfYAU=+;(J-dIR*B0Q{n{9`facF=HX zcB^H2*6t8F-3HLQ2?O?c!mvU_i(ym;yWJ-D?vM1HW7AP!k-@OKR%~s7&qCbc|!3Ged_ep+qCyT$7v@ZbomfNkz0b|wR z<&@K}9X7UyY_E1(6m{Sx)UgRyR|M!hyM)s^5zwG(H=)`>uGPN6Gp_^w?|5c!d~%P6Ga41 zt_0JGapKbl zwys!+P2yZu)a6-qHqS_st=&0Fc!&)vX&m& z6~-d~Z=`uo8iCvp0nWGzjDYc2N#PZY9gFgzQwnPtc9n9@E3z`i4~eQNFV}JKqKhqG z)6opjuSFXstibgxr{GToCtq8=)>o(96tkre3B3$^1D||X4&$tq^(GXf%uVF$)3->r zFmA|thcjcj_k@XTu#0|`$t|dr&P3SdaXqkwd^({$WVe@e1$^xLk$aKqFpRw0;|L!3 zu!AU=DVTXFnPs4p^A({H&?$`kVJ3*(nO&EHfnbZ^HiEK8R6Dd%(~~ud!mrN+&h;*7 zM*gE36Zm-=m0A=#?F)9UY*eVOnj@oS&SZ;+q$wl`dal)vw#~jWp3p$frmFXqrgYkF2%fy0n@Ur;OdK z01nOc=`5ctbN)h3^M}Dtf0f^~VrzHHb?bzdHs}|tte|>iBGr_0N;2Rv@Emw7Jbd+W zzc$Cm)X>zHdzw{pI}Kkr-aKSbn0Vv&r4^-tlA5!b6MO&_FT0*d+vz`L*+!od+Hlwy zZ#>#y+F;md{PY5^N6_Lznjq#Gj zb@lrdeB+R^g&LVUtI9^0UFq}2vHPZ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ditingPOIActivity.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);