Prepare english name maps

This commit is contained in:
Victor Shcherb 2014-06-26 02:29:02 +02:00
parent 68cd88c36d
commit 46adfea1c1
5 changed files with 11 additions and 16 deletions

View file

@ -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() {

View file

@ -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();

View file

@ -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

View file

@ -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"

View file

@ -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);
}