fix issue 260

git-svn-id: https://osmand.googlecode.com/svn/trunk@810 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-12-13 09:42:36 +00:00
parent e243439cf4
commit 18ffc2e9bb
4 changed files with 34 additions and 17 deletions

View file

@ -1282,7 +1282,7 @@ public class IndexCreator {
int mtType = findMultiPolygonType(e, 0);
if (mtType != 0) {
String name = MapRenderingTypes.getEntityName(e, mtType);
String name = renderingTypes.getEntityName(e);
List<List<Way>> completedRings = new ArrayList<List<Way>>();
List<List<Way>> incompletedRings = new ArrayList<List<Way>>();
for (Entity es : entities.keySet()) {
@ -1571,7 +1571,7 @@ public class IndexCreator {
zoom = mapZooms.getLevel(level).getMaxZoom() - 1;
boolean skip = false;
String eName = MapRenderingTypes.getEntityName(e, type);
String eName = renderingTypes.getEntityName(e);
if (eName == null) {
eName = multiPolygonsNames.get(baseId);
}

View file

@ -137,8 +137,9 @@ public class MapRenderingTypes {
// val could be null means others for that tag
private Integer nullRule;
private Map<String, Integer> rules = new LinkedHashMap<String, Integer>();
private String nameNullTag;
public MapRulType(String tag){
public MapRulType(String tag, String nameNullTag){
this.tag = tag;
}
@ -146,6 +147,10 @@ public class MapRenderingTypes {
return tag;
}
public String getNameNullTag() {
return nameNullTag;
}
public Collection<String> getValuesSet(){
return rules.keySet();
}
@ -501,7 +506,7 @@ public class MapRenderingTypes {
return (attr & 3) == 1;
}
public static String getEntityName(Entity e, int mainType) {
public String getEntityName(Entity e) {
if (e.getTag(OSMTagKey.REF) != null && e.getTag(OSMTagKey.HIGHWAY) != null) {
String ref = e.getTag(OSMTagKey.REF);
if (ref.length() > 5 && ref.indexOf('_') != -1) {
@ -518,12 +523,25 @@ public class MapRenderingTypes {
if (name == null) {
name = e.getTag(OSMTagKey.ADDR_HOUSE_NUMBER);
}
if(name == null && "peak".equals(e.getTag(OSMTagKey.HIGHWAY))){ //$NON-NLS-1$
name = e.getTag("ele"); //$NON-NLS-1$
}
if(name == null && "gate".equals(e.getTag("aeroway"))){ //$NON-NLS-1$ //$NON-NLS-2$
name = e.getTag(OSMTagKey.REF);
if (name == null) {
Collection<String> tagKeySet = e.getTagKeySet();
Map<String, MapRulType> types = getEncodingRuleTypes();
for (int i = 0; i < 2 && name == null; i++) {
for (String tag : tagKeySet) {
if (types.containsKey(tag)) {
MapRulType rType = types.get(tag);
if (rType.getNameNullTag() != null) {
name = e.getTag(rType.getNameNullTag());
if (name != null) {
break;
}
}
}
}
}
}
return name;
}
@ -643,6 +661,7 @@ public class MapRenderingTypes {
if (val != null) {
maxzoom = Integer.parseInt(val);
}
String nameNullTag = attributes.getValue("nameNullTag");
String tag = attributes.getValue("tag"); //$NON-NLS-1$
val = attributes.getValue("value"); //$NON-NLS-1$
@ -683,9 +702,7 @@ public class MapRenderingTypes {
polygonRule = POINT_TYPE;
}
stepSubtype(st, maxzoom, tag, val, currentType, subtype, polygonRule, polylineRule, pointRule);
stepSubtype(st, maxzoom, tag, val, currentType, subtype, polygonRule, polylineRule, pointRule, nameNullTag);
}
}
});
@ -711,11 +728,11 @@ public class MapRenderingTypes {
}
private void stepSubtype(int st, int minZoom, String tag, String val, int type, int subtype, int polygonRule, int polylineRule,
int pointRule) {
int pointRule, String nameNullTag) {
if(st == INIT_RULE_TYPES){
MapRulType rtype = types.get(tag);
if(rtype == null){
rtype = new MapRulType(tag);
rtype = new MapRulType(tag, nameNullTag);
types.put(tag, rtype);
}
rtype.registerType(minZoom, val, pointRule, polylineRule, polygonRule, type, subtype);

View file

@ -143,7 +143,7 @@
<subtype id="8" polyline="true" tag="aeroway" value="taxiway" minzoom="12" />
<subtype id="9" polygon="true" tag="aeroway" value="apron" minzoom="12" />
<subtype id="10" point="true" polygon_center="true" tag="aeroway" value="airport" minzoom="12" />
<subtype id="12" point="true" tag="aeroway" value="gate" minzoom="15" />
<subtype id="12" point="true" tag="aeroway" value="gate" minzoom="15" nameNullTag="ref"/>
<subtype id="13" point="true" tag="aeroway" value="windsock" minzoom="15" />
</type>
@ -420,7 +420,7 @@
<subtype id="9" point="true" polygon="true" tag="natural" value="land" minzoom="13" />
<subtype id="11" point="true" polygon="true" tag="natural" value="marsh" minzoom="13" />
<subtype id="12" point="true" polygon="true" tag="natural" value="mud" minzoom="13" />
<subtype id="13" point="true" tag="natural" value="peak" minzoom="12" />
<subtype id="13" point="true" tag="natural" value="peak" minzoom="12" nameNullTag="ele"/>
<subtype id="14" point="true" polygon="true" tag="natural" value="sand" minzoom="15" />
<subtype id="15" point="true" polygon="true" tag="natural" value="scree" minzoom="15" />
<subtype id="16" point="true" polygon="true" tag="natural" value="scrub" minzoom="13" />

View file

@ -89,7 +89,7 @@ public class CommandPlayer {
}
}
// see comments while it is impossible to read from zip
// see comments why it is impossible to read from zip
// voiceZipFile = null;
if(voiceDir != null) {
long time = System.currentTimeMillis();