From ea08f604b6840d41d2127972dcde541a6b79b595 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 29 Jul 2020 14:36:24 +0200 Subject: [PATCH] Fix sorting for tags --- .../net/osmand/osm/MapRenderingTypes.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java b/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java index c6c90a1b25..68b74ebbfe 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/MapRenderingTypes.java @@ -14,7 +14,6 @@ import java.util.Map; import java.util.Map.Entry; import net.osmand.PlatformUtil; -import net.osmand.osm.MapRenderingTypes.MapRulType; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -163,6 +162,16 @@ public abstract class MapRenderingTypes { return mt; } + protected MapRulType checkOrMainRule(String tag, String value, int minzoom) { + MapRulType mt = types.get(constructRuleKey(tag, value)); + if (mt == null) { + mt = registerRuleType(MapRulType.createMainEntity(tag, value)); + mt.minzoom = minzoom; + mt.maxzoom = 21; + } + return mt; + } + protected MapRulType checkOrCreateAdditional(String tag, String value) { MapRulType mt = types.get(constructRuleKey(tag, value)); if (mt == null) { @@ -319,16 +328,12 @@ public abstract class MapRenderingTypes { rtype.additionalTags.put(tg, targetTag); } } + rtype.relationGroupPrefix = parser.getAttributeValue("", "relationGroupPrefix"); //$NON-NLS-1$ String relationGroupAdditionalTags = parser.getAttributeValue("", "relationGroupAdditionalTags"); - String relationAdditionalPrefix = parser.getAttributeValue("", "relationGroupAdditionalPrefix"); if (relationGroupAdditionalTags != null) { rtype.relationGroupAdditionalTags = new LinkedHashMap(); for(String tg : relationGroupAdditionalTags.split(",")) { - String targetTag = tg; - if(!Algorithms.isEmpty(relationAdditionalPrefix)) { - targetTag = relationAdditionalPrefix + tg; - } - rtype.relationGroupAdditionalTags.put(tg, targetTag); + rtype.relationGroupAdditionalTags.put(tg, tg); } } @@ -343,12 +348,8 @@ public abstract class MapRenderingTypes { } String rnmts = parser.getAttributeValue("", "relationGroupNameTags"); if (rnmts != null) { - String relationGroupNamePrefix = parser.getAttributeValue("", "relationGroupNamePrefix"); //$NON-NLS-1$ - if (relationGroupNamePrefix == null) { - relationGroupNamePrefix = ""; - } rtype.relationGroupNameTags = new LinkedHashMap(); - putNameTags(rnmts, rtype.relationGroupNameTags, relationGroupNamePrefix); + putNameTags(rnmts, rtype.relationGroupNameTags, ""); } } return rtype; @@ -517,9 +518,10 @@ public abstract class MapRenderingTypes { // relation part protected Map relationNames; protected Map additionalTags; + protected Map> relationSortTags; + protected String relationGroupPrefix; protected Map relationGroupNameTags; protected Map relationGroupAdditionalTags; - protected Map> relationSortTags; protected TagValuePattern tagValuePattern; protected boolean additional;