Adjust english names
This commit is contained in:
parent
7024f12b15
commit
f3f9c0038b
2 changed files with 16 additions and 3 deletions
|
@ -1568,6 +1568,7 @@ public class BinaryMapIndexReader {
|
|||
Map<String, Map<String, Integer> > encodingRules = new HashMap<String, Map<String, Integer> >();
|
||||
TIntObjectMap<TagValuePair> decodingRules = new TIntObjectHashMap<TagValuePair>();
|
||||
public int nameEncodingType = 0;
|
||||
public int nameEnEncodingType = -1;
|
||||
public int refEncodingType = -1;
|
||||
public int coastlineEncodingType = -1;
|
||||
public int coastlineBrokenEncodingType = -1;
|
||||
|
@ -1624,6 +1625,8 @@ public class BinaryMapIndexReader {
|
|||
onewayReverseAttribute = id;
|
||||
} else if("ref".equals(tag)){
|
||||
refEncodingType = id;
|
||||
} else if("name:en".equals(tag)){
|
||||
nameEnEncodingType = id;
|
||||
} else if("tunnel".equals(tag)){
|
||||
negativeLayers.add(id);
|
||||
} else if("bridge".equals(tag)){
|
||||
|
|
|
@ -358,14 +358,24 @@ public class TextRenderer {
|
|||
|
||||
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) {
|
||||
TIntObjectHashMap<String> map = obj.getObjectNames();
|
||||
final TIntObjectHashMap<String> map = obj.getObjectNames();
|
||||
if (map != null) {
|
||||
map.forEachEntry(new TIntObjectProcedure<String>() {
|
||||
@Override
|
||||
public boolean execute(int tag, String name) {
|
||||
if (name != null && name.trim().length() > 0) {
|
||||
createTextDrawInfo(obj, render, rc, pair, xMid, yMid, path, points, name, tag == obj.getMapIndex().nameEncodingType ? ""
|
||||
: obj.getMapIndex().decodeType(tag).tag);
|
||||
boolean isName = tag == obj.getMapIndex().nameEncodingType;
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue