pR cleanup
This commit is contained in:
parent
c60b1e3f2c
commit
0de10e76ee
11 changed files with 72 additions and 321 deletions
|
@ -435,7 +435,7 @@ public class BinaryMapTransportReaderAdapter {
|
||||||
dataObject.setEnName(stringTable.get(dataObject.getEnName(false).charAt(0)));
|
dataObject.setEnName(stringTable.get(dataObject.getEnName(false).charAt(0)));
|
||||||
}
|
}
|
||||||
if(dataObject.getName().length() > 0 && dataObject.getName("en").length() == 0){
|
if(dataObject.getName().length() > 0 && dataObject.getName("en").length() == 0){
|
||||||
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
|
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||||
}
|
}
|
||||||
if(dataObject.getOperator() != null && dataObject.getOperator().length() > 0){
|
if(dataObject.getOperator() != null && dataObject.getOperator().length() > 0){
|
||||||
dataObject.setOperator(stringTable.get(dataObject.getOperator().charAt(0)));
|
dataObject.setOperator(stringTable.get(dataObject.getOperator().charAt(0)));
|
||||||
|
@ -547,7 +547,7 @@ public class BinaryMapTransportReaderAdapter {
|
||||||
case 0:
|
case 0:
|
||||||
dataObject.setReferencesToRoutes(req.cacheTypes.toArray());
|
dataObject.setReferencesToRoutes(req.cacheTypes.toArray());
|
||||||
if(dataObject.getName("en").length() == 0){
|
if(dataObject.getName("en").length() == 0){
|
||||||
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
|
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||||
}
|
}
|
||||||
return dataObject;
|
return dataObject;
|
||||||
case OsmandOdb.TransportStop.ROUTES_FIELD_NUMBER :
|
case OsmandOdb.TransportStop.ROUTES_FIELD_NUMBER :
|
||||||
|
@ -611,7 +611,7 @@ public class BinaryMapTransportReaderAdapter {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 0:
|
case 0:
|
||||||
if (dataObject.getName("en").length() == 0) {
|
if (dataObject.getName("en").length() == 0) {
|
||||||
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
|
dataObject.setEnName(TransliterationHelper.transliterate(dataObject.getName()));
|
||||||
}
|
}
|
||||||
if (x != 0 || y != 0) {
|
if (x != 0 || y != 0) {
|
||||||
dataObject.setLocation(BinaryMapIndexReader.TRANSPORT_STOP_ZOOM, x, y);
|
dataObject.setLocation(BinaryMapIndexReader.TRANSPORT_STOP_ZOOM, x, y);
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class RouteDataObject {
|
||||||
}
|
}
|
||||||
String nmDef = names.get(region.nameTypeRule);
|
String nmDef = names.get(region.nameTypeRule);
|
||||||
if(transliterate && nmDef != null && nmDef.length() > 0) {
|
if(transliterate && nmDef != null && nmDef.length() > 0) {
|
||||||
return TransliterationHelper.getInstance().transliterate(nmDef);
|
return TransliterationHelper.transliterate(nmDef);
|
||||||
}
|
}
|
||||||
return nmDef;
|
return nmDef;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ public class RouteDataObject {
|
||||||
}
|
}
|
||||||
String refDefault = names.get(region.refTypeRule);
|
String refDefault = names.get(region.refTypeRule);
|
||||||
if(transliterate && refDefault != null && refDefault.length() > 0) {
|
if(transliterate && refDefault != null && refDefault.length() > 0) {
|
||||||
return TransliterationHelper.getInstance().transliterate(refDefault);
|
return TransliterationHelper.transliterate(refDefault);
|
||||||
}
|
}
|
||||||
return refDefault;
|
return refDefault;
|
||||||
}
|
}
|
||||||
|
@ -358,13 +358,13 @@ public class RouteDataObject {
|
||||||
int k = kt[i];
|
int k = kt[i];
|
||||||
if(region.routeEncodingRules.size() > k) {
|
if(region.routeEncodingRules.size() > k) {
|
||||||
if(!Algorithms.isEmpty(lang) && destinationTagLangFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
if(!Algorithms.isEmpty(lang) && destinationTagLangFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
|
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||||
}
|
}
|
||||||
if(destinationTagFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
if(destinationTagFB.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
|
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||||
}
|
}
|
||||||
if(!Algorithms.isEmpty(lang) && destinationTagLang.equals(region.routeEncodingRules.get(k).getTag())) {
|
if(!Algorithms.isEmpty(lang) && destinationTagLang.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
|
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(names.get(k)) : names.get(k));
|
||||||
}
|
}
|
||||||
if(destinationTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
|
if(destinationTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||||
destinationDefault = names.get(k);
|
destinationDefault = names.get(k);
|
||||||
|
@ -372,7 +372,7 @@ public class RouteDataObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(destinationDefault != null) {
|
if(destinationDefault != null) {
|
||||||
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(destinationDefault) : destinationDefault);
|
return destRef1 + ((transliterate) ? TransliterationHelper.transliterate(destinationDefault) : destinationDefault);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "".equals(destRef) ? null : destRef;
|
return "".equals(destRef) ? null : destRef;
|
||||||
|
|
|
@ -28,8 +28,6 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
|
|
||||||
public static final byte WAY_MODULO_REMAINDER = 1;
|
public static final byte WAY_MODULO_REMAINDER = 1;
|
||||||
|
|
||||||
private int obfCountryLang = 0;
|
|
||||||
|
|
||||||
|
|
||||||
protected String name = null;
|
protected String name = null;
|
||||||
protected String enName = null;
|
protected String enName = null;
|
||||||
|
@ -184,8 +182,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
if (transliterate) {
|
if (transliterate) {
|
||||||
return TransliterationHelper.getInstance().transliterate(getName());
|
return TransliterationHelper.transliterate(getName());
|
||||||
// return Junidecode.unidecode(getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,8 +194,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
||||||
if (!Algorithms.isEmpty(enName)) {
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
return this.enName;
|
return this.enName;
|
||||||
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
|
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
|
||||||
return TransliterationHelper.getInstance().transliterate(getName());
|
return TransliterationHelper.transliterate(getName());
|
||||||
// return Junidecode.unidecode(getName());
|
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,17 @@ public class TransliterationHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCountry(String countryName) {
|
public static void setCountry(String countryName) {
|
||||||
TransliterationHelper.country = countryName;
|
if (!countryName.equals(country)) {
|
||||||
|
switch (countryName) {
|
||||||
|
case "Japan": {
|
||||||
|
country = JAPAN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
country = DEFAULT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCountry() {
|
public static String getCountry() {
|
||||||
|
|
|
@ -373,50 +373,49 @@ task appStart(type: Exec) {
|
||||||
|
|
||||||
project.logger.warn("Analytics enabled for free version: $analytics")
|
project.logger.warn("Analytics enabled for free version: $analytics")
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ':OsmAnd-java', configuration: 'android')
|
implementation project(path: ':OsmAnd-java', configuration: 'android')
|
||||||
if (analytics) {
|
if (analytics) {
|
||||||
implementation 'com.google.firebase:firebase-core:12.0.1'
|
implementation 'com.google.firebase:firebase-core:12.0.1'
|
||||||
implementation 'com.google.firebase:firebase-messaging:12.0.1'
|
implementation 'com.google.firebase:firebase-messaging:12.0.1'
|
||||||
implementation 'com.google.firebase:firebase-iid:12.0.1'
|
implementation 'com.google.firebase:firebase-iid:12.0.1'
|
||||||
implementation 'com.google.firebase:firebase-config:12.0.1'
|
implementation 'com.google.firebase:firebase-config:12.0.1'
|
||||||
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
|
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
|
||||||
}
|
}
|
||||||
implementation 'com.android.support:multidex:1.0.1'
|
implementation 'com.android.support:multidex:1.0.1'
|
||||||
implementation 'com.android.support:gridlayout-v7:27.1.1'
|
implementation 'com.android.support:gridlayout-v7:27.1.1'
|
||||||
implementation 'com.android.support:cardview-v7:27.1.1'
|
implementation 'com.android.support:cardview-v7:27.1.1'
|
||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:design:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
implementation 'com.android.support:customtabs:27.1.1'
|
implementation 'com.android.support:customtabs:27.1.1'
|
||||||
implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
|
implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
|
||||||
implementation 'commons-logging:commons-logging:1.2'
|
implementation 'commons-logging:commons-logging:1.2'
|
||||||
implementation 'commons-codec:commons-codec:1.11'
|
implementation 'commons-codec:commons-codec:1.11'
|
||||||
implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
|
implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
|
||||||
implementation 'org.beanshell:bsh-core:2.0b4'
|
implementation 'org.beanshell:bsh-core:2.0b4'
|
||||||
implementation 'org.apache.commons:commons-compress:1.17'
|
implementation 'org.apache.commons:commons-compress:1.17'
|
||||||
implementation 'com.moparisthebest:junidecode:0.1.1'
|
implementation 'com.moparisthebest:junidecode:0.1.1'
|
||||||
implementation 'org.immutables:gson:2.5.0'
|
implementation 'org.immutables:gson:2.5.0'
|
||||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||||
// JS core
|
// JS core
|
||||||
implementation 'org.mozilla:rhino:1.7.9'
|
implementation 'org.mozilla:rhino:1.7.9'
|
||||||
// size restrictions
|
// size restrictions
|
||||||
// implementation 'com.ibm.icu:icu4j:50.1'
|
// implementation 'com.ibm.icu:icu4j:50.1'
|
||||||
// implementation 'net.sf.trove4j:trove4j:3.0.3'
|
// implementation 'net.sf.trove4j:trove4j:3.0.3'
|
||||||
qtcoreImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
|
qtcoreImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
|
||||||
qtcoredebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
|
qtcoredebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
|
||||||
legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
|
legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
|
||||||
qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
|
qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
|
||||||
qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||||
qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
||||||
qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||||
implementation('com.getkeepsafe.taptargetview:taptargetview:1.12.0') {
|
implementation('com.getkeepsafe.taptargetview:taptargetview:1.12.0') {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
|
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
|
||||||
implementation('com.github.HITGIF:TextFieldBoxes:1.3.5') {
|
implementation('com.github.HITGIF:TextFieldBoxes:1.3.5') {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
|
||||||
}
|
}
|
||||||
if(analytics) {
|
if(analytics) {
|
||||||
println "Apply GMS plugin"
|
println "Apply GMS plugin"
|
||||||
|
|
|
@ -43,7 +43,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.lang.Character.UnicodeBlock;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
|
||||||
|
@ -526,13 +525,4 @@ public class AndroidUtils {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkIfKana(String string) {
|
|
||||||
boolean isKana = false;
|
|
||||||
for (char c : string.toCharArray()) {
|
|
||||||
isKana = UnicodeBlock.of(c) == UnicodeBlock.KATAKANA;
|
|
||||||
}
|
|
||||||
return isKana;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,225 +0,0 @@
|
||||||
package net.osmand.plus.helpers;
|
|
||||||
|
|
||||||
import com.atilika.kuromoji.ipadic.Token;
|
|
||||||
import com.atilika.kuromoji.ipadic.Tokenizer;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class CustomTransliterationHelper {
|
|
||||||
|
|
||||||
public static String japanese2Romaji(String input) {
|
|
||||||
|
|
||||||
boolean capitalizeWords = true;
|
|
||||||
|
|
||||||
Tokenizer tokenizer = new Tokenizer();
|
|
||||||
List<Token> tokens = tokenizer.tokenize(input);
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
|
||||||
KanaToRomaji kanaToRomaji = new KanaToRomaji();
|
|
||||||
String lastTokenToMerge = "";
|
|
||||||
for (Token token : tokens) {
|
|
||||||
String type = token.getAllFeaturesArray()[1];
|
|
||||||
|
|
||||||
if (token.getAllFeaturesArray()[0].equals("記号")) {
|
|
||||||
buffer.append(token.getSurface());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
switch (token.getAllFeaturesArray()[1]) {
|
|
||||||
case "数":
|
|
||||||
case "アルファベット":
|
|
||||||
case "サ変接続":
|
|
||||||
buffer.append(token.getSurface());
|
|
||||||
continue;
|
|
||||||
default:
|
|
||||||
String lastFeature = token.getAllFeaturesArray()[8];
|
|
||||||
if (lastFeature.equals("*")) {
|
|
||||||
buffer.append(token.getSurface());
|
|
||||||
} else {
|
|
||||||
String romaji = kanaToRomaji.convert(token.getAllFeaturesArray()[8]);
|
|
||||||
if (lastFeature.endsWith("ッ")) {
|
|
||||||
lastTokenToMerge = lastFeature;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
lastTokenToMerge = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (capitalizeWords) {
|
|
||||||
buffer.append(romaji.substring(0, 1).toUpperCase());
|
|
||||||
buffer.append(romaji.substring(1));
|
|
||||||
} else {
|
|
||||||
// Convert foreign katakana words to uppercase
|
|
||||||
if (token.getSurface()
|
|
||||||
.equals(token.getPronunciation())) // detect katakana
|
|
||||||
{
|
|
||||||
romaji = romaji.toUpperCase();
|
|
||||||
}
|
|
||||||
buffer.append(romaji);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buffer.append(" ");
|
|
||||||
}
|
|
||||||
return buffer.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static boolean isCharFromCJK(final char c) {
|
|
||||||
return (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.HIRAGANA)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.KATAKANA)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS)
|
|
||||||
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println(japanese2Romaji("川名本町"));
|
|
||||||
System.out.println(japanese2Romaji("明岸寺"));
|
|
||||||
System.out.println(japanese2Romaji("つきしま"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class KanaToRomaji {
|
|
||||||
|
|
||||||
Map<String, String> m = new HashMap<String, String>();
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
public KanaToRomaji() {
|
|
||||||
m.put("ア", "a");
|
|
||||||
m.put("イ", "i");
|
|
||||||
m.put("ウ", "u");
|
|
||||||
m.put("エ", "e");
|
|
||||||
m.put("オ", "o");
|
|
||||||
m.put("カ", "ka");
|
|
||||||
m.put("キ", "ki");
|
|
||||||
m.put("ク", "ku");
|
|
||||||
m.put("ケ", "ke");
|
|
||||||
m.put("コ", "ko");
|
|
||||||
m.put("サ", "sa");
|
|
||||||
m.put("シ", "shi");
|
|
||||||
m.put("ス", "su");
|
|
||||||
m.put("セ", "se");
|
|
||||||
m.put("ソ", "so");
|
|
||||||
m.put("タ", "ta");
|
|
||||||
m.put("チ", "chi");
|
|
||||||
m.put("ツ", "tsu");
|
|
||||||
m.put("テ", "te");
|
|
||||||
m.put("ト", "to");
|
|
||||||
m.put("ナ", "na");
|
|
||||||
m.put("ニ", "ni");
|
|
||||||
m.put("ヌ", "nu");
|
|
||||||
m.put("ネ", "ne");
|
|
||||||
m.put("ノ", "no");
|
|
||||||
m.put("ハ", "ha");
|
|
||||||
m.put("ヒ", "hi");
|
|
||||||
m.put("フ", "fu");
|
|
||||||
m.put("ヘ", "he");
|
|
||||||
m.put("ホ", "ho");
|
|
||||||
m.put("マ", "ma");
|
|
||||||
m.put("ミ", "mi");
|
|
||||||
m.put("ム", "mu");
|
|
||||||
m.put("メ", "me");
|
|
||||||
m.put("モ", "mo");
|
|
||||||
m.put("ヤ", "ya");
|
|
||||||
m.put("ユ", "yu");
|
|
||||||
m.put("ヨ", "yo");
|
|
||||||
m.put("ラ", "ra");
|
|
||||||
m.put("リ", "ri");
|
|
||||||
m.put("ル", "ru");
|
|
||||||
m.put("レ", "re");
|
|
||||||
m.put("ロ", "ro");
|
|
||||||
m.put("ワ", "wa");
|
|
||||||
m.put("ヲ", "wo");
|
|
||||||
m.put("ン", "n");
|
|
||||||
m.put("ガ", "ga");
|
|
||||||
m.put("ギ", "gi");
|
|
||||||
m.put("グ", "gu");
|
|
||||||
m.put("ゲ", "ge");
|
|
||||||
m.put("ゴ", "go");
|
|
||||||
m.put("ザ", "za");
|
|
||||||
m.put("ジ", "ji");
|
|
||||||
m.put("ズ", "zu");
|
|
||||||
m.put("ゼ", "ze");
|
|
||||||
m.put("ゾ", "zo");
|
|
||||||
m.put("ダ", "da");
|
|
||||||
m.put("ヂ", "ji");
|
|
||||||
m.put("ヅ", "zu");
|
|
||||||
m.put("デ", "de");
|
|
||||||
m.put("ド", "do");
|
|
||||||
m.put("バ", "ba");
|
|
||||||
m.put("ビ", "bi");
|
|
||||||
m.put("ブ", "bu");
|
|
||||||
m.put("ベ", "be");
|
|
||||||
m.put("ボ", "bo");
|
|
||||||
m.put("パ", "pa");
|
|
||||||
m.put("ピ", "pi");
|
|
||||||
m.put("プ", "pu");
|
|
||||||
m.put("ペ", "pe");
|
|
||||||
m.put("ポ", "po");
|
|
||||||
m.put("キャ", "kya");
|
|
||||||
m.put("キュ", "kyu");
|
|
||||||
m.put("キョ", "kyo");
|
|
||||||
m.put("シャ", "sha");
|
|
||||||
m.put("シュ", "shu");
|
|
||||||
m.put("ショ", "sho");
|
|
||||||
m.put("チャ", "cha");
|
|
||||||
m.put("チュ", "chu");
|
|
||||||
m.put("チョ", "cho");
|
|
||||||
m.put("ニャ", "nya");
|
|
||||||
m.put("ニュ", "nyu");
|
|
||||||
m.put("ニョ", "nyo");
|
|
||||||
m.put("ヒャ", "hya");
|
|
||||||
m.put("ヒュ", "hyu");
|
|
||||||
m.put("ヒョ", "hyo");
|
|
||||||
m.put("リャ", "rya");
|
|
||||||
m.put("リュ", "ryu");
|
|
||||||
m.put("リョ", "ryo");
|
|
||||||
m.put("ギャ", "gya");
|
|
||||||
m.put("ギュ", "gyu");
|
|
||||||
m.put("ギョ", "gyo");
|
|
||||||
m.put("ジャ", "ja");
|
|
||||||
m.put("ジュ", "ju");
|
|
||||||
m.put("ジョ", "jo");
|
|
||||||
m.put("ティ", "ti");
|
|
||||||
m.put("ディ", "di");
|
|
||||||
m.put("ツィ", "tsi");
|
|
||||||
m.put("ヂャ", "dya");
|
|
||||||
m.put("ヂュ", "dyu");
|
|
||||||
m.put("ヂョ", "dyo");
|
|
||||||
m.put("ビャ", "bya");
|
|
||||||
m.put("ビュ", "byu");
|
|
||||||
m.put("ビョ", "byo");
|
|
||||||
m.put("ピャ", "pya");
|
|
||||||
m.put("ピュ", "pyu");
|
|
||||||
m.put("ピョ", "pyo");
|
|
||||||
m.put("ー", "-");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String convert(String s) {
|
|
||||||
StringBuilder t = new StringBuilder();
|
|
||||||
for (int i = 0; i < s.length(); i++) {
|
|
||||||
if (i <= s.length() - 2) {
|
|
||||||
if (m.containsKey(s.substring(i, i + 2))) {
|
|
||||||
t.append(m.get(s.substring(i, i + 2)));
|
|
||||||
i++;
|
|
||||||
} else if (m.containsKey(s.substring(i, i + 1))) {
|
|
||||||
t.append(m.get(s.substring(i, i + 1)));
|
|
||||||
} else if (s.charAt(i) == 'ッ') {
|
|
||||||
t.append(m.get(s.substring(i + 1, i + 2)).charAt(0));
|
|
||||||
} else {
|
|
||||||
t.append(s.charAt(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (m.containsKey(s.substring(i, i + 1))) {
|
|
||||||
t.append(m.get(s.substring(i, i + 1)));
|
|
||||||
} else {
|
|
||||||
t.append(s.charAt(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return t.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -137,7 +137,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
|
||||||
a.setId(Long.parseLong(parser.getAttributeValue("", "place_id"))); //$NON-NLS-1$ //$NON-NLS-2$
|
a.setId(Long.parseLong(parser.getAttributeValue("", "place_id"))); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
String name = parser.getAttributeValue("", "display_name"); //$NON-NLS-1$//$NON-NLS-2$
|
String name = parser.getAttributeValue("", "display_name"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
a.setName(name);
|
a.setName(name);
|
||||||
a.setEnName(TransliterationHelper.getInstance().transliterate(getName()));
|
a.setEnName(TransliterationHelper.transliterate(getName()));
|
||||||
a.setSubType(parser.getAttributeValue("", "type")); //$NON-NLS-1$//$NON-NLS-2$
|
a.setSubType(parser.getAttributeValue("", "type")); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
PoiType pt = poiTypes.getPoiTypeByKey(a.getSubType());
|
PoiType pt = poiTypes.getPoiTypeByKey(a.getSubType());
|
||||||
a.setType(pt != null ? pt.getCategory() : poiTypes.getOtherPoiCategory());
|
a.setType(pt != null ? pt.getCategory() : poiTypes.getOtherPoiCategory());
|
||||||
|
@ -153,7 +153,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
|
||||||
String name = parser.getText();
|
String name = parser.getText();
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
a.setName(name);
|
a.setName(name);
|
||||||
a.setEnName(TransliterationHelper.getInstance().transliterate(getName()));
|
a.setEnName(TransliterationHelper.transliterate(getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,8 +308,8 @@ public class MapRenderRepositories {
|
||||||
BinaryMapIndexReader fr = files.get(mapName);
|
BinaryMapIndexReader fr = files.get(mapName);
|
||||||
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
if (fr != null && (fr.containsMapData(leftX, topY, rightX, bottomY, zoom) ||
|
||||||
fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) {
|
fr.containsRouteData(leftX, topY, rightX, bottomY, zoom))) {
|
||||||
if(!Algorithms.isEmpty(fr.getCountryName())) {
|
if (!Algorithms.isEmpty(fr.getCountryName())) {
|
||||||
setCountryForTransliterationMethod(fr.getCountryName());
|
TransliterationHelper.setCountry(fr.getCountryName());
|
||||||
}
|
}
|
||||||
if (!nativeFiles.contains(mapName)) {
|
if (!nativeFiles.contains(mapName)) {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
|
@ -546,9 +546,8 @@ public class MapRenderRepositories {
|
||||||
res = new ArrayList<BinaryMapDataObject>();
|
res = new ArrayList<BinaryMapDataObject>();
|
||||||
log.debug("Search failed " + c.getRegionNames(), e); //$NON-NLS-1$
|
log.debug("Search failed " + c.getRegionNames(), e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
if(res.size() > 0) {
|
if (res.size() > 0) {
|
||||||
log.debug("Country name:" + c.getCountryName());
|
TransliterationHelper.setCountry(c.getCountryName());
|
||||||
setCountryForTransliterationMethod(c.getCountryName());
|
|
||||||
if(basemap) {
|
if(basemap) {
|
||||||
renderedState |= 1;
|
renderedState |= 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -596,20 +595,6 @@ public class MapRenderRepositories {
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCountryForTransliterationMethod(String countryName) {
|
|
||||||
if(!countryName.equals(TransliterationHelper.getCountry())) {
|
|
||||||
switch (countryName) {
|
|
||||||
case "Japan": {
|
|
||||||
setCountry(countryName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
setCountry(TransliterationHelper.DEFAULT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateLatLonBox(QuadRect box) {
|
private void validateLatLonBox(QuadRect box) {
|
||||||
if (box.top > 90) {
|
if (box.top > 90) {
|
||||||
box.top = 85.5f;
|
box.top = 85.5f;
|
||||||
|
|
|
@ -241,11 +241,9 @@ public class TextRenderer {
|
||||||
TextDrawInfo text = rc.textToDraw.get(i);
|
TextDrawInfo text = rc.textToDraw.get(i);
|
||||||
if (text.text != null && text.text.length() > 0) {
|
if (text.text != null && text.text.length() > 0) {
|
||||||
if (preferredLocale.length() > 0) {
|
if (preferredLocale.length() > 0) {
|
||||||
text.text = TransliterationHelper.getInstance().transliterate(text.text);
|
text.text = TransliterationHelper.transliterate(text.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// sest text size before finding intersection (it is used there)
|
// sest text size before finding intersection (it is used there)
|
||||||
float textSize = text.textSize * rc.textScale ;
|
float textSize = text.textSize * rc.textScale ;
|
||||||
paintText.setTextSize(textSize);
|
paintText.setTextSize(textSize);
|
||||||
|
|
|
@ -45,11 +45,9 @@ public class AsyncLoadingThread extends Thread {
|
||||||
if (req instanceof TileLoadDownloadRequest) {
|
if (req instanceof TileLoadDownloadRequest) {
|
||||||
TileLoadDownloadRequest r = (TileLoadDownloadRequest) req;
|
TileLoadDownloadRequest r = (TileLoadDownloadRequest) req;
|
||||||
tileLoaded |= resourceManger.hasRequestedTile(r);
|
tileLoaded |= resourceManger.hasRequestedTile(r);
|
||||||
|
|
||||||
} else if (req instanceof MapLoadRequest) {
|
} else if (req instanceof MapLoadRequest) {
|
||||||
if (!mapLoaded) {
|
if (!mapLoaded) {
|
||||||
MapLoadRequest r = (MapLoadRequest) req;
|
MapLoadRequest r = (MapLoadRequest) req;
|
||||||
|
|
||||||
resourceManger.getRenderer().loadMap(r.tileBox, resourceManger.getMapTileDownloader());
|
resourceManger.getRenderer().loadMap(r.tileBox, resourceManger.getMapTileDownloader());
|
||||||
mapLoaded = !resourceManger.getRenderer().wasInterrupted();
|
mapLoaded = !resourceManger.getRenderer().wasInterrupted();
|
||||||
if (r.mapLoadedListener != null) {
|
if (r.mapLoadedListener != null) {
|
||||||
|
|
Loading…
Reference in a new issue