diff --git a/OsmAnd-java/src/net/osmand/RenderingContext.java b/OsmAnd-java/src/net/osmand/RenderingContext.java index ea7ccf03a6..f63c07e5b3 100644 --- a/OsmAnd-java/src/net/osmand/RenderingContext.java +++ b/OsmAnd-java/src/net/osmand/RenderingContext.java @@ -22,7 +22,7 @@ public class RenderingContext { // FIELDS OF THAT CLASS ARE USED IN C++ public boolean interrupted = false; public boolean nightMode = false; - public boolean useEnglishNames = false; + public String preferredLocale = ""; public int defaultColor = 0xf1eee8; public RenderingContext() { diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index a253661ce1..08a2b4a76a 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -1158,13 +1158,6 @@ public class BinaryMapIndexReader { break; } } -// if(req.cacheCoordinates.size() > 500 && req.cacheTypes.size() > 0) { -// TagValuePair p = root.decodeType(req.cacheTypes.get(0)); -// if("admin_level".equals(p.tag)) { -// log.info("TODO Object is ignored due to performance issues " + p.tag + " "+p.value); -// return null; -// } -// } BinaryMapDataObject dataObject = new BinaryMapDataObject(); dataObject.area = area; dataObject.coordinates = req.cacheCoordinates.toArray(); diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 9001715c6e..bf82c80a39 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -668,7 +668,7 @@ public class MapRenderRepositories { currentRenderingContext.width = requestedBox.getPixWidth(); currentRenderingContext.height = requestedBox.getPixHeight(); currentRenderingContext.nightMode = nightMode; - currentRenderingContext.useEnglishNames = prefs.USE_ENGLISH_NAMES.get(); + currentRenderingContext.preferredLocale = prefs.USE_ENGLISH_NAMES.get()?":en":""; currentRenderingContext.setDensityValue(mapDensity); currentRenderingContext.screenDensityRatio = mapDensity / Math.max(1, requestedBox.getDensity()) ; // init rendering context diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index 1d8ef3aa7e..ecb5708ae4 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -271,7 +271,7 @@ public class OsmandRenderer { drawIconsOverCanvas(rc, cv); notifyListeners(notifyList); - textRenderer.drawTextOverCanvas(rc, cv, rc.useEnglishNames); + textRenderer.drawTextOverCanvas(rc, cv, rc.preferredLocale); long time = System.currentTimeMillis() - now; rc.renderingDebugInfo = String.format("Rendering: %s ms (%s text)\n" diff --git a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java index 4b3c3770a9..8d69d77578 100644 --- a/OsmAnd/src/net/osmand/plus/render/TextRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/TextRenderer.java @@ -204,7 +204,7 @@ public class TextRenderer { cv.drawText(text, centerX, centerY, paint); } - public void drawTextOverCanvas(RenderingContext rc, Canvas cv, boolean useEnglishNames) { + public void drawTextOverCanvas(RenderingContext rc, Canvas cv, String preferredLocale) { int size = rc.textToDraw.size(); // 1. Sort text using text order @@ -221,7 +221,7 @@ public class TextRenderer { for (int i = 0; i < size; i++) { TextDrawInfo text = rc.textToDraw.get(i); if (text.text != null && text.text.length() > 0) { - if (useEnglishNames) { + if (preferredLocale.length() > 0) { text.text = Junidecode.unidecode(text.text); } @@ -377,12 +377,14 @@ public class TextRenderer { 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)) { + // not completely correct we should check "name"+rc.preferredLocale + if (isName && !rc.preferredLocale.equals("") && + map.containsKey(obj.getMapIndex().nameEnEncodingType)) { skip = true; } - if (tag == obj.getMapIndex().nameEnEncodingType && !rc.useEnglishNames) { - skip = true; - } +// if (tag == obj.getMapIndex().nameEnEncodingType && !rc.useEnglishNames) { +// skip = true; +// } if(!skip) { createTextDrawInfo(obj, render, rc, pair, xMid, yMid, path, points, name, nameTag); }