Adjust english names

This commit is contained in:
vshcherb 2013-10-30 17:13:54 +01:00
parent 7024f12b15
commit f3f9c0038b
2 changed files with 16 additions and 3 deletions

View file

@ -1568,6 +1568,7 @@ public class BinaryMapIndexReader {
Map<String, Map<String, Integer> > encodingRules = new HashMap<String, Map<String, Integer> >(); Map<String, Map<String, Integer> > encodingRules = new HashMap<String, Map<String, Integer> >();
TIntObjectMap<TagValuePair> decodingRules = new TIntObjectHashMap<TagValuePair>(); TIntObjectMap<TagValuePair> decodingRules = new TIntObjectHashMap<TagValuePair>();
public int nameEncodingType = 0; public int nameEncodingType = 0;
public int nameEnEncodingType = -1;
public int refEncodingType = -1; public int refEncodingType = -1;
public int coastlineEncodingType = -1; public int coastlineEncodingType = -1;
public int coastlineBrokenEncodingType = -1; public int coastlineBrokenEncodingType = -1;
@ -1624,6 +1625,8 @@ public class BinaryMapIndexReader {
onewayReverseAttribute = id; onewayReverseAttribute = id;
} else if("ref".equals(tag)){ } else if("ref".equals(tag)){
refEncodingType = id; refEncodingType = id;
} else if("name:en".equals(tag)){
nameEnEncodingType = id;
} else if("tunnel".equals(tag)){ } else if("tunnel".equals(tag)){
negativeLayers.add(id); negativeLayers.add(id);
} else if("bridge".equals(tag)){ } else if("bridge".equals(tag)){

View file

@ -358,14 +358,24 @@ public class TextRenderer {
public void renderText(final BinaryMapDataObject obj, final RenderingRuleSearchRequest render, final RenderingContext rc, public void renderText(final BinaryMapDataObject obj, final RenderingRuleSearchRequest render, final RenderingContext rc,
final TagValuePair pair, final float xMid, final float yMid, final Path path, final PointF[] points) { final TagValuePair pair, final float xMid, final float yMid, final Path path, final PointF[] points) {
TIntObjectHashMap<String> map = obj.getObjectNames(); final TIntObjectHashMap<String> map = obj.getObjectNames();
if (map != null) { if (map != null) {
map.forEachEntry(new TIntObjectProcedure<String>() { map.forEachEntry(new TIntObjectProcedure<String>() {
@Override @Override
public boolean execute(int tag, String name) { public boolean execute(int tag, String name) {
if (name != null && name.trim().length() > 0) { if (name != null && name.trim().length() > 0) {
createTextDrawInfo(obj, render, rc, pair, xMid, yMid, path, points, name, tag == obj.getMapIndex().nameEncodingType ? "" boolean isName = tag == obj.getMapIndex().nameEncodingType;
: obj.getMapIndex().decodeType(tag).tag); String nameTag = isName ? "" : obj.getMapIndex().decodeType(tag).tag;
boolean skip = false;
if (isName && rc.useEnglishNames && map.containsKey(obj.getMapIndex().nameEnEncodingType)) {
skip = true;
}
if (tag == obj.getMapIndex().nameEnEncodingType && !rc.useEnglishNames) {
skip = true;
}
if(!skip) {
createTextDrawInfo(obj, render, rc, pair, xMid, yMid, path, points, name, nameTag);
}
} }
return true; return true;
} }