From 87d910e7b748b6e3d22f216a942fe81fab26a234 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 26 Jun 2014 00:23:16 +0200 Subject: [PATCH] Update rendering types --- .../net/osmand/binary/BinaryInspector.java | 5 +++-- .../src/net/osmand/osm/MapRenderingTypes.java | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java index cb427c1cb0..e32cbfe44e 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java @@ -62,8 +62,9 @@ public class BinaryInspector { // "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings", //"-zoom=16", //"-bbox=4,55,7,50", - //"/home/victor/projects/osmand/osm-gen/Map.obf" - // "/home/victor/projects/osmand/osm-gen/Russia_bashkiria_asia_2.obf" +// "/home/victor/projects/osmand/osm-gen/Map.obf" +// "/home/victor/projects/osmand/osm-gen/World_basemap_2_b.obf___" +// "/home/victor/projects/osmand/osm-gen/World_basemap_2.obf__" }); } else { in.inspector(args); diff --git a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java index 0287c62b52..8f026a4790 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapRenderingTypes.java @@ -253,6 +253,7 @@ public class MapRenderingTypes { MapRulType parent = rType; rType = MapRulType.createAdditional(tag, val); rType.additional = true; + rType.order = parent.order; rType.applyToTagValue = parent.applyToTagValue; rType.onlyMap = parent.onlyMap; rType.onlyPoi = parent.onlyPoi; @@ -373,15 +374,17 @@ public class MapRenderingTypes { parser.setInput(is, "UTF-8"); String poiParentCategory = null; String poiParentPrefix = null; + String order = null; while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) { if (tok == XmlPullParser.START_TAG) { String name = parser.getName(); if (name.equals("category")) { //$NON-NLS-1$ poiParentCategory = parser.getAttributeValue("","poi_category"); poiParentPrefix = parser.getAttributeValue("","poi_prefix"); + order = parser.getAttributeValue("","order"); parseCategoryFromXml(parser, poiParentCategory, poiParentPrefix); } else if (name.equals("type")) { - parseTypeFromXML(parser, poiParentCategory, poiParentPrefix); + parseTypeFromXML(parser, poiParentCategory, poiParentPrefix, order); } else if (name.equals("routing_type")) { parseRouteTagFromXML(parser); } @@ -407,11 +410,11 @@ public class MapRenderingTypes { protected void parseRouteTagFromXML(XmlPullParser parser) { } - protected MapRulType parseTypeFromXML(XmlPullParser parser, String poiParentCategory, String poiParentPrefix) { - return parseBaseRuleType(parser, poiParentCategory, poiParentPrefix, true); + protected MapRulType parseTypeFromXML(XmlPullParser parser, String poiParentCategory, String poiParentPrefix, String parentOrder) { + return parseBaseRuleType(parser, poiParentCategory, poiParentPrefix, parentOrder, true); } - protected MapRulType parseBaseRuleType(XmlPullParser parser, String poiParentCategory, String poiParentPrefix, boolean filterOnlyMap) { + protected MapRulType parseBaseRuleType(XmlPullParser parser, String poiParentCategory, String poiParentPrefix, String parentOrder, boolean filterOnlyMap) { String tag = parser.getAttributeValue("", "tag"); String value = parser.getAttributeValue("", "value"); String additional = parser.getAttributeValue("", "additional"); @@ -442,6 +445,12 @@ public class MapRenderingTypes { throw new RuntimeException("Illegal target tag/value " + targetTag + " " + targetValue + " for " + tag + " / " + value); } } + String order = parser.getAttributeValue("", "order"); + if(!Algorithms.isEmpty(order)) { + rtype.order = Integer.parseInt(order); + } else if(!Algorithms.isEmpty(parentOrder)) { + rtype.order = Integer.parseInt(parentOrder); + } String applyTo = parser.getAttributeValue("", "apply_to"); String applyValue = parser.getAttributeValue("", "apply_value"); if (applyTo != null || applyValue != null) { @@ -643,6 +652,7 @@ public class MapRenderingTypes { protected boolean additional; protected boolean additionalText; protected boolean main; + protected int order = 50; protected Set applyToTagValue = null; protected String poiPrefix; @@ -686,6 +696,10 @@ public class MapRenderingTypes { return !onlyPoi; } + public int getOrder() { + return order; + } + public static MapRulType createMainEntity(String tag, String value) { MapRulType rt = new MapRulType(); rt.tagValuePattern = new TagValuePattern(tag, value);