Update rendering types

This commit is contained in:
Victor Shcherb 2014-06-26 00:23:16 +02:00
parent 11b54ce922
commit 87d910e7b7
2 changed files with 21 additions and 6 deletions

View file

@ -62,8 +62,9 @@ public class BinaryInspector {
// "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings", // "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
//"-zoom=16", //"-zoom=16",
//"-bbox=4,55,7,50", //"-bbox=4,55,7,50",
//"/home/victor/projects/osmand/osm-gen/Map.obf" // "/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/World_basemap_2_b.obf___"
// "/home/victor/projects/osmand/osm-gen/World_basemap_2.obf__"
}); });
} else { } else {
in.inspector(args); in.inspector(args);

View file

@ -253,6 +253,7 @@ public class MapRenderingTypes {
MapRulType parent = rType; MapRulType parent = rType;
rType = MapRulType.createAdditional(tag, val); rType = MapRulType.createAdditional(tag, val);
rType.additional = true; rType.additional = true;
rType.order = parent.order;
rType.applyToTagValue = parent.applyToTagValue; rType.applyToTagValue = parent.applyToTagValue;
rType.onlyMap = parent.onlyMap; rType.onlyMap = parent.onlyMap;
rType.onlyPoi = parent.onlyPoi; rType.onlyPoi = parent.onlyPoi;
@ -373,15 +374,17 @@ public class MapRenderingTypes {
parser.setInput(is, "UTF-8"); parser.setInput(is, "UTF-8");
String poiParentCategory = null; String poiParentCategory = null;
String poiParentPrefix = null; String poiParentPrefix = null;
String order = null;
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) { while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
if (tok == XmlPullParser.START_TAG) { if (tok == XmlPullParser.START_TAG) {
String name = parser.getName(); String name = parser.getName();
if (name.equals("category")) { //$NON-NLS-1$ if (name.equals("category")) { //$NON-NLS-1$
poiParentCategory = parser.getAttributeValue("","poi_category"); poiParentCategory = parser.getAttributeValue("","poi_category");
poiParentPrefix = parser.getAttributeValue("","poi_prefix"); poiParentPrefix = parser.getAttributeValue("","poi_prefix");
order = parser.getAttributeValue("","order");
parseCategoryFromXml(parser, poiParentCategory, poiParentPrefix); parseCategoryFromXml(parser, poiParentCategory, poiParentPrefix);
} else if (name.equals("type")) { } else if (name.equals("type")) {
parseTypeFromXML(parser, poiParentCategory, poiParentPrefix); parseTypeFromXML(parser, poiParentCategory, poiParentPrefix, order);
} else if (name.equals("routing_type")) { } else if (name.equals("routing_type")) {
parseRouteTagFromXML(parser); parseRouteTagFromXML(parser);
} }
@ -407,11 +410,11 @@ public class MapRenderingTypes {
protected void parseRouteTagFromXML(XmlPullParser parser) { protected void parseRouteTagFromXML(XmlPullParser parser) {
} }
protected MapRulType parseTypeFromXML(XmlPullParser parser, String poiParentCategory, String poiParentPrefix) { protected MapRulType parseTypeFromXML(XmlPullParser parser, String poiParentCategory, String poiParentPrefix, String parentOrder) {
return parseBaseRuleType(parser, poiParentCategory, poiParentPrefix, true); 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 tag = parser.getAttributeValue("", "tag");
String value = parser.getAttributeValue("", "value"); String value = parser.getAttributeValue("", "value");
String additional = parser.getAttributeValue("", "additional"); String additional = parser.getAttributeValue("", "additional");
@ -442,6 +445,12 @@ public class MapRenderingTypes {
throw new RuntimeException("Illegal target tag/value " + targetTag + " " + targetValue + " for " + tag + " / " + value); 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 applyTo = parser.getAttributeValue("", "apply_to");
String applyValue = parser.getAttributeValue("", "apply_value"); String applyValue = parser.getAttributeValue("", "apply_value");
if (applyTo != null || applyValue != null) { if (applyTo != null || applyValue != null) {
@ -643,6 +652,7 @@ public class MapRenderingTypes {
protected boolean additional; protected boolean additional;
protected boolean additionalText; protected boolean additionalText;
protected boolean main; protected boolean main;
protected int order = 50;
protected Set<TagValuePattern> applyToTagValue = null; protected Set<TagValuePattern> applyToTagValue = null;
protected String poiPrefix; protected String poiPrefix;
@ -686,6 +696,10 @@ public class MapRenderingTypes {
return !onlyPoi; return !onlyPoi;
} }
public int getOrder() {
return order;
}
public static MapRulType createMainEntity(String tag, String value) { public static MapRulType createMainEntity(String tag, String value) {
MapRulType rt = new MapRulType(); MapRulType rt = new MapRulType();
rt.tagValuePattern = new TagValuePattern(tag, value); rt.tagValuePattern = new TagValuePattern(tag, value);