summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
Diffstat (limited to 'navit')
-rw-r--r--navit/android.c569
-rw-r--r--navit/android.h2
-rw-r--r--navit/android/AndroidManifest.xml9
-rw-r--r--navit/android/build.gradle10
-rw-r--r--navit/android/res/values-v19/styles.xml16
-rw-r--r--navit/android/res/values-v21/styles.xml27
-rw-r--r--navit/android/res/values/strings.xml589
-rw-r--r--navit/android/res/values/styles.xml13
-rw-r--r--navit/android/src/org/navitproject/navit/FileBrowserActivity.java233
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java677
-rw-r--r--navit/android/src/org/navitproject/navit/NavitActivityResult.java2
-rw-r--r--navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java239
-rwxr-xr-xnavit/android/src/org/navitproject/navit/NavitAppConfig.java56
-rw-r--r--navit/android/src/org/navitproject/navit/NavitBackupTask.java25
-rw-r--r--navit/android/src/org/navitproject/navit/NavitCamera.java75
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDialogs.java141
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java146
-rw-r--r--navit/android/src/org/navitproject/navit/NavitGraphics.java1183
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMap.java38
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMapDownloader.java745
-rw-r--r--navit/android/src/org/navitproject/navit/NavitRestoreTask.java55
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSensors.java30
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java30
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTimeout.java79
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTraff.java53
-rw-r--r--navit/android/src/org/navitproject/navit/NavitUtils.java53
-rw-r--r--navit/android/src/org/navitproject/navit/NavitVehicle.java126
-rw-r--r--navit/android/src/org/navitproject/navit/NavitWatch.java89
-rw-r--r--navit/attr.c39
-rw-r--r--navit/attr.h2
-rw-r--r--navit/attr_def.h2
-rw-r--r--navit/bookmarks.c25
-rw-r--r--navit/callback.c2
-rw-r--r--navit/color.h5
-rw-r--r--navit/coord.c152
-rw-r--r--navit/coord.h30
-rw-r--r--navit/graphics.c414
-rw-r--r--navit/graphics.h2
-rw-r--r--navit/graphics/android/graphics_android.c67
-rw-r--r--navit/graphics/qt5/graphics_qt5.cpp28
-rw-r--r--navit/graphics/sdl/graphics_sdl.c60
-rw-r--r--navit/graphics/sdl/raster.c199
-rw-r--r--navit/graphics/sdl/raster.h6
-rw-r--r--navit/graphics/win32/graphics_win32.c175
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c9
-rw-r--r--navit/gui/gtk/gui_gtk_window.c3
-rw-r--r--navit/gui/internal/gui_internal.c7
-rw-r--r--navit/gui/internal/gui_internal_command.c171
-rw-r--r--navit/gui/qt5_qml/skins/modern/navit.svg394
-rw-r--r--navit/gui/qt5_qml/skins/navit.svg394
-rw-r--r--navit/icons/desktop_icons/108x108/navit.pngbin9870 -> 5640 bytes
-rw-r--r--navit/icons/desktop_icons/128x128/navit.pngbin12526 -> 6704 bytes
-rw-r--r--navit/icons/desktop_icons/22x22/navit.pngbin1110 -> 942 bytes
-rw-r--r--navit/icons/desktop_icons/256x256/navit.pngbin31357 -> 13749 bytes
-rw-r--r--navit/icons/desktop_icons/86x86/navit.pngbin7314 -> 4373 bytes
-rw-r--r--navit/icons/navit.svg394
-rwxr-xr-xnavit/icons/navit_plain_bk.svg102
-rw-r--r--navit/layout.c41
-rw-r--r--navit/layout.h7
-rw-r--r--navit/main.c55
-rw-r--r--navit/maptool/osm.c87
-rw-r--r--navit/navit.c3
-rw-r--r--navit/navit_layout_bike_shipped.xml2
-rw-r--r--navit/navit_layout_car_android_shipped.xml2
-rw-r--r--navit/navit_layout_car_dark_shipped.xml2
-rw-r--r--navit/navit_layout_car_shipped.xml110
-rw-r--r--navit/navit_layout_car_simple_shipped.xml2
-rw-r--r--navit/navit_layout_th_shipped.xml2
-rw-r--r--navit/speech/android/speech_android.c2
-rw-r--r--navit/support/glib/fake.h6
-rw-r--r--navit/support/glib/glibconfig.h4
-rw-r--r--navit/support/glib/gslice.c7
-rw-r--r--navit/traffic/traff_android/traffic_traff_android.c6
-rw-r--r--navit/util.c123
-rw-r--r--navit/util.h17
-rw-r--r--navit/vehicle/android/vehicle_android.c7
-rw-r--r--navit/vehicle/file/vehicle_file.c1
-rw-r--r--navit/xslt/android.xslt1
-rw-r--r--navit/xslt/sailfish_svg.xslt17
79 files changed, 4246 insertions, 4250 deletions
diff --git a/navit/android.c b/navit/android.c
index dc506ffb0..f35cb274a 100644
--- a/navit/android.c
+++ b/navit/android.c
@@ -23,8 +23,6 @@
JNIEnv *jnienv;
jobject *android_activity = NULL;
-jobject *android_application = NULL;
-int android_version;
struct android_search_priv {
struct jni_object search_result_obj;
@@ -38,6 +36,16 @@ struct android_search_priv {
int found;
};
+
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *aVm, void *aReserved) {
+ if ((*aVm)->GetEnv(aVm,(void**)&jnienv, JNI_VERSION_1_6) != JNI_OK) {
+ dbg(lvl_error,"Failed to get the environment");
+ return -1;
+ }
+ dbg(lvl_debug,"Found the environment");
+ return JNI_VERSION_1_6;
+}
+
int android_find_class_global(char *name, jclass *ret) {
*ret=(*jnienv)->FindClass(jnienv, name);
if (! *ret) {
@@ -67,131 +75,122 @@ int android_find_static_method(jclass class, char *name, char *args, jmethodID *
return 1;
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject activity,
- jobject application, jobject lang, int version, jobject display_density_string, jobject path, jobject map_path,
- jboolean isLaunch) {
+
+/**
+ * @brief Starts the Navitlib for Android
+ *
+ * @param env provided by JVM
+ * @param thiz the calling Navit instance
+ * @param lang a string describing the language
+ * @param path relates to NAVIT_DATA_DIR on linux
+ * @param map_path where the binfiles are stored
+ */
+JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_navitMain( JNIEnv* env, jobject thiz,
+ jstring lang, jstring path, jstring map_path) {
const char *langstr;
- const char *displaydensitystr;
const char *map_file_path;
- android_version=version;
- __android_log_print(ANDROID_LOG_ERROR,"test","called");
jnienv=env;
- if (android_activity)
- (*jnienv)->DeleteGlobalRef(jnienv, android_activity);
- android_activity = (*jnienv)->NewGlobalRef(jnienv, activity);
- if (android_application)
- (*jnienv)->DeleteGlobalRef(jnienv, android_application);
- android_application = (*jnienv)->NewGlobalRef(jnienv, application);
+
+ android_activity = (*jnienv)->NewGlobalRef(jnienv, thiz);
+
langstr=(*env)->GetStringUTFChars(env, lang, NULL);
- dbg(lvl_debug,"enter env=%p thiz=%p activity=%p lang=%s version=%d",env,thiz,android_activity,langstr,version);
+ dbg(lvl_debug,"enter env=%p thiz=%p activity=%p lang=%s",env,thiz,android_activity,langstr);
setenv("LANG",langstr,1);
(*env)->ReleaseStringUTFChars(env, lang, langstr);
- displaydensitystr=(*env)->GetStringUTFChars(env, display_density_string, NULL);
- dbg(lvl_debug,"*****displaydensity=%s",displaydensitystr);
- setenv("ANDROID_DENSITY",displaydensitystr,1);
- (*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr);
-
map_file_path=(*env)->GetStringUTFChars(env, map_path, NULL);
setenv("NAVIT_USER_DATADIR",map_file_path,1);
- (*env)->ReleaseStringUTFChars(env, display_density_string, map_file_path);
+ (*env)->ReleaseStringUTFChars(env, map_path, map_file_path);
- if (isLaunch) {
- const char *strings=(*env)->GetStringUTFChars(env, path, NULL);
- main_real(1, &strings);
- (*env)->ReleaseStringUTFChars(env, path, strings);
- }
+ const char *strings=(*env)->GetStringUTFChars(env, path, NULL);
+ main_real(1, &strings);
+ (*env)->ReleaseStringUTFChars(env, path, strings);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_NavitDestroy( JNIEnv* env) {
+JNIEXPORT void JNICALL Java_org_navitproject_navit_Navit_navitDestroy( JNIEnv* env, jobject thiz) {
dbg(lvl_debug, "shutdown navit");
exit(0);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id,
- int w, int h) {
- dbg(lvl_debug,"enter %p %d %d",(struct callback *)id,w,h);
- if (id)
- callback_call_2((struct callback *)id,w,h);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_sizeChangedCallback( JNIEnv* env, jobject thiz,
+ jlong id, jint w, jint h) {
+ dbg(lvl_debug,"enter %p %d %d",(struct callback *)(intptr_t)id,w,h);
+ if (id) {
+ callback_call_2((struct callback *)(intptr_t)id, w, h);
+ }
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_PaddingChangedCallback(JNIEnv* env, jobject thiz,
- int id, int left, int top, int right, int bottom) {
- dbg(lvl_debug,"enter %p %d %d %d %d",(struct callback *)id, left, top, right, bottom);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_paddingChangedCallback(JNIEnv* env, jobject thiz,
+ jlong id, jint left, jint top, jint right, jint bottom) {
+ dbg(lvl_debug,"enter %p %d %d %d %d",(struct callback *)(intptr_t)id, left, top, right, bottom);
if (id)
- callback_call_4((struct callback *)id, left, top, right, bottom);
+ callback_call_4((struct callback *)(intptr_t)id, left, top, right, bottom);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_ButtonCallback( JNIEnv* env, jobject thiz, int id,
- int pressed, int button, int x, int y) {
- dbg(lvl_debug,"enter %p %d %d",(struct callback *)id,pressed,button);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_buttonCallback( JNIEnv* env, jobject thiz,
+ jlong id, jint pressed, jint button, jint x, jint y) {
+ dbg(lvl_debug,"enter %p %d %d",(struct callback *)(intptr_t)id,pressed,button);
if (id)
- callback_call_4((struct callback *)id,pressed,button,x,y);
+ callback_call_4((struct callback *)(intptr_t)id,pressed,button,x,y);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_MotionCallback( JNIEnv* env, jobject thiz, int id,
- int x, int y) {
- dbg(lvl_debug,"enter %p %d %d",(struct callback *)id,x,y);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_motionCallback( JNIEnv* env, jobject thiz,
+ jlong id, jint x, jint y) {
+ dbg(lvl_debug,"enter %p %d %d",(struct callback *)(intptr_t)id,x,y);
if (id)
- callback_call_2((struct callback *)id,x,y);
+ callback_call_2((struct callback *)(intptr_t)id,x,y);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_KeypressCallback( JNIEnv* env, jobject thiz, int id,
- jobject str) {
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitGraphics_keypressCallback( JNIEnv* env, jobject thiz,
+ jlong id, jstring str) {
const char *s;
- dbg(lvl_debug,"enter %p %p",(struct callback *)id,str);
+ dbg(lvl_debug,"enter %p %p",(struct callback *)(intptr_t)id,str);
s=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(lvl_debug,"key=%d",s);
+ dbg(lvl_debug,"key=%s",s);
if (id)
- callback_call_1((struct callback *)id,s);
+ callback_call_1((struct callback *)(intptr_t)id,s);
(*env)->ReleaseStringUTFChars(env, str, s);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitTimeout_TimeoutCallback( JNIEnv* env, jobject thiz, int id) {
- void (*event_handler)(void *) = *(void **)id;
- dbg(lvl_debug,"enter %p %p",thiz, (void *)id);
- event_handler((void*)id);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitTimeout_timeoutCallback( JNIEnv* env, jobject thiz,
+ jlong id) {
+ dbg(lvl_debug,"enter %p %p %p",thiz,(void *)id, (void *)(intptr_t)id);
+ void (*event_handler)(void *) = *((void **)(intptr_t)id);
+ event_handler((void*)(intptr_t)id);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitVehicle_VehicleCallback( JNIEnv * env, jobject thiz, int id,
- jobject location) {
- callback_call_1((struct callback *)id, (void *)location);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitVehicle_vehicleCallback( JNIEnv * env, jobject thiz,
+ jlong id, jobject location) {
+ callback_call_1((struct callback *)(intptr_t)id, (void *)location);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id) {
- dbg(lvl_debug,"enter %p %p",thiz, (void *)id);
- callback_call_0((struct callback *)id);
-}
-
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_poll( JNIEnv* env, jobject thiz, int func, int fd,
- int cond) {
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_poll( JNIEnv* env, jobject thiz, jlong func, jint fd,
+ jint cond) {
void (*pollfunc)(JNIEnv *env, int fd, int cond)=(void *)func;
pollfunc(env, fd, cond);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_WatchCallback( JNIEnv* env, jobject thiz, int id) {
- dbg(lvl_debug,"enter %p %p",thiz, (void *)id);
- callback_call_0((struct callback *)id);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitWatch_watchCallback( JNIEnv* env, jobject thiz, jlong id) {
+ dbg(lvl_debug,"enter %p %p",thiz, (void *)(intptr_t)id);
+ callback_call_0((struct callback *)(intptr_t)id);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitSensors_SensorCallback( JNIEnv* env, jobject thiz, int id,
- int sensor, float x, float y, float z) {
- dbg(lvl_debug,"enter %p %p %f %f %f",thiz, (void *)id,x,y,z);
- callback_call_4((struct callback *)id, sensor, &x, &y, &z);
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitSensors_sensorCallback( JNIEnv* env, jobject thiz,
+ jlong id, jint sensor, jfloat x, jfloat y, jfloat z) {
+ dbg(lvl_debug,"enter %p %p %f %f %f",thiz, (void *)(intptr_t)id,x,y,z);
+ callback_call_4((struct callback *)(intptr_t)id, sensor, &x, &y, &z);
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitTraff_onFeedReceived(JNIEnv * env, jobject thiz, int id,
- jstring feed) {
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitTraff_onFeedReceived(JNIEnv * env, jobject thiz,
+ jlong id, jstring feed) {
const char *s;
s = (*env)->GetStringUTFChars(env, feed, NULL);
if (id)
- callback_call_1((struct callback *) id, s);
+ callback_call_1((struct callback *)(intptr_t) id, s);
(*env)->ReleaseStringUTFChars(env, feed, s);
}
-
-
// type: 0=town, 1=street, 2=House#
void android_return_search_result(struct jni_object *jni_o, int type, struct pcoord *location, const char *address) {
struct coord_geo geo_location;
@@ -209,8 +208,8 @@ void android_return_search_result(struct jni_object *jni_o, int type, struct pco
(*env)->DeleteLocalRef(jni_o->env, jaddress);
}
-JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackLocalizedString( JNIEnv* env, jobject thiz,
- jobject str) {
+JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitAppConfig_callbackLocalizedString( JNIEnv* env, jclass thiz,
+ jstring str) {
const char *s;
const char *localized_str;
@@ -222,19 +221,146 @@ JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackLoca
// jstring dataStringValue = (jstring) localized_str;
jstring js = (*env)->NewStringUTF(env,localized_str);
-
(*env)->ReleaseStringUTFChars(env, str, s);
-
return js;
}
-JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, jobject thiz,
- int channel, jobject str) {
+
+JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_getDefaultCountry( JNIEnv* env, jobject thiz,
+ jint channel, jstring str) {
+ struct attr search_attr, country_name, country_iso2, *country_attr;
+ struct tracking *tracking;
+ struct search_list_result *res;
+ jstring return_string = NULL;
+
+ struct attr attr;
+ dbg(lvl_debug,"enter %d %p",channel,str);
+
+ config_get_attr(config_get(), attr_navit, &attr, NULL);
+
+ country_attr=country_default();
+ tracking=navit_get_tracking(attr.u.navit);
+ if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL)) {
+ country_attr = &search_attr;
+ }
+ if (country_attr) {
+ struct country_search *cs=country_search_new(country_attr, 0);
+ struct item *item=country_search_get_item(cs);
+ if (item && item_attr_get(item, attr_country_name, &country_name)) {
+ struct mapset *ms=navit_get_mapset(attr.u.navit);
+ struct search_list *search_list = search_list_new(ms);
+ search_attr.type=attr_country_all;
+ dbg(lvl_debug,"country %s", country_name.u.str);
+ search_attr.u.str=country_name.u.str;
+ search_list_search(search_list, &search_attr, 0);
+ while((res=search_list_get_result(search_list))) {
+ dbg(lvl_debug,"Get result: %s", res->country->iso2);
+ }
+ if (item_attr_get(item, attr_country_iso2, &country_iso2)) {
+ return_string = (*env)->NewStringUTF(env, country_iso2.u.str);
+ }
+ }
+ country_search_destroy(cs);
+ }
+
+ return return_string;
+}
+
+
+JNIEXPORT jobjectArray JNICALL Java_org_navitproject_navit_NavitGraphics_getAllCountries( JNIEnv* env,
+ jclass thiz) {
+ struct attr search_attr;
+ struct search_list_result *res;
+ GList* countries = NULL;
+ int country_count = 0;
+ jobjectArray all_countries;
+
+ struct attr attr;
+ dbg(lvl_debug,"enter");
+
+ config_get_attr(config_get(), attr_navit, &attr, NULL);
+
+ struct mapset *ms=navit_get_mapset(attr.u.navit);
+ struct search_list *search_list = search_list_new(ms);
+ jobjectArray current_country = NULL;
+ search_attr.type=attr_country_all;
+ //dbg(lvl_debug,"country %s", country_name.u.str);
+ search_attr.u.str=g_strdup("");//country_name.u.str;
+ search_list_search(search_list, &search_attr, 1);
+ while((res=search_list_get_result(search_list))) {
+ dbg(lvl_debug,"Get result: %s", res->country->iso2);
+
+ if (strlen(res->country->iso2)==2) {
+ jstring j_iso2 = (*env)->NewStringUTF(env, res->country->iso2);
+ jstring j_name = (*env)->NewStringUTF(env, navit_nls_gettext(res->country->name));
+
+ current_country = (jobjectArray)(*env)->NewObjectArray(env, 2, (*env)->FindClass(env, "java/lang/String"), NULL);
+
+ (*env)->SetObjectArrayElement(env, current_country, 0, j_iso2);
+ (*env)->SetObjectArrayElement(env, current_country, 1, j_name);
+
+ (*env)->DeleteLocalRef(env, j_iso2);
+ (*env)->DeleteLocalRef(env, j_name);
+
+ countries = g_list_prepend(countries, current_country);
+ country_count++;
+ }
+ }
+
+ search_list_destroy(search_list);
+ all_countries = (jobjectArray)(*env)->NewObjectArray(env, country_count, (*env)->GetObjectClass(env,current_country),
+ NULL);
+
+ while(countries) {
+ (*env)->SetObjectArrayElement(env, all_countries, --country_count, countries->data);
+ countries = g_list_delete_link( countries, countries);
+ }
+
+ return all_countries;
+}
+
+
+JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_getCoordForPoint( JNIEnv* env,
+ jobject thiz, jint x, jint y, jboolean absolute_coord) {
+
+ jstring return_string = NULL;
+
+ struct attr attr;
+ config_get_attr(config_get(), attr_navit, &attr, NULL);
+
+ struct transformation *transform=navit_get_trans(attr.u.navit);
+ struct point p;
+ struct coord c;
+ struct pcoord pc;
+
+ p.x = x;
+ p.y = y;
+
+ transform_reverse(transform, &p, &c);
+
+ pc.x = c.x;
+ pc.y = c.y;
+ pc.pro = transform_get_projection(transform);
+
+ char coord_str[32];
+ if (absolute_coord) {
+ pcoord_format_absolute(&pc, coord_str, sizeof(coord_str), ",");
+ } else {
+ pcoord_format_degree_short(&pc, coord_str, sizeof(coord_str), " ");
+ }
+
+ dbg(lvl_error,"Display point x=%d y=%d is \"%s\"",x,y,coord_str);
+ return_string = (*env)->NewStringUTF(env,coord_str);
+
+ return return_string;
+}
+
+JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_callbackMessageChannel( JNIEnv* env, jclass thiz,
+ jint channel, jstring str) {
struct attr attr;
const char *s;
jint ret = 0;
dbg(lvl_debug,"enter %d %p",channel,str);
-
config_get_attr(config_get(), attr_navit, &attr, NULL);
switch(channel) {
@@ -248,107 +374,104 @@ JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackMessage
navit_zoom_out_cursor(attr.u.navit, 2);
navit_draw(attr.u.navit);
break;
- case 6: { // add a map to the current mapset, return 1 on success
+ case 6: {// add a map to the current mapset, return 1 on success
struct mapset *ms = navit_get_mapset(attr.u.navit);
struct attr type, name, data, *attrs[4];
- const char *map_location=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(lvl_debug,"*****string=%s",map_location);
- type.type=attr_type;
- type.u.str="binfile";
+ const char *map_location = (*env)->GetStringUTFChars(env, str, NULL);
+ dbg(lvl_debug, "*****string=%s", map_location);
+ type.type = attr_type;
+ type.u.str = "binfile";
- data.type=attr_data;
- data.u.str=g_strdup(map_location);
+ data.type = attr_data;
+ data.u.str = g_strdup(map_location);
- name.type=attr_name;
- name.u.str=g_strdup(map_location);
+ name.type = attr_name;
+ name.u.str = g_strdup(map_location);
- attrs[0]=&type;
- attrs[1]=&data;
- attrs[2]=&name;
- attrs[3]=NULL;
+ attrs[0] = &type;
+ attrs[1] = &data;
+ attrs[2] = &name;
+ attrs[3] = NULL;
- struct map * new_map = map_new(NULL, attrs);
+ struct map *new_map = map_new(NULL, attrs);
if (new_map) {
struct attr map_a;
- map_a.type=attr_map;
- map_a.u.map=new_map;
+ map_a.type = attr_map;
+ map_a.u.map = new_map;
ret = mapset_add_attr(ms, &map_a);
navit_draw(attr.u.navit);
}
(*env)->ReleaseStringUTFChars(env, str, map_location);
+ break;
}
- break;
- case 7: { // remove a map to the current mapset, return 1 on success
+ case 7: { // remove a map from the current mapset, return 1 on success
struct mapset *ms = navit_get_mapset(attr.u.navit);
struct attr map_r;
- const char *map_location=(*env)->GetStringUTFChars(env, str, NULL);
- struct map * delete_map = mapset_get_map_by_name(ms, map_location);
+ const char *map_location = (*env)->GetStringUTFChars(env, str, NULL);
+ struct map *delete_map = mapset_get_map_by_name(ms, map_location);
if (delete_map) {
- dbg(lvl_debug,"delete map %s (%p)", map_location, delete_map);
- map_r.type=attr_map;
- map_r.u.map=delete_map;
+ dbg(lvl_debug, "delete map %s (%p)", map_location, delete_map);
+ map_r.type = attr_map;
+ map_r.u.map = delete_map;
ret = mapset_remove_attr(ms, &map_r);
navit_draw(attr.u.navit);
}
(*env)->ReleaseStringUTFChars(env, str, map_location);
+ break;
}
- break;
case 5:
// call a command (like in gui)
- s=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(lvl_debug,"*****string=%s",s);
- command_evaluate(&attr,s);
+ s = (*env)->GetStringUTFChars(env, str, NULL);
+ dbg(lvl_debug, "*****string=%s", s);
+ command_evaluate(&attr, s);
(*env)->ReleaseStringUTFChars(env, str, s);
break;
- case 4: {
- // navigate to display position
+ case 4: { // navigate to display position
char *pstr;
struct point p;
struct coord c;
struct pcoord pc;
+ struct transformation *transform = navit_get_trans(attr.u.navit);
- struct transformation *transform=navit_get_trans(attr.u.navit);
-
- s=(*env)->GetStringUTFChars(env, str, NULL);
+ s = (*env)->GetStringUTFChars(env, str, NULL);
char parse_str[strlen(s) + 1];
strcpy(parse_str, s);
(*env)->ReleaseStringUTFChars(env, str, s);
- dbg(lvl_debug,"*****string=%s",parse_str);
+ dbg(lvl_debug, "*****string=%s", parse_str);
// set destination to (pixel-x#pixel-y)
// pixel-x
- pstr = strtok (parse_str,"#");
+ pstr = strtok(parse_str, "#");
p.x = atoi(pstr);
// pixel-y
- pstr = strtok (NULL, "#");
+ pstr = strtok(NULL, "#");
p.y = atoi(pstr);
- dbg(lvl_debug,"11x=%d",p.x);
- dbg(lvl_debug,"11y=%d",p.y);
+ dbg(lvl_debug, "11x=%d", p.x);
+ dbg(lvl_debug, "11y=%d", p.y);
transform_reverse(transform, &p, &c);
-
pc.x = c.x;
pc.y = c.y;
pc.pro = transform_get_projection(transform);
- dbg(lvl_debug,"22x=%d",pc.x);
- dbg(lvl_debug,"22y=%d",pc.y);
-
+ char coord_str[32];
+ //pcoord_format_short(&pc, coord_str, sizeof(coord_str), " ");
+ pcoord_format_degree_short(&pc, coord_str, sizeof(coord_str), " ");
+ dbg(lvl_debug,"Setting destination to %s",coord_str);
// start navigation asynchronous
- navit_set_destination(attr.u.navit, &pc, parse_str, 1);
+ navit_set_destination(attr.u.navit, &pc, coord_str, 1);
}
- break;
case 3: {
// navigate to geo position
char *name;
- s=(*env)->GetStringUTFChars(env, str, NULL);
+ s = (*env)->GetStringUTFChars(env, str, NULL);
char parse_str[strlen(s) + 1];
strcpy(parse_str, s);
(*env)->ReleaseStringUTFChars(env, str, s);
- dbg(lvl_debug,"*****string=%s",s);
+ dbg(lvl_debug, "*****string=%s", s);
// set destination to (lat#lon#title)
struct coord_geo g;
@@ -356,31 +479,34 @@ JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackMessage
char *stopstring;
// lat
- p = strtok (parse_str,"#");
+ p = strtok(parse_str, "#");
g.lat = strtof(p, &stopstring);
// lon
- p = strtok (NULL, "#");
+ p = strtok(NULL, "#");
g.lng = strtof(p, &stopstring);
// description
- name = strtok (NULL, "#");
+ name = strtok(NULL, "#");
- dbg(lvl_debug,"lat=%f",g.lat);
- dbg(lvl_debug,"lng=%f",g.lng);
- dbg(lvl_debug,"str1=%s",name);
+ dbg(lvl_debug, "lat=%f", g.lat);
+ dbg(lvl_debug, "lng=%f", g.lng);
+ dbg(lvl_debug, "str1=%s", name);
struct coord c;
transform_from_geo(projection_mg, &g, &c);
struct pcoord pc;
- pc.x=c.x;
- pc.y=c.y;
- pc.pro=projection_mg;
-
+ pc.x = c.x;
+ pc.y = c.y;
+ pc.pro = projection_mg;
+ char coord_str[32];
+ if (!name || *name == '\0') {
+ pcoord_format_degree_short(&pc, coord_str, sizeof(coord_str), " ");
+ name = coord_str;
+ }
// start navigation asynchronous
navit_set_destination(attr.u.navit, &pc, name, 1);
-
+ break;
}
- break;
default:
dbg(lvl_error, "Unknown command: %d", channel);
}
@@ -388,93 +514,6 @@ JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_CallbackMessage
return ret;
}
-JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_GetDefaultCountry( JNIEnv* env, jobject thiz,
- int channel, jobject str) {
- struct attr search_attr, country_name, country_iso2, *country_attr;
- struct tracking *tracking;
- struct search_list_result *res;
- jstring return_string = NULL;
-
- struct attr attr;
- dbg(lvl_debug,"enter %d %p",channel,str);
-
- config_get_attr(config_get(), attr_navit, &attr, NULL);
-
- country_attr=country_default();
- tracking=navit_get_tracking(attr.u.navit);
- if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
- country_attr=&search_attr;
- if (country_attr) {
- struct country_search *cs=country_search_new(country_attr, 0);
- struct item *item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name)) {
- struct mapset *ms=navit_get_mapset(attr.u.navit);
- struct search_list *search_list = search_list_new(ms);
- search_attr.type=attr_country_all;
- dbg(lvl_debug,"country %s", country_name.u.str);
- search_attr.u.str=country_name.u.str;
- search_list_search(search_list, &search_attr, 0);
- while((res=search_list_get_result(search_list))) {
- dbg(lvl_debug,"Get result: %s", res->country->iso2);
- }
- if (item_attr_get(item, attr_country_iso2, &country_iso2))
- return_string = (*env)->NewStringUTF(env,country_iso2.u.str);
- }
- country_search_destroy(cs);
- }
-
- return return_string;
-}
-
-JNIEXPORT jobjectArray JNICALL Java_org_navitproject_navit_NavitGraphics_GetAllCountries( JNIEnv* env, jobject thiz) {
- struct attr search_attr;
- struct search_list_result *res;
- GList* countries = NULL;
- int country_count = 0;
- jobjectArray all_countries;
-
- struct attr attr;
- dbg(lvl_debug,"enter");
-
- config_get_attr(config_get(), attr_navit, &attr, NULL);
-
- struct mapset *ms=navit_get_mapset(attr.u.navit);
- struct search_list *search_list = search_list_new(ms);
- jobjectArray current_country = NULL;
- search_attr.type=attr_country_all;
- //dbg(lvl_debug,"country %s", country_name.u.str);
- search_attr.u.str=g_strdup("");//country_name.u.str;
- search_list_search(search_list, &search_attr, 1);
- while((res=search_list_get_result(search_list))) {
- dbg(lvl_debug,"Get result: %s", res->country->iso2);
-
- if (strlen(res->country->iso2)==2) {
- jstring j_iso2 = (*env)->NewStringUTF(env, res->country->iso2);
- jstring j_name = (*env)->NewStringUTF(env, navit_nls_gettext(res->country->name));
-
- current_country = (jobjectArray)(*env)->NewObjectArray(env, 2, (*env)->FindClass(env, "java/lang/String"), NULL);
-
- (*env)->SetObjectArrayElement(env, current_country, 0, j_iso2);
- (*env)->SetObjectArrayElement(env, current_country, 1, j_name);
-
- (*env)->DeleteLocalRef(env, j_iso2);
- (*env)->DeleteLocalRef(env, j_name);
-
- countries = g_list_prepend(countries, current_country);
- country_count++;
- }
- }
-
- search_list_destroy(search_list);
- all_countries = (jobjectArray)(*env)->NewObjectArray(env, country_count, (*env)->GetObjectClass(env, current_country),
- NULL);
-
- while(countries) {
- (*env)->SetObjectArrayElement(env, all_countries, --country_count, countries->data);
- countries = g_list_delete_link( countries, countries);
- }
- return all_countries;
-}
static char *postal_str(struct search_list_result *res, int level) {
char *ret=NULL;
@@ -528,8 +567,8 @@ static char *town_str(struct search_list_result *res, int level) {
if (!county)
county_sep=county="";
- return g_strdup_printf("%s%s%s%s%s%s%s%s", postal, postal_sep, town, district_begin, district, district_end, county_sep,
- county);
+ return g_strdup_printf("%s%s%s%s%s%s%s%s", postal, postal_sep, town, district_begin, district,
+ district_end, county_sep, county);
}
static void android_search_end(struct android_search_priv *search_priv) {
@@ -562,41 +601,46 @@ static enum attr_type android_search_level[] = {
attr_house_number
};
+static void android_search_idle_result(struct android_search_priv *search_priv, struct search_list_result *res) {
+// commented out because otherwise cyclomatic complexity needleslly reported as too high
+// dbg(lvl_debug, "Town: %s, Street: %s",res->town ? res->town->common.town_name : "no town",
+// res->street ? res->street->name : "no street");
+ search_priv->found = 1;
+ switch (search_priv->search_attr.type) {
+ case attr_town_or_district_name: {
+ gchar *town = town_str(res, 1);
+ android_return_search_result(&search_priv->search_result_obj, 0, res->town->common.c, town);
+ g_free(town);
+ }
+ break;
+ case attr_street_name: {
+ gchar *town = town_str(res, 2);
+ gchar *address = g_strdup_printf("%.101s,%.101s, %.101s", res->country->name, town, res->street->name);
+ android_return_search_result(&search_priv->search_result_obj, 1, res->street->common.c, address);
+ g_free(address);
+ g_free(town);
+ }
+ break;
+ case attr_house_number: {
+ gchar *town = town_str(res, 3);
+ gchar *address = g_strdup_printf("%.101s, %.101s, %.101s %.15s", res->country->name, town,
+ res->street->name, res->house_number->house_number);
+ android_return_search_result(&search_priv->search_result_obj, 2, res->house_number->common.c, address);
+ g_free(address);
+ g_free(town);
+ }
+ break;
+ default:
+ dbg(lvl_error, "Unhandled search type %d", search_priv->search_attr.type);
+ }
+}
+
static void android_search_idle(struct android_search_priv *search_priv) {
dbg(lvl_debug, "enter android_search_idle");
struct search_list_result *res = search_list_get_result(search_priv->search_list);
if (res) {
- dbg(lvl_debug, "Town: %s, Street: %s",res->town ? res->town->common.town_name : "no town",
- res->street ? res->street->name : "no street");
- search_priv->found = 1;
- switch (search_priv->search_attr.type) {
- case attr_town_or_district_name: {
- gchar *town = town_str(res, 1);
- android_return_search_result(&search_priv->search_result_obj, 0, res->town->common.c, town);
- g_free(town);
- break;
- }
- case attr_street_name: {
- gchar *town = town_str(res, 2);
- gchar *address = g_strdup_printf("%.101s,%.101s, %.101s", res->country->name, town, res->street->name);
- android_return_search_result(&search_priv->search_result_obj, 1, res->street->common.c, address);
- g_free(address);
- g_free(town);
- break;
- }
- case attr_house_number: {
- gchar *town = town_str(res, 3);
- gchar *address = g_strdup_printf("%.101s, %.101s, %.101s %.15s", res->country->name, town, res->street->name,
- res->house_number->house_number);
- android_return_search_result(&search_priv->search_result_obj, 2, res->house_number->common.c, address);
- g_free(address);
- g_free(town);
- break;
- }
- default:
- dbg(lvl_error, "Unhandled search type %d", search_priv->search_attr.type);
- }
+ android_search_idle_result(search_priv, res);
} else {
int level = search_list_level(search_priv->search_attr.type) - 1;
@@ -642,7 +686,7 @@ static char *search_fix_spaces(const char *str) {
char c,*s,*d,*ret=g_strdup(str);
for (i = 0 ; i < len ; i++) {
- if (ret[i] == ',' || ret[i] == ',' || ret[i] == '/')
+ if (ret[i] == ',' || ret[i] == '/')
ret[i]=' ';
}
s=ret;
@@ -661,6 +705,7 @@ static char *search_fix_spaces(const char *str) {
len--;
}
} while (c);
+
return ret;
}
@@ -683,8 +728,8 @@ static void start_search(struct android_search_priv *search_priv, const char *se
dbg(lvl_debug,"leave");
}
-JNIEXPORT jlong JNICALL Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackStartAddressSearch( JNIEnv* env,
- jobject thiz, int partial, jobject country, jobject str) {
+JNIEXPORT jlong JNICALL Java_org_navitproject_navit_NavitAddressSearchActivity_callbackStartAddressSearch( JNIEnv* env,
+ jobject thiz, jint partial, jstring country, jstring str) {
struct attr attr;
const char *search_string =(*env)->GetStringUTFChars(env, str, NULL);
dbg(lvl_debug,"search '%s'", search_string);
@@ -734,7 +779,7 @@ JNIEXPORT jlong JNICALL Java_org_navitproject_navit_NavitAddressSearchActivity_C
return (jlong)(long)search_priv;
}
-JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackCancelAddressSearch( JNIEnv* env,
+JNIEXPORT void JNICALL Java_org_navitproject_navit_NavitAddressSearchActivity_callbackCancelAddressSearch( JNIEnv* env,
jobject thiz, jlong handle) {
struct android_search_priv *priv = (void*)(long)handle;
diff --git a/navit/android.h b/navit/android.h
index ee8b1b4b5..5751b2b17 100644
--- a/navit/android.h
+++ b/navit/android.h
@@ -1,8 +1,6 @@
#include <jni.h>
extern JNIEnv *jnienv;
extern jobject *android_activity;
-extern jobject *android_application;
-extern int android_version;
int android_find_class_global(char *name, jclass *ret);
int android_find_method(jclass class, char *name, char *args, jmethodID *ret);
int android_find_static_method(jclass class, char *name, char *args, jmethodID *ret);
diff --git a/navit/android/AndroidManifest.xml b/navit/android/AndroidManifest.xml
index 5080ec52b..e8f153fd4 100644
--- a/navit/android/AndroidManifest.xml
+++ b/navit/android/AndroidManifest.xml
@@ -10,14 +10,14 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <application android:label="@string/app_name"
+ <application android:usesCleartextTraffic="true" android:label="@string/app_name"
android:icon="@drawable/icon"
android:name=".NavitAppConfig"
- android:theme="@style/NavitBaseTheme">
+ android:theme="@style/NavitTheme">
<activity android:name="Navit"
android:label="@string/app_name"
- android:configChanges="locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize"
- android:theme="@style/NavitTheme">
+ android:configChanges="screenLayout|smallestScreenSize|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize"
+ android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -32,7 +32,6 @@
android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
<activity android:name=".NavitDownloadSelectMapActivity"></activity>
- <!-- <activity android:name=".NavitAddressResultListActivity"></activity> -->
<activity
android:name="FileBrowserActivity"
android:label="File browser"
diff --git a/navit/android/build.gradle b/navit/android/build.gradle
index faf5acc03..6934afdfa 100644
--- a/navit/android/build.gradle
+++ b/navit/android/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'checkstyle'
android {
compileSdkVersion 28
- buildToolsVersion "29.0.1"
+ buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.navitproject.navit"
minSdkVersion 9
@@ -12,8 +12,8 @@ android {
versionCode gitVersionCode
versionName gitVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- ndk { // need for now for 'x86_64' and 'armeabi'
- abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
+ ndk {
+ abiFilters 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
}
externalNativeBuild {
cmake {
@@ -57,7 +57,6 @@ android {
classpath = files()
reports {
include ('**/*.java')
- exclude ('**/FileBrowserActivity.java')
xml.enabled = true
html.enabled = true
xml {
@@ -75,7 +74,6 @@ android {
applicationVariants.all { variant ->
// create tasks to generate Javadocs
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
- source = variant.javaCompile.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
destinationDir = file("build/outputs/docs/javadoc/")
title = rootProject.name
@@ -92,5 +90,5 @@ dependencies {
})
testImplementation 'junit:junit:4.12'
implementation 'ch.acra:acra:4.9.2'
-// implementation 'com.android.support:support-v4:27.1.1'
+// implementation 'com.android.support:support-v4:28.0.0'
}
diff --git a/navit/android/res/values-v19/styles.xml b/navit/android/res/values-v19/styles.xml
index 69acd3a4e..7e3277f09 100644
--- a/navit/android/res/values-v19/styles.xml
+++ b/navit/android/res/values-v19/styles.xml
@@ -1,22 +1,8 @@
<resources>
-
- <!--
- Base application theme for API 19+. This theme completely replaces
- NavitBaseTheme from BOTH res/values/styles.xml and
- res/values-v19/styles.xml on API 19+ devices.
- -->
- <style name="NavitBaseTheme" parent="android:Theme.Holo"/>
-
- <!--
- Main Activity theme for API 19+. This theme completely replaces
- NavitTheme from BOTH res/values/styles.xml and
- res/values-v19/styles.xml on API 19+ devices.
- -->
- <style name="NavitTheme" parent="NavitBaseTheme">
+ <style name="NavitTheme" parent="android:Theme.DeviceDefault.NoActionBar">
<!-- API 19 theme customizations can go here. -->
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
-
</resources> \ No newline at end of file
diff --git a/navit/android/res/values-v21/styles.xml b/navit/android/res/values-v21/styles.xml
index 3edbb901a..85cf81d9b 100644
--- a/navit/android/res/values-v21/styles.xml
+++ b/navit/android/res/values-v21/styles.xml
@@ -1,30 +1,7 @@
<resources>
-
- <!--
- Base application theme for API 21+. This theme completely replaces
- NavitBaseTheme from BOTH res/values/styles.xml and
- res/values-v.../styles.xml on API 21+ devices.
- -->
- <style name="NavitBaseTheme" parent="android:Theme.Material">
-
- <!-- Main theme colors -->
- <!-- your app branding color for the app bar -->
- <item name="android:colorPrimary">@color/navitYellow500</item>
- <!-- darker variant for the status bar and contextual app bars -->
- <item name="android:colorPrimaryDark">@color/navitYellow700</item>
- <!-- theme UI controls like checkboxes and text fields -->
- <item name="android:colorAccent">@color/navitBlue500</item>
- </style>
-
- <!--
- Main Activity theme for API 21+. This theme completely replaces
- NavitTheme from BOTH res/values/styles.xml and
- res/values-v21/styles.xml on API 21+ devices.
- -->
- <style name="NavitTheme" parent="NavitBaseTheme">
+ <style name="NavitTheme" parent="android:Theme.DeviceDefault.NoActionBar">
<!-- API 21 theme customizations can go here. -->
-
<!--
Don't use translucent system bars on API 21 as they are drawn with a semitransparent
black background which can't be changed.
@@ -39,8 +16,6 @@
-->
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
-
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
-
</resources> \ No newline at end of file
diff --git a/navit/android/res/values/strings.xml b/navit/android/res/values/strings.xml
index f321991e7..44ed1483b 100644
--- a/navit/android/res/values/strings.xml
+++ b/navit/android/res/values/strings.xml
@@ -1,311 +1,312 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <!-- LANG=en -->
- <!-- GENERIC -->
- <string name="yes">Yes</string>
- <string name="no">No</string>
- <string name="cancel">Cancel</string>
+ <!-- LANG=en -->
+ <!-- GENERIC -->
+ <string name="yes">Yes</string>
+ <string name="no">No</string>
+ <string name="cancel">Cancel</string>
- <!-- NOTIFICATION -->
- <string name="channel_name">Navit</string>
- <string name="notification_ticker">Navit started</string>
- <string name="notification_event_default">Navit running</string>
+ <!-- NOTIFICATION -->
+ <string name="channel_name">Navit</string>
+ <string name="notification_ticker">Navit started</string>
+ <string name="notification_event_default">Navit running</string>
- <!-- INITIAL INFOBOX -->
- <string name="initial_info_box_title">Welcome to Navit</string>
- <string name="initial_info_box_message">Thank you for installing Navit!\n\nTo start, select \"Download maps\" from the menu to download a map. Note: The map filesize may be large (>50MB) - a wifi connection is recommended.\n\nMapdata: (c) OpenStreetMap contributors\n\nEnjoy Navit!</string>
- <string name="initial_info_box_OK">OK</string>
- <string name="initial_info_box_more_info">More info</string>
+ <!-- INITIAL INFOBOX -->
+ <string name="initial_info_box_title">Welcome to Navit</string>
+ <string name="initial_info_box_message">Thank you for installing Navit!\n\nTo start, select \"Download maps\" from the menu to download a map. Note: The map filesize may be large (>50MB) - a wifi connection is recommended.\n\nMapdata: (c) OpenStreetMap contributors\n\nEnjoy Navit!</string>
+ <string name="initial_info_box_OK">OK</string>
+ <string name="initial_info_box_more_info">More info</string>
- <!-- OPTIONS MENU -->
- <string name="optionsmenu_zoom_in">Zoom in</string>
- <string name="optionsmenu_zoom_out">Zoom out</string>
- <string name="optionsmenu_download_maps">Download maps</string>
- <string name="optionsmenu_toggle_poi">Toggle POIs</string>
- <string name="optionsmenu_exit_navit">Exit Navit</string>
- <string name="optionsmenu_backup_restore">Backup / Restore</string>
- <string name="optionsmenu_set_map_location">Set map location</string>
+ <!-- OPTIONS MENU -->
+ <string name="optionsmenu_zoom_in">Zoom in</string>
+ <string name="optionsmenu_zoom_out">Zoom out</string>
+ <string name="optionsmenu_download_maps">Download maps</string>
+ <string name="optionsmenu_toggle_poi">Toggle POIs</string>
+ <string name="optionsmenu_exit_navit">Exit Navit</string>
+ <string name="optionsmenu_backup_restore">Backup / Restore</string>
+ <string name="optionsmenu_set_map_location">Set map location</string>
- <!-- POSITION POP-UP -->
- <string name="position_popup_title">Position</string>
- <string name="position_popup_drive_here">Route to here</string>
+ <!-- POSITION POP-UP -->
+ <string name="position_popup_title">Position</string>
+ <string name="position_popup_drive_here">Route to here</string>
+ <string name="position_popup_view">View</string>
- <!-- MAP DOWNLOAD -->
- <string name="map_delete">Delete this map?</string>
- <string name="map_download_title">Map download</string>
- <string name="map_download_downloading">Downloading:</string>
- <string name="map_download_eta">ETA</string>
- <string name="map_download_ready">ready</string>
- <string name="map_download_download_error">Error downloading map.</string>
- <string name="map_download_download_aborted">Map download aborted</string>
- <string name="map_download_not_enough_free_space">Not enough free space</string>
- <string name="map_download_oversize">Sorry, we currently do not support maps above 3.8G on Android, please select a smaller one.</string>
- <string name="map_no_fix">No location. Reopen after location fix.</string>
- <string name="maps_for_current_location">Maps containing current location</string>
- <string name="maps_installed">Installed maps</string>
- <string name="map_downloading">downloading</string>
- <string name="map_download_medium_unavailable">Media selected for map storage is not available</string>
- <string name="map_download_error_writing_map">Error writing map!</string>
+ <!-- MAP DOWNLOAD -->
+ <string name="map_delete">Delete this map?</string>
+ <string name="map_download_title">Map download</string>
+ <string name="map_download_downloading">Downloading:</string>
+ <string name="map_download_eta">ETA</string>
+ <string name="map_download_ready">ready</string>
+ <string name="map_download_download_error">Error downloading map.</string>
+ <string name="map_download_download_aborted">Map download aborted</string>
+ <string name="map_download_not_enough_free_space">Not enough free space</string>
+ <string name="map_download_oversize">Sorry, we currently do not support maps above 3.8G on Android, please select a smaller one.</string>
+ <string name="map_no_fix">No location. Reopen after location fix.</string>
+ <string name="maps_for_current_location">Maps containing current location</string>
+ <string name="maps_installed">Installed maps</string>
+ <string name="map_downloading">downloading</string>
+ <string name="map_download_medium_unavailable">Media selected for map storage is not available</string>
+ <string name="map_download_error_writing_map">Error writing map!</string>
- <!-- STORAGE -->
- <string name="map_location_changed">New location set to %s Restart Navit to apply the changes.</string>
- <string name="map_location_unavailable">Current map location %s is not available Please restart Navit after you attach an SD card or select a different map location.</string>
+ <!-- STORAGE -->
+ <string name="map_location_changed">New location set to %s Restart Navit to apply the changes.</string>
+ <string name="map_location_unavailable">Current map location %s is not available Please restart Navit after you attach an SD card or select a different map location.</string>
- <!-- ADDRESS SEARCH -->
- <string name="address_search_title">Address search</string>
- <string name="address_enter_destination">Enter destination</string>
- <string name="address_partial_match">Match partial address</string>
- <string name="address_search_button">Search</string>
- <string name="address_search_searching">Searching...</string>
- <string name="address_search_not_found">Address not found</string>
- <string name="address_search_getting_results">Getting search results</string>
- <string name="address_search_loading_results">Loading search results</string>
- <string name="address_search_no_results">No results found</string>
- <string name="address_search_no_text_entered">No text entered</string>
- <string name="address_search_set_destination">Setting destination to:</string>
- <string name="address_search_towns">Towns</string>
- <string name="address_search_streets">Streets</string>
+ <!-- ADDRESS SEARCH -->
+ <string name="address_search_title">Address search</string>
+ <string name="address_enter_destination">Enter destination</string>
+ <string name="address_partial_match">Match partial address</string>
+ <string name="address_search_button">Search</string>
+ <string name="address_search_searching">Searching...</string>
+ <string name="address_search_not_found">Address not found</string>
+ <string name="address_search_getting_results">Getting search results</string>
+ <string name="address_search_loading_results">Loading search results</string>
+ <string name="address_search_no_results">No results found</string>
+ <string name="address_search_no_text_entered">No text entered</string>
+ <string name="address_search_set_destination">Setting destination to:</string>
+ <string name="address_search_towns">Towns</string>
+ <string name="address_search_streets">Streets</string>
- <!-- Backup Restore -->
- <string name="choose_an_action">Choose an action</string>
- <string name="please_insert_an_sd_card">Please insert an SD Card</string>
- <string name="backing_up">Backing up...</string>
- <string name="restoring">Restoring...</string>
- <string name="failed_to_create_backup_directory">Failed to create backup directory</string>
- <string name="backup_failed">Backup failed</string>
- <string name="no_backup_found">No backup found</string>
- <string name="failed_to_restore">Failed to restore</string>
- <string name="backup_successful">Backup successful</string>
- <string name="restore_successful_please_restart_navit">Restore Successful\nPlease restart Navit</string>
- <string name="backup_not_found">Backup not found</string>
- <string name="restore_failed">Restore failed</string>
- <string name="select_backup">Select backup</string>
- <string name="backup">Backup</string>
- <string name="restore">Restore</string>
+ <!-- Backup Restore -->
+ <string name="choose_an_action">Choose an action</string>
+ <string name="please_insert_an_sd_card">Please insert an SD Card</string>
+ <string name="backing_up">Backing up...</string>
+ <string name="restoring">Restoring...</string>
+ <string name="failed_to_create_backup_directory">Failed to create backup directory</string>
+ <string name="backup_failed">Backup failed</string>
+ <string name="no_backup_found">No backup found</string>
+ <string name="failed_to_restore">Failed to restore</string>
+ <string name="backup_successful">Backup successful</string>
+ <string name="restore_successful_please_restart_navit">Restore Successful\nPlease restart Navit</string>
+ <string name="backup_not_found">Backup not found</string>
+ <string name="restore_failed">Restore failed</string>
+ <string name="select_backup">Select backup</string>
+ <string name="backup">Backup</string>
+ <string name="restore">Restore</string>
- <!-- TTS -->
- <string name="TTS_title_data_missing">System text to speech engine data is missing</string>
- <string name="TTS_qery_install_data">Navit can use any text to speech engine installed on your device. The currently selected engine reports it is unable to speak in your language. Should we ask the system to show voice download dialog?</string>
+ <!-- TTS -->
+ <string name="TTS_title_data_missing">System text to speech engine data is missing</string>
+ <string name="TTS_qery_install_data">Navit can use any text to speech engine installed on your device. The currently selected engine reports it is unable to speak in your language. Should we ask the system to show voice download dialog?</string>
- <!-- Permissions dialog-->
- <string name="permissions_not_granted">Navit needs permission to access GPS and read the map.\nIf you change your mind please restart Navit and grant the permissions</string>
- <string name="permissions_info_box_title">One or more ungranted permissions</string>
+ <!-- Permissions dialog-->
+ <string name="permissions_not_granted">Navit needs permission to access GPS and read the map.\nIf you change your mind please restart Navit and grant the permissions</string>
+ <string name="permissions_info_box_title">One or more ungranted permissions</string>
- <!-- countries, continents, regions -->
- <string name="whole_planet">Whole Planet</string>
- <string name="africa">Africa</string>
- <string name="angola">Angola</string>
- <string name="burundi">Burundi</string>
- <string name="canary_islands">Canary Islands</string>
- <string name="congo">Congo, Democratic Republic of the</string>
- <string name="ethiopia">Ethiopia</string>
- <string name="guinea">Guinea</string>
- <string name="cotedivoire">Cote d\'Ivoire</string>
- <string name="kenya">Kenya</string>
- <string name="lesotho">Lesotho</string>
- <string name="liberia">Liberia</string>
- <string name="libya">Libya</string>
- <string name="madagascar">Madagascar</string>
- <string name="namibia">Namibia</string>
- <string name="botswana">Botswana</string>
- <string name="reunion">Reunion</string>
- <string name="rwanda">Rwanda</string>
- <string name="south_africa">South Africa</string>
- <string name="tanzania">Tanzania, United Republic of</string>
- <string name="uganda">Uganda</string>
- <string name="asia">Asia</string>
- <string name="azerbaijan">Azerbaijan</string>
- <string name="china">China</string>
- <string name="cyprus">Cyprus</string>
- <string name="india">India</string>
- <string name="nepal">Nepal</string>
- <string name="indonesia">Indonesia</string>
- <string name="iran">Iran, Islamic Republic of</string>
- <string name="iraq">Iraq</string>
- <string name="israel">Israel</string>
- <string name="japan">Japan</string>
- <string name="kazakhstan">Kazakhstan</string>
- <string name="kyrgyzsyan">Kyrgyzstan</string>
- <string name="malaysia">Malaysia</string>
- <string name="mongolia">Mongolia</string>
- <string name="pakistan">Pakistan</string>
- <string name="philippines">Philippines</string>
- <string name="saudi_arabia">Saudi Arabia</string>
- <string name="taiwan">Taiwan</string>
- <string name="korea">Korea</string>
- <string name="singapore">Singapore</string>
- <string name="thailand">Thailand</string>
- <string name="turkey">Turkey</string>
- <string name="turkmenistan">Turkmenistan</string>
- <string name="uae_other">UAE+Other</string>
- <string name="australia">Australia</string>
- <string name="oceania">Oceania</string>
- <string name="tasmania">Tasmania</string>
- <string name="victoria">Victoria</string>
- <string name="new_south_wales">New South Wales</string>
- <string name="new_caledonia">New Caledonia</string>
- <string name="newzealand">New Zealand</string>
- <string name="europe">Europe</string>
- <string name="western_europe">Western Europe</string>
- <string name="austria">Austria</string>
- <string name="azores">Azores</string>
- <string name="belgium">Belgium</string>
- <string name="benelux">BeNeLux</string>
- <string name="netherlands">Netherlands</string>
- <string name="denmark">Denmark</string>
- <string name="faroe_islands">Faroe Islands</string>
- <string name="france">France</string>
- <string name="alsace">Alsace</string>
- <string name="aquitaine">Aquitaine</string>
- <string name="auvergne">Auvergne</string>
- <string name="centre">Centre</string>
- <string name="bretagne">Bretagne</string>
- <string name="bourgogne">Bourgogne</string>
- <string name="basse_normandie">Basse-Normandie</string>
- <string name="champagne_ardenne">Champagne-Ardenne</string>
- <string name="corse">Corse</string>
- <string name="franche_comte">Franche-Comte</string>
- <string name="haute_normandie">Haute-Normandie</string>
- <string name="ile_de_france">Ile-de-France</string>
- <string name="languedoc_roussillon">Languedoc-Roussillon</string>
- <string name="limousin">Limousin</string>
- <string name="lorraine">Lorraine</string>
- <string name="midi_pyrenees">Midi-Pyrenees</string>
- <string name="nord_pas_de_calais">Nord-pas-de-Calais</string>
- <string name="pays_de_la_loire">Pays-de-la-Loire</string>
- <string name="picardie">Picardie</string>
- <string name="poitou_charentes">Poitou-Charentes</string>
- <string name="provence_alpes_cote_d_azur">Provence-Alpes-Cote-d-Azur</string>
- <string name="rhone_alpes">Rhone-Alpes</string>
- <string name="luxembourg">Luxembourg</string>
- <string name="germany">Germany</string>
- <string name="baden_wuerttemberg">Baden-Wuerttemberg</string>
- <string name="bayern">Bayern</string>
- <string name="mittelfranken">Mittelfranken</string>
- <string name="niederbayern">Niederbayern</string>
- <string name="oberbayern">Oberbayern</string>
- <string name="oberfranken">Oberfranken</string>
- <string name="oberpfalz">Oberpfalz</string>
- <string name="schwaben">Schwaben</string>
- <string name="unterfranken">Unterfranken</string>
- <string name="berlin">Berlin</string>
- <string name="brandenburg">Brandenburg</string>
- <string name="bremen">Bremen</string>
- <string name="hamburg">Hamburg</string>
- <string name="hessen">Hessen</string>
- <string name="mecklenburg_vorpommern">Mecklenburg-Vorpommern</string>
- <string name="niedersachsen">Niedersachsen</string>
- <string name="nordrhein_westfalen">Nordrhein-westfalen</string>
- <string name="rheinland_pfalz">Rheinland-Pfalz</string>
- <string name="saarland">Saarland</string>
- <string name="sachsen_anhalt">Sachsen-Anhalt</string>
- <string name="sachsen">Sachsen</string>
- <string name="schleswig_holstein">Schleswig-Holstein</string>
- <string name="thueringen">Thueringen</string>
- <string name="iceland">Iceland</string>
- <string name="ireland">Ireland</string>
- <string name="italy">Italy</string>
- <string name="portugal">Portugal</string>
- <string name="spain">Spain</string>
- <string name="mallorca">Mallorca</string>
- <string name="galicia">Galicia</string>
- <string name="scandinavia">Scandinavia</string>
- <string name="finland">Finland</string>
- <string name="switzerland">Switzerland</string>
- <string name="united_kingdom">United Kingdom</string>
- <string name="england">England</string>
- <string name="buckinghamshire">Buckinghamshire</string>
- <string name="cambridgeshire">Cambridgeshire</string>
- <string name="cumbria">Cumbria</string>
- <string name="east_yorkshire_with_hull">East yorkshire with hull</string>
- <string name="essex">Essex</string>
- <string name="herefordshire">Herefordshire</string>
- <string name="kent">Kent</string>
- <string name="lancashire">Lancashire</string>
- <string name="leicestershire">Leicestershire</string>
- <string name="norfolk">Norfolk</string>
- <string name="nottinghamshire">Nottinghamshire</string>
- <string name="oxfordshire">Oxfordshire</string>
- <string name="shropshire">Shropshire</string>
- <string name="somerset">Somerset</string>
- <string name="south_yorkshire">South yorkshire</string>
- <string name="suffolk">Suffolk</string>
- <string name="surrey">Surrey</string>
- <string name="wiltshire">Wiltshire</string>
- <string name="scotland">Scotland</string>
- <string name="wales">Wales</string>
- <string name="albania">Albania</string>
- <string name="belarus">Belarus</string>
- <string name="russian_federation">Russian Federation</string>
- <string name="bulgaria">Bulgaria</string>
- <string name="bosnia_and_herzegovina">Bosnia and Herzegovina</string>
- <string name="czech_republic">Czech Republic</string>
- <string name="croatia">Croatia</string>
- <string name="estonia">Estonia</string>
- <string name="greece">Greece</string>
- <string name="crete">Crete</string>
- <string name="hungary">Hungary</string>
- <string name="latvia">Latvia</string>
- <string name="lithuania">Lithuania</string>
- <string name="poland">Poland</string>
- <string name="romania">Romania</string>
- <string name="slovakia">Slovakia</string>
- <string name="ukraine">Ukraine</string>
- <string name="north_america">North America</string>
- <string name="alaska">Alaska</string>
- <string name="canada">Canada</string>
- <string name="hawaii">Hawaii</string>
- <string name="usa">USA</string>
- <string name="except_alaska_and_hawaii">(except Alaska and Hawaii)</string>
- <string name="midwest">Midwest</string>
- <string name="michigan">Michigan</string>
- <string name="ohio">Ohio</string>
- <string name="northeast">Northeast</string>
- <string name="massachusetts">Massachusetts</string>
- <string name="vermont">Vermont</string>
- <string name="pacific">Pacific</string>
- <string name="south">South</string>
- <string name="arkansas">Arkansas</string>
- <string name="district_of_columbia">District of Columbia</string>
- <string name="florida">Florida</string>
- <string name="louisiana">Louisiana</string>
- <string name="maryland">Maryland</string>
- <string name="mississippi">Mississippi</string>
- <string name="oklahoma">Oklahoma</string>
- <string name="texas">Texas</string>
- <string name="virginia">Virginia</string>
- <string name="west_virginia">West Virginia</string>
- <string name="west">West</string>
- <string name="arizona">Arizona</string>
- <string name="california">California</string>
- <string name="colorado">Colorado</string>
- <string name="idaho">Idaho</string>
- <string name="montana">Montana</string>
- <string name="new_mexico">New Mexico</string>
- <string name="nevada">Nevada</string>
- <string name="oregon">Oregon</string>
- <string name="utah">Utah</string>
- <string name="washington_state">Washington State</string>
- <string name="south_middle_america">South+Middle America</string>
- <string name="argentina">Argentina</string>
- <string name="chile">Chile</string>
- <string name="bolivia">Bolivia</string>
- <string name="brazil">Brazil</string>
- <string name="cuba">Cuba</string>
- <string name="colombia">Colombia</string>
- <string name="ecuador">Ecuador</string>
- <string name="guyana">Guyana</string>
- <string name="suriname">Suriname</string>
- <string name="guyane_francaise">Guyane Francaise</string>
- <string name="haiti">Haiti</string>
- <string name="dominican_republic">Dominican Republic</string>
- <string name="jamaica">Jamaica</string>
- <string name="mexico">Mexico</string>
- <string name="paraguay">Paraguay</string>
- <string name="peru">Peru</string>
- <string name="uruguay">Uruguay</string>
- <string name="venezuela">Venezuela</string>
+ <!-- countries, continents, regions -->
+ <string name="whole_planet">Whole Planet</string>
+ <string name="africa">Africa</string>
+ <string name="angola">Angola</string>
+ <string name="burundi">Burundi</string>
+ <string name="canary_islands">Canary Islands</string>
+ <string name="congo">Congo, Democratic Republic of the</string>
+ <string name="ethiopia">Ethiopia</string>
+ <string name="guinea">Guinea</string>
+ <string name="cotedivoire">Cote d\'Ivoire</string>
+ <string name="kenya">Kenya</string>
+ <string name="lesotho">Lesotho</string>
+ <string name="liberia">Liberia</string>
+ <string name="libya">Libya</string>
+ <string name="madagascar">Madagascar</string>
+ <string name="namibia">Namibia</string>
+ <string name="botswana">Botswana</string>
+ <string name="reunion">Reunion</string>
+ <string name="rwanda">Rwanda</string>
+ <string name="south_africa">South Africa</string>
+ <string name="tanzania">Tanzania, United Republic of</string>
+ <string name="uganda">Uganda</string>
+ <string name="asia">Asia</string>
+ <string name="azerbaijan">Azerbaijan</string>
+ <string name="china">China</string>
+ <string name="cyprus">Cyprus</string>
+ <string name="india">India</string>
+ <string name="nepal">Nepal</string>
+ <string name="indonesia">Indonesia</string>
+ <string name="iran">Iran, Islamic Republic of</string>
+ <string name="iraq">Iraq</string>
+ <string name="israel">Israel</string>
+ <string name="japan">Japan</string>
+ <string name="kazakhstan">Kazakhstan</string>
+ <string name="kyrgyzsyan">Kyrgyzstan</string>
+ <string name="malaysia">Malaysia</string>
+ <string name="mongolia">Mongolia</string>
+ <string name="pakistan">Pakistan</string>
+ <string name="philippines">Philippines</string>
+ <string name="saudi_arabia">Saudi Arabia</string>
+ <string name="taiwan">Taiwan</string>
+ <string name="korea">Korea</string>
+ <string name="singapore">Singapore</string>
+ <string name="thailand">Thailand</string>
+ <string name="turkey">Turkey</string>
+ <string name="turkmenistan">Turkmenistan</string>
+ <string name="uae_other">UAE+Other</string>
+ <string name="australia">Australia</string>
+ <string name="oceania">Oceania</string>
+ <string name="tasmania">Tasmania</string>
+ <string name="victoria">Victoria</string>
+ <string name="new_south_wales">New South Wales</string>
+ <string name="new_caledonia">New Caledonia</string>
+ <string name="newzealand">New Zealand</string>
+ <string name="europe">Europe</string>
+ <string name="western_europe">Western Europe</string>
+ <string name="austria">Austria</string>
+ <string name="azores">Azores</string>
+ <string name="belgium">Belgium</string>
+ <string name="benelux">BeNeLux</string>
+ <string name="netherlands">Netherlands</string>
+ <string name="denmark">Denmark</string>
+ <string name="faroe_islands">Faroe Islands</string>
+ <string name="france">France</string>
+ <string name="alsace">Alsace</string>
+ <string name="aquitaine">Aquitaine</string>
+ <string name="auvergne">Auvergne</string>
+ <string name="centre">Centre</string>
+ <string name="bretagne">Bretagne</string>
+ <string name="bourgogne">Bourgogne</string>
+ <string name="basse_normandie">Basse-Normandie</string>
+ <string name="champagne_ardenne">Champagne-Ardenne</string>
+ <string name="corse">Corse</string>
+ <string name="franche_comte">Franche-Comte</string>
+ <string name="haute_normandie">Haute-Normandie</string>
+ <string name="ile_de_france">Ile-de-France</string>
+ <string name="languedoc_roussillon">Languedoc-Roussillon</string>
+ <string name="limousin">Limousin</string>
+ <string name="lorraine">Lorraine</string>
+ <string name="midi_pyrenees">Midi-Pyrenees</string>
+ <string name="nord_pas_de_calais">Nord-pas-de-Calais</string>
+ <string name="pays_de_la_loire">Pays-de-la-Loire</string>
+ <string name="picardie">Picardie</string>
+ <string name="poitou_charentes">Poitou-Charentes</string>
+ <string name="provence_alpes_cote_d_azur">Provence-Alpes-Cote-d-Azur</string>
+ <string name="rhone_alpes">Rhone-Alpes</string>
+ <string name="luxembourg">Luxembourg</string>
+ <string name="germany">Germany</string>
+ <string name="baden_wuerttemberg">Baden-Wuerttemberg</string>
+ <string name="bayern">Bayern</string>
+ <string name="mittelfranken">Mittelfranken</string>
+ <string name="niederbayern">Niederbayern</string>
+ <string name="oberbayern">Oberbayern</string>
+ <string name="oberfranken">Oberfranken</string>
+ <string name="oberpfalz">Oberpfalz</string>
+ <string name="schwaben">Schwaben</string>
+ <string name="unterfranken">Unterfranken</string>
+ <string name="berlin">Berlin</string>
+ <string name="brandenburg">Brandenburg</string>
+ <string name="bremen">Bremen</string>
+ <string name="hamburg">Hamburg</string>
+ <string name="hessen">Hessen</string>
+ <string name="mecklenburg_vorpommern">Mecklenburg-Vorpommern</string>
+ <string name="niedersachsen">Niedersachsen</string>
+ <string name="nordrhein_westfalen">Nordrhein-westfalen</string>
+ <string name="rheinland_pfalz">Rheinland-Pfalz</string>
+ <string name="saarland">Saarland</string>
+ <string name="sachsen_anhalt">Sachsen-Anhalt</string>
+ <string name="sachsen">Sachsen</string>
+ <string name="schleswig_holstein">Schleswig-Holstein</string>
+ <string name="thueringen">Thueringen</string>
+ <string name="iceland">Iceland</string>
+ <string name="ireland">Ireland</string>
+ <string name="italy">Italy</string>
+ <string name="portugal">Portugal</string>
+ <string name="spain">Spain</string>
+ <string name="mallorca">Mallorca</string>
+ <string name="galicia">Galicia</string>
+ <string name="scandinavia">Scandinavia</string>
+ <string name="finland">Finland</string>
+ <string name="switzerland">Switzerland</string>
+ <string name="united_kingdom">United Kingdom</string>
+ <string name="england">England</string>
+ <string name="buckinghamshire">Buckinghamshire</string>
+ <string name="cambridgeshire">Cambridgeshire</string>
+ <string name="cumbria">Cumbria</string>
+ <string name="east_yorkshire_with_hull">East yorkshire with hull</string>
+ <string name="essex">Essex</string>
+ <string name="herefordshire">Herefordshire</string>
+ <string name="kent">Kent</string>
+ <string name="lancashire">Lancashire</string>
+ <string name="leicestershire">Leicestershire</string>
+ <string name="norfolk">Norfolk</string>
+ <string name="nottinghamshire">Nottinghamshire</string>
+ <string name="oxfordshire">Oxfordshire</string>
+ <string name="shropshire">Shropshire</string>
+ <string name="somerset">Somerset</string>
+ <string name="south_yorkshire">South yorkshire</string>
+ <string name="suffolk">Suffolk</string>
+ <string name="surrey">Surrey</string>
+ <string name="wiltshire">Wiltshire</string>
+ <string name="scotland">Scotland</string>
+ <string name="wales">Wales</string>
+ <string name="albania">Albania</string>
+ <string name="belarus">Belarus</string>
+ <string name="russian_federation">Russian Federation</string>
+ <string name="bulgaria">Bulgaria</string>
+ <string name="bosnia_and_herzegovina">Bosnia and Herzegovina</string>
+ <string name="czech_republic">Czech Republic</string>
+ <string name="croatia">Croatia</string>
+ <string name="estonia">Estonia</string>
+ <string name="greece">Greece</string>
+ <string name="crete">Crete</string>
+ <string name="hungary">Hungary</string>
+ <string name="latvia">Latvia</string>
+ <string name="lithuania">Lithuania</string>
+ <string name="poland">Poland</string>
+ <string name="romania">Romania</string>
+ <string name="slovakia">Slovakia</string>
+ <string name="ukraine">Ukraine</string>
+ <string name="north_america">North America</string>
+ <string name="alaska">Alaska</string>
+ <string name="canada">Canada</string>
+ <string name="hawaii">Hawaii</string>
+ <string name="usa">USA</string>
+ <string name="except_alaska_and_hawaii">(except Alaska and Hawaii)</string>
+ <string name="midwest">Midwest</string>
+ <string name="michigan">Michigan</string>
+ <string name="ohio">Ohio</string>
+ <string name="northeast">Northeast</string>
+ <string name="massachusetts">Massachusetts</string>
+ <string name="vermont">Vermont</string>
+ <string name="pacific">Pacific</string>
+ <string name="south">South</string>
+ <string name="arkansas">Arkansas</string>
+ <string name="district_of_columbia">District of Columbia</string>
+ <string name="florida">Florida</string>
+ <string name="louisiana">Louisiana</string>
+ <string name="maryland">Maryland</string>
+ <string name="mississippi">Mississippi</string>
+ <string name="oklahoma">Oklahoma</string>
+ <string name="texas">Texas</string>
+ <string name="virginia">Virginia</string>
+ <string name="west_virginia">West Virginia</string>
+ <string name="west">West</string>
+ <string name="arizona">Arizona</string>
+ <string name="california">California</string>
+ <string name="colorado">Colorado</string>
+ <string name="idaho">Idaho</string>
+ <string name="montana">Montana</string>
+ <string name="new_mexico">New Mexico</string>
+ <string name="nevada">Nevada</string>
+ <string name="oregon">Oregon</string>
+ <string name="utah">Utah</string>
+ <string name="washington_state">Washington State</string>
+ <string name="south_middle_america">South+Middle America</string>
+ <string name="argentina">Argentina</string>
+ <string name="chile">Chile</string>
+ <string name="bolivia">Bolivia</string>
+ <string name="brazil">Brazil</string>
+ <string name="cuba">Cuba</string>
+ <string name="colombia">Colombia</string>
+ <string name="ecuador">Ecuador</string>
+ <string name="guyana">Guyana</string>
+ <string name="suriname">Suriname</string>
+ <string name="guyane_francaise">Guyane Francaise</string>
+ <string name="haiti">Haiti</string>
+ <string name="dominican_republic">Dominican Republic</string>
+ <string name="jamaica">Jamaica</string>
+ <string name="mexico">Mexico</string>
+ <string name="paraguay">Paraguay</string>
+ <string name="peru">Peru</string>
+ <string name="uruguay">Uruguay</string>
+ <string name="venezuela">Venezuela</string>
</resources>
diff --git a/navit/android/res/values/styles.xml b/navit/android/res/values/styles.xml
deleted file mode 100644
index 78dadf1ce..000000000
--- a/navit/android/res/values/styles.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<resources>
- <!-- Yellow from Navit icon background (300 and 700 are the extremes of the gradient, 500 is the average, 900 is the line color) -->
- <color name="navitYellow300">#e9cb14</color>
- <color name="navitYellow500">#d5a411</color>
- <!-- <color name="navitYellow600">#d19b13</color> -->
- <color name="navitYellow700">#c17d11</color>
- <color name="navitYellow900">#43350f</color>
-
- <!-- Blue from arrow in Navit icon (500 is the midpoint of the gradient, 300 is the end, 900 is the line color) -->
- <color name="navitBlue300">#329eff</color>
- <color name="navitBlue500">#1a6cb6</color>
- <color name="navitBlue900">#1f3157</color>
-</resources> \ No newline at end of file
diff --git a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java b/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
index dc7462b76..2d7242264 100644
--- a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
+++ b/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
@@ -1,30 +1,34 @@
package org.navitproject.navit;
-//Heavily based on code from
-//https://github.com/mburman/Android-File-Explore
+// Heavily based on code from
+// https://github.com/mburman/Android-File-Explore
// Version of Aug 13, 2011
-//Also contributed:
-// Sugan Krishnan (https://github.com/rgksugan) - Jan 2013.
+// Also contributed:
+// Sugan Krishnan (https://github.com/rgksugan) - Jan 2013.
//
-//Project type now is Android library:
-// http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject
+// Project type now is Android library:
+// http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject
-//Android imports
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
-import android.graphics.Color;
import android.os.Bundle;
import android.os.Environment;
import android.os.StatFs;
import android.util.Log;
-import android.view.*;
+import android.view.View;
import android.view.View.OnClickListener;
+import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
-import android.widget.*;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
-//General Java imports
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
@@ -32,44 +36,42 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-//Import of resources file for file browser
-import org.navitproject.navit.R;
public class FileBrowserActivity extends Activity {
// Intent Action Constants
public static final String INTENT_ACTION_SELECT_DIR = "ua.com.vassiliev.androidfilebrowser.SELECT_DIRECTORY_ACTION";
- public static final String INTENT_ACTION_SELECT_FILE = "ua.com.vassiliev.androidfilebrowser.SELECT_FILE_ACTION";
+ private static final String INTENT_ACTION_SELECT_FILE = "ua.com.vassiliev.androidfilebrowser.SELECT_FILE_ACTION";
// Intent parameters names constants
public static final String startDirectoryParameter = "ua.com.vassiliev.androidfilebrowser.directoryPath";
public static final String returnDirectoryParameter = "ua.com.vassiliev.androidfilebrowser.directoryPathRet";
- public static final String returnFileParameter = "ua.com.vassiliev.androidfilebrowser.filePathRet";
- public static final String showCannotReadParameter = "ua.com.vassiliev.androidfilebrowser.showCannotRead";
- public static final String filterExtension = "ua.com.vassiliev.androidfilebrowser.filterExtension";
+ private static final String returnFileParameter = "ua.com.vassiliev.androidfilebrowser.filePathRet";
+ private static final String showCannotReadParameter = "ua.com.vassiliev.androidfilebrowser.showCannotRead";
+ private static final String filterExtension = "ua.com.vassiliev.androidfilebrowser.filterExtension";
// Stores names of traversed directories
- ArrayList<String> pathDirsList = new ArrayList<String>();
+ private final ArrayList<String> mPathDirsList = new ArrayList<>();
// Check if the first level of the directory structure is the one showing
// private Boolean firstLvl = true;
- private static final String LOGTAG = "F_PATH";
+ private static final String TAG = "F_PATH";
- private List<Item> fileList = new ArrayList<Item>();
- private File path = null;
- private String chosenFile;
+ private final List<Item> mFileList = new ArrayList<>();
+ private File mPath = null;
+ private String mChosenFile;
// private static final int DIALOG_LOAD_FILE = 1000;
- ArrayAdapter<Item> adapter;
+ private ArrayAdapter<Item> mAdapter;
- private boolean showHiddenFilesAndDirs = true;
+ private boolean mShowHiddenFilesAndDirs = true;
- private boolean directoryShownIsEmpty = false;
+ private boolean mDirectoryShownIsEmpty = false;
- private String filterFileExtension = null;
+ private String mFilterFileExtension = null;
// Action constants
- private static int currentAction = -1;
+ private static int sCurrentAction = -1;
private static final int SELECT_DIRECTORY = 1;
private static final int SELECT_FILE = 2;
@@ -85,17 +87,17 @@ public class FileBrowserActivity extends Activity {
// Set action for this activity
Intent thisInt = this.getIntent();
- currentAction = SELECT_DIRECTORY;// This would be a default action in
+ sCurrentAction = SELECT_DIRECTORY;// This would be a default action in
// case not set by intent
if (thisInt.getAction().equalsIgnoreCase(INTENT_ACTION_SELECT_FILE)) {
- Log.d(LOGTAG, "SELECT ACTION - SELECT FILE");
- currentAction = SELECT_FILE;
+ Log.d(TAG, "SELECT ACTION - SELECT FILE");
+ sCurrentAction = SELECT_FILE;
}
- showHiddenFilesAndDirs = thisInt.getBooleanExtra(
+ mShowHiddenFilesAndDirs = thisInt.getBooleanExtra(
showCannotReadParameter, true);
- filterFileExtension = thisInt.getStringExtra(filterExtension);
+ mFilterFileExtension = thisInt.getStringExtra(filterExtension);
setInitialDirectory();
@@ -105,7 +107,7 @@ public class FileBrowserActivity extends Activity {
this.initializeButtons();
this.initializeFileListView();
updateCurrentDirectoryTextView();
- Log.d(LOGTAG, path.getAbsolutePath());
+ Log.d(TAG, mPath.getAbsolutePath());
}
private void setInitialDirectory() {
@@ -116,85 +118,83 @@ public class FileBrowserActivity extends Activity {
if (requestedStartDir != null && requestedStartDir.length() > 0) { // if(requestedStartDir!=null
File tempFile = new File(requestedStartDir);
if (tempFile.isDirectory()) {
- this.path = tempFile;
+ this.mPath = tempFile;
}
} // if(requestedStartDir!=null
- if (this.path == null) { // No or invalid directory supplied in intent parameter
+ if (this.mPath == null) { // No or invalid directory supplied in intent parameter
if (Environment.getExternalStorageDirectory().isDirectory()
&& Environment.getExternalStorageDirectory().canRead()) {
- path = Environment.getExternalStorageDirectory();
+ mPath = Environment.getExternalStorageDirectory();
} else {
- path = new File("/");
+ mPath = new File("/");
}
} // if(this.path==null) {//No or invalid directory supplied in intent parameter
} // private void setInitialDirectory() {
private void parseDirectoryPath() {
- pathDirsList.clear();
- String pathString = path.getAbsolutePath();
+ mPathDirsList.clear();
+ String pathString = mPath.getAbsolutePath();
String[] parts = pathString.split("/");
int i = 0;
while (i < parts.length) {
- pathDirsList.add(parts[i]);
+ mPathDirsList.add(parts[i]);
i++;
}
}
private void initializeButtons() {
- Button upDirButton = (Button) this.findViewById(R.id.upDirectoryButton);
+ Button upDirButton = this.findViewById(R.id.upDirectoryButton);
upDirButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- Log.d(LOGTAG, "onclick for upDirButton");
+ Log.d(TAG, "onclick for upDirButton");
loadDirectoryUp();
loadFileList();
- adapter.notifyDataSetChanged();
+ mAdapter.notifyDataSetChanged();
updateCurrentDirectoryTextView();
}
});// upDirButton.setOnClickListener(
- Button selectFolderButton = (Button) this
+ Button selectFolderButton = this
.findViewById(R.id.selectCurrentDirectoryButton);
- if (currentAction == SELECT_DIRECTORY) {
+ if (sCurrentAction == SELECT_DIRECTORY) {
selectFolderButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- Log.d(LOGTAG, "onclick for selectFolderButton");
+ Log.d(TAG, "onclick for selectFolderButton");
returnDirectoryFinishActivity();
}
});
- } else { // if(currentAction == this.SELECT_DIRECTORY) {
+ } else { // if(sCurrentAction == this.SELECT_DIRECTORY) {
selectFolderButton.setVisibility(View.GONE);
- } // } else {//if(currentAction == this.SELECT_DIRECTORY) {
+ } // } else {//if(sCurrentAction == this.SELECT_DIRECTORY) {
} // private void initializeButtons() {
private void loadDirectoryUp() {
// present directory removed from list
- String s = pathDirsList.remove(pathDirsList.size() - 1);
+ String s = mPathDirsList.remove(mPathDirsList.size() - 1);
// path modified to exclude present directory
- path = new File(path.toString().substring(0,
- path.toString().lastIndexOf(s)));
- fileList.clear();
+ mPath = new File(mPath.toString().substring(0,
+ mPath.toString().lastIndexOf(s)));
+ mFileList.clear();
}
private void updateCurrentDirectoryTextView() {
int i = 0;
String curDirString = "";
- while (i < pathDirsList.size()) {
- curDirString += pathDirsList.get(i) + "/";
+ while (i < mPathDirsList.size()) {
+ curDirString += mPathDirsList.get(i) + "/";
i++;
}
- if (pathDirsList.size() == 0) {
- ((Button) this.findViewById(R.id.upDirectoryButton))
- .setEnabled(false);
+ if (mPathDirsList.size() == 0) {
+ this.findViewById(R.id.upDirectoryButton).setEnabled(false);
curDirString = "/";
} else {
- ((Button) this.findViewById(R.id.upDirectoryButton))
- .setEnabled(true);
+ this.findViewById(R.id.upDirectoryButton).setEnabled(true);
}
long freeSpace = getFreeSpace(curDirString);
String formattedSpaceString = formatBytes(freeSpace);
if (freeSpace == 0) {
- Log.d(LOGTAG, "NO FREE SPACE");
+ Log.d(TAG, "NO FREE SPACE");
File currentDir = new File(curDirString);
if (!currentDir.canWrite()) {
formattedSpaceString = "NON Writable";
@@ -213,35 +213,35 @@ public class FileBrowserActivity extends Activity {
}
private void initializeFileListView() {
- ListView lView = (ListView) this.findViewById(R.id.fileListView);
+ ListView lView = this.findViewById(R.id.fileListView);
LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lParam.setMargins(15, 5, 15, 5);
- lView.setAdapter(this.adapter);
+ lView.setAdapter(this.mAdapter);
lView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
- chosenFile = fileList.get(position).file;
- File sel = new File(path + "/" + chosenFile);
- Log.d(LOGTAG, "Clicked:" + chosenFile);
+ mChosenFile = mFileList.get(position).mFile;
+ File sel = new File(mPath + "/" + mChosenFile);
+ Log.d(TAG, "Clicked:" + mChosenFile);
if (sel.isDirectory()) {
if (sel.canRead()) {
// Adds chosen directory to list
- pathDirsList.add(chosenFile);
- path = new File(sel + "");
- Log.d(LOGTAG, "Just reloading the list");
+ mPathDirsList.add(mChosenFile);
+ mPath = new File(sel + "");
+ Log.d(TAG, "Just reloading the list");
loadFileList();
- adapter.notifyDataSetChanged();
+ mAdapter.notifyDataSetChanged();
updateCurrentDirectoryTextView();
- Log.d(LOGTAG, path.getAbsolutePath());
+ Log.d(TAG, mPath.getAbsolutePath());
} else { // if(sel.canRead()) {
showToast("Path does not exist or cannot be read");
} // } else {//if(sel.canRead()) {
} else { // if (sel.isDirectory()) {
// File picked or an empty directory message clicked
- Log.d(LOGTAG, "item clicked");
- if (!directoryShownIsEmpty) {
- Log.d(LOGTAG, "File selected:" + chosenFile);
+ Log.d(TAG, "item clicked");
+ if (!mDirectoryShownIsEmpty) {
+ Log.d(TAG, "File selected:" + mChosenFile);
returnFileFinishActivity(sel.getAbsolutePath());
}
} // else {//if (sel.isDirectory()) {
@@ -251,7 +251,7 @@ public class FileBrowserActivity extends Activity {
private void returnDirectoryFinishActivity() {
Intent retIntent = new Intent();
- retIntent.putExtra(returnDirectoryParameter, path.getAbsolutePath());
+ retIntent.putExtra(returnDirectoryParameter, mPath.getAbsolutePath());
this.setResult(RESULT_OK, retIntent);
this.finish();
} // END private void returnDirectoryFinishActivity() {
@@ -265,28 +265,28 @@ public class FileBrowserActivity extends Activity {
private void loadFileList() {
try {
- path.mkdirs();
+ mPath.mkdirs();
} catch (SecurityException e) {
- Log.e(LOGTAG, "unable to write on the sd card ");
+ Log.i(TAG, "unable to write on the sd card ");
}
- fileList.clear();
+ mFileList.clear();
- if (path.exists() && path.canRead()) {
+ if (mPath.exists() && mPath.canRead()) {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String filename) {
File sel = new File(dir, filename);
- boolean showReadableFile = showHiddenFilesAndDirs
+ boolean showReadableFile = mShowHiddenFilesAndDirs
|| sel.canRead();
// Filters based on whether the file is hidden or not
- if (currentAction == SELECT_DIRECTORY) {
+ if (sCurrentAction == SELECT_DIRECTORY) {
return (sel.isDirectory() && showReadableFile);
}
- if (currentAction == SELECT_FILE) {
+ if (sCurrentAction == SELECT_FILE) {
// If it is a file check the extension if provided
- if (sel.isFile() && filterFileExtension != null) {
+ if (sel.isFile() && mFilterFileExtension != null) {
return (showReadableFile && sel.getName().endsWith(
- filterFileExtension));
+ mFilterFileExtension));
}
return (showReadableFile);
}
@@ -294,12 +294,12 @@ public class FileBrowserActivity extends Activity {
} // public boolean accept(File dir, String filename) {
}; // FilenameFilter filter = new FilenameFilter() {
- String[] fList = path.list(filter);
- this.directoryShownIsEmpty = false;
+ String[] fList = mPath.list(filter);
+ this.mDirectoryShownIsEmpty = false;
for (int i = 0; i < fList.length; i++) {
// Convert into file path
- File sel = new File(path, fList[i]);
- Log.d(LOGTAG, "File:" + fList[i] + " readable:" + (Boolean.valueOf(sel.canRead())).toString());
+ File sel = new File(mPath, fList[i]);
+ Log.d(TAG, "File:" + fList[i] + " readable:" + (Boolean.valueOf(sel.canRead())).toString());
int drawableID = R.drawable.file_icon;
boolean canRead = sel.canRead();
// Set drawables
@@ -310,36 +310,36 @@ public class FileBrowserActivity extends Activity {
drawableID = R.drawable.folder_icon_light;
}
}
- fileList.add(i, new Item(fList[i], drawableID, canRead));
+ mFileList.add(i, new Item(fList[i], drawableID, canRead));
} // for (int i = 0; i < fList.length; i++) {
- if (fileList.size() == 0) {
+ if (mFileList.size() == 0) {
// Log.d(LOGTAG, "This directory is empty");
- this.directoryShownIsEmpty = true;
- fileList.add(0, new Item("Directory is empty", -1, true));
+ this.mDirectoryShownIsEmpty = true;
+ mFileList.add(0, new Item("Directory is empty", -1, true));
} else { // sort non empty list
- Collections.sort(fileList, new ItemFileNameComparator());
+ Collections.sort(mFileList, new ItemFileNameComparator());
}
} else {
- Log.e(LOGTAG, "path does not exist or cannot be read");
+ Log.e(TAG, "path does not exist or cannot be read");
}
// Log.d(TAG, "loadFileList finished");
} // private void loadFileList() {
private void createFileListAdapter() {
- adapter = new ArrayAdapter<Item>(this,
+ mAdapter = new ArrayAdapter<Item>(this,
android.R.layout.select_dialog_item, android.R.id.text1,
- fileList) {
+ mFileList) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// creates view
View view = super.getView(position, convertView, parent);
- TextView textView = (TextView) view
+ TextView textView = view
.findViewById(android.R.id.text1);
// put the image on the text view
int drawableID = 0;
- if (fileList.get(position).icon != -1) {
+ if (mFileList.get(position).mIcon != -1) {
// If icon == -1, then directory is empty
- drawableID = fileList.get(position).icon;
+ drawableID = mFileList.get(position).mIcon;
}
textView.setCompoundDrawablesWithIntrinsicBounds(drawableID, 0,
0, 0);
@@ -360,33 +360,34 @@ public class FileBrowserActivity extends Activity {
} // private createFileListAdapter(){
private class Item {
- public String file;
- public int icon;
- public boolean canRead;
+ String mFile;
+ int mIcon;
+ public boolean mCanRead;
- public Item(String file, Integer icon, boolean canRead) {
- this.file = file;
- this.icon = icon;
+ Item(String file, Integer icon, boolean canRead) {
+ this.mFile = file;
+ this.mIcon = icon;
}
@Override
public String toString() {
- return file;
+ return mFile;
}
} // END private class Item {
private class ItemFileNameComparator implements Comparator<Item> {
public int compare(Item lhs, Item rhs) {
- return lhs.file.toLowerCase().compareTo(rhs.file.toLowerCase());
+ return lhs.mFile.toLowerCase().compareTo(rhs.mFile.toLowerCase());
}
}
+ @Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
- Log.d(LOGTAG, "ORIENTATION_LANDSCAPE");
+ Log.d(TAG, "ORIENTATION_LANDSCAPE");
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
- Log.d(LOGTAG, "ORIENTATION_PORTRAIT");
+ Log.d(TAG, "ORIENTATION_PORTRAIT");
}
// Layout apparently changes itself, only have to provide good onMeasure
// in custom components
@@ -394,34 +395,32 @@ public class FileBrowserActivity extends Activity {
// if(newConfig.keyboard == Configuration.KEYBOARDHIDDEN_YES)
} // END public void onConfigurationChanged(Configuration newConfig) {
- public static long getFreeSpace(String path) {
+ private static long getFreeSpace(String path) {
StatFs stat = new StatFs(path);
- long availSize = (long) stat.getAvailableBlocks()
- * (long) stat.getBlockSize();
- return availSize;
+ return (long) stat.getAvailableBlocks() * (long) stat.getBlockSize();
} // END public static long getFreeSpace(String path) {
- public static String formatBytes(long bytes) {
+ private static String formatBytes(long bytes) {
// TODO: add flag to which part is needed (e.g. GB, MB, KB or bytes)
String retStr = "";
// One binary gigabyte equals 1,073,741,824 bytes.
if (bytes > 1073741824) { // Add GB
long gbs = bytes / 1073741824;
- retStr += (new Long(gbs)).toString() + "GB ";
+ retStr += (Long.valueOf(gbs)).toString() + "GB ";
bytes = bytes - (gbs * 1073741824);
}
// One MB - 1048576 bytes
if (bytes > 1048576) { // Add GB
long mbs = bytes / 1048576;
- retStr += (new Long(mbs)).toString() + "MB ";
+ retStr += (Long.valueOf(mbs)).toString() + "MB ";
bytes = bytes - (mbs * 1048576);
}
if (bytes > 1024) {
long kbs = bytes / 1024;
- retStr += (new Long(kbs)).toString() + "KB";
+ retStr += (Long.valueOf(kbs)).toString() + "KB";
bytes = bytes - (kbs * 1024);
} else {
- retStr += (new Long(bytes)).toString() + " bytes";
+ retStr += (Long.valueOf(bytes)).toString() + " bytes";
}
return retStr;
} // public static String formatBytes(long bytes){
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
index a2c1a4ff1..78ddff901 100644
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ b/navit/android/src/org/navitproject/navit/Navit.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
@@ -19,11 +19,11 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.Manifest;
-import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.Application;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -38,8 +38,6 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetManager;
import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Point;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
@@ -47,6 +45,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Message;
import android.os.PowerManager;
+import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
@@ -60,8 +59,8 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
+
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -71,130 +70,47 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
+
public class Navit extends Activity {
- protected static NavitGraphics graphics = null;
- private NavitDialogs dialogs;
- private PowerManager.WakeLock wl;
- private NavitActivityResult[] ActivityResults;
- public static InputMethodManager mgr = null;
- public static DisplayMetrics metrics = null;
- public static Boolean show_soft_keyboard = false;
- public static Boolean show_soft_keyboard_now_showing = false;
- public static long last_pressed_menu_key = 0L;
- public static long time_pressed_menu_key = 0L;
- private static Intent startup_intent = null;
- private static long startup_intent_timestamp = 0L;
- private static String my_display_density = "mdpi";
+
+ public static DisplayMetrics sMetrics;
+ public static boolean sShowSoftKeyboardShowing;
+ private static Intent sStartupIntent;
+ private static long sStartupIntentTimestamp;
+ private static final int MY_PERMISSIONS_REQ_FINE_LOC = 103;
private static final int NavitDownloaderSelectMap_id = 967;
private static final int NavitAddressSearch_id = 70;
private static final int NavitSelectStorage_id = 43;
- private static String NavitLanguage;
- private static Resources NavitResources = null;
- private static final String CHANNEL_ID = "org.navitproject.navit";
private static final String NAVIT_PACKAGE_NAME = "org.navitproject.navit";
private static final String TAG = "Navit";
- static String map_filename_path = null;
- static final String NAVIT_DATA_DIR = "/data/data/" + NAVIT_PACKAGE_NAME;
- private static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
- public static final String NAVIT_PREFS = "NavitPrefs";
- Boolean isFullscreen = false;
- private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
- private static NotificationManager nm;
- private static Navit navit = null;
-
- public static Navit getInstance() {
- return navit;
- }
+ static String sMapFilenamePath;
+ static String sNavitDataDir;
+ boolean mIsFullscreen;
+ private NavitDialogs mDialogs;
+ private PowerManager.WakeLock mWakeLock;
+ private NavitActivityResult[] mActivityResults;
- /**
- * @brief A Runnable to restore soft input when the user returns to the activity.
- *
- * An instance of this class can be passed to the main message queue in the Activity's
- * {@code onRestore()} method.
- */
- private class SoftInputRestorer implements Runnable {
- public void run() {
- Navit.this.showNativeKeyboard();
- }
- }
private void createNotificationChannel() {
/*
* Create the NotificationChannel, but only on API 26+ because
* the NotificationChannel class is new and not in the support library
+ * uses NAVIT_PACKAGE_NAME as id
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = getString(R.string.channel_name);
- //String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_LOW;
- NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
- //channel.setDescription(description);
- /*
- * Register the channel with the system; you can't change the importance
- * or other notification behaviors after this
- */
+ NotificationChannel channel = new NotificationChannel(NAVIT_PACKAGE_NAME, name, importance);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
- public void removeFileIfExists(String source) {
- File file = new File(source);
-
- if (!file.exists()) {
- return;
- }
-
- file.delete();
- }
-
- public void copyFileIfExists(String source, String destination) throws IOException {
- File file = new File(source);
-
- if (!file.exists()) {
- return;
- }
-
- FileInputStream is = null;
- FileOutputStream os = null;
-
- try {
- is = new FileInputStream(source);
- os = new FileOutputStream(destination);
-
- int len;
- byte[] buffer = new byte[1024];
-
- while ((len = is.read(buffer)) != -1) {
- os.write(buffer, 0, len);
- }
- } finally {
- /* Close the FileStreams to prevent Resource leaks */
- if (is != null) {
- is.close();
- }
-
- if (os != null) {
- os.close();
- }
- }
- }
-
/**
- * Translates a string from its id
- * in R.strings
- *
- * @param Rid resource identifier
- * @return translated string
- */
- String getTstring(int Rid) {
- return getLocalizedString(getString(Rid));
- }
-
- /**
- * Check if a specific file needs to be extracted from the apk archive
+ * Check if a specific file needs to be extracted from the apk archive.
* This is based on whether the file already exist, and if so, whether it is older than the archive or not
*
* @param filename The full path to the file
@@ -222,23 +138,20 @@ public class Navit extends Activity {
Log.e(TAG, "Could not read package infos");
e.printStackTrace();
}
- if (apkUpdateTime > resultfile.lastModified()) {
- return true;
- }
+ return apkUpdateTime > resultfile.lastModified();
}
- return false;
}
/**
- * Extract a ressource from the apk archive (res/raw) and save it to a local file
+ * Extract a resource from the apk archive (res/raw) and save it to a local file.
*
* @param result The full path to the local file
- * @param resname The name of the ressource file in the archive
+ * @param resname The name of the resource file in the archive
* @return true if the local file is extracted in @p result
*/
private boolean extractRes(String resname, String result) {
Log.d(TAG, "Res Name " + resname + ", result " + result);
- int id = NavitResources.getIdentifier(resname, "raw", NAVIT_PACKAGE_NAME);
+ int id = NavitAppConfig.sResources.getIdentifier(resname, "raw", NAVIT_PACKAGE_NAME);
Log.d(TAG, "Res ID " + id);
if (id == 0) {
return false;
@@ -248,7 +161,7 @@ public class Navit extends Activity {
Log.d(TAG, "Extracting resource");
try {
- InputStream resourcestream = NavitResources.openRawResource(id);
+ InputStream resourcestream = NavitAppConfig.sResources.openRawResource(id);
FileOutputStream resultfilestream = new FileOutputStream(new File(result));
byte[] buf = new byte[1024];
int i;
@@ -265,14 +178,14 @@ public class Navit extends Activity {
}
/**
- * Extract an asset from the apk archive (assets) and save it to a local file
+ * Extract an asset from the apk archive (assets) and save it to a local file.
*
- * @param output The full path to the output local file
- * @param assetFileName The full path of the asset file within the archive
+ * @param output The full path to the local file
+ * @param assetFileName The full path of the asset file in the archive
* @return true if the local file is extracted in @p output
*/
private boolean extractAsset(String assetFileName, String output) {
- AssetManager assetMgr = NavitResources.getAssets();
+ AssetManager assetMgr = NavitAppConfig.sResources.getAssets();
InputStream assetstream;
Log.d(TAG, "Asset Name " + assetFileName + ", output " + output);
try {
@@ -288,7 +201,7 @@ public class Navit extends Activity {
try {
FileOutputStream outputFilestream = new FileOutputStream(new File(output));
byte[] buf = new byte[1024];
- int i = 0;
+ int i;
while ((i = assetstream.read(buf)) != -1) {
outputFilestream.write(buf, 0, i);
}
@@ -298,12 +211,11 @@ public class Navit extends Activity {
return false;
}
}
-
return true;
}
private void showInfos() {
- SharedPreferences settings = getSharedPreferences(NAVIT_PREFS, MODE_PRIVATE);
+ SharedPreferences settings = getSharedPreferences(NavitAppConfig.NAVIT_PREFS, MODE_PRIVATE);
boolean firstStart = settings.getBoolean("firstStart", true);
if (firstStart) {
@@ -330,167 +242,173 @@ public class Navit extends Activity {
}
});
infobox.show();
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putBoolean("firstStart", false);
- edit_settings.apply();
+ SharedPreferences.Editor preferenceEditor = settings.edit();
+ preferenceEditor.putBoolean("firstStart", false);
+ preferenceEditor.apply();
+ }
+ }
+
+ private void verifyPermissions() {
+ if (ContextCompat.checkSelfPermission(this,
+ Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ Log.d(TAG,"ask for permission(s)");
+ ActivityCompat.requestPermissions(this, new String[] {
+ Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQ_FINE_LOC);
}
}
- /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
- /* Whether this is the first launch of Navit (as opposed to the activity being recreated) */
- boolean isLaunch = (navit == null);
super.onCreate(savedInstanceState);
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- } else {
- this.getActionBar().hide();
- }
-
- navit = this;
- dialogs = new NavitDialogs(this);
- NavitResources = getResources();
+ windowSetup();
+ mDialogs = new NavitDialogs(this);
// only take arguments here, onResume gets called all the time (e.g. when screenblanks, etc.)
- Navit.startup_intent = this.getIntent();
+ Navit.sStartupIntent = this.getIntent();
// hack! Remember time stamps, and only allow 4 secs. later in onResume to set target!
- Navit.startup_intent_timestamp = System.currentTimeMillis();
- Log.d(TAG, "**1**A " + startup_intent.getAction());
- Log.d(TAG, "**1**D " + startup_intent.getDataString());
-
- // NOTIFICATION
- // Setup the status bar notification
- // This notification is removed in the exit() function
- if (isLaunch)
- createNotificationChannel();
- nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
- PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
-
- Notification NavitNotification;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- Notification.Builder builder;
- builder = new Notification.Builder(getApplicationContext(), CHANNEL_ID);
- builder.setContentIntent(appIntent);
- builder.setAutoCancel(false).setOngoing(true);
- builder.setContentTitle(getTstring(R.string.app_name));
- builder.setContentText(getTstring(R.string.notification_event_default));
- builder.setSmallIcon(R.drawable.ic_notify);
- NavitNotification = builder.build();
- } else {
- NotificationCompat.Builder builder;
- builder = new NotificationCompat.Builder(getApplicationContext());
- builder.setContentIntent(appIntent);
- builder.setAutoCancel(false).setOngoing(true);
- builder.setContentTitle(getTstring(R.string.app_name));
- builder.setContentText(getTstring(R.string.notification_event_default));
- builder.setSmallIcon(R.drawable.ic_notify);
- NavitNotification = builder.build();
- }
- nm.notify(R.string.app_name, NavitNotification);// Show the notification
+ Navit.sStartupIntentTimestamp = System.currentTimeMillis();
+ Log.d(TAG, "**1**A " + sStartupIntent.getAction());
+ Log.d(TAG, "**1**D " + sStartupIntent.getDataString());
- if ((ContextCompat.checkSelfPermission(this,
- Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
- || (ContextCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- Log.d(TAG,"ask for permission(s)");
- ActivityCompat.requestPermissions(this,
- new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_FINE_LOCATION},
- MY_PERMISSIONS_REQUEST_ALL);
- }
+ createNotificationChannel();
+ buildNotification();
+ verifyPermissions();
// get the local language -------------
- Locale locale = java.util.Locale.getDefault();
+ Locale locale = Locale.getDefault();
String lang = locale.getLanguage();
String langc = lang;
Log.d(TAG, "lang=" + lang);
int pos = lang.indexOf('_');
+ String navitLanguage;
if (pos != -1) {
langc = lang.substring(0, pos);
- NavitLanguage = langc + lang.substring(pos).toUpperCase(locale);
- Log.d(TAG, "substring lang " + NavitLanguage.substring(pos).toUpperCase(locale));
+ navitLanguage = langc + lang.substring(pos).toUpperCase(locale);
+ Log.d(TAG, "substring lang " + navitLanguage.substring(pos).toUpperCase(locale));
} else {
String country = locale.getCountry();
Log.d(TAG, "Country1 " + country);
Log.d(TAG, "Country2 " + country.toUpperCase(locale));
- NavitLanguage = langc + "_" + country.toUpperCase(locale);
+ navitLanguage = langc + "_" + country.toUpperCase(locale);
}
Log.d(TAG, "Language " + lang);
- SharedPreferences prefs = getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- map_filename_path = prefs.getString("filenamePath",
- Environment.getExternalStorageDirectory().getPath() + "/navit/");
-
+ SharedPreferences prefs = getSharedPreferences(NavitAppConfig.NAVIT_PREFS,MODE_PRIVATE);
+ sNavitDataDir = getApplicationContext().getFilesDir().getPath();
+ sMapFilenamePath = prefs.getString("filenamePath", sNavitDataDir + '/');
+ Log.i(TAG,"NavitDataDir = " + sNavitDataDir);
+ Log.i(TAG,"mapFilenamePath = " + sMapFilenamePath);
// make sure the new path for the navitmap.bin file(s) exist!!
- File navit_maps_dir = new File(map_filename_path);
- navit_maps_dir.mkdirs();
+ File navitMapsDir = new File(sMapFilenamePath);
+ navitMapsDir.mkdirs();
// make sure the share dir exists
- File navit_data_share_dir = new File(NAVIT_DATA_SHARE_DIR);
- navit_data_share_dir.mkdirs();
-
- Display display_ = getWindowManager().getDefaultDisplay();
- int width_ = display_.getWidth();
- int height_ = display_.getHeight();
- metrics = new DisplayMetrics();
- display_.getMetrics(Navit.metrics);
- int densityDpi = (int)((Navit.metrics.density * 160) - .5f);
- Log.d(TAG, "Navit -> pixels x=" + width_ + " pixels y=" + height_);
- Log.d(TAG, "Navit -> dpi=" + densityDpi);
- Log.d(TAG, "Navit -> density=" + Navit.metrics.density);
- Log.d(TAG, "Navit -> scaledDensity=" + Navit.metrics.scaledDensity);
-
- ActivityResults = new NavitActivityResult[16];
+ File navitDataShareDir = new File(sNavitDataDir + "/share");
+ navitDataShareDir.mkdirs();
+
+ Display display = getWindowManager().getDefaultDisplay();
+ sMetrics = new DisplayMetrics();
+ display.getMetrics(sMetrics);
+ int densityDpi = (int)((sMetrics.density * 160) - .5f);
+ Log.d(TAG, "-> pixels x=" + display.getWidth() + " pixels y=" + display.getHeight());
+ Log.d(TAG, "-> dpi=" + densityDpi);
+ Log.d(TAG, "-> density=" + sMetrics.density);
+ Log.d(TAG, "-> scaledDensity=" + sMetrics.scaledDensity);
+
+ mActivityResults = new NavitActivityResult[16];
setVolumeControlStream(AudioManager.STREAM_MUSIC);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"navit:DoNotDimScreen");
+ mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"navit:DoNotDimScreen");
- if (!extractRes(langc, NAVIT_DATA_DIR + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) {
+ if (!extractRes(langc, sNavitDataDir + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) {
Log.e(TAG, "Failed to extract language resource " + langc);
}
+ String myDisplayDensity;
if (densityDpi <= 120) {
- my_display_density = "ldpi";
+ myDisplayDensity = "ldpi";
} else if (densityDpi <= 160) {
- my_display_density = "mdpi";
+ myDisplayDensity = "mdpi";
} else if (densityDpi < 240) {
- my_display_density = "hdpi";
+ myDisplayDensity = "hdpi";
} else if (densityDpi < 320) {
- my_display_density = "xhdpi";
+ myDisplayDensity = "xhdpi";
} else if (densityDpi < 480) {
- my_display_density = "xxhdpi";
+ myDisplayDensity = "xxhdpi";
} else if (densityDpi < 640) {
- my_display_density = "xxxhdpi";
+ myDisplayDensity = "xxxhdpi";
} else {
Log.w(TAG, "found device of very high density (" + densityDpi + ")");
Log.w(TAG, "using xxxhdpi values");
- my_display_density = "xxxhdpi";
+ myDisplayDensity = "xxxhdpi";
}
- Log.i(TAG, "Device density detected: " + my_display_density);
+ Log.i(TAG, "Device density detected: " + myDisplayDensity);
try {
- AssetManager assetMgr = NavitResources.getAssets();
- String[] children = assetMgr.list("config/" + my_display_density);
+ AssetManager assetMgr = NavitAppConfig.sResources.getAssets();
+ String[] children = assetMgr.list("config/" + myDisplayDensity);
for (String child : children) {
Log.d(TAG, "Processing config file '" + child + "' from assets");
- if (!extractAsset("config/" + my_display_density + "/" + child, NAVIT_DATA_DIR + "/share/" + child)) {
- Log.e(TAG, "Failed to extract asset config/" + my_display_density + "/" + child);
+ if (!extractAsset("config/" + myDisplayDensity + "/" + child, sNavitDataDir + "/share/" + child)) {
+ Log.e(TAG, "Failed to extract asset config/" + myDisplayDensity + "/" + child);
}
}
} catch (IOException e) {
Log.e(TAG, "Failed to access assets using AssetManager");
}
+ Log.d(TAG, "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(Build.VERSION.SDK));
+ navitMain(navitLanguage, sNavitDataDir + "/bin/navit", sMapFilenamePath);
+ showInfos();
+ }
- Log.d(TAG, "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(android.os.Build.VERSION.SDK));
- NavitMain(this, getApplication(), NavitLanguage, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density,
- NAVIT_DATA_DIR + "/bin/navit", map_filename_path, isLaunch);
- if (graphics != null)
- graphics.setActivity(this);
+ private void windowSetup() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ } else {
+ if (this.getActionBar() != null) {
+ this.getActionBar().hide();
+ }
+ }
+ }
- showInfos();
+ /* uses NAVIT_PACKAGE_NAME as id */
- Navit.mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ private void buildNotification() {
+ NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
+
+ Notification navitNotification;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ Notification.Builder builder;
+ builder = new Notification.Builder(getApplicationContext(), NAVIT_PACKAGE_NAME);
+ builder.setContentIntent(appIntent);
+ builder.setAutoCancel(false).setOngoing(true);
+ builder.setContentTitle(getTstring(R.string.app_name));
+ builder.setContentText(getTstring(R.string.notification_event_default));
+ builder.setSmallIcon(R.drawable.ic_notify);
+ navitNotification = builder.build();
+ } else {
+ NotificationCompat.Builder builder;
+ builder = new NotificationCompat.Builder(getApplicationContext());
+ builder.setContentIntent(appIntent);
+ builder.setAutoCancel(false).setOngoing(true);
+ builder.setContentTitle(getTstring(R.string.app_name));
+ builder.setContentText(getTstring(R.string.notification_event_default));
+ builder.setSmallIcon(R.drawable.ic_notify);
+ navitNotification = builder.build();
+ }
+ notificationManager.notify(R.string.app_name, navitNotification);// Show the notification
+ }
+
+ public void onRestart() {
+ super.onRestart();
+ Log.d(TAG, "OnRestart");
+ }
+
+ public void onStart() {
+ super.onStart();
+ Log.d(TAG, "OnStart");
}
@Override
@@ -503,79 +421,59 @@ public class Navit extends Activity {
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
- //InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ //InputMethodManager sInputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// DEBUG
// intent_data = "google.navigation:q=Wien Burggasse 27";
// intent_data = "google.navigation:q=48.25676,16.643";
// intent_data = "google.navigation:ll=48.25676,16.643&q=blabla-strasse";
// intent_data = "google.navigation:ll=48.25676,16.643";
- if (startup_intent != null) {
- if (System.currentTimeMillis() <= Navit.startup_intent_timestamp + 4000L) {
- Log.d(TAG, "**2**A " + startup_intent.getAction());
- Log.d(TAG, "**2**D " + startup_intent.getDataString());
- String navi_scheme = startup_intent.getScheme();
- if (navi_scheme != null && navi_scheme.equals("google.navigation")) {
- parseNavigationURI(startup_intent.getData().getSchemeSpecificPart());
+ if (sStartupIntent != null) {
+ if (System.currentTimeMillis() <= Navit.sStartupIntentTimestamp + 4000L) {
+ Log.d(TAG, "**2**A " + sStartupIntent.getAction());
+ Log.d(TAG, "**2**D " + sStartupIntent.getDataString());
+ String naviScheme = sStartupIntent.getScheme();
+ if (naviScheme != null && naviScheme.equals("google.navigation")) {
+ parseNavigationURI(sStartupIntent.getData().getSchemeSpecificPart());
}
} else {
Log.e(TAG, "timestamp for navigate_to expired! not using data");
}
}
- Log.d(TAG, "onResume");
-
- if (show_soft_keyboard_now_showing) {
- /* Calling showNativeKeyboard() directly won't work here, we need to use the message queue */
- View cf = getCurrentFocus();
- if (cf == null) {
- Log.e(TAG, "no view in focus, can't get a handler");
- } else {
- cf.getHandler().post(new SoftInputRestorer());
- }
- }
}
@Override
public void onPause() {
super.onPause();
Log.d(TAG, "onPause");
- if (show_soft_keyboard_now_showing) {
- Log.d(TAG, "onPause:hiding soft input");
- this.hideNativeKeyboard();
- show_soft_keyboard_now_showing = true;
- }
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
- switch (requestCode) {
- case MY_PERMISSIONS_REQUEST_ALL: {
- if (grantResults.length > 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED
- && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
- return;
- }
- AlertDialog.Builder infobox = new AlertDialog.Builder(this);
- infobox.setTitle(getTstring(R.string.permissions_info_box_title)); // TRANS
- infobox.setCancelable(false);
- infobox.setMessage(getTstring(R.string.permissions_not_granted));
- // TRANS
- infobox.setPositiveButton(getTstring(R.string.initial_info_box_OK),
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- exit();
- }
- });
- infobox.show();
+ if (requestCode == MY_PERMISSIONS_REQ_FINE_LOC) {
+ if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ return;
}
+ AlertDialog.Builder infobox = new AlertDialog.Builder(this);
+ infobox.setTitle(getTstring(R.string.permissions_info_box_title)); // TRANS
+ infobox.setCancelable(false);
+ infobox.setMessage(getTstring(R.string.permissions_not_granted));
+ // TRANS
+ infobox.setPositiveButton(getTstring(R.string.initial_info_box_OK),
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface arg0, int arg1) {
+ onDestroy();
+ }
+ });
+ infobox.show();
}
}
private void parseNavigationURI(String schemeSpecificPart) {
String[] naviData = schemeSpecificPart.split("&");
Pattern p = Pattern.compile("(.*)=(.*)");
- Map<String,String> params = new HashMap<String,String>();
- for (int count = 0; count < naviData.length; count++) {
- Matcher m = p.matcher(naviData[count]);
-
+ Map<String,String> params = new HashMap<>();
+ for (String naviDatum : naviData) {
+ Matcher m = p.matcher(naviDatum);
if (m.matches()) {
params.put(m.group(1), m.group(2));
}
@@ -586,8 +484,8 @@ public class Navit extends Activity {
// c: google.navigation:ll=48.25676,16.643
// b: google.navigation:q=48.25676,16.643
- Float lat;
- Float lon;
+ float lat;
+ float lon;
Bundle b = new Bundle();
String geoString = params.get("ll");
@@ -609,12 +507,12 @@ public class Navit extends Activity {
lon = Float.valueOf(geo[1]);
b.putFloat("lat", lat);
b.putFloat("lon", lon);
- Message msg = Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_SET_DESTINATION.ordinal());
msg.setData(b);
msg.sendToTarget();
- Log.e(TAG, "target found (b): " + geoString);
+ Log.i(TAG, "target found (b): " + geoString);
} catch (NumberFormatException e) {
e.printStackTrace();
}
@@ -625,23 +523,16 @@ public class Navit extends Activity {
}
}
- public void setActivityResult(int requestCode, NavitActivityResult ActivityResult) {
- ActivityResults[requestCode] = ActivityResult;
+ public void setActivityResult(int requestCode, NavitActivityResult activityResult) {
+ mActivityResults[requestCode] = activityResult;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
- //Log.e("Navit","onPrepareOptionsMenu");
- // this gets called every time the menu is opened!!
- // change menu items here!
menu.clear();
- // group-id,item-id,sort order number
- //menu.add(1, 1, 100, getString(R.string.optionsmenu_zoom_in)); //TRANS
- //menu.add(1, 2, 200, getString(R.string.optionsmenu_zoom_out)); //TRANS
-
menu.add(1, 3, 300, getTstring(R.string.optionsmenu_download_maps)); //TRANS
menu.add(1, 5, 400, getTstring(R.string.optionsmenu_toggle_poi)); //TRANS
@@ -658,32 +549,15 @@ public class Navit extends Activity {
return true;
}
- // define callback id here
- private NavitGraphics N_NavitGraphics = null;
-
- // callback id gets set here when called from NavitGraphics
- public void setKeypressCallback(int kp_cb_id, NavitGraphics ng) {
- N_NavitGraphics = ng;
- }
-
- public void setMotionCallback(int mo_cb_id, NavitGraphics ng) {
- N_NavitGraphics = ng;
- }
-
- public NavitGraphics getNavitGraphics() {
- return N_NavitGraphics;
- }
-
-
- public void start_targetsearch_from_intent(String target_address) {
- if (target_address == null || target_address.equals("")) {
+ private void start_targetsearch_from_intent(String targetAddress) {
+ if (targetAddress == null || targetAddress.equals("")) {
// empty search string entered
Toast.makeText(getApplicationContext(), getTstring(R.string.address_search_not_found),
Toast.LENGTH_LONG).show(); //TRANS
} else {
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- search_intent.putExtra("search_string", target_address);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
+ Intent searchIntent = new Intent(this, NavitAddressSearchActivity.class);
+ searchIntent.putExtra("search_string", targetAddress);
+ this.startActivityForResult(searchIntent, NavitAddressSearch_id);
}
}
@@ -693,44 +567,44 @@ public class Navit extends Activity {
return true;
}
- public void runOptionsItem(int id) {
+ private void runOptionsItem(int id) {
switch (id) {
case 1 :
// zoom in
- Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_ZOOM_IN.ordinal()).sendToTarget();
+ Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_ZOOM_IN.ordinal()).sendToTarget();
// if we zoom, hide the bubble
Log.d(TAG, "onOptionsItemSelected -> zoom in");
break;
case 2 :
// zoom out
- Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_ZOOM_OUT.ordinal()).sendToTarget();
+ Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_ZOOM_OUT.ordinal()).sendToTarget();
// if we zoom, hide the bubble
Log.d(TAG, "onOptionsItemSelected -> zoom out");
break;
case 3 :
// map download menu
- Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
- startActivityForResult(map_download_list_activity, Navit.NavitDownloaderSelectMap_id);
+ Intent mapDownloadListActivity = new Intent(this, NavitDownloadSelectMapActivity.class);
+ startActivityForResult(mapDownloadListActivity, Navit.NavitDownloaderSelectMap_id);
break;
case 5 :
// toggle the normal POI layers and labels (to avoid double POIs)
- Message msg = Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_CALL_CMD.ordinal());
Bundle b = new Bundle();
b.putString("cmd", "toggle_layer(\"POI Symbols\");");
msg.setData(b);
msg.sendToTarget();
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ msg = Message.obtain(NavitGraphics.sCallbackHandler, NavitGraphics.MsgType.CLB_CALL_CMD.ordinal());
b = new Bundle();
b.putString("cmd", "toggle_layer(\"POI Labels\");");
msg.setData(b);
msg.sendToTarget();
// toggle full POI icons on/off
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ msg = Message.obtain(NavitGraphics.sCallbackHandler, NavitGraphics.MsgType.CLB_CALL_CMD.ordinal());
b = new Bundle();
b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");");
msg.setData(b);
@@ -739,8 +613,8 @@ public class Navit extends Activity {
break;
case 6 :
// ok startup address search activity
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
+ Intent searchIntent = new Intent(this, NavitAddressSearchActivity.class);
+ this.startActivityForResult(searchIntent, NavitAddressSearch_id);
break;
case 7 :
/* Backup / Restore */
@@ -752,8 +626,10 @@ public class Navit extends Activity {
case 99 :
// exit
this.onStop();
- this.exit();
+ this.onDestroy();
break;
+ default:
+ Log.e(TAG,"unhandled OptionsItem id = " + id);
}
}
@@ -761,74 +637,57 @@ public class Navit extends Activity {
/**
* Shows the Options menu.
*
- * Calling this method has the same effect as pressing the hardware Menu button, where present, or touching
- * the overflow button in the Action bar.
+ * <p>Calling this method has the same effect as pressing the hardware Menu button, or touching
+ * the overflow button in the Action bar.</p>
*/
- public void showMenu() {
+ void showMenu() {
openOptionsMenu();
}
/**
* Shows the native keyboard or other input method.
+ *
+ * @return 1 if keyboard is software, 0 if hardware
*/
- public int showNativeKeyboard() {
- /*
- * Apologies for the huge mess that this function is, but Android's soft input API is a big
- * nightmare. Its devs have mercifully given us an option to show or hide the keyboard, but
- * there is no reliable way to figure out if it is actually showing, let alone how much of the
- * screen it occupies, so our best bet is guesswork.
- */
+ int showNativeKeyboard() {
+ Log.d(TAG, "showNativeKeyboard");
Configuration config = getResources().getConfiguration();
if ((config.keyboard == Configuration.KEYBOARD_QWERTY)
&& (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)) {
- /* physical keyboard present, exit */
+ /* physical keyboard present */
return 0;
}
/* Use SHOW_FORCED here, else keyboard won't show in landscape mode */
- mgr.showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED);
- show_soft_keyboard_now_showing = true;
+ ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
+ .showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED);
+ sShowSoftKeyboardShowing = true;
- /*
- * Crude way to estimate the height occupied by the keyboard: for AOSP on KitKat and Lollipop it
- * is about 62-63% of available screen width (in portrait mode) but no more than slightly above
- * 46% of height (in landscape mode).
- */
- Display display_ = getWindowManager().getDefaultDisplay();
- int width_ = display_.getWidth();
- int height_ = display_.getHeight();
- int maxHeight = height_ * 47 / 100;
- int inputHeight = width_ * 63 / 100;
- if (inputHeight > (maxHeight)) {
- inputHeight = maxHeight;
- }
-
- /* the receiver isn't going to fire before the UI thread becomes idle, well after this method returns */
- Log.d(TAG, "showNativeKeyboard:return (assuming true)");
- return inputHeight;
+ return 1;
}
/**
* Hides the native keyboard or other input method.
*/
- public void hideNativeKeyboard() {
- mgr.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
- show_soft_keyboard_now_showing = false;
+ void hideNativeKeyboard() {
+ ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
+ .hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
+ sShowSoftKeyboardShowing = false;
}
void setDestination(float latitude, float longitude, String address) {
- Toast.makeText(getApplicationContext(),getTstring(R.string.address_search_set_destination) + "\n" + address,
- Toast.LENGTH_LONG).show(); //TRANS
+ Toast.makeText(getApplicationContext(), getTstring(R.string.address_search_set_destination) + "\n"
+ + address, Toast.LENGTH_LONG).show(); //TRANS
- Message msg = Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
Bundle b = new Bundle();
b.putFloat("lat", latitude);
b.putFloat("lon", longitude);
b.putString("q", address);
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_SET_DESTINATION.ordinal());
msg.setData(b);
msg.sendToTarget();
}
@@ -837,7 +696,7 @@ public class Navit extends Activity {
switch (requestCode) {
case Navit.NavitDownloaderSelectMap_id :
if (resultCode == Activity.RESULT_OK) {
- Message msg = dialogs.obtainMessage(NavitDialogs.MSG_START_MAP_DOWNLOAD,
+ Message msg = mDialogs.obtainMessage(NavitDialogs.MSG_START_MAP_DOWNLOAD,
data.getIntExtra("map_index", -1), 0);
msg.sendToTarget();
}
@@ -849,8 +708,8 @@ public class Navit extends Activity {
getTstring(R.string.address_search_set_destination) + "\n" + destination.getString(("q")),
Toast.LENGTH_LONG).show(); //TRANS
- Message msg = Message.obtain(N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_SET_DESTINATION.ordinal());
msg.setData(destination);
msg.sendToTarget();
}
@@ -864,10 +723,10 @@ public class Navit extends Activity {
} else {
newDir = newDir + "/";
}
- SharedPreferences prefs = this.getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- SharedPreferences.Editor prefs_editor = prefs.edit();
- prefs_editor.putString("filenamePath", newDir);
- prefs_editor.apply();
+ SharedPreferences prefs = this.getSharedPreferences(NavitAppConfig.NAVIT_PREFS,MODE_PRIVATE);
+ SharedPreferences.Editor prefsEditor = prefs.edit();
+ prefsEditor.putString("filenamePath", newDir);
+ prefsEditor.apply();
Toast.makeText(this, String.format(getTstring(R.string.map_location_changed),newDir),
Toast.LENGTH_LONG).show();
@@ -876,27 +735,28 @@ public class Navit extends Activity {
}
break;
default :
- if (ActivityResults[requestCode] != null)
- ActivityResults[requestCode].onActivityResult(requestCode, resultCode, data);
+ if (mActivityResults[requestCode] != null) {
+ mActivityResults[requestCode].onActivityResult(requestCode, resultCode, data);
+ }
break;
}
}
@Override
protected void onPrepareDialog(int id, Dialog dialog) {
- dialogs.prepareDialog(id);
+ mDialogs.prepareDialog(id);
super.onPrepareDialog(id, dialog);
}
protected Dialog onCreateDialog(int id) {
- return dialogs.createDialog(id);
+ return mDialogs.createDialog(id);
}
@Override
public boolean onSearchRequested() {
/* Launch the internal Search Activity */
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
+ Intent searchIntent = new Intent(this, NavitAddressSearchActivity.class);
+ this.startActivityForResult(searchIntent, NavitAddressSearch_id);
return true;
}
@@ -913,62 +773,49 @@ public class Navit extends Activity {
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "OnDestroy");
+ NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ notificationManager.cancelAll();
+ NavitVehicle.removeListeners(this);
+ navitDestroy();
}
- public void fullscreen(int fullscreen) {
- int w, h;
- isFullscreen = (fullscreen != 0);
- if (isFullscreen) {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ public void onStop() {
+ super.onStop();
+ Log.d(TAG, "OnStop");
+ }
+
+
+ @RequiresApi(api = Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ void fullscreen(int fullscreen) {
+
+ View decorView = getWindow().getDecorView();
+
+ mIsFullscreen = (fullscreen != 0);
+ if (mIsFullscreen) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- } else {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+ decorView.setSystemUiVisibility(uiOptions);
+ }
- Display display_ = getWindowManager().getDefaultDisplay();
- if (Build.VERSION.SDK_INT < 17) {
- w = display_.getWidth();
- h = display_.getHeight();
} else {
- Point size = new Point();
- display_.getRealSize(size);
- w = size.x;
- h = size.y;
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ decorView.setSystemUiVisibility(0);
+ }
}
- Log.d(TAG, String.format("Toggle fullscreen, w=%d, h=%d", w, h));
- N_NavitGraphics.handleResize(w, h);
}
public void disableSuspend() {
- wl.acquire();
- wl.release();
- }
-
- private void exit() {
- nm.cancelAll();
- NavitVehicle.removeListener();
- NavitDestroy();
+ mWakeLock.acquire();
+ mWakeLock.release();
}
- public native void NavitMain(Navit x, Application application, String lang, int version,
- String display_density_string, String path, String path2, boolean isLaunch);
+ private native void navitMain(String lang, String path, String path2);
- public native void NavitDestroy();
+ public native void navitDestroy();
-
- private String getLocalizedString(String text) {
- return NavitGraphics.CallbackLocalizedString(text);
- }
-
-
- /*
- * this is used to load the 'navit' native library on
- * application startup. The library has already been unpacked at
- * installation time by the package manager.
- */
- static {
- System.loadLibrary("navit");
- }
}
diff --git a/navit/android/src/org/navitproject/navit/NavitActivityResult.java b/navit/android/src/org/navitproject/navit/NavitActivityResult.java
index 7d3ef8cb4..fb785d1d3 100644
--- a/navit/android/src/org/navitproject/navit/NavitActivityResult.java
+++ b/navit/android/src/org/navitproject/navit/NavitActivityResult.java
@@ -3,5 +3,5 @@ package org.navitproject.navit;
import android.content.Intent;
public interface NavitActivityResult {
- public void onActivityResult(int requestCode, int resultCode, Intent data);
+ void onActivityResult(int requestCode, int resultCode, Intent data);
}
diff --git a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
index 5905433d6..3c0c489d1 100644
--- a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
@@ -19,6 +19,8 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -42,10 +44,10 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
-import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
+
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
@@ -53,41 +55,41 @@ import java.util.Comparator;
import java.util.List;
import java.util.Locale;
+
public class NavitAddressSearchActivity extends Activity {
- public static final class NavitAddress {
- public NavitAddress(int type, float latitude, float longitude, String address) {
- result_type = type;
- lat = latitude;
- lon = longitude;
- addr = address;
+ static final class NavitAddress {
+ NavitAddress(int type, float latitude, float longitude, String address) {
+ mResultType = type;
+ mLat = latitude;
+ mLon = longitude;
+ mAddr = address;
}
- final int result_type;
- final float lat;
- final float lon;
- final String addr;
+ final int mResultType;
+ final float mLat;
+ final float mLon;
+ final String mAddr;
}
private static final String TAG = "NavitAddress";
private static final int ADDRESS_RESULT_PROGRESS_MAX = 10;
- private List<NavitAddress> Addresses_found = null;
- private List<NavitAddress> addresses_shown = null;
+ private List<NavitAddress> mAddressesFound = null;
+ private List<NavitAddress> mAddressesShown = null;
private String mAddressString = "";
private boolean mPartialSearch = false;
private String mCountry;
private ImageButton mCountryButton;
- private ProgressDialog search_results_wait = null;
- public RelativeLayout NavitAddressSearchActivity_layout;
- private int search_results_towns = 0;
- private int search_results_streets = 0;
- private int search_results_streets_hn = 0;
- private long search_handle = 0;
+ private ProgressDialog mSearchResultsWait = null;
+ private int mSearchResultsTowns = 0;
+ private int mSearchResultsStreets = 0;
+ private int mSearchResultsStreetsHn = 0;
+ private long mSearchHandle = 0;
// TODO remember settings
- private static String last_address_search_string = "";
- private static Boolean last_address_partial_match = false;
- private static String last_country = "";
+ private static String sLastAddressSearchString = "";
+ private static Boolean sLastAddressPartialMatch = false;
+ private static String sLastCountry = "";
private int getDrawableID(String resourceName) {
int drawableId = 0;
@@ -105,17 +107,18 @@ public class NavitAddressSearchActivity extends Activity {
// We have all images stored as drawable_nodpi resources which allows native code to manipulate them
// without interference with android builtin choosing and scaling system. But that makes us to
// reinvent the wheel here to show an image in android native interface.
- int[] flag_icon_sizes = {24,32,48,64,96};
- int exact_size, nearest_size;
- exact_size = (int)(Navit.metrics.density * 24.0 - .5);
- nearest_size = flag_icon_sizes[0];
- for (int size: flag_icon_sizes) {
- nearest_size = size;
- if (exact_size <= size) {
+ int[] flagIconSizes = {24,32,48,64,96};
+ int exactSize;
+ int nearestSize;
+ exactSize = (int)(Navit.sMetrics.density * 24.0 - .5);
+ nearestSize = flagIconSizes[0];
+ for (int size: flagIconSizes) {
+ nearestSize = size;
+ if (exactSize <= size) {
break;
}
}
- mCountryButton.setImageResource(getDrawableID("country_" + mCountry + "_" + nearest_size + "_" + nearest_size));
+ mCountryButton.setImageResource(getDrawableID("country_" + mCountry + "_" + nearestSize + "_" + nearestSize));
}
@@ -125,17 +128,17 @@ public class NavitAddressSearchActivity extends Activity {
Bundle extras = getIntent().getExtras();
if (extras != null) {
- String search_string = extras.getString(("search_string"));
- if (search_string != null) {
+ String searchString = extras.getString(("search_string"));
+ if (searchString != null) {
mPartialSearch = true;
- mAddressString = search_string;
+ mAddressString = searchString;
executeSearch();
return;
}
}
- mPartialSearch = last_address_partial_match;
- mAddressString = last_address_search_string;
+ mPartialSearch = sLastAddressPartialMatch;
+ mAddressString = sLastAddressSearchString;
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
LinearLayout panel = new LinearLayout(this);
@@ -143,15 +146,15 @@ public class NavitAddressSearchActivity extends Activity {
panel.setOrientation(LinearLayout.VERTICAL);
// address: label and text field
- SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
+ SharedPreferences settings = getSharedPreferences(NavitAppConfig.NAVIT_PREFS, MODE_PRIVATE);
mCountry = settings.getString(("DefaultCountry"), null);
if (mCountry == null) {
Locale defaultLocale = Locale.getDefault();
mCountry = defaultLocale.getCountry().toLowerCase(defaultLocale);
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.apply();
+ SharedPreferences.Editor editSettings = settings.edit();
+ editSettings.putString("DefaultCountry", mCountry);
+ editSettings.apply();
}
mCountryButton = new ImageButton(this);
@@ -165,33 +168,33 @@ public class NavitAddressSearchActivity extends Activity {
});
// address: label and text field
- TextView addr_view = new TextView(this);
- addr_view.setText(Navit.getInstance().getTstring(R.string.address_enter_destination)); // TRANS
- addr_view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
- addr_view.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- addr_view.setPadding(4, 4, 4, 4);
+ TextView addrView = new TextView(this);
+ addrView.setText(getTstring(R.string.address_enter_destination)); // TRANS
+ addrView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
+ addrView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+ addrView.setPadding(4, 4, 4, 4);
// partial match checkbox
final CheckBox checkboxPartialMatch = new CheckBox(this);
- checkboxPartialMatch.setText(Navit.getInstance().getTstring(R.string.address_partial_match)); // TRANS
- checkboxPartialMatch.setChecked(last_address_partial_match);
+ checkboxPartialMatch.setText(getTstring(R.string.address_partial_match)); // TRANS
+ checkboxPartialMatch.setChecked(sLastAddressPartialMatch);
checkboxPartialMatch.setGravity(Gravity.CENTER);
final EditText address_string = new EditText(this);
- address_string.setText(last_address_search_string);
+ address_string.setText(sLastAddressSearchString);
address_string.setSelectAllOnFocus(true);
// search button
final Button btnSearch = new Button(this);
- btnSearch.setText(Navit.getInstance().getTstring(R.string.address_search_button)); // TRANS
+ btnSearch.setText(getTstring(R.string.address_search_button)); // TRANS
btnSearch.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
btnSearch.setGravity(Gravity.CENTER);
btnSearch.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mPartialSearch = checkboxPartialMatch.isChecked();
mAddressString = address_string.getText().toString();
- last_address_partial_match = mPartialSearch;
- last_address_search_string = mAddressString;
+ sLastAddressPartialMatch = mPartialSearch;
+ sLastAddressSearchString = mAddressString;
executeSearch();
}
});
@@ -204,19 +207,19 @@ public class NavitAddressSearchActivity extends Activity {
if (addressCount > 0) {
String[] strAddresses = new String[addressCount];
for (int addrIndex = 0; addrIndex < addressCount; addrIndex++) {
- strAddresses[addrIndex] = addresses.get(addrIndex).addr;
+ strAddresses[addrIndex] = addresses.get(addrIndex).mAddr;
}
ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strAddresses);
+ new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, strAddresses);
lastAddresses.setAdapter(addressList);
lastAddresses.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
NavitAddress addressSelected = addresses.get(arg2);
Intent resultIntent = new Intent();
- resultIntent.putExtra("lat", addressSelected.lat);
- resultIntent.putExtra("lon", addressSelected.lon);
- resultIntent.putExtra("q", addressSelected.addr);
+ resultIntent.putExtra("lat", addressSelected.mLat);
+ resultIntent.putExtra("lon", addressSelected.mLon);
+ resultIntent.putExtra("q", addressSelected.mAddr);
setResult(Activity.RESULT_OK, resultIntent);
finish();
@@ -232,7 +235,7 @@ public class NavitAddressSearchActivity extends Activity {
searchSettingsLayout.addView(mCountryButton);
searchSettingsLayout.addView(checkboxPartialMatch);
- panel.addView(addr_view);
+ panel.addView(addrView);
panel.addView(address_string);
panel.addView(searchSettingsLayout);
panel.addView(btnSearch);
@@ -242,32 +245,31 @@ public class NavitAddressSearchActivity extends Activity {
}
private void requestCountryDialog() {
- final String[][] all_countries = NavitGraphics.GetAllCountries();
+ final String[][] all_countries = NavitGraphics.getAllCountries();
- Comparator<String[]> country_comperator = new Comparator<String[]>() {
+ Comparator<String[]> countryComparator = new Comparator<String[]>() {
public int compare(String[] object1, String[] object2) {
return object1[1].compareTo(object2[1]);
}
};
- Arrays.sort(all_countries, country_comperator);
+ Arrays.sort(all_countries, countryComparator);
AlertDialog.Builder mapModeChooser = new AlertDialog.Builder(this);
// ToDo also show icons and country code
- String[] country_name = new String[all_countries.length];
+ String[] countryName = new String[all_countries.length];
- for (int country_index = 0; country_index < all_countries.length; country_index++) {
- country_name[country_index] = all_countries[country_index][1];
+ for (int countryIndex = 0; countryIndex < all_countries.length; countryIndex++) {
+ countryName[countryIndex] = all_countries[countryIndex][1];
}
- mapModeChooser.setItems(country_name, new DialogInterface.OnClickListener() {
+ mapModeChooser.setItems(countryName, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
- SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
+ SharedPreferences settings = getSharedPreferences(NavitAppConfig.NAVIT_PREFS, MODE_PRIVATE);
mCountry = all_countries[item][0];
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.apply();
-
+ SharedPreferences.Editor editSettings = settings.edit();
+ editSettings.putString("DefaultCountry", mCountry);
+ editSettings.apply();
setCountryButtonImage();
}
});
@@ -277,36 +279,35 @@ public class NavitAddressSearchActivity extends Activity {
d.show();
}
- /**
- * start a search on the map
- */
- public void receiveAddress(int type, float latitude, float longitude, String address) {
- Log.e(TAG, "(" + String.valueOf(latitude) + ", " + String.valueOf(longitude) + ") " + address);
+ //start a search on the map
+ void receiveAddress(int type, float latitude, float longitude, String address) {
+ Log.d(TAG, "(" + latitude + ", " + longitude + ") " + address);
switch (type) {
case 0:
- search_results_towns++;
+ mSearchResultsTowns++;
break;
case 1:
- search_results_streets++;
+ mSearchResultsStreets++;
break;
case 2:
- search_results_streets_hn++;
+ mSearchResultsStreetsHn++;
break;
-
+ default:
+ Log.e(TAG,"Unexpected value: " + type);
}
- search_results_wait.setMessage(Navit.getInstance().getTstring(R.string.address_search_towns) + ":"
- + search_results_towns + " "
- + Navit.getInstance().getTstring(R.string.address_search_streets) + ":" + search_results_streets + "/"
- + search_results_streets_hn);
+ mSearchResultsWait.setMessage(getTstring(R.string.address_search_towns) + ":"
+ + mSearchResultsTowns + " "
+ + getTstring(R.string.address_search_streets) + ":" + mSearchResultsStreets + "/"
+ + mSearchResultsStreetsHn);
- search_results_wait.setProgress(Addresses_found.size() % (ADDRESS_RESULT_PROGRESS_MAX + 1));
+ mSearchResultsWait.setProgress(mAddressesFound.size() % (ADDRESS_RESULT_PROGRESS_MAX + 1));
- Addresses_found.add(new NavitAddress(type, latitude, longitude, address));
+ mAddressesFound.add(new NavitAddress(type, latitude, longitude, address));
}
- public void finishAddressSearch() {
- if (Addresses_found.isEmpty()) {
+ void finishAddressSearch() {
+ if (mAddressesFound.isEmpty()) {
// TRANS
Toast.makeText(getApplicationContext(),
getString(R.string.address_search_not_found) + "\n" + mAddressString, Toast.LENGTH_LONG).show();
@@ -316,14 +317,14 @@ public class NavitAddressSearchActivity extends Activity {
ListView addressesFound = new ListView(this);
addressesFound.setFastScrollEnabled(true);
ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
+ new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
- addresses_shown = new ArrayList<NavitAddress>();
+ mAddressesShown = new ArrayList<>();
- for (NavitAddress currentAddress : Addresses_found) {
- if (currentAddress.result_type != 0 || search_results_streets == 0) {
- addressList.add(currentAddress.addr);
- addresses_shown.add(currentAddress);
+ for (NavitAddress currentAddress : mAddressesFound) {
+ if (currentAddress.mResultType != 0 || mSearchResultsStreets == 0) {
+ addressList.add(currentAddress.mAddr);
+ mAddressesShown.add(currentAddress);
}
}
@@ -331,12 +332,12 @@ public class NavitAddressSearchActivity extends Activity {
addressesFound.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- NavitAddress addressSelected = addresses_shown.get(arg2);
+ NavitAddress addressSelected = mAddressesShown.get(arg2);
Intent resultIntent = new Intent();
- resultIntent.putExtra("lat", addressSelected.lat);
- resultIntent.putExtra("lon", addressSelected.lon);
- resultIntent.putExtra("q", addressSelected.addr);
+ resultIntent.putExtra("lat", addressSelected.mLat);
+ resultIntent.putExtra("lon", addressSelected.mLon);
+ resultIntent.putExtra("q", addressSelected.mAddr);
setResult(Activity.RESULT_OK, resultIntent);
finish();
@@ -344,39 +345,39 @@ public class NavitAddressSearchActivity extends Activity {
});
setContentView(addressesFound);
- search_results_wait.dismiss();
+ mSearchResultsWait.dismiss();
}
- public native long CallbackStartAddressSearch(int partial_match, String country, String s);
+ native long callbackStartAddressSearch(int partialMatch, String country, String s);
- public native void CallbackCancelAddressSearch(long handle);
+ native void callbackCancelAddressSearch(long handle);
@Override
protected Dialog onCreateDialog(int id) {
- search_results_wait = new ProgressDialog(this);
- search_results_wait.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- search_results_wait.setTitle("Loading search results");
- search_results_wait.setMessage("--");
- search_results_wait.setCancelable(true);
- search_results_wait.setProgress(0);
- search_results_wait.setMax(10);
-
- Addresses_found = new ArrayList<NavitAddress>();
- search_results_towns = 0;
- search_results_streets = 0;
- search_results_streets_hn = 0;
-
- search_handle = CallbackStartAddressSearch(mPartialSearch ? 1 : 0, mCountry, mAddressString);
-
- search_results_wait.setOnCancelListener(new DialogInterface.OnCancelListener() {
+ mSearchResultsWait = new ProgressDialog(this);
+ mSearchResultsWait.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mSearchResultsWait.setTitle("Loading search results");
+ mSearchResultsWait.setMessage("--");
+ mSearchResultsWait.setCancelable(true);
+ mSearchResultsWait.setProgress(0);
+ mSearchResultsWait.setMax(10);
+
+ mAddressesFound = new ArrayList<>();
+ mSearchResultsTowns = 0;
+ mSearchResultsStreets = 0;
+ mSearchResultsStreetsHn = 0;
+
+ mSearchHandle = callbackStartAddressSearch(mPartialSearch ? 1 : 0, mCountry, mAddressString);
+
+ mSearchResultsWait.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
- CallbackCancelAddressSearch(search_handle);
- search_handle = 0;
- search_results_wait.dismiss();
+ callbackCancelAddressSearch(mSearchHandle);
+ mSearchHandle = 0;
+ mSearchResultsWait.dismiss();
}
});
- return search_results_wait;
+ return mSearchResultsWait;
}
private void executeSearch() {
diff --git a/navit/android/src/org/navitproject/navit/NavitAppConfig.java b/navit/android/src/org/navitproject/navit/NavitAppConfig.java
index 22c310f70..322fcc9c7 100755
--- a/navit/android/src/org/navitproject/navit/NavitAppConfig.java
+++ b/navit/android/src/org/navitproject/navit/NavitAppConfig.java
@@ -2,6 +2,7 @@ package org.navitproject.navit;
import android.app.Application;
import android.content.SharedPreferences;
+import android.content.res.Resources;
import java.util.ArrayList;
import java.util.List;
@@ -10,34 +11,36 @@ import org.navitproject.navit.NavitAddressSearchActivity.NavitAddress;
public class NavitAppConfig extends Application {
+ public static final String NAVIT_PREFS = "NavitPrefs";
private static final int MAX_LAST_ADDRESSES = 10;
- private static final String TAG = "Navit";
-
- private List<NavitAddress> mLastAddresses = null;
+ static Resources sResources;
+ private List<NavitAddress> mLastAddresses = null;
private int mLastAddressField;
private SharedPreferences mSettings;
+
@Override
public void onCreate() {
- mSettings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
super.onCreate();
+ mSettings = getSharedPreferences(NAVIT_PREFS, MODE_PRIVATE);
+ sResources = getResources();
}
- public List<NavitAddress> getLastAddresses() {
+ List<NavitAddress> getLastAddresses() {
if (mLastAddresses == null) {
- mLastAddresses = new ArrayList<NavitAddress>();
+ mLastAddresses = new ArrayList<>();
int mLastAddressField = mSettings.getInt("LastAddress", -1);
if (mLastAddressField >= 0) {
int index = mLastAddressField;
do {
- String addr_str = mSettings.getString("LastAddress_" + String.valueOf(index), "");
+ String addrStr = mSettings.getString("LastAddress_" + index, "");
- if (addr_str.length() > 0) {
+ if (addrStr.length() > 0) {
mLastAddresses.add(new NavitAddress(
1,
- mSettings.getFloat("LastAddress_Lat_" + String.valueOf(index), 0),
- mSettings.getFloat("LastAddress_Lon_" + String.valueOf(index), 0),
- addr_str));
+ mSettings.getFloat("LastAddress_Lat_" + index, 0),
+ mSettings.getFloat("LastAddress_Lon_" + index, 0),
+ addrStr));
}
if (--index < 0) {
@@ -50,7 +53,7 @@ public class NavitAppConfig extends Application {
return mLastAddresses;
}
- public void addLastAddress(NavitAddress newAddress) {
+ void addLastAddress(NavitAddress newAddress) {
getLastAddresses();
mLastAddresses.add(newAddress);
@@ -66,10 +69,33 @@ public class NavitAppConfig extends Application {
SharedPreferences.Editor editSettings = mSettings.edit();
editSettings.putInt("LastAddress", mLastAddressField);
- editSettings.putString("LastAddress_" + String.valueOf(mLastAddressField), newAddress.addr);
- editSettings.putFloat("LastAddress_Lat_" + String.valueOf(mLastAddressField), newAddress.lat);
- editSettings.putFloat("LastAddress_Lon_" + String.valueOf(mLastAddressField), newAddress.lon);
+ editSettings.putString("LastAddress_" + mLastAddressField, newAddress.mAddr);
+ editSettings.putFloat("LastAddress_Lat_" + mLastAddressField, newAddress.mLat);
+ editSettings.putFloat("LastAddress_Lon_" + mLastAddressField, newAddress.mLon);
editSettings.apply();
}
+
+ /**
+ * Translates a string from its id
+ * in R.strings
+ *
+ * @param riD resource identifier
+ * @return translated string
+ */
+ static String getTstring(int riD) {
+
+ return callbackLocalizedString(sResources.getString(riD));
+ }
+
+ static native String callbackLocalizedString(String s);
+
+ /*
+ * this is used to load the 'navit' native library on
+ * application startup. The library has already been unpacked at
+ * installation time by the package manager.
+ */
+ static {
+ System.loadLibrary("navit");
+ }
}
diff --git a/navit/android/src/org/navitproject/navit/NavitBackupTask.java b/navit/android/src/org/navitproject/navit/NavitBackupTask.java
index c3fbe0517..567acb137 100644
--- a/navit/android/src/org/navitproject/navit/NavitBackupTask.java
+++ b/navit/android/src/org/navitproject/navit/NavitBackupTask.java
@@ -1,5 +1,7 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
@@ -11,6 +13,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+
public class NavitBackupTask extends AsyncTask<Void, Void, String> {
private Navit mActivity;
@@ -28,7 +31,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* Create a Wait Progress Dialog to inform the User that we are working */
mDialog = new ProgressDialog(mActivity);
mDialog.setIndeterminate(true);
- mDialog.setMessage(mActivity.getTstring(R.string.backing_up));
+ mDialog.setMessage(getTstring(R.string.backing_up));
mDialog.show();
}
@@ -44,7 +47,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* Create the Main Backup Directory if it doesn't exist */
if (!mainBackupDir.isDirectory()) {
if (!mainBackupDir.mkdirs()) {
- return mActivity.getTstring(R.string.failed_to_create_backup_directory);
+ return getTstring(R.string.failed_to_create_backup_directory);
}
}
@@ -70,29 +73,29 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
/* Create the Backup Directory if it doesn't exist */
if (!backupDir.isDirectory()) {
if (!backupDir.mkdirs()) {
- return mActivity.getTstring(R.string.failed_to_create_backup_directory);
+ return getTstring(R.string.failed_to_create_backup_directory);
}
}
ObjectOutputStream preferencesOOs = null;
try {
/* Backup Files in home */
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt",
+ NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/bookmark.txt",
backupDir.getPath() + "/bookmark.txt");
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/destination.txt",
+ NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/destination.txt",
backupDir.getPath() + "/destination.txt");
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt",
+ NavitUtils.copyFileIfExists(Navit.sNavitDataDir + "/home/gui_internal.txt",
backupDir.getPath() + "/gui_internal.txt");
/* Backup Shared Preferences */
preferencesOOs = new ObjectOutputStream(
new FileOutputStream(backupDir.getPath() + "/preferences.bak"));
preferencesOOs.writeObject(
- mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE)
+ mActivity.getSharedPreferences(NavitAppConfig.NAVIT_PREFS, Context.MODE_PRIVATE)
.getAll());
} catch (IOException e) {
e.printStackTrace();
- return mActivity.getTstring(R.string.backup_failed);
+ return getTstring(R.string.backup_failed);
} finally {
/* Close Stream to prevent Resource Leaks */
try {
@@ -101,7 +104,7 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
}
} catch (IOException e) {
e.printStackTrace();
- return mActivity.getTstring(R.string.backup_failed);
+ return getTstring(R.string.backup_failed);
}
}
@@ -121,14 +124,14 @@ public class NavitBackupTask extends AsyncTask<Void, Void, String> {
return;
}
- Toast.makeText(mActivity, mActivity.getTstring(R.string.backup_successful),
+ Toast.makeText(mActivity, getTstring(R.string.backup_successful),
Toast.LENGTH_LONG).show();
}
@Override
protected void onCancelled() {
super.onCancelled();
- Toast.makeText(mActivity, mActivity.getTstring(R.string.backup_failed), Toast.LENGTH_LONG)
+ Toast.makeText(mActivity, getTstring(R.string.backup_failed), Toast.LENGTH_LONG)
.show();
mDialog.dismiss();
}
diff --git a/navit/android/src/org/navitproject/navit/NavitCamera.java b/navit/android/src/org/navitproject/navit/NavitCamera.java
index 709686b97..1df26081a 100644
--- a/navit/android/src/org/navitproject/navit/NavitCamera.java
+++ b/navit/android/src/org/navitproject/navit/NavitCamera.java
@@ -25,58 +25,73 @@ import android.view.SurfaceView;
import java.io.IOException;
+class NavitCamera extends SurfaceView implements SurfaceHolder.Callback {
-
-public class NavitCamera extends SurfaceView implements SurfaceHolder.Callback {
- SurfaceHolder mHolder;
- Camera mCamera;
-
-
+ private Camera mCamera;
+ private static final String TAG = "NavitCamera";
NavitCamera(Context context) {
super(context);
- mHolder = getHolder();
- mHolder.addCallback(this);
- mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- Log.e("NavitCamera","Creator");
-
-
+ if (android.support.v4.content.ContextCompat.checkSelfPermission(context,
+ android.Manifest.permission.CAMERA)
+ != android.content.pm.PackageManager.PERMISSION_GRANTED) {
+ Log.e(TAG,"No permission to access camera");
+ return;
+ }
+ SurfaceHolder holder;
+ holder = getHolder();
+ holder.addCallback(this);
+ holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
+ Log.v(TAG,"Creator");
}
+ /**
+ * {@inheritDoc}
+ *
+ * <p>acquire the camera and tell it where to draw.</p>
+ */
public void surfaceCreated(SurfaceHolder holder) {
- // The Surface has been created, acquire the camera and tell it where
- // to draw.
- try {
- mCamera = Camera.open();
- mCamera.setPreviewDisplay(holder);
- } catch (IOException exception) {
- mCamera.release();
- mCamera = null;
- // TODO: add more exception handling logic here
+ if (mCamera != null) {
+ try {
+ mCamera = Camera.open();
+ mCamera.setPreviewDisplay(holder);
+ } catch (IOException exception) {
+ mCamera.release();
+ mCamera = null;
+ Log.e(TAG, "IOException");
+ }
+ Log.i(TAG, "surfaceCreated");
+ } else {
+ Log.e(TAG, "null camera");
}
- Log.e("NavitCamera","surfaceCreated");
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>stop the preview and release the camera.</p>
+ */
public void surfaceDestroyed(SurfaceHolder holder) {
- // Surface will be destroyed when we return, so stop the preview.
- // Because the CameraDevice object is not a shared resource, it's very
- // important to release it when the activity is paused.
mCamera.stopPreview();
mCamera = null;
- Log.e("NavitCamera","surfaceDestroyed");
+ Log.e(TAG,"surfaceDestroyed");
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>set up the camera with the new parameters.</p>
+ */
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- // Now that the size is known, set up the camera parameters and begin
- // the preview.
- Log.e("NavitCamera","surfaceChanged " + w + "x" + h);
+ Log.e(TAG,"surfaceChanged " + w + "x " + h);
mCamera.stopPreview();
Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(w, h);
mCamera.setParameters(parameters);
mCamera.startPreview();
}
-
}
diff --git a/navit/android/src/org/navitproject/navit/NavitDialogs.java b/navit/android/src/org/navitproject/navit/NavitDialogs.java
index 41cac61da..8a9d6de65 100644
--- a/navit/android/src/org/navitproject/navit/NavitDialogs.java
+++ b/navit/android/src/org/navitproject/navit/NavitDialogs.java
@@ -1,5 +1,7 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
@@ -14,11 +16,12 @@ import android.widget.ArrayAdapter;
import android.widget.Toast;
import java.io.File;
+
public class NavitDialogs extends Handler {
// Dialogs
- public static final int DIALOG_MAPDOWNLOAD = 1;
- public static final int DIALOG_BACKUP_RESTORE = 2;
+ static final int DIALOG_MAPDOWNLOAD = 1;
+ static final int DIALOG_BACKUP_RESTORE = 2;
// dialog messages
static final int MSG_MAP_DOWNLOAD_FINISHED = 0;
static final int MSG_PROGRESS_BAR = 1;
@@ -27,30 +30,30 @@ public class NavitDialogs extends Handler {
static final int MSG_START_MAP_DOWNLOAD = 7;
private static final int DIALOG_SELECT_BACKUP = 3;
private static final int MSG_REMOVE_DIALOG_GENERIC = 99;
- private static Handler mHandler;
- private final String TAG = this.getClass().getName();
- private ProgressDialog mapdownloader_dialog = null;
- private NavitMapDownloader mapdownloader = null;
- private Navit mActivity;
+ private static Handler sHandler;
+ private static final String TAG = "NavitDialogs";
+ private ProgressDialog mMapdownloaderDialog = null;
+ private NavitMapDownloader mMapdownloader = null;
+ private final Navit mActivity;
NavitDialogs(Navit activity) {
super();
mActivity = activity;
- mHandler = this;
+ sHandler = this;
}
- static public void sendDialogMessage(int what, String title, String text, int dialog_num,
+ static void sendDialogMessage(int what, String title, String text, int dialogNum,
int value1, int value2) {
- Message msg = mHandler.obtainMessage(what);
Bundle data = new Bundle();
data.putString("title", title);
data.putString("text", text);
data.putInt("value1", value1);
data.putInt("value2", value2);
- data.putInt("dialog_num", dialog_num);
+ data.putInt("dialog_num", dialogNum);
+ Message msg = sHandler.obtainMessage(what);
msg.setData(data);
- mHandler.sendMessage(msg);
+ sHandler.sendMessage(msg);
}
@Override
@@ -61,32 +64,32 @@ public class NavitDialogs extends Handler {
mActivity.dismissDialog(DIALOG_MAPDOWNLOAD);
mActivity.removeDialog(DIALOG_MAPDOWNLOAD);
if (msg.getData().getInt("value1") == 1) {
- Message msg_out = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_LOAD_MAP.ordinal());
- msg_out.setData(msg.getData());
- msg_out.sendToTarget();
-
- msg_out = Message
- .obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
+ Message msgOut = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_LOAD_MAP.ordinal());
+ msgOut.setData(msg.getData());
+ msgOut.sendToTarget();
+
+ msgOut = Message
+ .obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_CALL_CMD.ordinal());
Bundle b = new Bundle();
int mi = msg.getData().getInt("value2");
- double lon = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lon1) + Double
- .parseDouble(NavitMapDownloader.osm_maps[mi].lon2)) / 2.0;
- double lat = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].lat1) + Double
- .parseDouble(NavitMapDownloader.osm_maps[mi].lat2)) / 2.0;
+ double lon = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].mLon1) + Double
+ .parseDouble(NavitMapDownloader.osm_maps[mi].mLon2)) / 2.0;
+ double lat = (Double.parseDouble(NavitMapDownloader.osm_maps[mi].mLat1) + Double
+ .parseDouble(NavitMapDownloader.osm_maps[mi].mLat2)) / 2.0;
b.putString("cmd", "set_center(\"" + lon + " " + lat + "\",1); zoom=256");
- msg_out.setData(b);
- msg_out.sendToTarget();
+ msgOut.setData(b);
+ msgOut.sendToTarget();
}
break;
}
case MSG_PROGRESS_BAR:
// change progressbar values
- mapdownloader_dialog.setMax(msg.getData().getInt("value1"));
- mapdownloader_dialog.setProgress(msg.getData().getInt("value2"));
- mapdownloader_dialog.setTitle(msg.getData().getString(("title")));
- mapdownloader_dialog.setMessage(msg.getData().getString(("text")));
+ mMapdownloaderDialog.setMax(msg.getData().getInt("value1"));
+ mMapdownloaderDialog.setProgress(msg.getData().getInt("value2"));
+ mMapdownloaderDialog.setTitle(msg.getData().getString(("title")));
+ mMapdownloaderDialog.setMessage(msg.getData().getString(("text")));
break;
case MSG_TOAST:
Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_SHORT).show();
@@ -95,14 +98,14 @@ public class NavitDialogs extends Handler {
Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_LONG).show();
break;
case MSG_START_MAP_DOWNLOAD: {
- int download_map_id = msg.arg1;
- Log.d(TAG, "PRI id=" + download_map_id);
+ int downloadMapId = msg.arg1;
+ Log.d(TAG, "PRI id=" + downloadMapId);
// set map id to download
// show the map download progressbar, and download the map
- if (download_map_id > -1) {
- mapdownloader = new NavitMapDownloader(download_map_id);
+ if (downloadMapId > -1) {
+ mMapdownloader = new NavitMapDownloader(downloadMapId);
mActivity.showDialog(NavitDialogs.DIALOG_MAPDOWNLOAD);
- mapdownloader.start();
+ mMapdownloader.start();
}
}
break;
@@ -111,6 +114,8 @@ public class NavitDialogs extends Handler {
mActivity.dismissDialog(msg.getData().getInt("dialog_num"));
mActivity.removeDialog(msg.getData().getInt("dialog_num"));
break;
+ default:
+ Log.e(TAG,"Unexpected value: " + msg.what);
}
}
@@ -119,53 +124,45 @@ public class NavitDialogs extends Handler {
switch (id) {
case DIALOG_MAPDOWNLOAD:
- mapdownloader_dialog = new ProgressDialog(mActivity);
- mapdownloader_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- mapdownloader_dialog.setTitle("--");
- mapdownloader_dialog.setMessage("--");
- mapdownloader_dialog.setCancelable(true);
- mapdownloader_dialog.setProgress(0);
- mapdownloader_dialog.setMax(200);
+ mMapdownloaderDialog = new ProgressDialog(mActivity);
+ mMapdownloaderDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mMapdownloaderDialog.setTitle("--");
+ mMapdownloaderDialog.setMessage("--");
+ mMapdownloaderDialog.setCancelable(true);
+ mMapdownloaderDialog.setProgress(0);
+ mMapdownloaderDialog.setMax(200);
DialogInterface.OnDismissListener onDismissListener = new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
- Log.e(TAG, "onDismiss: mapdownloader_dialog");
- if (mapdownloader != null) {
- mapdownloader.stop_thread();
+ Log.e(TAG, "onDismiss: mMapdownloaderDialog");
+ if (mMapdownloader != null) {
+ mMapdownloader.stop_thread();
}
}
};
- mapdownloader_dialog.setOnDismissListener(onDismissListener);
+ mMapdownloaderDialog.setOnDismissListener(onDismissListener);
// show license for OSM maps
Toast.makeText(mActivity.getApplicationContext(),
- Navit.getInstance().getString(R.string.osm_copyright),
- Toast.LENGTH_LONG).show();
- return mapdownloader_dialog;
+ R.string.osm_copyright, Toast.LENGTH_LONG).show();
+ return mMapdownloaderDialog;
case DIALOG_BACKUP_RESTORE:
/* Create a Dialog that Displays Options wether to Backup or Restore */
- builder.setTitle(mActivity.getTstring(R.string.choose_an_action)).
- setCancelable(true).
- setItems(R.array.dialog_backup_restore_items,
- new DialogInterface.OnClickListener() {
+ builder.setTitle(getTstring(R.string.choose_an_action))
+ .setCancelable(true)
+ .setItems(R.array.dialog_backup_restore_items,
+ new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
/* Notify User if no SD Card present */
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
- Toast.makeText(mActivity, mActivity
- .getTstring(R.string.please_insert_an_sd_card),
+ Toast.makeText(mActivity, getTstring(R.string.please_insert_an_sd_card),
Toast.LENGTH_LONG).show();
}
-
- switch (which) {
- case 0:
- /* Backup */
- new NavitBackupTask(mActivity).execute();
- break;
- case 1:
- /* Restore */
- mActivity.showDialog(DIALOG_SELECT_BACKUP);
- break;
+ if (which == 0) { /* Backup */
+ new NavitBackupTask(mActivity).execute();
+ } else if (which == 1) { /* Restore */
+ mActivity.showDialog(DIALOG_SELECT_BACKUP);
}
}
});
@@ -183,13 +180,13 @@ public class NavitDialogs extends Handler {
if (backups == null || backups.length == 0) {
/* No Backups were found */
- builder.setTitle(mActivity.getTstring(R.string.no_backup_found));
- builder.setNegativeButton(mActivity.getTstring(android.R.string.cancel), null);
+ builder.setTitle(getTstring(R.string.no_backup_found));
+ builder.setNegativeButton(getTstring(android.R.string.cancel), null);
return builder.create();
}
- builder.setTitle(mActivity.getTstring(R.string.select_backup));
- final ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity,
+ builder.setTitle(getTstring(R.string.select_backup));
+ final ArrayAdapter<String> adapter = new ArrayAdapter<>(mActivity,
android.R.layout.simple_spinner_item, backups);
builder.setAdapter(adapter, new OnClickListener() {
@@ -198,15 +195,17 @@ public class NavitDialogs extends Handler {
new NavitRestoreTask(mActivity, adapter.getItem(which)).execute();
}
});
- builder.setNegativeButton(mActivity.getTstring(android.R.string.cancel), null);
+ builder.setNegativeButton(getTstring(android.R.string.cancel), null);
return builder.create();
+ default:
+ Log.e(TAG,"Unexpected value: " + id);
}
// should never get here!!
return null;
}
- public void prepareDialog(int id) {
+ void prepareDialog(int id) {
/* Remove the Dialog to force Android to rerun onCreateDialog */
if (id == DIALOG_SELECT_BACKUP) {
diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
index bb66a8df7..8f816df60 100644
--- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
+++ b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
@@ -15,6 +15,8 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
@@ -37,58 +39,59 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+
public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
private static final String MAP_BULLETPOINT = " * ";
- private static SimpleExpandableListAdapter adapter = null;
- private static ArrayList<HashMap<String, String>> downloaded_maps_childs = null;
- private static ArrayList<HashMap<String, String>> maps_current_position_childs = null;
- private static boolean currentLocationKnown = false;
- private final String TAG = this.getClass().getName();
+ private static SimpleExpandableListAdapter sAdapter = null;
+ private static ArrayList<HashMap<String, String>> sDownloadedMapsChilds = null;
+ private static ArrayList<HashMap<String, String>> sMapsCurrentPositionChilds = null;
+ private static boolean sCurrentLocationKnown = false;
+ private static final String TAG = "DownloadSelectMapAct";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- if (adapter == null) {
- adapter = createAdapter();
+ if (sAdapter == null) {
+ sAdapter = createAdapter();
}
updateDownloadedMaps();
- updateMapsForLocation(NavitMapDownloader.osm_maps);
- setListAdapter(adapter);
+ updateMapsForLocation();
+ setListAdapter(sAdapter);
try {
- setTitle(String.valueOf(getFreeSpace() / 1024 / 1024) + "MB available");
+ setTitle(getFreeSpace() / 1024 / 1024 + "MB available");
} catch (Exception e) {
Log.e(TAG, "Exception " + e.getClass().getName()
+ " during getFreeSpace, reporting 'no sdcard present'");
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
String.format(
- (Navit.getInstance().getTstring(R.string.map_location_unavailable)),
- Navit.map_filename_path),
+ (getTstring(R.string.map_location_unavailable)),
+ Navit.sMapFilenamePath),
-1, 0, 0);
finish();
}
}
private long getFreeSpace() {
- StatFs fsInfo = new StatFs(Navit.map_filename_path);
+ StatFs fsInfo = new StatFs(Navit.sMapFilenamePath);
return (long) fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
}
private void updateDownloadedMaps() {
- downloaded_maps_childs.clear();
+ sDownloadedMapsChilds.clear();
for (NavitMap map : NavitMapDownloader.getAvailableMaps()) {
- HashMap<String, String> child = new HashMap<String, String>();
- child.put("map_name", map.mapName + " " + (map.size() / 1024 / 1024) + "MB");
+ HashMap<String, String> child = new HashMap<>();
+ child.put("map_name", map.mMapName + " " + (map.size() / 1024 / 1024) + "MB");
child.put("map_location", map.getLocation());
- downloaded_maps_childs.add(child);
+ sDownloadedMapsChilds.add(child);
}
}
- private void updateMapsForLocation(NavitMapDownloader.osm_map_values[] osm_maps) {
- Location currentLocation = NavitVehicle.lastLocation;
- if (maps_current_position_childs.size() == 0 || (currentLocation != null
- && !currentLocationKnown)) {
+ private void updateMapsForLocation() {
+ Location currentLocation = NavitVehicle.sLastLocation;
+ if (sMapsCurrentPositionChilds.size() == 0 || (currentLocation != null
+ && !sCurrentLocationKnown)) {
if (currentLocation == null) {
LocationManager mapLocationManager = (LocationManager) getSystemService(
Context.LOCATION_SERVICE);
@@ -114,22 +117,23 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
}
}
} else {
- currentLocationKnown = true;
+ sCurrentLocationKnown = true;
}
if (currentLocation != null) {
// if this map contains data to our current position, add it to
// the MapsOfCurrentLocation-list
- for (int currentMapIndex = 0; currentMapIndex < osm_maps.length;
+ for (int currentMapIndex = 0; currentMapIndex < NavitMapDownloader.osm_maps.length;
currentMapIndex++) {
- if (osm_maps[currentMapIndex].isInMap(currentLocation)) {
- HashMap<String, String> currentPositionMapChild = new HashMap<String, String>();
- currentPositionMapChild.put("map_name", osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024)
+ if (NavitMapDownloader.osm_maps[currentMapIndex].isInMap(currentLocation)) {
+ HashMap<String, String> currentPositionMapChild = new HashMap<>();
+ currentPositionMapChild.put("map_name", NavitMapDownloader.osm_maps[currentMapIndex].mMapName
+ + " "
+ + (NavitMapDownloader.osm_maps[currentMapIndex].mEstSizeBytes / 1024 / 1024)
+ "MB");
currentPositionMapChild.put("map_index", String.valueOf(currentMapIndex));
- maps_current_position_childs.add(currentPositionMapChild);
+ sMapsCurrentPositionChilds.add(currentPositionMapChild);
}
}
}
@@ -138,45 +142,41 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
private SimpleExpandableListAdapter createAdapter() {
- NavitMapDownloader.osm_map_values[] osm_maps = NavitMapDownloader.osm_maps;
-
- ArrayList<HashMap<String, String>> resultGroups = new ArrayList<HashMap<String, String>>();
- ArrayList<ArrayList<HashMap<String, String>>> resultChilds =
- new ArrayList<ArrayList<HashMap<String, String>>>();
+ ArrayList<HashMap<String, String>> resultGroups = new ArrayList<>();
// add already downloaded maps (group and empty child list
- HashMap<String, String> downloaded_maps_hash = new HashMap<String, String>();
- downloaded_maps_hash
- .put("category_name", Navit.getInstance().getTstring(R.string.maps_installed));
- resultGroups.add(downloaded_maps_hash);
- downloaded_maps_childs = new ArrayList<HashMap<String, String>>();
- resultChilds.add(downloaded_maps_childs);
+ HashMap<String, String> downloadedMapsHash = new HashMap<>();
+ downloadedMapsHash.put("category_name", getTstring(R.string.maps_installed));
+ resultGroups.add(downloadedMapsHash);
+ sDownloadedMapsChilds = new ArrayList<>();
+ ArrayList<ArrayList<HashMap<String, String>>> resultChilds = new ArrayList<>();
+ resultChilds.add(sDownloadedMapsChilds);
- ArrayList<HashMap<String, String>> secList = new ArrayList<HashMap<String, String>>();
- maps_current_position_childs = new ArrayList<HashMap<String, String>>();
+ ArrayList<HashMap<String, String>> secList = new ArrayList<>();
+ sMapsCurrentPositionChilds = new ArrayList<>();
// maps containing the current location
- HashMap<String, String> matching_maps = new HashMap<String, String>();
- matching_maps.put("category_name",
- Navit.getInstance().getTstring(R.string.maps_for_current_location));
- resultGroups.add(matching_maps);
- resultChilds.add(maps_current_position_childs);
-
+ HashMap<String, String> matchingMaps = new HashMap<>();
+ matchingMaps.put("category_name",
+ getTstring(R.string.maps_for_current_location));
+ resultGroups.add(matchingMaps);
+ resultChilds.add(sMapsCurrentPositionChilds);
+ NavitMapDownloader.OsmMapValues[] osmMaps = NavitMapDownloader.osm_maps;
// add all maps
- for (int currentMapIndex = 0; currentMapIndex < osm_maps.length; currentMapIndex++) {
- if (osm_maps[currentMapIndex].level == 0) {
+ for (int currentMapIndex = 0; currentMapIndex < osmMaps.length; currentMapIndex++) {
+ if (osmMaps[currentMapIndex].mLevel == 0) {
if (secList.size() > 0) {
resultChilds.add(secList);
}
- secList = new ArrayList<HashMap<String, String>>();
- HashMap<String, String> map_info_hash = new HashMap<String, String>();
- map_info_hash.put("category_name", osm_maps[currentMapIndex].map_name);
- resultGroups.add(map_info_hash);
+ secList = new ArrayList<>();
+ HashMap<String, String> mapInfoHash = new HashMap<>();
+ mapInfoHash.put("category_name", osmMaps[currentMapIndex].mMapName);
+ resultGroups.add(mapInfoHash);
}
- HashMap<String, String> child = new HashMap<String, String>();
- child.put("map_name", (osm_maps[currentMapIndex].level > 1 ? MAP_BULLETPOINT : "")
- + osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024) + "MB");
+ HashMap<String, String> child = new HashMap<>();
+ child.put("map_name", (osmMaps[currentMapIndex].mLevel > 1 ? MAP_BULLETPOINT : "")
+ + osmMaps[currentMapIndex].mMapName + " "
+ + (osmMaps[currentMapIndex].mEstSizeBytes / 1024 / 1024) + "MB");
child.put("map_index", String.valueOf(currentMapIndex));
secList.add(child);
@@ -197,14 +197,14 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
Log.d(TAG, "p:" + groupPosition + ", child_pos:" + childPosition);
@SuppressWarnings("unchecked")
- HashMap<String, String> child = (HashMap<String, String>) adapter.getChild(groupPosition, childPosition);
+ HashMap<String, String> child = (HashMap<String, String>) sAdapter.getChild(groupPosition, childPosition);
- String map_index = child.get("map_index");
- if (map_index != null) {
- int mi = Integer.parseInt(map_index);
- if (NavitMapDownloader.osm_maps[mi].est_size_bytes / 1024 / 1024 / 950 >= 4) {
+ String mapIndex = child.get("map_index");
+ if (mapIndex != null) {
+ int mi = Integer.parseInt(mapIndex);
+ if (NavitMapDownloader.osm_maps[mi].mEstSizeBytes / 1024 / 1024 / 950 >= 4) {
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- Navit.getInstance().getTstring(R.string.map_download_oversize),
+ getTstring(R.string.map_download_oversize),
-1, 0, 0);
return true;
}
@@ -219,25 +219,25 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
return true;
}
- private void askForMapDeletion(final String map_location) {
+ private void askForMapDeletion(final String mapLocation) {
AlertDialog.Builder deleteMapBox = new AlertDialog.Builder(this);
- deleteMapBox.setTitle(Navit.getInstance().getTstring(R.string.map_delete));
+ deleteMapBox.setTitle(getTstring(R.string.map_delete));
deleteMapBox.setCancelable(true);
- NavitMap maptoDelete = new NavitMap(map_location);
+ NavitMap maptoDelete = new NavitMap(mapLocation);
deleteMapBox.setMessage(
- maptoDelete.mapName + " " + String.valueOf(maptoDelete.size() / 1024 / 1024)
+ maptoDelete.mMapName + " " + maptoDelete.size() / 1024 / 1024
+ "MB");
// TRANS
- deleteMapBox.setPositiveButton(Navit.getInstance().getTstring(R.string.yes),
+ deleteMapBox.setPositiveButton(getTstring(R.string.yes),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Log.d(TAG, "Delete Map");
- Message msg = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_DELETE_MAP.ordinal());
Bundle b = new Bundle();
- b.putString("title", map_location);
+ b.putString("title", mapLocation);
msg.setData(b);
msg.sendToTarget();
finish();
@@ -245,7 +245,7 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
});
// TRANS
- deleteMapBox.setNegativeButton((Navit.getInstance().getTstring(R.string.no)),
+ deleteMapBox.setNegativeButton((getTstring(R.string.no)),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Log.d(TAG, "don't delete map");
diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java
index 4e7929f88..67fe2615e 100644
--- a/navit/android/src/org/navitproject/navit/NavitGraphics.java
+++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
@@ -19,10 +19,15 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -32,9 +37,11 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.Rect;
+import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
+import android.support.annotation.RequiresApi;
import android.support.v4.view.ViewConfigurationCompat;
import android.util.Log;
import android.view.ContextMenu;
@@ -46,200 +53,223 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowInsets;
+import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
-import java.io.File;
-import java.lang.reflect.Method;
+
import java.util.ArrayList;
+import java.util.List;
-public class NavitGraphics {
+class NavitGraphics {
private static final String TAG = "NavitGraphics";
- private final NavitGraphics parent_graphics;
- private final ArrayList<NavitGraphics> overlays = new ArrayList<NavitGraphics>();
- private int bitmap_w;
- private int bitmap_h;
- private int pos_x;
- private int pos_y;
- private int pos_wraparound;
- private int overlay_disabled;
- private int bgcolor;
- private float trackball_x;
- private float trackball_y;
- private int padding_left = 0;
- private int padding_right = 0;
- private int padding_top = 0;
- private int padding_bottom = 0;
- private View view;
- private SystemBarTintView leftTintView;
- private SystemBarTintView rightTintView;
- private SystemBarTintView topTintView;
- private SystemBarTintView bottomTintView;
- private FrameLayout frameLayout;
- private RelativeLayout relativelayout;
- private NavitCamera camera = null;
- private Navit activity;
- private static Boolean in_map = false;
- // for menu key
- private static final long time_for_long_press = 300L;
-
-
- private Handler timer_handler = new Handler();
-
- public void setBackgroundColor(int bgcolor) {
- this.bgcolor = bgcolor;
- if (leftTintView != null) {
- leftTintView.setBackgroundColor(bgcolor);
+ private static final long TIME_FOR_LONG_PRESS = 300L;
+ private final NavitGraphics mParentGraphics;
+ private final ArrayList<NavitGraphics> mOverlays = new ArrayList<>();
+ private int mBitmapWidth;
+ private int mBitmapHeight;
+ private int mPosX;
+ private int mPosY;
+ private int mPosWraparound;
+ private int mOverlayDisabled;
+ private int mBgColor;
+ private float mTrackballX;
+ private float mTrackballY;
+ private int mPaddingLeft;
+ private int mPaddingRight;
+ private int mPaddingTop;
+ private int mPaddingBottom;
+ private View mView;
+ static final Handler sCallbackHandler = new CallBackHandler();
+ private SystemBarTintView mLeftTintView;
+ private SystemBarTintView mRightTintView;
+ private SystemBarTintView mTopTintView;
+ private SystemBarTintView mBottomTintView;
+ private FrameLayout mFrameLayout;
+ private RelativeLayout mRelativeLayout;
+ private NavitCamera mCamera;
+ private Navit mActivity;
+ private static boolean sInMap;
+ private boolean mTinting;
+
+
+ void setBackgroundColor(int bgcolor) {
+ this.mBgColor = bgcolor;
+ if (mLeftTintView != null) {
+ mLeftTintView.setBackgroundColor(bgcolor);
}
- if (rightTintView != null) {
- rightTintView.setBackgroundColor(bgcolor);
+ if (mRightTintView != null) {
+ mRightTintView.setBackgroundColor(bgcolor);
}
- if (topTintView != null) {
- topTintView.setBackgroundColor(bgcolor);
+ if (mTopTintView != null) {
+ mTopTintView.setBackgroundColor(bgcolor);
}
- if (bottomTintView != null) {
- bottomTintView.setBackgroundColor(bgcolor);
+ if (mBottomTintView != null) {
+ mBottomTintView.setBackgroundColor(bgcolor);
}
}
- private void SetCamera(int use_camera) {
- if (use_camera != 0 && camera == null) {
- // activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ private void setCamera(int useCamera) {
+ if (useCamera != 0 && mCamera == null) {
+ // mActivity.requestWindowFeature(Window.FEATURE_NO_TITLE);
addCamera();
addCameraView();
}
}
/**
- * @brief Adds a camera.
+ * Adds a camera.
*
- * This method does not create the view for the camera. This must be done separately by calling
- * {@link #addCameraView()}.
+ * <p>This method does not create the view for the camera. This must be done separately by calling
+ * {@link #addCameraView()}.</p>
*/
private void addCamera() {
- camera = new NavitCamera(activity);
+ mCamera = new NavitCamera(mActivity);
}
- /**
- * @brief Adds a view for the camera.
- *
- * If {@link #camera} is null, this method is a no-op.
- */
private void addCameraView() {
- if (camera != null) {
- relativelayout.addView(camera);
- relativelayout.bringChildToFront(view);
+ if (mCamera != null) {
+ mRelativeLayout.addView(mCamera);
+ mRelativeLayout.bringChildToFront(mView);
}
}
private Rect get_rect() {
Rect ret = new Rect();
- ret.left = pos_x;
- ret.top = pos_y;
- if (pos_wraparound != 0) {
+ ret.left = mPosX;
+ ret.top = mPosY;
+ if (mPosWraparound != 0) {
if (ret.left < 0) {
- ret.left += parent_graphics.bitmap_w;
+ ret.left += mParentGraphics.mBitmapWidth;
}
if (ret.top < 0) {
- ret.top += parent_graphics.bitmap_h;
+ ret.top += mParentGraphics.mBitmapHeight;
}
}
- ret.right = ret.left + bitmap_w;
- ret.bottom = ret.top + bitmap_h;
- if (pos_wraparound != 0) {
- if (bitmap_w < 0) {
- ret.right = ret.left + bitmap_w + parent_graphics.bitmap_w;
+ ret.right = ret.left + mBitmapWidth;
+ ret.bottom = ret.top + mBitmapHeight;
+ if (mPosWraparound != 0) {
+ if (mBitmapWidth < 0) {
+ ret.right = ret.left + mBitmapWidth + mParentGraphics.mBitmapWidth;
}
- if (bitmap_h < 0) {
- ret.bottom = ret.top + bitmap_h + parent_graphics.bitmap_h;
+ if (mBitmapHeight < 0) {
+ ret.bottom = ret.top + mBitmapHeight + mParentGraphics.mBitmapHeight;
}
}
return ret;
}
private class NavitView extends View implements Runnable, MenuItem.OnMenuItemClickListener {
- int touch_mode = NONE;
- float oldDist = 0;
+ int mTouchMode = NONE;
+ float mOldDist = 0;
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
static final int PRESSED = 3;
- Method eventGetX = null;
- Method eventGetY = null;
+ PointF mPressedPosition = null;
- PointF mPressedPosition = null;
-
- public NavitView(Context context) {
+ NavitView(Context context) {
super(context);
- try {
- eventGetX = android.view.MotionEvent.class.getMethod("getX", int.class);
- eventGetY = android.view.MotionEvent.class.getMethod("getY", int.class);
- } catch (Exception e) {
- Log.e(TAG, "Multitouch zoom not supported");
+ }
+
+ public void onWindowFocusChanged(boolean hasWindowFocus) {
+ Log.v(TAG,"onWindowFocusChanged = " + hasWindowFocus);
+ // beter aanroepen in Navit of appconfig ?
+ if (Navit.sShowSoftKeyboardShowing && hasWindowFocus) {
+ InputMethodManager imm = (InputMethodManager) mActivity
+ .getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.showSoftInput(this,InputMethodManager.SHOW_FORCED);
+ }
+ if (Navit.sShowSoftKeyboardShowing && !hasWindowFocus) {
+ InputMethodManager imm = (InputMethodManager) mActivity
+ .getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(this.getWindowToken(), 0);
}
}
- @Override
- @TargetApi(20)
- public WindowInsets onApplyWindowInsets (WindowInsets insets) {
- /*
- * We're skipping the top inset here because it appears to have a bug on most Android versions tested,
- * causing it to report between 24 and 64 dip more than what is actually occupied by the system UI.
- * The top inset is retrieved in handleResize(), with logic depending on the platform version.
- */
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
- padding_left = insets.getSystemWindowInsetLeft();
- padding_right = insets.getSystemWindowInsetRight();
- padding_bottom = insets.getSystemWindowInsetBottom();
+
+ @TargetApi(21)
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ Log.d(TAG,"onApplyWindowInsets");
+ if (mTinting) {
+ mPaddingLeft = insets.getSystemWindowInsetLeft();
+ mPaddingRight = insets.getSystemWindowInsetRight();
+ mPaddingBottom = insets.getSystemWindowInsetBottom();
+ mPaddingTop = insets.getSystemWindowInsetTop();
+ Log.v(TAG, String.format("Padding -1a- left=%d top=%d right=%d bottom=%d",
+ mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom));
+ int width = this.getWidth();
+ int height = this.getHeight();
+ if (width > 0 && height > 0) {
+ adjustSystemBarsTintingViews();
+ sizeChangedCallback(mSizeChangedCallbackID, width, height);
+ }
}
- return super.onApplyWindowInsets(insets);
+ return insets;
}
+ private static final int MENU_DRIVE_HERE = 1;
+ private static final int MENU_VIEW = 2;
+ private static final int MENU_CANCEL = 3;
+
@Override
protected void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);
-
- menu.setHeaderTitle(activity.getTstring(R.string.position_popup_title) + "..");
- menu.add(1, 1, NONE, activity.getTstring(R.string.position_popup_drive_here))
+ String clickCoord = getCoordForPoint((int)mPressedPosition.x, (int)mPressedPosition.y, false);
+ menu.setHeaderTitle(NavitAppConfig.getTstring(R.string.position_popup_title) + " " + clickCoord);
+ menu.add(1, MENU_DRIVE_HERE, NONE, NavitAppConfig.getTstring(R.string.position_popup_drive_here))
.setOnMenuItemClickListener(this);
- menu.add(1, 2, NONE, activity.getTstring(R.string.cancel)).setOnMenuItemClickListener(this);
+ Uri intentUri = Uri.parse("geo:" + getCoordForPoint((int)mPressedPosition.x,
+ (int)mPressedPosition.y, true));
+ Intent mContextMenuMapViewIntent = new Intent(Intent.ACTION_VIEW, intentUri);
+
+ PackageManager packageManager = this.getContext().getPackageManager();
+ List<ResolveInfo> activities = packageManager.queryIntentActivities(mContextMenuMapViewIntent,
+ PackageManager.MATCH_DEFAULT_ONLY);
+ boolean isIntentSafe = (activities.size() > 0); // at least one candidate receiver
+ if (isIntentSafe) { // add view with external app option
+ menu.add(1, MENU_VIEW, NONE, NavitAppConfig.getTstring(R.string.position_popup_view))
+ .setOnMenuItemClickListener(this);
+ } else {
+ Log.w(TAG, "No application available to handle ACTION_VIEW intent, option not displayed");
+ }
+ menu.add(1, MENU_CANCEL, NONE, getTstring(R.string.cancel)).setOnMenuItemClickListener(this);
}
@Override
public boolean onMenuItemClick(MenuItem item) {
- switch (item.getItemId()) {
- case 1:
- Message msg = Message.obtain(callback_handler, msg_type.CLB_SET_DISPLAY_DESTINATION.ordinal(),
- (int)mPressedPosition.x, (int)mPressedPosition.y);
- msg.sendToTarget();
- break;
+ int itemId = item.getItemId();
+ if (itemId == MENU_DRIVE_HERE) {
+ Message msg = Message.obtain(sCallbackHandler, MsgType.CLB_SET_DISPLAY_DESTINATION.ordinal(),
+ (int) mPressedPosition.x, (int) mPressedPosition.y);
+ msg.sendToTarget();
+ } else if (itemId == MENU_VIEW) {
+ Uri intentUri = Uri.parse("geo:" + getCoordForPoint((int) mPressedPosition.x,
+ (int) mPressedPosition.y, true));
+ Intent mContextMenuMapViewIntent = new Intent(Intent.ACTION_VIEW, intentUri);
+ if (mContextMenuMapViewIntent.resolveActivity(this.getContext().getPackageManager()) != null) {
+ this.getContext().startActivity(mContextMenuMapViewIntent);
+ } else {
+ Log.w(TAG, "ACTION_VIEW intent is not handled by any application, discarding...");
+ }
}
- return false;
+ return true;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
- canvas.drawBitmap(draw_bitmap, pos_x, pos_y, null);
- if (overlay_disabled == 0) {
+ canvas.drawBitmap(mDrawBitmap, mPosX, mPosY, null);
+ if (mOverlayDisabled == 0) {
// assume we ARE in map view mode!
- in_map = true;
- for (NavitGraphics overlay : overlays) {
- if (overlay.overlay_disabled == 0) {
+ sInMap = true;
+ for (NavitGraphics overlay : mOverlays) {
+ if (overlay.mOverlayDisabled == 0) {
Rect r = overlay.get_rect();
- canvas.drawBitmap(overlay.draw_bitmap, r.left, r.top, null);
- }
- }
- } else {
- if (Navit.show_soft_keyboard) {
- if (Navit.mgr != null) {
- Navit.mgr.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
- Navit.show_soft_keyboard_now_showing = true;
- // clear the variable now, keyboard will stay on screen until backbutton pressed
- Navit.show_soft_keyboard = false;
+ canvas.drawBitmap(overlay.mDrawBitmap, r.left, r.top, null);
}
}
}
@@ -248,33 +278,23 @@ public class NavitGraphics {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
Log.d(TAG, "onSizeChanged pixels x=" + w + " pixels y=" + h);
- Log.d(TAG, "onSizeChanged density=" + Navit.metrics.density);
- Log.d(TAG, "onSizeChanged scaledDensity=" + Navit.metrics.scaledDensity);
+ Log.v(TAG, "onSizeChanged density=" + Navit.sMetrics.density);
+ Log.v(TAG, "onSizeChanged scaledDensity=" + Navit.sMetrics.scaledDensity);
super.onSizeChanged(w, h, oldw, oldh);
+ mDrawBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+ mDrawCanvas = new Canvas(mDrawBitmap);
+ mBitmapWidth = w;
+ mBitmapHeight = h;
handleResize(w, h);
+ sizeChangedCallback(mSizeChangedCallbackID, w, h);
}
- void do_longpress_action() {
- Log.d(TAG, "do_longpress_action enter");
-
- activity.openContextMenu(this);
+ void doLongpressAction() {
+ Log.d(TAG, "doLongpressAction enter");
+ mActivity.openContextMenu(this);
}
- private int getActionField(String fieldname, Object obj) {
- int ret_value = -999;
- try {
- java.lang.reflect.Field field = android.view.MotionEvent.class.getField(fieldname);
- try {
- ret_value = field.getInt(obj);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } catch (NoSuchFieldException ex) {
- ex.printStackTrace();
- }
- return ret_value;
- }
@SuppressLint("ClickableViewAccessibility")
@Override
@@ -282,220 +302,153 @@ public class NavitGraphics {
super.onTouchEvent(event);
int x = (int) event.getX();
int y = (int) event.getY();
-
- int _ACTION_POINTER_UP_ = getActionField("ACTION_POINTER_UP", event);
- int _ACTION_POINTER_DOWN_ = getActionField("ACTION_POINTER_DOWN", event);
- int _ACTION_MASK_ = getActionField("ACTION_MASK", event);
-
- int switch_value = event.getAction();
- if (_ACTION_MASK_ != -999) {
- switch_value = (event.getAction() & _ACTION_MASK_);
- }
-
- if (switch_value == MotionEvent.ACTION_DOWN) {
- touch_mode = PRESSED;
- if (!in_map) {
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ int switchValue = (event.getActionMasked());
+ Log.d(TAG, "ACTION_ value = " + switchValue);
+
+ if (switchValue == MotionEvent.ACTION_DOWN) {
+ mTouchMode = PRESSED;
+ Log.d(TAG, "ACTION_DOWN mode PRESSED");
+ if (!sInMap) {
+ buttonCallback(mButtonCallbackID, 1, 1, x, y); // down
}
mPressedPosition = new PointF(x, y);
- postDelayed(this, time_for_long_press);
- } else if ((switch_value == MotionEvent.ACTION_UP) || (switch_value == _ACTION_POINTER_UP_)) {
- Log.d(TAG, "ACTION_UP");
+ postDelayed(this, TIME_FOR_LONG_PRESS);
- switch (touch_mode) {
+ } else if (switchValue == MotionEvent.ACTION_POINTER_DOWN) {
+ mOldDist = spacing(event);
+ if (mOldDist > 2f) {
+ mTouchMode = ZOOM;
+ Log.d(TAG, "ACTION_DOWN mode ZOOM started");
+ }
+ } else if (switchValue == MotionEvent.ACTION_UP) {
+ Log.d(TAG, "ACTION_UP");
+ switch (mTouchMode) {
case DRAG:
Log.d(TAG, "onTouch move");
-
- MotionCallback(MotionCallbackID, x, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
-
- break;
- case ZOOM:
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = 0;
- if (newDist > 10f) {
- scale = newDist / oldDist;
- }
-
- if (scale > 1.3) {
- // zoom in
- CallbackMessageChannel(1, null);
- } else if (scale < 0.8) {
- // zoom out
- CallbackMessageChannel(2, null);
- }
+ motionCallback(mMotionCallbackID, x, y);
+ buttonCallback(mButtonCallbackID, 0, 1, x, y); // up
break;
case PRESSED:
- if (in_map) {
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
+ if (sInMap) {
+ buttonCallback(mButtonCallbackID, 1, 1, x, y); // down
}
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
-
+ buttonCallback(mButtonCallbackID, 0, 1, x, y); // up
break;
+ default:
+ Log.i(TAG, "Unexpected touchmode: " + mTouchMode);
}
- touch_mode = NONE;
- } else if (switch_value == MotionEvent.ACTION_MOVE) {
- switch (touch_mode) {
+ mTouchMode = NONE;
+ } else if (switchValue == MotionEvent.ACTION_MOVE) {
+ switch (mTouchMode) {
case DRAG:
- MotionCallback(MotionCallbackID, x, y);
+ motionCallback(mMotionCallbackID, x, y);
break;
case ZOOM:
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = newDist / oldDist;
- Log.d(TAG, "New scale = " + scale);
- if (scale > 1.2) {
- // zoom in
- CallbackMessageChannel(1, "");
- oldDist = newDist;
- } else if (scale < 0.8) {
- oldDist = newDist;
- // zoom out
- CallbackMessageChannel(2, "");
- }
+ doZoom(event);
break;
case PRESSED:
Log.d(TAG, "Start drag mode");
if (spacing(mPressedPosition, new PointF(event.getX(), event.getY())) > 20f) {
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- touch_mode = DRAG;
+ buttonCallback(mButtonCallbackID, 1, 1, x, y); // down
+ mTouchMode = DRAG;
}
break;
- }
- } else if (switch_value == _ACTION_POINTER_DOWN_) {
- oldDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- if (oldDist > 2f) {
- touch_mode = ZOOM;
+ default:
+ Log.i(TAG, "Unexpected touchmode: " + mTouchMode);
}
}
return true;
}
+ private void doZoom(MotionEvent event) {
+ if (event.findPointerIndex(0) == -1 || event.findPointerIndex(1) == -1) {
+ Log.e(TAG,"missing pointer");
+ return;
+ }
+ float newDist = spacing(event);
+ float scale;
+ if (event.getActionMasked() == MotionEvent.ACTION_MOVE) {
+ scale = newDist / mOldDist;
+ Log.v(TAG, "New scale = " + scale);
+ if (scale > 1.2) {
+ // zoom in
+ callbackMessageChannel(1, "");
+ mOldDist = newDist;
+ } else if (scale < 0.8) {
+ mOldDist = newDist;
+ // zoom out
+ callbackMessageChannel(2, "");
+ }
+ }
+ }
+
+ private float spacing(MotionEvent event) {
+ float x = event.getX(0) - event.getX(1);
+ float y = event.getY(0) - event.getY(1);
+ return (float) Math.sqrt(x * x + y * y);
+ }
+
private float spacing(PointF a, PointF b) {
float x = a.x - b.x;
float y = a.y - b.y;
return (float)Math.sqrt(x * x + y * y);
}
- private PointF getFloatValue(Object instance, Object argument) {
- PointF pos = new PointF(0,0);
-
- if (eventGetX != null && eventGetY != null) {
- try {
- Float x = (java.lang.Float) eventGetX.invoke(instance, argument);
- Float y = (java.lang.Float) eventGetY.invoke(instance, argument);
- pos.set(x, y);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return pos;
- }
-
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
- int i;
- String s = null;
- long interval_for_long_press = 200L;
- i = event.getUnicodeChar();
- if (i == 0) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_DEL:
- s = String.valueOf((char) 8);
- break;
- case KeyEvent.KEYCODE_MENU:
- if (!in_map) {
- // if last menukeypress is less than 0.2 seconds away then count longpress
- if ((System.currentTimeMillis() - Navit.last_pressed_menu_key) < interval_for_long_press) {
- Navit.time_pressed_menu_key = Navit.time_pressed_menu_key
- + (System.currentTimeMillis() - Navit.last_pressed_menu_key);
- // on long press let softkeyboard popup
- if (Navit.time_pressed_menu_key > time_for_long_press) {
- Navit.show_soft_keyboard = true;
- Navit.time_pressed_menu_key = 0L;
- // need to draw to get the keyboard showing
- this.postInvalidate();
- }
- } else {
- Navit.time_pressed_menu_key = 0L;
- }
- Navit.last_pressed_menu_key = System.currentTimeMillis();
- // if in menu view:
- // use as OK (Enter) key
- // dont use menu key here (use it in onKeyUp)
- return true;
- } else {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
- return true;
- }
- case KeyEvent.KEYCODE_SEARCH:
- /* Handle event in Main Activity if map is shown */
- if (in_map) {
- return false;
- }
-
- s = String.valueOf((char) 19);
- break;
- case KeyEvent.KEYCODE_BACK:
- s = String.valueOf((char) 27);
- break;
- case KeyEvent.KEYCODE_CALL:
- s = String.valueOf((char) 3);
- break;
- case KeyEvent.KEYCODE_VOLUME_UP:
- if (!in_map) {
- // if in menu view:
- // use as UP key
- s = String.valueOf((char) 16);
- } else {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 21);
- return false;
- }
- break;
- case KeyEvent.KEYCODE_VOLUME_DOWN:
- if (!in_map) {
- // if in menu view:
- // use as DOWN key
- s = String.valueOf((char) 14);
- } else {
- // if on map view:
- // volume DOWN
- //s = java.lang.String.valueOf((char) 4);
- return false;
- }
- break;
- case KeyEvent.KEYCODE_DPAD_CENTER:
- s = String.valueOf((char) 13);
- break;
- case KeyEvent.KEYCODE_DPAD_DOWN:
- s = String.valueOf((char) 14);
- break;
- case KeyEvent.KEYCODE_DPAD_LEFT:
- s = String.valueOf((char) 2);
- break;
- case KeyEvent.KEYCODE_DPAD_RIGHT:
- s = String.valueOf((char) 6);
- break;
- case KeyEvent.KEYCODE_DPAD_UP:
- s = String.valueOf((char) 16);
- break;
- }
- } else if (i == 10) {
- s = java.lang.String.valueOf((char) 13);
+ Log.d(TAG,"onkeydown = " + keyCode);
+ String keyStr = null;
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_ENTER:
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ keyStr = String.valueOf((char) 13);
+ break;
+ case KeyEvent.KEYCODE_DEL:
+ keyStr = String.valueOf((char) 8);
+ break;
+ //case KeyEvent.KEYCODE_MENU:
+ // if (!sInMap) {
+ // this.postInvalidate();
+ // return true;
+ // }
+ // break;
+ case KeyEvent.KEYCODE_SEARCH:
+ /* Handle event in Main Activity if map is shown */
+ if (!sInMap) {
+ keyStr = String.valueOf((char) 19);
+ }
+ break;
+ case KeyEvent.KEYCODE_BACK:
+ keyStr = String.valueOf((char) 27);
+ break;
+ case KeyEvent.KEYCODE_CALL:
+ keyStr = String.valueOf((char) 3);
+ break;
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ keyStr = String.valueOf((char) 14);
+ break;
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ keyStr = String.valueOf((char) 2);
+ break;
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ keyStr = String.valueOf((char) 6);
+ break;
+ case KeyEvent.KEYCODE_DPAD_UP:
+ keyStr = String.valueOf((char) 16);
+ break;
+ default:
+ Log.v(TAG, "keycode: " + keyCode);
}
-
- if (s != null) {
- KeypressCallback(KeypressCallbackID, s);
+ if (keyStr != null) {
+ keypressCallback(mKeypressCallbackID, keyStr);
+ return true;
}
- return true;
+ return false;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
+ Log.d(TAG,"onkeyUp = " + keyCode);
int i;
String s = null;
i = event.getUnicodeChar();
@@ -503,44 +456,39 @@ public class NavitGraphics {
if (i == 0) {
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
- return (!in_map);
case KeyEvent.KEYCODE_VOLUME_DOWN:
- return (!in_map);
+ return (!sInMap);
case KeyEvent.KEYCODE_SEARCH:
/* Handle event in Main Activity if map is shown */
- if (in_map) {
+ if (sInMap) {
return false;
}
break;
case KeyEvent.KEYCODE_BACK:
- if (Navit.show_soft_keyboard_now_showing) {
- Navit.show_soft_keyboard_now_showing = false;
+ if (Navit.sShowSoftKeyboardShowing) {
+ Navit.sShowSoftKeyboardShowing = false;
}
//s = java.lang.String.valueOf((char) 27);
return true;
case KeyEvent.KEYCODE_MENU:
- if (!in_map) {
- if (Navit.show_soft_keyboard_now_showing) {
- // if soft keyboard showing on screen, dont use menu button as select key
- } else {
+ if (!sInMap) {
+ if (!Navit.sShowSoftKeyboardShowing) {
// if in menu view:
// use as OK (Enter) key
s = String.valueOf((char) 13);
- }
+ } // if soft keyboard showing on screen, dont use menu button as select key
} else {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
return false;
}
break;
+ default:
+ Log.v(TAG, "keycode: " + keyCode);
}
} else if (i != 10) {
s = java.lang.String.valueOf((char) i);
}
-
if (s != null) {
- KeypressCallback(KeypressCallbackID, s);
+ keypressCallback(mKeypressCallbackID, s);
}
return true;
}
@@ -550,7 +498,7 @@ public class NavitGraphics {
String s;
if (keyCode == KeyEvent.KEYCODE_UNKNOWN) {
s = event.getCharacters();
- KeypressCallback(KeypressCallbackID, s);
+ keypressCallback(mKeypressCallbackID, s);
return true;
}
return super.onKeyMultiple(keyCode, count, event);
@@ -563,422 +511,361 @@ public class NavitGraphics {
s = java.lang.String.valueOf((char) 13);
}
if (event.getAction() == android.view.MotionEvent.ACTION_MOVE) {
- trackball_x += event.getX();
- trackball_y += event.getY();
- if (trackball_x <= -1) {
+ mTrackballX += event.getX();
+ mTrackballY += event.getY();
+ if (mTrackballX <= -1) {
s = java.lang.String.valueOf((char) 2);
- trackball_x += 1;
+ mTrackballX += 1;
}
- if (trackball_x >= 1) {
+ if (mTrackballX >= 1) {
s = java.lang.String.valueOf((char) 6);
- trackball_x -= 1;
+ mTrackballX -= 1;
}
- if (trackball_y <= -1) {
+ if (mTrackballY <= -1) {
s = java.lang.String.valueOf((char) 16);
- trackball_y += 1;
+ mTrackballY += 1;
}
- if (trackball_y >= 1) {
+ if (mTrackballY >= 1) {
s = java.lang.String.valueOf((char) 14);
- trackball_y -= 1;
+ mTrackballY -= 1;
}
}
if (s != null) {
- KeypressCallback(KeypressCallbackID, s);
+ keypressCallback(mKeypressCallbackID, s);
}
return true;
}
public void run() {
- if (in_map && touch_mode == PRESSED) {
- do_longpress_action();
- touch_mode = NONE;
+ if (sInMap && mTouchMode == PRESSED) {
+ doLongpressAction();
+ mTouchMode = NONE;
}
}
-
}
private class SystemBarTintView extends View {
public SystemBarTintView(Context context) {
super(context);
- this.setBackgroundColor(bgcolor);
+ this.setBackgroundColor(mBgColor);
}
}
- public NavitGraphics(final Activity activity, NavitGraphics parent, int x, int y, int w, int h,
- int wraparound, int use_camera) {
+ NavitGraphics(final Activity navit, NavitGraphics parent, int x, int y, int w, int h,
+ int wraparound, int useCamera) {
if (parent == null) {
- if (use_camera != 0) {
+ if (useCamera != 0) {
addCamera();
}
- setActivity(activity);
+ setmActivity((Navit)navit);
} else {
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- bitmap_w = w;
- bitmap_h = h;
- pos_x = x;
- pos_y = y;
- pos_wraparound = wraparound;
- draw_canvas = new Canvas(draw_bitmap);
- parent.overlays.add(this);
+ mDrawBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+ mBitmapWidth = w;
+ mBitmapHeight = h;
+ mPosX = x;
+ mPosY = y;
+ mPosWraparound = wraparound;
+ mDrawCanvas = new Canvas(mDrawBitmap);
+ parent.mOverlays.add(this);
}
- parent_graphics = parent;
+ mParentGraphics = parent;
}
/**
- * @brief Sets up the main activity.
- *
- * @param activity The main activity.
+ * Sets up the main view.
+ * @param navit The main activity.
*/
- protected void setActivity(final Activity activity) {
- if (Navit.graphics == null)
- Navit.graphics = this;
- this.activity = (Navit) activity;
- view = new NavitView(activity);
- view.setClickable(false);
- view.setFocusable(true);
- view.setFocusableInTouchMode(true);
- view.setKeepScreenOn(true);
- relativelayout = new RelativeLayout(activity);
+ private void setmActivity(final Navit navit) {
+ this.mActivity = navit;
+ mView = new NavitView(mActivity);
+ mView.setClickable(false);
+ mView.setFocusable(true);
+ mView.setFocusableInTouchMode(true);
+ mView.setKeepScreenOn(true);
+ mRelativeLayout = new RelativeLayout(mActivity);
addCameraView();
- relativelayout.addView(view);
-
+ mRelativeLayout.addView(mView);
/* The navigational and status bar tinting code is meaningful only on API19+ */
- if (Build.VERSION.SDK_INT >= 19) {
- frameLayout = new FrameLayout(activity);
- frameLayout.addView(relativelayout);
- leftTintView = new SystemBarTintView(activity);
- rightTintView = new SystemBarTintView(activity);
- topTintView = new SystemBarTintView(activity);
- bottomTintView = new SystemBarTintView(activity);
- frameLayout.addView(leftTintView);
- frameLayout.addView(rightTintView);
- frameLayout.addView(topTintView);
- frameLayout.addView(bottomTintView);
- activity.setContentView(frameLayout);
+ mTinting = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
+
+ if (mTinting) {
+ mFrameLayout = new FrameLayout(mActivity);
+ mFrameLayout.addView(mRelativeLayout);
+ mLeftTintView = new SystemBarTintView(mActivity);
+ mRightTintView = new SystemBarTintView(mActivity);
+ mTopTintView = new SystemBarTintView(mActivity);
+ mBottomTintView = new SystemBarTintView(mActivity);
+ mFrameLayout.addView(mLeftTintView);
+ mFrameLayout.addView(mRightTintView);
+ mFrameLayout.addView(mTopTintView);
+ mFrameLayout.addView(mBottomTintView);
+ mActivity.setContentView(mFrameLayout);
} else {
- activity.setContentView(relativelayout);
+ mActivity.setContentView(mRelativeLayout);
}
-
- view.requestFocus();
+ mView.requestFocus();
}
- public enum msg_type {
+ enum MsgType {
CLB_ZOOM_IN, CLB_ZOOM_OUT, CLB_REDRAW, CLB_MOVE, CLB_BUTTON_UP, CLB_BUTTON_DOWN, CLB_SET_DESTINATION,
CLB_SET_DISPLAY_DESTINATION, CLB_CALL_CMD, CLB_COUNTRY_CHOOSER, CLB_LOAD_MAP, CLB_UNLOAD_MAP, CLB_DELETE_MAP
}
- static private final msg_type[] msg_values = msg_type.values();
+ private static final MsgType[] msg_values = MsgType.values();
- public final Handler callback_handler = new Handler() {
+ private static class CallBackHandler extends Handler {
public void handleMessage(Message msg) {
switch (msg_values[msg.what]) {
case CLB_ZOOM_IN:
- CallbackMessageChannel(1, "");
+ callbackMessageChannel(1, "");
break;
case CLB_ZOOM_OUT:
- CallbackMessageChannel(2, "");
+ callbackMessageChannel(2, "");
break;
case CLB_MOVE:
- MotionCallback(MotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y"));
+ //motionCallback(mMotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y"));
break;
case CLB_SET_DESTINATION:
String lat = Float.toString(msg.getData().getFloat("lat"));
String lon = Float.toString(msg.getData().getFloat("lon"));
String q = msg.getData().getString(("q"));
- CallbackMessageChannel(3, lat + "#" + lon + "#" + q);
+ callbackMessageChannel(3, lat + "#" + lon + "#" + q);
break;
case CLB_SET_DISPLAY_DESTINATION:
int x = msg.arg1;
int y = msg.arg2;
- CallbackMessageChannel(4, "" + x + "#" + y);
+ callbackMessageChannel(4, "" + x + "#" + y);
break;
case CLB_CALL_CMD:
String cmd = msg.getData().getString(("cmd"));
- CallbackMessageChannel(5, cmd);
+ callbackMessageChannel(5, cmd);
break;
case CLB_BUTTON_UP:
- ButtonCallback(ButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // up
+ //buttonCallback(mButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y"));
break;
case CLB_BUTTON_DOWN:
- // down
- ButtonCallback(ButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y"));
+ //buttonCallback(mButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y"));
break;
case CLB_COUNTRY_CHOOSER:
break;
case CLB_LOAD_MAP:
- CallbackMessageChannel(6, msg.getData().getString(("title")));
+ callbackMessageChannel(6, msg.getData().getString(("title")));
break;
case CLB_DELETE_MAP:
- File toDelete = new File(msg.getData().getString(("title")));
- toDelete.delete();
- //fallthrough
+ //unload map before deleting it !!!
+ callbackMessageChannel(7, msg.getData().getString(("title")));
+ //remove commentlines below after testing
+ //File toDelete = new File(msg.getData().getString(("title")));
+ //toDelete.delete();
+ NavitUtils.removeFileIfExists(msg.getData().getString(("title")));
+ break;
case CLB_UNLOAD_MAP:
- CallbackMessageChannel(7, msg.getData().getString(("title")));
+ callbackMessageChannel(7, msg.getData().getString(("title")));
break;
+ case CLB_REDRAW:
+ default:
+ Log.d(TAG, "Unhandled callback : " + msg_values[msg.what]);
}
}
- };
+ }
+
- public native void SizeChangedCallback(int id, int x, int y);
+ private native void sizeChangedCallback(long id, int x, int y);
- public native void PaddingChangedCallback(int id, int left, int right, int top, int bottom);
+ private native void paddingChangedCallback(long id, int left, int top, int right, int bottom);
- public native void KeypressCallback(int id, String s);
+ private native void keypressCallback(long id, String s);
- public native int CallbackMessageChannel(int i, String s);
+ private static native int callbackMessageChannel(int i, String s);
- public native void ButtonCallback(int id, int pressed, int button, int x, int y);
+ private native void buttonCallback(long id, int pressed, int button, int x, int y);
- public native void MotionCallback(int id, int x, int y);
+ private native void motionCallback(long id, int x, int y);
- public native String GetDefaultCountry(int id, String s);
+ private native String getCoordForPoint(int x, int y, boolean absolutCoord);
- public static native String[][] GetAllCountries();
+ static native String[][] getAllCountries();
- private Canvas draw_canvas;
- private Bitmap draw_bitmap;
- private int SizeChangedCallbackID;
- private int PaddingChangedCallbackID;
- private int ButtonCallbackID;
- private int MotionCallbackID;
- private int KeypressCallbackID;
+ private Canvas mDrawCanvas;
+ private Bitmap mDrawBitmap;
+ private long mSizeChangedCallbackID;
+ private long mPaddingChangedCallbackID;
+ private long mButtonCallbackID;
+ private long mMotionCallbackID;
+ private long mKeypressCallbackID;
/**
- * @brief Adjust views used to tint navigation and status bars.
+ * Adjust views used to tint navigation and status bars.
*
- * This method is called from handleResize.
+ * <p>This method is called from handleResize.
*
* It (re-)evaluates if and where the navigation bar is going to be shown, and calculates the
- * padding for objects which should not be obstructed.
+ * padding for objects which should not be obstructed.</p>
*
*/
private void adjustSystemBarsTintingViews() {
+
/* hide tint bars during update to prevent ugly effects */
- leftTintView.setVisibility(View.GONE);
- rightTintView.setVisibility(View.GONE);
- topTintView.setVisibility(View.GONE);
- bottomTintView.setVisibility(View.GONE);
+ mLeftTintView.setVisibility(View.GONE);
+ mRightTintView.setVisibility(View.GONE);
+ mTopTintView.setVisibility(View.GONE);
+ mBottomTintView.setVisibility(View.GONE);
- frameLayout.post(new Runnable() {
+ mFrameLayout.post(new Runnable() {
@Override
public void run() {
- FrameLayout.LayoutParams leftLayoutParams = new FrameLayout.LayoutParams(padding_left,
+ FrameLayout.LayoutParams leftLayoutParams = new FrameLayout.LayoutParams(mPaddingLeft,
LayoutParams.MATCH_PARENT, Gravity.BOTTOM | Gravity.LEFT);
- leftTintView.setLayoutParams(leftLayoutParams);
+ mLeftTintView.setLayoutParams(leftLayoutParams);
- FrameLayout.LayoutParams rightLayoutParams = new FrameLayout.LayoutParams(padding_right,
+ FrameLayout.LayoutParams rightLayoutParams = new FrameLayout.LayoutParams(mPaddingRight,
LayoutParams.MATCH_PARENT, Gravity.BOTTOM | Gravity.RIGHT);
- rightTintView.setLayoutParams(rightLayoutParams);
+ mRightTintView.setLayoutParams(rightLayoutParams);
FrameLayout.LayoutParams topLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
- padding_top, Gravity.TOP);
+ mPaddingTop, Gravity.TOP);
/* Prevent horizontal and vertical tint views from overlapping */
- topLayoutParams.setMargins(padding_left, 0, padding_right, 0);
- topTintView.setLayoutParams(topLayoutParams);
+ topLayoutParams.setMargins(mPaddingLeft, 0, mPaddingRight, 0);
+ mTopTintView.setLayoutParams(topLayoutParams);
FrameLayout.LayoutParams bottomLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
- padding_bottom, Gravity.BOTTOM);
+ mPaddingBottom, Gravity.BOTTOM);
/* Prevent horizontal and vertical tint views from overlapping */
- bottomLayoutParams.setMargins(padding_left, 0, padding_right, 0);
- bottomTintView.setLayoutParams(bottomLayoutParams);
+ bottomLayoutParams.setMargins(mPaddingLeft, 0, mPaddingRight, 0);
+ mBottomTintView.setLayoutParams(bottomLayoutParams);
/* show tint bars again */
- leftTintView.setVisibility(View.VISIBLE);
- rightTintView.setVisibility(View.VISIBLE);
- topTintView.setVisibility(View.VISIBLE);
- bottomTintView.setVisibility(View.VISIBLE);
+ mLeftTintView.setVisibility(View.VISIBLE);
+ mRightTintView.setVisibility(View.VISIBLE);
+ mTopTintView.setVisibility(View.VISIBLE);
+ mBottomTintView.setVisibility(View.VISIBLE);
}
});
- PaddingChangedCallback(PaddingChangedCallbackID, padding_left, padding_top, padding_right, padding_bottom);
+ paddingChangedCallback(mPaddingChangedCallbackID, mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
}
/**
- * @brief Handles resize events.
- *
- * This method is called whenever the main View is resized in any way. This is the case when its
- * {@code onSizeChanged()} event handler fires or when toggling Fullscreen mode.
+ * Handles resize events.
*
+ * <p>This method is called whenever the main View is resized in any way. This is the case when its
+ * {@code onSizeChanged()} event handler fires.</p>
*/
- @TargetApi(23)
- public void handleResize(int w, int h) {
- if (this.parent_graphics != null) {
- this.parent_graphics.handleResize(w, h);
- } else {
+ private void handleResize(int w, int h) {
+ if (this.mParentGraphics == null) {
Log.d(TAG, String.format("handleResize w=%d h=%d", w, h));
-
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
- /*
- * On API 23+ we can query window insets to determine the area which is obscured by the system bars.
- * This appears to have a bug, though, causing an inset to be reported for the navigation bar even
- * when it is not obstructing the window. Therefore, we are relying on the values previously obtained
- * by NavitView#onApplyWindowInsets(), though this is affected by a different bug. Luckily, the two
- * bugs appear to be complementary, allowing us to mix and match results.
- */
- if (view == null) {
- Log.w(TAG, "view is null, cannot update padding");
- } else {
- Log.d(TAG, String.format("view w=%d h=%d x=%.0f y=%.0f",
- view.getWidth(), view.getHeight(), view.getX(), view.getY()));
- if (view.getRootWindowInsets() == null)
- Log.w(TAG, "No root window insets, cannot update padding");
- else {
- Log.d(TAG, String.format("RootWindowInsets left=%d right=%d top=%d bottom=%d",
- view.getRootWindowInsets().getSystemWindowInsetLeft(),
- view.getRootWindowInsets().getSystemWindowInsetRight(),
- view.getRootWindowInsets().getSystemWindowInsetTop(),
- view.getRootWindowInsets().getSystemWindowInsetBottom()));
- padding_top = view.getRootWindowInsets().getSystemWindowInsetTop();
- }
+ if (mTinting) {
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
+ resizePaddingKitkat();
}
- } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
- /*
- * API 20-22 do not support root window insets, forcing us to make an educated guess about the
- * navigation bar height:
- *
- * The size is a platform default and does not change with rotation, but we have to figure out if it
- * applies, i.e. if the status bar is visible.
- *
- * The status bar is always visible unless we are in fullscreen mode. (Fortunately, none of the
- * versions affected by this support split screen mode, which would have further complicated things.)
- */
- if (activity.isFullscreen)
- padding_top = 0;
- else {
- Resources resources = view.getResources();
- int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
- padding_top = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
- }
- } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
- /*
- * API 19 does not support window insets at all, forcing us to do even more guessing than on API 20-22:
- *
- * All system bar sizes are platform defaults and do not change with rotation, but we have
- * to figure out which ones apply.
- *
- * Status bar visibility is as on API 20-22.
- *
- * The navigation bar is shown on devices that report they have no physical menu button. This seems to
- * work even on devices that allow disabling the physical buttons (and use the navigation bar, in which
- * case they report no physical menu button is available; tested with a OnePlus One running CyanogenMod).
- *
- * If shown, the navigation bar may appear on the side or at the bottom. The logic to determine this is
- * taken from AOSP RenderSessionImpl.findNavigationBar()
- * platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
- */
- Resources resources = view.getResources();
- int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
- int adhid = resources.getIdentifier("action_bar_default_height", "dimen", "android");
- int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
- int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
- int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
- int status_bar_height = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
- int action_bar_default_height = (adhid > 0) ? resources.getDimensionPixelSize(adhid) : 0;
- int navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
- int navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
- int navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
- Log.d(TAG, String.format(
- "status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, "
- + "navigation_bar_height_landscape=%d, navigation_bar_width=%d",
- status_bar_height, action_bar_default_height, navigation_bar_height,
- navigation_bar_height_landscape, navigation_bar_width));
-
- if (activity == null) {
- Log.w(TAG, "Main Activity is not a Navit instance, cannot update padding");
- } else if (frameLayout != null) {
- /* frameLayout is only created on platforms supporting navigation and status bar tinting */
-
- Navit navit = activity;
- boolean isStatusShowing = !navit.isFullscreen;
- boolean isNavShowing = !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(navit));
- Log.d(TAG, String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
-
- boolean isLandscape = (navit.getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE);
- boolean isNavAtBottom = (!isLandscape)
- || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
- Log.d(TAG, String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
- isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
-
- padding_left = 0;
- padding_top = isStatusShowing ? status_bar_height : 0;
- padding_right = (isNavShowing && !isNavAtBottom) ? navigation_bar_width : 0;
- padding_bottom = (!(isNavShowing && isNavAtBottom)) ? 0 : (
- isLandscape ? navigation_bar_height_landscape : navigation_bar_height);
- }
- } else {
- /* API 18 and below does not support drawing under the system bars, padding is 0 all around */
- padding_left = 0;
- padding_right = 0;
- padding_top = 0;
- padding_bottom = 0;
+ adjustSystemBarsTintingViews(); // is incl paddingchangedcallback
}
+ }
+ }
- Log.d(TAG, String.format("Padding left=%d top=%d right=%d bottom=%d",
- padding_left, padding_top, padding_right, padding_bottom));
-
- adjustSystemBarsTintingViews();
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- draw_canvas = new Canvas(draw_bitmap);
- bitmap_w = w;
- bitmap_h = h;
- SizeChangedCallback(SizeChangedCallbackID, w, h);
+ @RequiresApi(api = Build.VERSION_CODES.KITKAT)
+ private void resizePaddingKitkat() {
+ /*
+ * API 19 does not support window insets.
+ *
+ * All system bar sizes are device defaults and do not change with rotation, but we have
+ * to figure out which ones apply.
+ *
+ * Status bar visibility is as on API 20-22.
+ *
+ * The navigation bar is shown on devices that report they have no physical menu button. This seems to
+ * work even on devices that allow disabling the physical buttons (and use the navigation bar, in which
+ * case they report no physical menu button is available; tested with a OnePlus One running CyanogenMod)
+ *
+ * If shown, the navigation bar may appear on the side or at the bottom. The logic to determine this is
+ * taken from AOSP RenderSessionImpl.findNavigationBar()
+ * platform/frameworks/base/tools/layoutlib/bridge/src/com/android/
+ * layoutlib/bridge/impl/RenderSessionImpl.java
+ */
+ mPaddingLeft = 0;
+ if (!sInMap) {
+ mPaddingTop = 0;
+ mPaddingRight = 0;
+ mPaddingBottom = 0;
+ return;
}
+ Resources resources = NavitAppConfig.sResources;
+ int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
+ int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
+ int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
+ int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
+ int statusBarHeight = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
+ int navigationBarHeight = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
+ int navigationBarHeightLandscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
+ int navigationBarWidth = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
+ Log.v(TAG, String.format("statusBarHeight=%d, navigationBarHeight=%d, "
+ + "navigationBarHeightLandscape=%d, navigationBarWidth=%d",
+ statusBarHeight, navigationBarHeight,
+ navigationBarHeightLandscape, navigationBarWidth));
+ boolean isStatusShowing = !mActivity.mIsFullscreen;
+ boolean isNavShowing = !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(mActivity));
+ Log.v(TAG, String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
+ boolean isLandscape = (mActivity.getResources().getConfiguration().orientation
+ == Configuration.ORIENTATION_LANDSCAPE);
+ boolean isNavAtBottom = (!isLandscape)
+ || (mActivity.getResources().getConfiguration().smallestScreenWidthDp >= 600);
+ Log.v(TAG, String.format("isNavAtBottom=%b (Config.smallestScreenWidthDp=%d, isLandscape=%b)",
+ isNavAtBottom, mActivity.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
+
+ mPaddingTop = isStatusShowing ? statusBarHeight : 0;
+ mPaddingRight = (isNavShowing && !isNavAtBottom) ? navigationBarWidth : 0;
+ mPaddingBottom = (!(isNavShowing && isNavAtBottom)) ? 0 : (
+ isLandscape ? navigationBarHeightLandscape : navigationBarHeight);
}
+
/**
- * @brief Returns whether the device has a hardware menu button.
+ * Returns whether the device has a hardware menu button.
*
- * Only Android versions starting with ICS (API version 14) support the API call to detect the presence of a
+ * <p>Only Android versions starting with ICS (API version 14) support the API call to detect the presence of a
* Menu button. On earlier Android versions, the following assumptions will be made: On API levels up to 10,
* this method will always return {@code true}, as these Android versions relied on devices having a physical
* Menu button. On API levels 11 through 13 (Honeycomb releases), this method will always return
- * {@code false}, as Honeycomb was a tablet-only release and did not require devices to have a Menu button.
+ * {@code false}, as Honeycomb was a tablet-only release and did not require devices to have a Menu button.</p>
*
- * Note that this method is not aware of non-standard mechanisms on some customized builds of Android. For
- * example, CyanogenMod has an option to add a menu button to the navigation bar. Even with that option,
- * this method will still return `false`.
+ * <p>Note that this method is not aware of non-standard mechanisms on some customized builds of Android</p>
*/
- public boolean hasMenuButton() {
+ boolean hasMenuButton() {
if (Build.VERSION.SDK_INT <= 10) {
return true;
} else {
if (Build.VERSION.SDK_INT <= 13) {
return false;
} else {
- return ViewConfiguration.get(activity.getApplication()).hasPermanentMenuKey();
+ return ViewConfiguration.get(mActivity.getApplication()).hasPermanentMenuKey();
}
}
}
- public void setSizeChangedCallback(int id) {
- SizeChangedCallbackID = id;
+ void setSizeChangedCallback(long id) {
+ mSizeChangedCallbackID = id;
}
- public void setPaddingChangedCallback(int id) {
- PaddingChangedCallbackID = id;
+ void setPaddingChangedCallback(long id) {
+ mPaddingChangedCallbackID = id;
}
- public void setButtonCallback(int id) {
- ButtonCallbackID = id;
+ void setButtonCallback(long id) {
+ Log.v(TAG,"set Buttononcallback");
+ mButtonCallbackID = id;
}
- public void setMotionCallback(int id) {
- MotionCallbackID = id;
- if (activity != null) {
- activity.setMotionCallback(id, this);
- }
+ void setMotionCallback(long id) {
+ mMotionCallbackID = id;
+ Log.v(TAG,"set Motioncallback");
}
- public void setKeypressCallback(int id) {
- KeypressCallbackID = id;
- // set callback id also in main intent (for menus)
- if (activity != null) {
- activity.setKeypressCallback(id, this);
- }
+ void setKeypressCallback(long id) {
+ Log.v(TAG,"set Keypresscallback");
+ mKeypressCallbackID = id;
}
@@ -1008,7 +895,7 @@ public class NavitGraphics {
path.lineTo(c[i], c[i + 1]);
}
//global_path.close();
- draw_canvas.drawPath(path, paint);
+ mDrawCanvas.drawPath(path, paint);
paint.setPathEffect(null);
}
@@ -1024,7 +911,7 @@ public class NavitGraphics {
path.lineTo(c[i], c[i + 1]);
}
//global_path.close();
- draw_canvas.drawPath(path, paint);
+ mDrawCanvas.drawPath(path, paint);
}
protected void draw_rectangle(Paint paint, int x, int y, int w, int h) {
@@ -1032,12 +919,12 @@ public class NavitGraphics {
paint.setStyle(Paint.Style.FILL);
paint.setAntiAlias(true);
//paint.setStrokeWidth(0);
- draw_canvas.drawRect(r, paint);
+ mDrawCanvas.drawRect(r, paint);
}
protected void draw_circle(Paint paint, int x, int y, int r) {
paint.setStyle(Paint.Style.STROKE);
- draw_canvas.drawCircle(x, y, r / 2, paint);
+ mDrawCanvas.drawCircle(x, y, r / 2, paint);
}
protected void draw_text(Paint paint, int x, int y, String text, int size, int dx, int dy, int bgcolor) {
@@ -1059,27 +946,27 @@ public class NavitGraphics {
paint.setColor(bgcolor);
paint.setStyle(Paint.Style.STROKE);
if (path == null) {
- draw_canvas.drawText(text, x, y, paint);
+ mDrawCanvas.drawText(text, x, y, paint);
} else {
- draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
+ mDrawCanvas.drawTextOnPath(text, path, 0, 0, paint);
}
paint.setStyle(Paint.Style.FILL);
paint.setColor(oldcolor);
}
if (path == null) {
- draw_canvas.drawText(text, x, y, paint);
+ mDrawCanvas.drawText(text, x, y, paint);
} else {
- draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
+ mDrawCanvas.drawTextOnPath(text, path, 0, 0, paint);
}
paint.clearShadowLayer();
}
protected void draw_image(Paint paint, int x, int y, Bitmap bitmap) {
- draw_canvas.drawBitmap(bitmap, x, y, null);
+ mDrawCanvas.drawBitmap(bitmap, x, y, null);
}
- /* takes an image and draws it on the screen as a prerendered maptile
+ /* takes an image and draws it on the screen as a prerendered maptile.
*
*
*
@@ -1116,56 +1003,82 @@ public class NavitGraphics {
matrix.preScale(scale, scale);
matrix.postTranslate(p0x, p0y);
matrix.postRotate(angle, p0x, p0y);
- draw_canvas.drawBitmap(bitmap, matrix, paint);
+ mDrawCanvas.drawBitmap(bitmap, matrix, paint);
}
}
/* These constants must be synchronized with enum draw_mode_num in graphics.h. */
- private static final int draw_mode_begin = 0;
- private static final int draw_mode_end = 1;
+ private static final int DRAW_MODE_BEGIN = 0;
+ private static final int DRAW_MODE_END = 1;
+ /* Used by the pedestrian plugin, draws without a mapbackground */
+ private static final int DRAW_MODE_BEGIN_CLEAR = 2;
protected void draw_mode(int mode) {
- if (mode == draw_mode_end) {
- if (parent_graphics == null) {
- view.invalidate();
+ if (mode == DRAW_MODE_END) {
+ if (mParentGraphics == null) {
+ mView.invalidate();
} else {
- parent_graphics.view.invalidate(get_rect());
+ mParentGraphics.mView.invalidate(get_rect());
}
}
- if (mode == draw_mode_begin && parent_graphics != null) {
- draw_bitmap.eraseColor(0);
+ if (mode == DRAW_MODE_BEGIN_CLEAR || (mode == DRAW_MODE_BEGIN && mParentGraphics != null)) {
+ mDrawBitmap.eraseColor(0);
}
}
protected void draw_drag(int x, int y) {
- pos_x = x;
- pos_y = y;
+ mPosX = x;
+ mPosY = y;
}
protected void overlay_disable(int disable) {
- Log.d(TAG,"overlay_disable: " + disable + "Parent: " + (parent_graphics != null));
+ Log.v(TAG,"overlay_disable: " + disable + ", Parent: " + (mParentGraphics != null));
// assume we are NOT in map view mode!
- if (parent_graphics == null) {
- in_map = (disable == 0);
+ // but this backfires when dragging the map
+ if (mParentGraphics == null) {
+ sInMap = (disable == 0);
+ workAroundForGuiInternal(sInMap);
}
- if (overlay_disabled != disable) {
- overlay_disabled = disable;
- if (parent_graphics != null) {
- parent_graphics.view.invalidate(get_rect());
+ if (mOverlayDisabled != disable) {
+ mOverlayDisabled = disable;
+ if (mParentGraphics != null) {
+ mParentGraphics.mView.invalidate(get_rect());
}
}
}
- protected void overlay_resize(int x, int y, int w, int h, int wraparound) {
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- bitmap_w = w;
- bitmap_h = h;
- pos_x = x;
- pos_y = y;
- pos_wraparound = wraparound;
- draw_canvas.setBitmap(draw_bitmap);
+ private void workAroundForGuiInternal(Boolean inMap) {
+ if (!mTinting) {
+ return;
+ }
+ Log.v(TAG,"workaround gui internal");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !inMap) {
+ mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ return;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ return;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !inMap) {
+ mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+ mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+ return;
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+ mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+ }
}
- public static native String CallbackLocalizedString(String s);
+ protected void overlay_resize(int x, int y, int w, int h, int wraparound) {
+ mDrawBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+ mBitmapWidth = w;
+ mBitmapHeight = h;
+ mPosX = x;
+ mPosY = y;
+ mPosWraparound = wraparound;
+ mDrawCanvas.setBitmap(mDrawBitmap);
+ }
}
diff --git a/navit/android/src/org/navitproject/navit/NavitMap.java b/navit/android/src/org/navitproject/navit/NavitMap.java
index ee0f11bb7..b3eb28d17 100644
--- a/navit/android/src/org/navitproject/navit/NavitMap.java
+++ b/navit/android/src/org/navitproject/navit/NavitMap.java
@@ -3,38 +3,38 @@ package org.navitproject.navit;
import java.io.File;
public class NavitMap {
- private String fileName;
- String mapName;
- private String mapPath;
+ String mMapName;
+ private final String mFileName;
+ private final String mMapPath;
- NavitMap(String path, String map_file_name) {
- mapPath = path;
- fileName = map_file_name;
- if (map_file_name.endsWith(".bin")) {
- mapName = map_file_name.substring(0, map_file_name.length() - 4);
+ NavitMap(String path, String mapFileName) {
+ mMapPath = path;
+ mFileName = mapFileName;
+ if (mapFileName.endsWith(".bin")) {
+ mMapName = mapFileName.substring(0, mapFileName.length() - 4);
} else {
- mapName = map_file_name;
+ mMapName = mapFileName;
}
}
- NavitMap(String map_location) {
- File mapFile = new File(map_location);
+ NavitMap(String mapLocation) {
+ File mapFile = new File(mapLocation);
- mapPath = mapFile.getParent() + "/";
- fileName = mapFile.getName();
- if (fileName.endsWith(".bin")) {
- mapName = fileName.substring(0, fileName.length() - 4);
+ mMapPath = mapFile.getParent() + "/";
+ mFileName = mapFile.getName();
+ if (mFileName.endsWith(".bin")) {
+ mMapName = mFileName.substring(0, mFileName.length() - 4);
} else {
- mapName = fileName;
+ mMapName = mFileName;
}
}
public long size() {
- File map_file = new File(mapPath + fileName);
- return map_file.length();
+ File mapFile = new File(mMapPath + mFileName);
+ return mapFile.length();
}
public String getLocation() {
- return mapPath + fileName;
+ return mMapPath + mFileName;
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
index c2c40fe2e..51c362407 100644
--- a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
+++ b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
@@ -15,11 +15,14 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.location.Location;
import android.os.Bundle;
import android.os.Message;
import android.os.StatFs;
import android.util.Log;
+
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -37,7 +40,8 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-/**
+
+/*
* @author rikky
*
*/
@@ -47,438 +51,418 @@ public class NavitMapDownloader extends Thread {
// define the maps here
// size estimations updated 2017-06-22
//
- public static final osm_map_values[] osm_maps = {
- new osm_map_values(Navit.getInstance().getTstring(R.string.whole_planet), "-180", "-90", "180", "90",
+ static final OsmMapValues[] osm_maps = {
+ new OsmMapValues(getTstring(R.string.whole_planet), "-180", "-90", "180", "90",
23992258630L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.africa), "-30.89", "-36.17", "61.68",
+ new OsmMapValues(getTstring(R.string.africa), "-30.89", "-36.17", "61.68",
"38.40", 2070076339L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.angola), "11.4", "-18.1", "24.2", "-5.3",
+ new OsmMapValues(getTstring(R.string.angola), "11.4", "-18.1", "24.2", "-5.3",
127557789L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.burundi), "28.9", "-4.5", "30.9", "-2.2",
+ new OsmMapValues(getTstring(R.string.burundi), "28.9", "-4.5", "30.9", "-2.2",
124049667L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.canary_islands), "-18.69", "26.52", "-12.79",
+ new OsmMapValues(getTstring(R.string.canary_islands), "-18.69", "26.52", "-12.79",
"29.99", 133565815L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.congo), "11.7",
+ new OsmMapValues(getTstring(R.string.congo), "11.7",
"-13.6", "31.5", "5.7", 244228485L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ethiopia), "32.89", "3.33", "48.07", "14.97",
+ new OsmMapValues(getTstring(R.string.ethiopia), "32.89", "3.33", "48.07", "14.97",
153067406L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.guinea), "-15.47", "7.12", "-7.58", "12.74",
+ new OsmMapValues(getTstring(R.string.guinea), "-15.47", "7.12", "-7.58", "12.74",
188047126L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.cotedivoire), "-8.72", "4.09", "-2.43",
+ new OsmMapValues(getTstring(R.string.cotedivoire), "-8.72", "4.09", "-2.43",
"10.80", 132187496L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.kenya), "33.8", "-5.2", "42.4", "4.9",
+ new OsmMapValues(getTstring(R.string.kenya), "33.8", "-5.2", "42.4", "4.9",
190073089L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.lesotho), "26.9", "-30.7", "29.6", "-28.4",
+ new OsmMapValues(getTstring(R.string.lesotho), "26.9", "-30.7", "29.6", "-28.4",
196189429L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.liberia), "-15.00", "-0.73", "-7.20", "8.65",
+ new OsmMapValues(getTstring(R.string.liberia), "-15.00", "-0.73", "-7.20", "8.65",
156257253L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.libya), "9.32", "19.40", "25.54", "33.63",
+ new OsmMapValues(getTstring(R.string.libya), "9.32", "19.40", "25.54", "33.63",
126046917L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.madagascar), "42.25", "-26.63", "51.20",
+ new OsmMapValues(getTstring(R.string.madagascar), "42.25", "-26.63", "51.20",
"-11.31", 145210721L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.namibia) + "+"
- + Navit.getInstance().getTstring(R.string.botswana),
+ new OsmMapValues(getTstring(R.string.namibia) + "+" + getTstring(R.string.botswana),
"11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.reunion), "55.2", "-21.4", "55.9", "-20.9",
+ new OsmMapValues(getTstring(R.string.reunion), "55.2", "-21.4", "55.9", "-20.9",
126008774L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.rwanda), "28.8", "-2.9", "30.9", "-1.0",
+ new OsmMapValues(getTstring(R.string.rwanda), "28.8", "-2.9", "30.9", "-1.0",
128267595L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.south_africa) + "+"
- + Navit.getInstance().getTstring(R.string.lesotho),
+ new OsmMapValues(getTstring(R.string.south_africa) + "+" + getTstring(R.string.lesotho),
"15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.tanzania), "29.19",
+ new OsmMapValues(getTstring(R.string.tanzania), "29.19",
"-11.87", "40.74", "-0.88", 253621029L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.uganda), "29.3", "-1.6", "35.1", "4.3",
+ new OsmMapValues(getTstring(R.string.uganda), "29.3", "-1.6", "35.1", "4.3",
179134521L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.asia), "23.8", "0.1", "195.0", "82.4",
+ new OsmMapValues(getTstring(R.string.asia), "23.8", "0.1", "195.0", "82.4",
5113673780L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.azerbaijan), "44.74", "38.34", "51.69",
+ new OsmMapValues(getTstring(R.string.azerbaijan), "44.74", "38.34", "51.69",
"42.37", 138346406L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.china), "67.3", "5.3", "135.0", "54.5",
+ new OsmMapValues(getTstring(R.string.china), "67.3", "5.3", "135.0", "54.5",
1718108758L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.cyprus), "32.0", "34.5", "34.9", "35.8",
+ new OsmMapValues(getTstring(R.string.cyprus), "32.0", "34.5", "34.9", "35.8",
118472448L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.india) + "+"
- + Navit.getInstance().getTstring(R.string.nepal), "67.9",
+ new OsmMapValues(getTstring(R.string.india) + "+" + getTstring(R.string.nepal), "67.9",
"5.5", "89.6", "36.0", 601877877L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.indonesia), "93.7", "-17.3", "155.5", "7.6",
+ new OsmMapValues(getTstring(R.string.indonesia), "93.7", "-17.3", "155.5", "7.6",
420741405L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.iran), "43.5", "24.4",
+ new OsmMapValues(getTstring(R.string.iran), "43.5", "24.4",
"63.6", "40.4", 242016066L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.iraq), "38.7", "28.5", "49.2", "37.4",
+ new OsmMapValues(getTstring(R.string.iraq), "38.7", "28.5", "49.2", "37.4",
160751805L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.israel), "33.99", "29.8", "35.95", "33.4",
+ new OsmMapValues(getTstring(R.string.israel), "33.99", "29.8", "35.95", "33.4",
155685778L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.japan) + "+"
- + Navit.getInstance().getTstring(R.string.korea), "123.6",
+ new OsmMapValues(getTstring(R.string.japan) + "+" + getTstring(R.string.korea), "123.6",
"25.2", "151.3", "47.1", 1029080156L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.kazakhstan), "46.44", "40.89", "87.36",
+ new OsmMapValues(getTstring(R.string.kazakhstan), "46.44", "40.89", "87.36",
"55.45", 407633007L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.kyrgyzsyan), "69.23", "39.13", "80.33",
+ new OsmMapValues(getTstring(R.string.kyrgyzsyan), "69.23", "39.13", "80.33",
"43.29", 147997835L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.malaysia) + "+"
- + Navit.getInstance().getTstring(R.string.singapore),
+ new OsmMapValues(getTstring(R.string.malaysia) + "+" + getTstring(R.string.singapore),
"94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mongolia), "87.5", "41.4", "120.3", "52.7",
+ new OsmMapValues(getTstring(R.string.mongolia), "87.5", "41.4", "120.3", "52.7",
153534851L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.pakistan), "60.83", "23.28", "77.89",
+ new OsmMapValues(getTstring(R.string.pakistan), "60.83", "23.28", "77.89",
"37.15", 217644321L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.philippines), "115.58", "4.47", "127.85",
+ new OsmMapValues(getTstring(R.string.philippines), "115.58", "4.47", "127.85",
"21.60", 281428307L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.saudi_arabia), "33.2", "16.1", "55.9",
+ new OsmMapValues(getTstring(R.string.saudi_arabia), "33.2", "16.1", "55.9",
"33.5", 242648303L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.taiwan), "119.1", "21.5", "122.5", "25.2",
+ new OsmMapValues(getTstring(R.string.taiwan), "119.1", "21.5", "122.5", "25.2",
1029080156L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.thailand), "97.5", "5.7", "105.2", "19.7",
+ new OsmMapValues(getTstring(R.string.thailand), "97.5", "5.7", "105.2", "19.7",
185135492L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.turkey), "25.1", "35.8", "46.4", "42.8",
+ new OsmMapValues(getTstring(R.string.turkey), "25.1", "35.8", "46.4", "42.8",
331087441L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.turkmenistan), "51.78", "35.07", "66.76",
+ new OsmMapValues(getTstring(R.string.turkmenistan), "51.78", "35.07", "66.76",
"42.91", 131045087L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.uae_other), "51.5", "22.6", "56.7", "26.5",
+ new OsmMapValues(getTstring(R.string.uae_other), "51.5", "22.6", "56.7", "26.5",
128934674L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.australia) + "+"
- + Navit.getInstance().getTstring(R.string.oceania),
+ new OsmMapValues(getTstring(R.string.australia) + "+" + getTstring(R.string.oceania),
"89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.australia), "110.5", "-44.2", "154.9",
+ new OsmMapValues(getTstring(R.string.australia), "110.5", "-44.2", "154.9",
"-9.2", 348652900L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.tasmania), "144.0", "-45.1", "155.3",
+ new OsmMapValues(getTstring(R.string.tasmania), "144.0", "-45.1", "155.3",
"-24.8", 253231890L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.victoria) + " + " + Navit.getInstance()
- .getTstring(R.string.new_south_wales), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.new_caledonia), "157.85", "-25.05", "174.15",
+ new OsmMapValues(getTstring(R.string.victoria) + " + " + getTstring(R.string.new_south_wales),
+ "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
+ new OsmMapValues(getTstring(R.string.new_caledonia), "157.85", "-25.05", "174.15",
"-16.85", 115512336L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.newzealand), "165.2", "-47.6", "179.1",
+ new OsmMapValues(getTstring(R.string.newzealand), "165.2", "-47.6", "179.1",
"-33.7", 239264192L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.europe), "-12.97", "33.59", "34.15", "72.10",
+ new OsmMapValues(getTstring(R.string.europe), "-12.97", "33.59", "34.15", "72.10",
11984126789L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.western_europe), "-17.6", "34.5", "42.9",
+ new OsmMapValues(getTstring(R.string.western_europe), "-17.6", "34.5", "42.9",
"70.9", 12648810717L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.austria), "9.4", "46.32", "17.21", "49.1",
+ new OsmMapValues(getTstring(R.string.austria), "9.4", "46.32", "17.21", "49.1",
898273634L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.azores), "-31.62", "36.63", "-24.67",
+ new OsmMapValues(getTstring(R.string.azores), "-31.62", "36.63", "-24.67",
"40.13", 112687225L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.belgium), "2.3", "49.5", "6.5", "51.6",
+ new OsmMapValues(getTstring(R.string.belgium), "2.3", "49.5", "6.5", "51.6",
733035524L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.benelux), "2.08", "48.87", "7.78", "54.52",
+ new OsmMapValues(getTstring(R.string.benelux), "2.08", "48.87", "7.78", "54.52",
1771971595L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.netherlands), "3.07", "50.75", "7.23",
+ new OsmMapValues(getTstring(R.string.netherlands), "3.07", "50.75", "7.23",
"53.73", 1191828033L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.denmark), "7.65", "54.32", "15.58", "58.07",
+ new OsmMapValues(getTstring(R.string.denmark), "7.65", "54.32", "15.58", "58.07",
365606979L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.faroe_islands), "-7.8", "61.3", "-6.1",
+ new OsmMapValues(getTstring(R.string.faroe_islands), "-7.8", "61.3", "-6.1",
"62.5", 109377568L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.france), "-5.45", "42.00", "8.44", "51.68",
+ new OsmMapValues(getTstring(R.string.france), "-5.45", "42.00", "8.44", "51.68",
3907969744L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.alsace), "6.79", "47.27", "8.48", "49.17",
+ new OsmMapValues(getTstring(R.string.alsace), "6.79", "47.27", "8.48", "49.17",
354249349L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.aquitaine), "-2.27", "42.44", "1.50",
+ new OsmMapValues(getTstring(R.string.aquitaine), "-2.27", "42.44", "1.50",
"45.76", 443715019L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.auvergne), "2.01", "44.57", "4.54", "46.85",
+ new OsmMapValues(getTstring(R.string.auvergne), "2.01", "44.57", "4.54", "46.85",
287663213L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.basse_normandie), "-2.09", "48.13", "1.03",
+ new OsmMapValues(getTstring(R.string.basse_normandie), "-2.09", "48.13", "1.03",
"49.98", 262352354L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bourgogne), "2.80", "46.11", "5.58", "48.45",
+ new OsmMapValues(getTstring(R.string.bourgogne), "2.80", "46.11", "5.58", "48.45",
298868796L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bretagne), "-5.58", "46.95", "-0.96",
+ new OsmMapValues(getTstring(R.string.bretagne), "-5.58", "46.95", "-0.96",
"48.99", 382770794L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.centre), "0.01", "46.29", "3.18", "48.99",
+ new OsmMapValues(getTstring(R.string.centre), "0.01", "46.29", "3.18", "48.99",
474224721L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.champagne_ardenne), "3.34", "47.53", "5.94",
+ new OsmMapValues(getTstring(R.string.champagne_ardenne), "3.34", "47.53", "5.94",
"50.28", 269947824L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.corse), "8.12", "41.32", "9.95", "43.28",
+ new OsmMapValues(getTstring(R.string.corse), "8.12", "41.32", "9.95", "43.28",
129902146L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.franche_comte), "5.20", "46.21", "7.83",
+ new OsmMapValues(getTstring(R.string.franche_comte), "5.20", "46.21", "7.83",
"48.07", 324476070L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.haute_normandie), "-0.15", "48.62", "1.85",
+ new OsmMapValues(getTstring(R.string.haute_normandie), "-0.15", "48.62", "1.85",
"50.18", 202782876L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ile_de_france), "1.40", "48.07", "3.61",
+ new OsmMapValues(getTstring(R.string.ile_de_france), "1.40", "48.07", "3.61",
"49.29", 311052699L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.languedoc_roussillon), "1.53", "42.25",
+ new OsmMapValues(getTstring(R.string.languedoc_roussillon), "1.53", "42.25",
"4.89", "45.02", 380145667L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.limousin), "0.58", "44.87", "2.66", "46.50",
+ new OsmMapValues(getTstring(R.string.limousin), "0.58", "44.87", "2.66", "46.50",
206696539L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.lorraine), "4.84", "47.77", "7.72", "49.73",
+ new OsmMapValues(getTstring(R.string.lorraine), "4.84", "47.77", "7.72", "49.73",
330777318L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.midi_pyrenees), "-0.37", "42.18", "3.50",
+ new OsmMapValues(getTstring(R.string.midi_pyrenees), "-0.37", "42.18", "3.50",
"45.10", 462618363L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.nord_pas_de_calais), "1.42", "49.92", "4.49",
+ new OsmMapValues(getTstring(R.string.nord_pas_de_calais), "1.42", "49.92", "4.49",
"51.31", 368467511L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.pays_de_la_loire), "-2.88", "46.20", "0.97",
+ new OsmMapValues(getTstring(R.string.pays_de_la_loire), "-2.88", "46.20", "0.97",
"48.62", 499471143L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.picardie), "1.25", "48.79", "4.31", "50.43",
+ new OsmMapValues(getTstring(R.string.picardie), "1.25", "48.79", "4.31", "50.43",
374308041L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.poitou_charentes), "-1.69", "45.04", "1.26",
+ new OsmMapValues(getTstring(R.string.poitou_charentes), "-1.69", "45.04", "1.26",
"47.23", 342125526L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.provence_alpes_cote_d_azur), "4.21", "42.91",
+ new OsmMapValues(getTstring(R.string.provence_alpes_cote_d_azur), "4.21", "42.91",
"7.99", "45.18", 390306134L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.rhone_alpes), "3.65", "44.07", "7.88",
+ new OsmMapValues(getTstring(R.string.rhone_alpes), "3.65", "44.07", "7.88",
"46.64", 510797942L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.luxembourg), "5.7", "49.4", "6.5", "50.2",
+ new OsmMapValues(getTstring(R.string.luxembourg), "5.7", "49.4", "6.5", "50.2",
1771971595L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.germany), "5.18", "46.84", "15.47", "55.64",
+ new OsmMapValues(getTstring(R.string.germany), "5.18", "46.84", "15.47", "55.64",
3521359466L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.baden_wuerttemberg), "7.32", "47.14",
+ new OsmMapValues(getTstring(R.string.baden_wuerttemberg), "7.32", "47.14",
"10.57", "49.85", 674361124L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bayern), "8.92", "47.22", "13.90", "50.62",
+ new OsmMapValues(getTstring(R.string.bayern), "8.92", "47.22", "13.90", "50.62",
860161150L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mittelfranken), "9.86", "48.78", "11.65",
+ new OsmMapValues(getTstring(R.string.mittelfranken), "9.86", "48.78", "11.65",
"49.84", 203055195L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.niederbayern), "11.55", "47.75", "14.12",
+ new OsmMapValues(getTstring(R.string.niederbayern), "11.55", "47.75", "14.12",
"49.42", 312924770L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oberbayern), "10.67", "47.05", "13.57",
+ new OsmMapValues(getTstring(R.string.oberbayern), "10.67", "47.05", "13.57",
"49.14", 382734883L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oberfranken), "10.31", "49.54", "12.49",
+ new OsmMapValues(getTstring(R.string.oberfranken), "10.31", "49.54", "12.49",
"50.95", 235258691L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oberpfalz), "11.14", "48.71", "13.47",
+ new OsmMapValues(getTstring(R.string.oberpfalz), "11.14", "48.71", "13.47",
"50.43", 264536012L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.schwaben), "9.27", "47.10", "11.36", "49.09",
+ new OsmMapValues(getTstring(R.string.schwaben), "9.27", "47.10", "11.36", "49.09",
321141607L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.unterfranken), "8.59", "49.16", "10.93",
+ new OsmMapValues(getTstring(R.string.unterfranken), "8.59", "49.16", "10.93",
"50.67", 303720890L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.berlin), "13.03", "52.28", "13.81", "52.73",
+ new OsmMapValues(getTstring(R.string.berlin), "13.03", "52.28", "13.81", "52.73",
169019946L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.brandenburg), "11.17", "51.30", "14.83",
+ new OsmMapValues(getTstring(R.string.brandenburg), "11.17", "51.30", "14.83",
"53.63", 323497599L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bremen), "8.43", "52.96", "9.04", "53.66",
+ new OsmMapValues(getTstring(R.string.bremen), "8.43", "52.96", "9.04", "53.66",
150963608L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.hamburg), "9.56", "53.34", "10.39", "53.80",
+ new OsmMapValues(getTstring(R.string.hamburg), "9.56", "53.34", "10.39", "53.80",
156284421L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.hessen), "7.72", "49.34", "10.29", "51.71",
+ new OsmMapValues(getTstring(R.string.hessen), "7.72", "49.34", "10.29", "51.71",
432279328L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mecklenburg_vorpommern), "10.54", "53.05",
+ new OsmMapValues(getTstring(R.string.mecklenburg_vorpommern), "10.54", "53.05",
"14.48", "55.05", 213183908L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.niedersachsen), "6.40", "51.24", "11.69",
+ new OsmMapValues(getTstring(R.string.niedersachsen), "6.40", "51.24", "11.69",
"54.22", 819766939L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.nordrhein_westfalen), "5.46", "50.26",
+ new OsmMapValues(getTstring(R.string.nordrhein_westfalen), "5.46", "50.26",
"9.52", "52.59", 967053517L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.rheinland_pfalz), "6.06", "48.91", "8.56",
+ new OsmMapValues(getTstring(R.string.rheinland_pfalz), "6.06", "48.91", "8.56",
"51.00", 442868899L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.saarland), "6.30", "49.06", "7.46", "49.69",
+ new OsmMapValues(getTstring(R.string.saarland), "6.30", "49.06", "7.46", "49.69",
157721162L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.sachsen_anhalt), "10.50", "50.88", "13.26",
+ new OsmMapValues(getTstring(R.string.sachsen_anhalt), "10.50", "50.88", "13.26",
"53.11", 287785088L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.sachsen), "11.82", "50.11", "15.10", "51.73",
+ new OsmMapValues(getTstring(R.string.sachsen), "11.82", "50.11", "15.10", "51.73",
342620834L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.schleswig_holstein), "7.41", "53.30",
+ new OsmMapValues(getTstring(R.string.schleswig_holstein), "7.41", "53.30",
"11.98", "55.20", 280293910L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.thueringen), "9.81", "50.15", "12.72",
+ new OsmMapValues(getTstring(R.string.thueringen), "9.81", "50.15", "12.72",
"51.70", 269428239L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.iceland), "-25.3", "62.8", "-11.4", "67.5",
+ new OsmMapValues(getTstring(R.string.iceland), "-25.3", "62.8", "-11.4", "67.5",
124837162L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ireland), "-11.17", "51.25", "-5.23", "55.9",
+ new OsmMapValues(getTstring(R.string.ireland), "-11.17", "51.25", "-5.23", "55.9",
234750271L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.italy), "6.52", "36.38", "18.96", "47.19",
+ new OsmMapValues(getTstring(R.string.italy), "6.52", "36.38", "18.96", "47.19",
1610171395L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.spain) + "+"
- + Navit.getInstance().getTstring(R.string.portugal),
+ new OsmMapValues(getTstring(R.string.spain) + "+" + getTstring(R.string.portugal),
"-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mallorca), "2.2", "38.8", "4.7", "40.2",
+ new OsmMapValues(getTstring(R.string.mallorca), "2.2", "38.8", "4.7", "40.2",
137200636L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.galicia), "-10.0", "41.7", "-6.3", "44.1",
+ new OsmMapValues(getTstring(R.string.galicia), "-10.0", "41.7", "-6.3", "44.1",
174549553L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.scandinavia), "4.0", "54.4", "32.1", "71.5",
+ new OsmMapValues(getTstring(R.string.scandinavia), "4.0", "54.4", "32.1", "71.5",
1398661090L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.finland), "18.6", "59.2", "32.3", "70.3",
+ new OsmMapValues(getTstring(R.string.finland), "18.6", "59.2", "32.3", "70.3",
460997178L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.denmark), "7.49", "54.33", "13.05", "57.88",
+ new OsmMapValues(getTstring(R.string.denmark), "7.49", "54.33", "13.05", "57.88",
321870414L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.switzerland), "5.79", "45.74", "10.59",
+ new OsmMapValues(getTstring(R.string.switzerland), "5.79", "45.74", "10.59",
"47.84", 552565332L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.united_kingdom), "-9.7", "49.6", "2.2",
+ new OsmMapValues(getTstring(R.string.united_kingdom), "-9.7", "49.6", "2.2",
"61.2", 901724648L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.england), "-7.80", "48.93", "2.41", "56.14",
+ new OsmMapValues(getTstring(R.string.england), "-7.80", "48.93", "2.41", "56.14",
937728414L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.buckinghamshire), "-1.19", "51.44", "-0.43",
+ new OsmMapValues(getTstring(R.string.buckinghamshire), "-1.19", "51.44", "-0.43",
"52.25", 142256978L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.cambridgeshire), "-0.55", "51.96", "0.56",
+ new OsmMapValues(getTstring(R.string.cambridgeshire), "-0.55", "51.96", "0.56",
"52.79", 142334001L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.cumbria), "-3.96", "53.85", "-2.11", "55.24",
+ new OsmMapValues(getTstring(R.string.cumbria), "-3.96", "53.85", "-2.11", "55.24",
144422460L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.east_yorkshire_with_hull), "-1.16", "53.50",
+ new OsmMapValues(getTstring(R.string.east_yorkshire_with_hull), "-1.16", "53.50",
"0.54", "54.26", 141518744L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.essex), "-0.07", "51.40", "1.36", "52.14",
+ new OsmMapValues(getTstring(R.string.essex), "-0.07", "51.40", "1.36", "52.14",
162542730L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.herefordshire), "-3.19", "51.78", "-2.29",
+ new OsmMapValues(getTstring(R.string.herefordshire), "-3.19", "51.78", "-2.29",
"52.45", 129368660L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.kent), "-0.02", "50.81", "1.65", "51.53",
+ new OsmMapValues(getTstring(R.string.kent), "-0.02", "50.81", "1.65", "51.53",
145482562L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.lancashire), "-3.20", "53.43", "-2.00",
+ new OsmMapValues(getTstring(R.string.lancashire), "-3.20", "53.43", "-2.00",
"54.29", 148964975L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.leicestershire), "-1.65", "52.34", "-0.61",
+ new OsmMapValues(getTstring(R.string.leicestershire), "-1.65", "52.34", "-0.61",
"53.03", 154199956L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.norfolk), "0.10", "52.30", "2.04", "53.41",
+ new OsmMapValues(getTstring(R.string.norfolk), "0.10", "52.30", "2.04", "53.41",
146017009L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.nottinghamshire), "-1.39", "52.73", "-0.62",
+ new OsmMapValues(getTstring(R.string.nottinghamshire), "-1.39", "52.73", "-0.62",
"53.55", 147986548L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oxfordshire), "-1.77", "51.41", "-0.82",
+ new OsmMapValues(getTstring(R.string.oxfordshire), "-1.77", "51.41", "-0.82",
"52.22", 142240992L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.shropshire), "-3.29", "52.26", "-2.18",
+ new OsmMapValues(getTstring(R.string.shropshire), "-3.29", "52.26", "-2.18",
"53.05", 136909363L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.somerset), "-3.89", "50.77", "-2.20",
+ new OsmMapValues(getTstring(R.string.somerset), "-3.89", "50.77", "-2.20",
"51.40", 145186096L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.south_yorkshire), "-1.88", "53.25", "-0.80",
+ new OsmMapValues(getTstring(R.string.south_yorkshire), "-1.88", "53.25", "-0.80",
"53.71", 145902650L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.suffolk), "0.29", "51.88", "1.81", "52.60",
+ new OsmMapValues(getTstring(R.string.suffolk), "0.29", "51.88", "1.81", "52.60",
143799697L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.surrey), "-0.90", "51.02", "0.10", "51.52",
+ new OsmMapValues(getTstring(R.string.surrey), "-0.90", "51.02", "0.10", "51.52",
157987139L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.wiltshire), "-2.41", "50.90", "-1.44",
+ new OsmMapValues(getTstring(R.string.wiltshire), "-2.41", "50.90", "-1.44",
"51.76", 138652346L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.scotland), "-8.13", "54.49", "-0.15",
+ new OsmMapValues(getTstring(R.string.scotland), "-8.13", "54.49", "-0.15",
"61.40", 258853845L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.wales), "-5.56", "51.28", "-2.60", "53.60",
+ new OsmMapValues(getTstring(R.string.wales), "-5.56", "51.28", "-2.60", "53.60",
193593409L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.albania), "19.09", "39.55", "21.12", "42.72",
+ new OsmMapValues(getTstring(R.string.albania), "19.09", "39.55", "21.12", "42.72",
146199817L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.belarus), "23.12", "51.21", "32.87", "56.23",
+ new OsmMapValues(getTstring(R.string.belarus), "23.12", "51.21", "32.87", "56.23",
324470696L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.russian_federation), "27.9", "41.5", "190.4",
+ new OsmMapValues(getTstring(R.string.russian_federation), "27.9", "41.5", "190.4",
"77.6", 2148314279L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bulgaria), "24.7", "42.1", "24.8", "42.1",
+ new OsmMapValues(getTstring(R.string.bulgaria), "24.7", "42.1", "24.8", "42.1",
109869373L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bosnia_and_herzegovina), "15.69", "42.52",
+ new OsmMapValues(getTstring(R.string.bosnia_and_herzegovina), "15.69", "42.52",
"19.67", "45.32", 187122485L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.czech_republic), "11.91", "48.48", "19.02",
+ new OsmMapValues(getTstring(R.string.czech_republic), "11.91", "48.48", "19.02",
"51.17", 904838442L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.croatia), "13.4", "42.1", "19.4", "46.9",
+ new OsmMapValues(getTstring(R.string.croatia), "13.4", "42.1", "19.4", "46.9",
460854751L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.estonia), "21.5", "57.5", "28.2", "59.6",
+ new OsmMapValues(getTstring(R.string.estonia), "21.5", "57.5", "28.2", "59.6",
173378927L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.greece), "28.9", "37.8", "29.0", "37.8",
+ new OsmMapValues(getTstring(R.string.greece), "28.9", "37.8", "29.0", "37.8",
109435051L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.crete), "23.3", "34.5", "26.8", "36.0",
+ new OsmMapValues(getTstring(R.string.crete), "23.3", "34.5", "26.8", "36.0",
115985063L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.hungary), "16.08", "45.57", "23.03", "48.39",
+ new OsmMapValues(getTstring(R.string.hungary), "16.08", "45.57", "23.03", "48.39",
350318541L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.latvia), "20.7", "55.6", "28.3", "58.1",
+ new OsmMapValues(getTstring(R.string.latvia), "20.7", "55.6", "28.3", "58.1",
188188140L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.lithuania), "20.9", "53.8", "26.9", "56.5",
+ new OsmMapValues(getTstring(R.string.lithuania), "20.9", "53.8", "26.9", "56.5",
217852597L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.poland), "13.6", "48.8", "24.5", "55.0",
+ new OsmMapValues(getTstring(R.string.poland), "13.6", "48.8", "24.5", "55.0",
1464968657L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.romania), "20.3", "43.5", "29.9", "48.4",
+ new OsmMapValues(getTstring(R.string.romania), "20.3", "43.5", "29.9", "48.4",
347931565L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.slovakia), "16.8", "47.7", "22.6", "49.7",
+ new OsmMapValues(getTstring(R.string.slovakia), "16.8", "47.7", "22.6", "49.7",
420533039L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ukraine), "22.0", "44.3", "40.4", "52.4",
+ new OsmMapValues(getTstring(R.string.ukraine), "22.0", "44.3", "40.4", "52.4",
793611912L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.north_america), "-178.1", "6.5", "-10.4",
+ new OsmMapValues(getTstring(R.string.north_america), "-178.1", "6.5", "-10.4",
"84.0", 5601866516L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.alaska), "-179.5", "49.5", "-129", "71.6",
+ new OsmMapValues(getTstring(R.string.alaska), "-179.5", "49.5", "-129", "71.6",
207746039L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.canada), "-141.3", "41.5", "-52.2", "70.2",
+ new OsmMapValues(getTstring(R.string.canada), "-141.3", "41.5", "-52.2", "70.2",
2635719651L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.hawaii), "-161.07", "18.49", "-154.45",
+ new OsmMapValues(getTstring(R.string.hawaii), "-161.07", "18.49", "-154.45",
"22.85", 115016656L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.usa) + Navit.getInstance()
- .getTstring(R.string.except_alaska_and_hawaii), "-125.4", "24.3", "-66.5", "49.3",
- 4060487198L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.midwest), "-104.11", "35.92", "-80.46",
+ new OsmMapValues(getTstring(R.string.usa) + getTstring(R.string.except_alaska_and_hawaii),
+ "-125.4", "24.3", "-66.5", "49.3", 4060487198L, 1),
+ new OsmMapValues(getTstring(R.string.midwest), "-104.11", "35.92", "-80.46",
"49.46", 1145596450L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.michigan), "-90.47", "41.64", "-79.00",
+ new OsmMapValues(getTstring(R.string.michigan), "-90.47", "41.64", "-79.00",
"49.37", 538247019L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ohio), "-84.87", "38.05", "-79.85", "43.53",
+ new OsmMapValues(getTstring(R.string.ohio), "-84.87", "38.05", "-79.85", "43.53",
277022336L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.northeast), "-80.58", "38.72", "-66.83",
+ new OsmMapValues(getTstring(R.string.northeast), "-80.58", "38.72", "-66.83",
"47.53", 1017160709L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.massachusetts), "-73.56", "40.78", "-68.67",
+ new OsmMapValues(getTstring(R.string.massachusetts), "-73.56", "40.78", "-68.67",
"42.94", 340055487L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.vermont), "-73.49", "42.68", "-71.41",
+ new OsmMapValues(getTstring(R.string.vermont), "-73.49", "42.68", "-71.41",
"45.07", 139626067L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.pacific), "-180.05", "15.87", "-129.75",
+ new OsmMapValues(getTstring(R.string.pacific), "-180.05", "15.87", "-129.75",
"73.04", 207090640L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.south), "-106.70", "23.98", "-71.46",
+ new OsmMapValues(getTstring(R.string.south), "-106.70", "23.98", "-71.46",
"40.70", 1747935356L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.arkansas), "-94.67", "32.95", "-89.59",
+ new OsmMapValues(getTstring(R.string.arkansas), "-94.67", "32.95", "-89.59",
"36.60", 155658661L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.district_of_columbia), "-77.17", "38.74",
+ new OsmMapValues(getTstring(R.string.district_of_columbia), "-77.17", "38.74",
"-76.86", "39.05", 129235755L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.florida), "-88.75", "23.63", "-77.67",
+ new OsmMapValues(getTstring(R.string.florida), "-88.75", "23.63", "-77.67",
"31.05", 224022108L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.louisiana), "-94.09", "28.09", "-88.62",
+ new OsmMapValues(getTstring(R.string.louisiana), "-94.09", "28.09", "-88.62",
"33.07", 210120605L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.maryland), "-79.54", "37.83", "-74.99",
+ new OsmMapValues(getTstring(R.string.maryland), "-79.54", "37.83", "-74.99",
"40.22", 276462622L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mississippi), "-91.71", "29.99", "-88.04",
+ new OsmMapValues(getTstring(R.string.mississippi), "-91.71", "29.99", "-88.04",
"35.05", 177858031L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oklahoma), "-103.41", "33.56", "-94.38",
+ new OsmMapValues(getTstring(R.string.oklahoma), "-103.41", "33.56", "-94.38",
"37.38", 200061473L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.texas), "-106.96", "25.62", "-92.97",
+ new OsmMapValues(getTstring(R.string.texas), "-106.96", "25.62", "-92.97",
"36.58", 430089141L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.virginia), "-83.73", "36.49", "-74.25",
+ new OsmMapValues(getTstring(R.string.virginia), "-83.73", "36.49", "-74.25",
"39.52", 384187569L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.west_virginia), "-82.70", "37.15", "-77.66",
+ new OsmMapValues(getTstring(R.string.west_virginia), "-82.70", "37.15", "-77.66",
"40.97", 220552071L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.west), "-133.11", "31.28", "-101.99",
+ new OsmMapValues(getTstring(R.string.west), "-133.11", "31.28", "-101.99",
"49.51", 1152909162L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.arizona), "-114.88", "30.01", "-108.99",
+ new OsmMapValues(getTstring(R.string.arizona), "-114.88", "30.01", "-108.99",
"37.06", 182826833L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.california), "-125.94", "32.43", "-114.08",
+ new OsmMapValues(getTstring(R.string.california), "-125.94", "32.43", "-114.08",
"42.07", 586923326L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.colorado), "-109.11", "36.52", "-100.41",
+ new OsmMapValues(getTstring(R.string.colorado), "-109.11", "36.52", "-100.41",
"41.05", 228623724L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.idaho), "-117.30", "41.93", "-110.99",
+ new OsmMapValues(getTstring(R.string.idaho), "-117.30", "41.93", "-110.99",
"49.18", 170684507L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.montana), "-116.10", "44.31", "-102.64",
+ new OsmMapValues(getTstring(R.string.montana), "-116.10", "44.31", "-102.64",
"49.74", 176229800L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.new_mexico), "-109.10", "26.98", "-96.07",
+ new OsmMapValues(getTstring(R.string.new_mexico), "-109.10", "26.98", "-96.07",
"37.05", 361793070L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.nevada), "-120.2", "35.0", "-113.8", "42.1",
+ new OsmMapValues(getTstring(R.string.nevada), "-120.2", "35.0", "-113.8", "42.1",
200614482L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.oregon), "-124.8", "41.8", "-116.3", "46.3",
+ new OsmMapValues(getTstring(R.string.oregon), "-124.8", "41.8", "-116.3", "46.3",
211462685L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.utah), "-114.11", "36.95", "-108.99",
+ new OsmMapValues(getTstring(R.string.utah), "-114.11", "36.95", "-108.99",
"42.05", 151590197L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.washington_state), "-125.0", "45.5",
+ new OsmMapValues(getTstring(R.string.washington_state), "-125.0", "45.5",
"-116.9", "49.0", 222553768L, 2),
- new osm_map_values(Navit.getInstance().getTstring(R.string.south_middle_america), "-83.5", "-56.3",
+ new OsmMapValues(getTstring(R.string.south_middle_america), "-83.5", "-56.3",
"-30.8", "13.7", 958895383L, 0),
- new osm_map_values(Navit.getInstance().getTstring(R.string.argentina), "-73.9", "-57.3", "-51.6",
+ new OsmMapValues(getTstring(R.string.argentina), "-73.9", "-57.3", "-51.6",
"-21.0", 376857648L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.argentina) + "+"
- + Navit.getInstance().getTstring(R.string.chile),
+ new OsmMapValues(getTstring(R.string.argentina) + "+" + getTstring(R.string.chile),
"-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.bolivia), "-70.5", "-23.1", "-57.3", "-9.3",
+ new OsmMapValues(getTstring(R.string.bolivia), "-70.5", "-23.1", "-57.3", "-9.3",
175937824L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.brazil), "-71.4", "-34.7", "-32.8", "5.4",
+ new OsmMapValues(getTstring(R.string.brazil), "-71.4", "-34.7", "-32.8", "5.4",
664872975L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.chile), "-81.77", "-58.50", "-65.46",
+ new OsmMapValues(getTstring(R.string.chile), "-81.77", "-58.50", "-65.46",
"-17.41", 241657330L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.cuba), "-85.3", "19.6", "-74.0", "23.6",
+ new OsmMapValues(getTstring(R.string.cuba), "-85.3", "19.6", "-74.0", "23.6",
129043575L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.colombia), "-79.1", "-4.0", "-66.7", "12.6",
+ new OsmMapValues(getTstring(R.string.colombia), "-79.1", "-4.0", "-66.7", "12.6",
212016580L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.ecuador), "-82.6", "-5.4", "-74.4", "2.3",
+ new OsmMapValues(getTstring(R.string.ecuador), "-82.6", "-5.4", "-74.4", "2.3",
158857591L, 1),
- new osm_map_values(
- Navit.getInstance().getTstring(R.string.guyana) + "+"
- + Navit.getInstance().getTstring(R.string.suriname) + "+"
- + Navit.getInstance().getTstring(R.string.guyane_francaise), "-62.0", "1.0", "-51.2",
+ new OsmMapValues(getTstring(R.string.guyana) + "+" + getTstring(R.string.suriname) + "+"
+ + getTstring(R.string.guyane_francaise), "-62.0", "1.0", "-51.2",
"8.9", 123000072L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.haiti) + "+"
- + Navit.getInstance().getTstring(R.string.dominican_republic), "-74.8", "17.3", "-68.2", "20.1",
- 149925689L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.jamaica), "-78.6", "17.4", "-75.9", "18.9",
+ new OsmMapValues(getTstring(R.string.haiti) + "+" + getTstring(R.string.dominican_republic),
+ "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1),
+ new OsmMapValues(getTstring(R.string.jamaica), "-78.6", "17.4", "-75.9", "18.9",
113961998L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.mexico), "-117.6", "14.1", "-86.4", "32.8",
+ new OsmMapValues(getTstring(R.string.mexico), "-117.6", "14.1", "-86.4", "32.8",
551307973L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.paraguay), "-63.8", "-28.1", "-53.6",
+ new OsmMapValues(getTstring(R.string.paraguay), "-63.8", "-28.1", "-53.6",
"-18.8", 159498397L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.peru), "-82.4", "-18.1", "-67.5", "0.4",
+ new OsmMapValues(getTstring(R.string.peru), "-82.4", "-18.1", "-67.5", "0.4",
212490557L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.uruguay), "-59.2", "-36.5", "-51.7", "-29.7",
- 157482719L, 1),
- new osm_map_values(Navit.getInstance().getTstring(R.string.venezuela), "-73.6", "0.4", "-59.7", "12.8",
- 167295729L, 1)
+ new OsmMapValues(getTstring(R.string.uruguay), "-59.2", "-36.5", "-51.7", "-29.7",
+ 157482719L, 1),
+ new OsmMapValues(getTstring(R.string.venezuela), "-73.6", "0.4", "-59.7", "12.8",
+ 167295729L, 1)
};
//we should try to resume
private static final int SOCKET_CONNECT_TIMEOUT = 60000; // 60 secs.
@@ -488,23 +472,23 @@ public class NavitMapDownloader extends Thread {
private static final int MAP_READ_FILE_BUFFER = 1024 * 64;
private static final int UPDATE_PROGRESS_TIME_NS = 1000 * 1000000; // 1ns=1E-9s
private static final int MAX_RETRIES = 5;
- private final String TAG = this.getClass().getName();
- private final String map_filename_path;
- private final osm_map_values map_values;
- private final int map_id;
- private Boolean stop_me = false;
- private long uiLastUpdated = -1;
- private Boolean retryDownload = false; //Download failed, but
- private int retry_counter = 0;
-
- NavitMapDownloader(int map_id) {
- this.map_values = osm_maps[map_id];
- this.map_id = map_id;
- this.map_filename_path = Navit.map_filename_path;
+ private static final String TAG = "NavitMapDownLoader";
+ private final String mMapFilenamePath;
+ private final OsmMapValues mMapValues;
+ private final int mMapId;
+ private Boolean mStopMe = false;
+ private long mUiLastUpdated = -1;
+ private Boolean mRetryDownload = false; //Download failed, but
+ private int mRetryCounter = 0;
+
+ NavitMapDownloader(int mapId) {
+ this.mMapValues = osm_maps[mapId];
+ this.mMapId = mapId;
+ this.mMapFilenamePath = Navit.sMapFilenamePath;
}
- public static NavitMap[] getAvailableMaps() {
- class filterMaps implements FilenameFilter {
+ static NavitMap[] getAvailableMaps() {
+ class FilterMaps implements FilenameFilter {
public boolean accept(File dir, String filename) {
return (filename.endsWith(".bin"));
@@ -512,75 +496,76 @@ public class NavitMapDownloader extends Thread {
}
NavitMap[] maps = new NavitMap[0];
- File map_dir = new File(Navit.map_filename_path);
- String[] map_file_names = map_dir.list(new filterMaps());
- if (map_file_names != null) {
- maps = new NavitMap[map_file_names.length];
- for (int map_file_index = 0; map_file_index < map_file_names.length; map_file_index++) {
- maps[map_file_index] = new NavitMap(Navit.map_filename_path,
- map_file_names[map_file_index]);
+ File mapDir = new File(Navit.sMapFilenamePath);
+ String[] mapFileNames = mapDir.list(new FilterMaps());
+ if (mapFileNames != null) {
+ maps = new NavitMap[mapFileNames.length];
+ for (int mapFileIndex = 0; mapFileIndex < mapFileNames.length; mapFileIndex++) {
+ maps[mapFileIndex] = new NavitMap(Navit.sMapFilenamePath,
+ mapFileNames[mapFileIndex]);
}
}
return maps;
}
+ @Override
public void run() {
- stop_me = false;
- retry_counter = 0;
+ mStopMe = false;
+ mRetryCounter = 0;
- Log.v(TAG, "start download " + map_values.map_name);
- updateProgress(0, map_values.est_size_bytes,
- Navit.getInstance().getTstring(R.string.map_downloading) + ": " + map_values.map_name);
+ Log.v(TAG, "start download " + mMapValues.mMapName);
+ updateProgress(0, mMapValues.mEstSizeBytes,
+ getTstring(R.string.map_downloading) + ": " + mMapValues.mMapName);
boolean success;
do {
try {
- Thread.sleep(10 + retry_counter * 1000);
+ Thread.sleep(10 + mRetryCounter * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- retryDownload = false;
+ mRetryDownload = false;
success = download_osm_map();
} while (!success
- && retryDownload
- && retry_counter < MAX_RETRIES
- && !stop_me);
+ && mRetryDownload
+ && mRetryCounter < MAX_RETRIES
+ && !mStopMe);
if (success) {
- toast(map_values.map_name + " " + Navit.getInstance().getTstring(R.string.map_download_ready));
+ toast(mMapValues.mMapName + " " + getTstring(R.string.map_download_ready));
getMapInfoFile().delete();
Log.d(TAG, "success");
}
- if (success || stop_me) {
+ if (success || mStopMe) {
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_MAP_DOWNLOAD_FINISHED,
- map_filename_path + map_values.map_name + ".bin", null, -1, success ? 1 : 0, map_id);
+ mMapFilenamePath + mMapValues.mMapName + ".bin", null, -1, success ? 1 : 0, mMapId);
}
}
- public void stop_thread() {
- stop_me = true;
- Log.d(TAG, "stop_me -> true");
+ void stop_thread() {
+ mStopMe = true;
+ Log.d(TAG, "mStopMe -> true");
}
- private boolean checkFreeSpace(long needed_bytes) {
- long free_space = getFreeSpace();
+ private boolean checkFreeSpace(long neededBytes) {
+ long freeSpace = getFreeSpace();
- if (needed_bytes <= 0) {
- needed_bytes = MAP_WRITE_FILE_BUFFER;
+ if (neededBytes <= 0) {
+ neededBytes = MAP_WRITE_FILE_BUFFER;
}
- if (free_space < needed_bytes) {
+ if (freeSpace < neededBytes) {
String msg;
Log.e(TAG, "Not enough free space or media not available. Please free at least "
- + needed_bytes / 1024 / 1024 + "Mb.");
- if (free_space < 0) {
- msg = Navit.getInstance().getTstring(R.string.map_download_medium_unavailable);
+ + neededBytes / 1024 / 1024 + "Mb.");
+ if (freeSpace < 0) {
+ msg = getTstring(R.string.map_download_medium_unavailable);
} else {
- msg = Navit.getInstance().getTstring(R.string.map_download_not_enough_free_space);
+ msg = getTstring(R.string.map_download_not_enough_free_space);
}
- updateProgress(free_space, needed_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n" + msg);
+ updateProgress(freeSpace, neededBytes,
+ getTstring(R.string.map_download_download_error) + "\n" + msg);
return false;
}
return true;
@@ -590,8 +575,8 @@ public class NavitMapDownloader extends Thread {
File finalOutputFile = getMapFile();
if (finalOutputFile.exists()) {
- Message msg = Message.obtain(Navit.getInstance().getNavitGraphics().callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
+ Message msg = Message.obtain(NavitGraphics.sCallbackHandler,
+ NavitGraphics.MsgType.CLB_DELETE_MAP.ordinal());
Bundle b = new Bundle();
b.putString("title", finalOutputFile.getAbsolutePath());
msg.setData(b);
@@ -603,15 +588,15 @@ public class NavitMapDownloader extends Thread {
private boolean download_osm_map() {
- long already_read = 0;
- long real_size_bytes;
+ long alreadyRead = 0;
+ long realSizeBytes;
boolean resume = true;
File outputFile = getDestinationFile();
- long old_download_size = outputFile.length();
+ long oldDownloadSize = outputFile.length();
URL url = null;
- if (old_download_size > 0) {
+ if (oldDownloadSize > 0) {
url = readFileInfo();
}
@@ -625,32 +610,32 @@ public class NavitMapDownloader extends Thread {
if (c != null) {
if (resume) {
- c.setRequestProperty("Range", "bytes=" + old_download_size + "-");
- already_read = old_download_size;
+ c.setRequestProperty("Range", "bytes=" + oldDownloadSize + "-");
+ alreadyRead = oldDownloadSize;
}
try {
- real_size_bytes = Long.parseLong(c.getHeaderField("Content-Length")) + already_read;
+ realSizeBytes = Long.parseLong(c.getHeaderField("Content-Length")) + alreadyRead;
} catch (Exception e) {
- real_size_bytes = -1;
+ realSizeBytes = -1;
}
long fileTime = c.getLastModified();
if (!resume) {
outputFile.delete();
- writeFileInfo(c, real_size_bytes);
+ writeFileInfo(c, realSizeBytes);
}
- if (real_size_bytes <= 0) {
- real_size_bytes = map_values.est_size_bytes;
+ if (realSizeBytes <= 0) {
+ realSizeBytes = mMapValues.mEstSizeBytes;
}
- Log.d(TAG, "size: " + real_size_bytes + ", read: " + already_read + ", timestamp: "
+ Log.d(TAG, "size: " + realSizeBytes + ", read: " + alreadyRead + ", timestamp: "
+ fileTime
+ ", Connection ref: " + c.getURL());
- if (checkFreeSpace(real_size_bytes - already_read)
- && downloadData(c, already_read, real_size_bytes, resume, outputFile)) {
+ if (checkFreeSpace(realSizeBytes - alreadyRead)
+ && downloadData(c, alreadyRead, realSizeBytes, resume, outputFile)) {
File finalOutputFile = getMapFile();
// delete an already existing file first
@@ -664,19 +649,19 @@ public class NavitMapDownloader extends Thread {
}
private File getDestinationFile() {
- File outputFile = new File(map_filename_path, map_values.map_name + ".tmp");
+ File outputFile = new File(mMapFilenamePath, mMapValues.mMapName + ".tmp");
outputFile.getParentFile().mkdir();
return outputFile;
}
- private boolean downloadData(URLConnection c, long already_read, long real_size_bytes, boolean resume,
+ private boolean downloadData(URLConnection c, long alreadyRead, long realSizeBytes, boolean resume,
File outputFile) {
boolean success = false;
BufferedOutputStream buf = getOutputStream(outputFile, resume);
BufferedInputStream bif = getInputStream(c);
if (buf != null && bif != null) {
- success = readData(buf, bif, already_read, real_size_bytes);
+ success = readData(buf, bif, alreadyRead, realSizeBytes);
// always cleanup, as we might get errors when trying to resume
try {
buf.flush();
@@ -694,11 +679,11 @@ public class NavitMapDownloader extends Thread {
URL url;
try {
url =
- new URL("http://maps.navit-project.org/api/map/?bbox=" + map_values.lon1 + ","
- + map_values.lat1
- + "," + map_values.lon2 + "," + map_values.lat2);
+ new URL("http://maps.navit-project.org/api/map/?bbox=" + mMapValues.mLon1 + ","
+ + mMapValues.mLat1
+ + "," + mMapValues.mLon2 + "," + mMapValues.mLat2);
} catch (MalformedURLException e) {
- Log.e(TAG, "We failed to create a URL to " + map_values.map_name);
+ Log.e(TAG, "We failed to create a URL to " + mMapValues.mMapName);
e.printStackTrace();
return null;
}
@@ -708,7 +693,7 @@ public class NavitMapDownloader extends Thread {
private long getFreeSpace() {
try {
- StatFs fsInfo = new StatFs(map_filename_path);
+ StatFs fsInfo = new StatFs(mMapFilenamePath);
return (long) fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
} catch (Exception e) {
return -1;
@@ -721,7 +706,7 @@ public class NavitMapDownloader extends Thread {
bif = new BufferedInputStream(c.getInputStream(), MAP_READ_FILE_BUFFER);
} catch (FileNotFoundException e) {
Log.e(TAG, "File not found on server: " + e);
- if (retry_counter > 0) {
+ if (mRetryCounter > 0) {
getMapInfoFile().delete();
}
enableRetry();
@@ -735,11 +720,11 @@ public class NavitMapDownloader extends Thread {
}
private File getMapFile() {
- return new File(map_filename_path, map_values.map_name + ".bin");
+ return new File(mMapFilenamePath, mMapValues.mMapName + ".bin");
}
private File getMapInfoFile() {
- return new File(map_filename_path, map_values.map_name + ".tmp.info");
+ return new File(mMapFilenamePath, mMapValues.mMapName + ".tmp.info");
}
private BufferedOutputStream getOutputStream(File outputFile, boolean resume) {
@@ -770,44 +755,44 @@ public class NavitMapDownloader extends Thread {
return c;
}
- private boolean readData(OutputStream buf, InputStream bif, long already_read,
- long real_size_bytes) {
- long start_timestamp = System.nanoTime();
+ private boolean readData(OutputStream buf, InputStream bif, long alreadyRead,
+ long realSizeBytes) {
+ long startTimestamp = System.nanoTime();
byte[] buffer = new byte[MAP_WRITE_MEM_BUFFER];
int len1;
- long startOffset = already_read;
+ long startOffset = alreadyRead;
boolean success = false;
try {
- while (!stop_me && (len1 = bif.read(buffer)) != -1) {
- already_read += len1;
- updateProgress(start_timestamp, startOffset, already_read, real_size_bytes);
+ while (!mStopMe && (len1 = bif.read(buffer)) != -1) {
+ alreadyRead += len1;
+ updateProgress(startTimestamp, startOffset, alreadyRead, realSizeBytes);
try {
buf.write(buffer, 0, len1);
} catch (IOException e) {
Log.d(TAG, "Error: " + e);
- if (!checkFreeSpace(real_size_bytes - already_read + MAP_WRITE_FILE_BUFFER)) {
+ if (!checkFreeSpace(realSizeBytes - alreadyRead + MAP_WRITE_FILE_BUFFER)) {
if (deleteMap()) {
enableRetry();
} else {
- updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error) + "\n"
- + Navit.getInstance().getTstring(R.string.map_download_not_enough_free_space));
+ updateProgress(alreadyRead, realSizeBytes,
+ getTstring(R.string.map_download_download_error) + "\n"
+ + getTstring(R.string.map_download_not_enough_free_space));
}
} else {
- updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_error_writing_map));
+ updateProgress(alreadyRead, realSizeBytes,
+ getTstring(R.string.map_download_error_writing_map));
}
return false;
}
}
- if (stop_me) {
- toast(Navit.getInstance().getTstring(R.string.map_download_download_aborted));
- } else if (already_read < real_size_bytes) {
- Log.d(TAG, "Server send only " + already_read + " bytes of " + real_size_bytes);
+ if (mStopMe) {
+ toast(getTstring(R.string.map_download_download_aborted));
+ } else if (alreadyRead < realSizeBytes) {
+ Log.d(TAG, "Server send only " + alreadyRead + " bytes of " + realSizeBytes);
enableRetry();
} else {
success = true;
@@ -816,8 +801,8 @@ public class NavitMapDownloader extends Thread {
Log.d(TAG, "Error: " + e);
enableRetry();
- updateProgress(already_read, real_size_bytes,
- Navit.getInstance().getTstring(R.string.map_download_download_error));
+ updateProgress(alreadyRead, realSizeBytes,
+ getTstring(R.string.map_download_download_error));
}
return success;
@@ -828,13 +813,13 @@ public class NavitMapDownloader extends Thread {
try {
ObjectInputStream infoStream = new ObjectInputStream(
new FileInputStream(getMapInfoFile()));
- String resume_proto = infoStream.readUTF();
infoStream.readUTF(); // read the host name (unused for now)
- String resume_file = infoStream.readUTF();
+ String resumeFile = infoStream.readUTF();
infoStream.close();
// looks like the same file, try to resume
Log.v(TAG, "Try to resume download");
- url = new URL(resume_proto + "://" + "maps.navit-project.org" + resume_file);
+ String resumeProto = infoStream.readUTF();
+ url = new URL(resumeProto + "://" + "maps.navit-project.org" + resumeFile);
} catch (Exception e) {
getMapInfoFile().delete();
}
@@ -848,36 +833,36 @@ public class NavitMapDownloader extends Thread {
private void updateProgress(long startTime, long offsetBytes, long readBytes, long maxBytes) {
long currentTime = System.nanoTime();
- if ((currentTime > uiLastUpdated + UPDATE_PROGRESS_TIME_NS) && startTime != currentTime) {
- float per_second_overall = (readBytes - offsetBytes) / ((currentTime - startTime) / 1000000000f);
- long bytes_remaining = maxBytes - readBytes;
- int eta_seconds = (int) (bytes_remaining / per_second_overall);
+ if ((currentTime > mUiLastUpdated + UPDATE_PROGRESS_TIME_NS) && startTime != currentTime) {
+ float perSecondOverall = (readBytes - offsetBytes) / ((currentTime - startTime) / 1000000000f);
+ long bytesRemaining = maxBytes - readBytes;
+ int etaSeconds = (int) (bytesRemaining / perSecondOverall);
- String eta_string;
- if (eta_seconds > 60) {
- eta_string = (int) (eta_seconds / 60f) + " m";
+ String etaString;
+ if (etaSeconds > 60) {
+ etaString = (int) (etaSeconds / 60f) + " m";
} else {
- eta_string = eta_seconds + " s";
+ etaString = etaSeconds + " s";
}
String info = String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s",
- Navit.getInstance().getTstring(R.string.map_downloading),
- map_values.map_name, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
- per_second_overall / 1024f, Navit.getInstance().getTstring(R.string.map_download_eta),
- eta_string);
+ getTstring(R.string.map_downloading),
+ mMapValues.mMapName, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
+ perSecondOverall / 1024f, getTstring(R.string.map_download_eta),
+ etaString);
- if (retry_counter > 0) {
- info += "\n Retry " + retry_counter + "/" + MAX_RETRIES;
+ if (mRetryCounter > 0) {
+ info += "\n Retry " + mRetryCounter + "/" + MAX_RETRIES;
}
Log.d(TAG, "info: " + info);
updateProgress(readBytes, maxBytes, info);
- uiLastUpdated = currentTime;
+ mUiLastUpdated = currentTime;
}
}
private void updateProgress(long positionBytes, long maximumBytes, String infoText) {
NavitDialogs.sendDialogMessage(NavitDialogs.MSG_PROGRESS_BAR,
- Navit.getInstance().getTstring(R.string.map_download_title), infoText,
+ getTstring(R.string.map_download_title), infoText,
NavitDialogs.DIALOG_MAPDOWNLOAD, (int) (maximumBytes / 1024),
(int) (positionBytes / 1024));
}
@@ -899,53 +884,45 @@ public class NavitMapDownloader extends Thread {
}
private void enableRetry() {
- retryDownload = true;
- retry_counter++;
+ mRetryDownload = true;
+ mRetryCounter++;
}
- public static class osm_map_values {
-
- final String lon1;
- final String lat1;
- final String lon2;
- final String lat2;
- final String map_name;
- final long est_size_bytes;
- final int level;
-
-
- private osm_map_values(String mapname, String lon_1, String lat_1, String lon_2,
- String lat_2,
- long bytes_est, int level) {
- this.map_name = mapname;
- this.lon1 = lon_1;
- this.lat1 = lat_1;
- this.lon2 = lon_2;
- this.lat2 = lat_2;
- this.est_size_bytes = bytes_est;
- this.level = level;
+ static class OsmMapValues {
+
+ final String mLon1;
+ final String mLat1;
+ final String mLon2;
+ final String mLat2;
+ final String mMapName;
+ final long mEstSizeBytes;
+ final int mLevel;
+
+
+ private OsmMapValues(String mapName, String lon1, String lat1, String lon2,
+ String lat2,
+ long bytesEst, int level) {
+ this.mMapName = mapName;
+ this.mLon1 = lon1;
+ this.mLat1 = lat1;
+ this.mLon2 = lon2;
+ this.mLat2 = lat2;
+ this.mEstSizeBytes = bytesEst;
+ this.mLevel = level;
}
- public boolean isInMap(Location location) {
- double longitude_1 = Double.valueOf(this.lon1);
- double latitude_1 = Double.valueOf(this.lat1);
- double longitude_2 = Double.valueOf(this.lon2);
- double latitude_2 = Double.valueOf(this.lat2);
+ boolean isInMap(Location location) {
- if (location.getLongitude() < longitude_1) {
+ if (location.getLongitude() < Double.valueOf(this.mLon1)) {
return false;
}
- if (location.getLongitude() > longitude_2) {
+ if (location.getLongitude() > Double.valueOf(this.mLon2)) {
return false;
}
- if (location.getLatitude() < latitude_1) {
+ if (location.getLatitude() < Double.valueOf(this.mLat1)) {
return false;
}
- if (location.getLatitude() > latitude_2) {
- return false;
- }
-
- return true;
+ return !(location.getLatitude() > Double.valueOf(this.mLat2));
}
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
index e4c774fb9..2e10e896e 100644
--- a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
+++ b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
@@ -1,5 +1,7 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.app.NotificationManager;
import android.app.ProgressDialog;
import android.content.Context;
@@ -7,6 +9,7 @@ import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
import android.os.Environment;
import android.widget.Toast;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -14,15 +17,15 @@ import java.io.ObjectInputStream;
import java.util.Map;
import java.util.Map.Entry;
-public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
- private Navit mActivity;
- private ProgressDialog mDialog;
+public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
- private String mTimestamp;
+ private final Navit mActivity;
+ private ProgressDialog mDialog;
+ private final String mTimestamp;
- public NavitRestoreTask(Navit context, String timestamp) {
+ NavitRestoreTask(Navit context, String timestamp) {
mActivity = context;
mTimestamp = timestamp;
}
@@ -34,7 +37,7 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* Create a Wait Progress Dialog to inform the User that we are working */
mDialog = new ProgressDialog(mActivity);
mDialog.setIndeterminate(true);
- mDialog.setMessage(mActivity.getTstring(R.string.restoring));
+ mDialog.setMessage(getTstring(R.string.restoring));
mDialog.show();
}
@@ -49,31 +52,31 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* Check if there is a Backup Directory */
if (!backupDir.isDirectory()) {
- return mActivity.getTstring(R.string.backup_not_found);
+ return getTstring(R.string.backup_not_found);
}
ObjectInputStream preferenceOis = null;
try {
/* Delete all old Files in Home */
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/destination.txt");
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
+ NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/bookmark.txt");
+ NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/destination.txt");
+ NavitUtils.removeFileIfExists(Navit.sNavitDataDir + "/home/gui_internal.txt");
/* Restore Files in home */
- mActivity.copyFileIfExists(backupDir.getPath() + "/bookmark.txt",
- Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
- mActivity.copyFileIfExists(backupDir.getPath() + "/destination.txt",
- Navit.NAVIT_DATA_DIR + "/home/destination.txt");
- mActivity.copyFileIfExists(backupDir.getPath() + "/gui_internal.txt",
- Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
+ NavitUtils.copyFileIfExists(backupDir.getPath() + "/bookmark.txt",
+ Navit.sNavitDataDir + "/home/bookmark.txt");
+ NavitUtils.copyFileIfExists(backupDir.getPath() + "/destination.txt",
+ Navit.sNavitDataDir + "/home/destination.txt");
+ NavitUtils.copyFileIfExists(backupDir.getPath() + "/gui_internal.txt",
+ Navit.sNavitDataDir + "/home/gui_internal.txt");
/* Restore Shared Preferences */
preferenceOis = new ObjectInputStream(
new FileInputStream(backupDir.getPath() + "/preferences.bak"));
Map<String, ?> entries = (Map<String, ?>) preferenceOis.readObject();
- Editor prefEditor = mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE).edit();
+ Editor prefEditor = mActivity.getSharedPreferences(NavitAppConfig.NAVIT_PREFS, Context.MODE_PRIVATE).edit();
/* Remove all old Preferences */
prefEditor.clear();
@@ -84,25 +87,25 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
String key = entry.getKey();
if (value instanceof Boolean) {
- prefEditor.putBoolean(key, ((Boolean) value).booleanValue());
+ prefEditor.putBoolean(key, (Boolean) value);
} else if (value instanceof Float) {
- prefEditor.putFloat(key, ((Float) value).floatValue());
+ prefEditor.putFloat(key, (Float) value);
} else if (value instanceof Integer) {
- prefEditor.putInt(key, ((Integer) value).intValue());
+ prefEditor.putInt(key, (Integer) value);
} else if (value instanceof Long) {
- prefEditor.putLong(key, ((Long) value).longValue());
+ prefEditor.putLong(key, (Long) value);
} else if (value instanceof String) {
prefEditor.putString(key, (String) value);
}
}
if (!prefEditor.commit()) {
- return mActivity.getTstring(R.string.failed_to_restore);
+ return getTstring(R.string.failed_to_restore);
}
} catch (Exception e) {
e.printStackTrace();
- return mActivity.getTstring(R.string.failed_to_restore);
+ return getTstring(R.string.failed_to_restore);
} finally {
try {
/* Close Stream to prevent Resource leak */
@@ -111,7 +114,6 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
}
} catch (IOException e) {
// Catching but ignoring that exception when closing the stream
- return null;
}
}
return null;
@@ -132,18 +134,17 @@ public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
/* Navit needs to be restarted. Currently the User has to restart it by himself */
Toast.makeText(mActivity,
- mActivity.getTstring(R.string.restore_successful_please_restart_navit),
+ getTstring(R.string.restore_successful_please_restart_navit),
Toast.LENGTH_LONG).show();
NotificationManager nm = (NotificationManager) mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
nm.cancel(R.string.app_name);
- NavitVehicle.removeListener();
mActivity.finish();
}
@Override
protected void onCancelled() {
super.onCancelled();
- Toast.makeText(mActivity, mActivity.getTstring(R.string.restore_failed), Toast.LENGTH_LONG)
+ Toast.makeText(mActivity, getTstring(R.string.restore_failed), Toast.LENGTH_LONG)
.show();
mDialog.dismiss();
}
diff --git a/navit/android/src/org/navitproject/navit/NavitSensors.java b/navit/android/src/org/navitproject/navit/NavitSensors.java
index ad94bdfbe..3ffb6457a 100644
--- a/navit/android/src/org/navitproject/navit/NavitSensors.java
+++ b/navit/android/src/org/navitproject/navit/NavitSensors.java
@@ -21,34 +21,34 @@ import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
+import android.util.Log;
+@SuppressWarnings("unused")
+class NavitSensors implements SensorEventListener {
+ private final long mCallbackid;
-public class NavitSensors implements SensorEventListener {
- private SensorManager mSensorManager;
- private int callbackid;
+ private native void sensorCallback(long id, int sensor, float x, float y, float z);
- public native void SensorCallback(int id, int sensor, float x, float y, float z);
-
- NavitSensors(Context context, int cbid) {
- mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
- mSensorManager.registerListener((SensorEventListener)this,
+ NavitSensors(Context context, long cbid) {
+ SensorManager mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
+ mSensorManager.registerListener(this,
mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
- SensorManager.SENSOR_DELAY_NORMAL);
- mSensorManager.registerListener((SensorEventListener)this,
+ SensorManager.SENSOR_DELAY_UI);
+ mSensorManager.registerListener(this,
mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
- SensorManager.SENSOR_DELAY_NORMAL);
- callbackid = cbid;
+ SensorManager.SENSOR_DELAY_UI);
+ mCallbackid = cbid;
}
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent sev) {
- // Log.e("NavitSensor","Type:" + sev.sensor.getType() + " X:" + sev.values[0] + " Y:"+sev.values[1]+" Z:"
- // +sev.values[2]);
- SensorCallback(callbackid, sev.sensor.getType(), sev.values[0], sev.values[1], sev.values[2]);
+ Log.v("NavitSensor","Type:" + sev.sensor.getType() + " X:" + sev.values[0] + " Y:"
+ + sev.values[1] + " Z:" + sev.values[2]);
+ sensorCallback(mCallbackid, sev.sensor.getType(), sev.values[0], sev.values[1], sev.values[2]);
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
index c86fdd1c8..c36b9556e 100644
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
@@ -15,6 +15,8 @@
package org.navitproject.navit;
+import static org.navitproject.navit.NavitAppConfig.getTstring;
+
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
@@ -23,17 +25,19 @@ import android.speech.tts.TextToSpeech;
import android.util.Log;
+
+
@SuppressWarnings("unused")
-public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
+class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
- private final Navit navit;
- private final int MY_DATA_CHECK_CODE = 1;
- private final String TAG = this.getClass().getName();
+ private final Navit mNavit;
+ private static final int MY_DATA_CHECK_CODE = 1;
+ private static final String TAG = "NavitSpeech2";
private TextToSpeech mTts;
NavitSpeech2(Navit navit) {
- this.navit = navit;
+ this.mNavit = navit;
navit.setActivityResult(1, this);
Log.d(TAG, "Create");
Intent checkIntent = new Intent();
@@ -57,23 +61,23 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
// success, create the TTS instance
- mTts = new TextToSpeech(navit.getApplication(), this);
+ mTts = new TextToSpeech(mNavit.getApplication(), this);
} else {
// missing data, ask to install it
- AlertDialog.Builder builder = new AlertDialog.Builder(navit);
+ AlertDialog.Builder builder = new AlertDialog.Builder(mNavit);
builder
- .setTitle(navit.getTstring(R.string.TTS_title_data_missing))
- .setMessage(navit.getTstring(R.string.TTS_qery_install_data))
- .setPositiveButton(navit.getTstring(R.string.yes),
+ .setTitle(getTstring(R.string.TTS_title_data_missing))
+ .setMessage(getTstring(R.string.TTS_qery_install_data))
+ .setPositiveButton(getTstring(R.string.yes),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent installIntent = new Intent();
installIntent.setAction(
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
- navit.startActivity(installIntent);
+ mNavit.startActivity(installIntent);
}
})
- .setNegativeButton(navit.getTstring(R.string.no), null)
+ .setNegativeButton(getTstring(R.string.no), null)
.show();
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitTimeout.java b/navit/android/src/org/navitproject/navit/NavitTimeout.java
index 81451ab47..0975e9454 100644
--- a/navit/android/src/org/navitproject/navit/NavitTimeout.java
+++ b/navit/android/src/org/navitproject/navit/NavitTimeout.java
@@ -1,20 +1,20 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+/*
+ Navit, a modular navigation system.
+ Copyright (C) 2005-2008 Navit Team
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
package org.navitproject.navit;
@@ -24,36 +24,37 @@ import android.os.Message;
import android.util.Log;
+class NavitTimeout implements Runnable {
-public class NavitTimeout implements Runnable {
- private static Handler handler = new Handler() {
- public void handleMessage(Message m) {
- Log.e("Navit","Handler received message");
- }
- };
- private boolean event_multi;
- private int event_callbackid;
- private int event_timeout;
-
- public native void TimeoutCallback(int id);
-
- NavitTimeout(int timeout, boolean multi, int callbackid) {
- event_timeout = timeout;
- event_multi = multi;
- event_callbackid = callbackid;
- handler.postDelayed(this, event_timeout);
+ private static final TimeoutHandler handler = new TimeoutHandler();
+ private final long mEventCallbackid;
+ private final int mEventTimeout;
+ private final boolean mEventMulti;
+
+ NavitTimeout(int timeout, boolean multi, long callbackid) {
+ mEventTimeout = timeout;
+ mEventMulti = multi;
+ mEventCallbackid = callbackid;
+ handler.postDelayed(this, mEventTimeout);
}
+ public native void timeoutCallback(long id);
+
public void run() {
- // Log.e("Navit","Handle Event");
- if (event_multi) {
- handler.postDelayed(this, event_timeout);
+ Log.v("Navit","Handle Event");
+ if (mEventMulti) {
+ handler.postDelayed(this, mEventTimeout);
}
- TimeoutCallback(event_callbackid);
+ timeoutCallback(mEventCallbackid);
}
public void remove() {
handler.removeCallbacks(this);
}
-}
+ static class TimeoutHandler extends Handler {
+ public void handleMessage(Message m) {
+ Log.d("NavitTimeout", "Handler received message");
+ }
+ }
+}
diff --git a/navit/android/src/org/navitproject/navit/NavitTraff.java b/navit/android/src/org/navitproject/navit/NavitTraff.java
index a98b91948..c82d7d293 100644
--- a/navit/android/src/org/navitproject/navit/NavitTraff.java
+++ b/navit/android/src/org/navitproject/navit/NavitTraff.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2018 Navit Team
*
@@ -32,49 +32,42 @@ import android.util.Log;
import java.util.List;
/**
- * @brief The TraFF receiver implementation.
+ * The TraFF receiver implementation.
*
- * This class registers the broadcast receiver for TraFF feeds, polls all registered sources once on creation, receives
- * TraFF feeds and forwards them to the traffic module for processing.
+ * <p>This class registers the broadcast receiver for TraFF feeds, polls all registered sources once on creation,
+ * receives TraFF feeds and forwards them to the traffic module for processing.</p>
*/
public class NavitTraff extends BroadcastReceiver {
- public static String ACTION_TRAFF_FEED = "org.traffxml.traff.FEED";
-
- public static String ACTION_TRAFF_POLL = "org.traffxml.traff.POLL";
-
- public static String EXTRA_FEED = "feed";
-
- /** Identifier for the callback function. */
- private int cbid;
- private Context context = null;
-
- /** An intent filter for TraFF events. */
- private IntentFilter traffFilter = new IntentFilter();
+ private static final String ACTION_TRAFF_FEED = "org.traffxml.traff.FEED";
+ private static final String ACTION_TRAFF_POLL = "org.traffxml.traff.POLL";
+ private static final String EXTRA_FEED = "feed";
+ private final long mCbid;
/**
- * @brief Forwards a newly received TraFF feed to the traffic module for processing.
+ * Forwards a newly received TraFF feed to the traffic module for processing.
*
- * This is called when a TraFF feed is received.
+ * <p>This is called when a TraFF feed is received.</p>
*
* @param id The identifier for the native callback implementation
* @param feed The TraFF feed
*/
- public native void onFeedReceived(int id, String feed);
+ public native void onFeedReceived(long id, String feed);
/**
- * @brief Creates a new {@code NavitTraff} instance.
+ * Creates a new {@code NavitTraff} instance.
*
- * Creating a new {@code NavitTraff} instance registers a broadcast receiver for TraFF broadcasts and polls all
- * registered sources once to ensure we have messages which were received by these sources before we started up.
+ * <p>Creating a new {@code NavitTraff} instance registers a broadcast receiver for TraFF broadcasts and polls all
+ * registered sources once to ensure we have messages which were received by these sources before we started up.</p>
*
* @param context The context
* @param cbid The callback identifier for the native method to call upon receiving a feed
*/
- NavitTraff(Context context, int cbid) {
- this.context = context;
- this.cbid = cbid;
+ NavitTraff(Context context, long cbid) {
+ this.mCbid = cbid;
+ /* An intent filter for TraFF events. */
+ IntentFilter traffFilter = new IntentFilter();
traffFilter.addAction(ACTION_TRAFF_FEED);
traffFilter.addAction(ACTION_TRAFF_POLL);
@@ -85,7 +78,7 @@ public class NavitTraff extends BroadcastReceiver {
Intent outIntent = new Intent(ACTION_TRAFF_POLL);
PackageManager pm = context.getPackageManager();
List<ResolveInfo> receivers = pm.queryBroadcastReceivers(outIntent, 0);
- if (receivers != null)
+ if (receivers != null) {
for (ResolveInfo receiver : receivers) {
ComponentName cn = new ComponentName(receiver.activityInfo.applicationInfo.packageName,
receiver.activityInfo.name);
@@ -93,16 +86,18 @@ public class NavitTraff extends BroadcastReceiver {
outIntent.setComponent(cn);
context.sendBroadcast(outIntent, Manifest.permission.ACCESS_COARSE_LOCATION);
}
+ }
}
@Override
public void onReceive(Context context, Intent intent) {
if ((intent != null) && (intent.getAction().equals(ACTION_TRAFF_FEED))) {
String feed = intent.getStringExtra(EXTRA_FEED);
- if (feed == null)
+ if (feed == null) {
Log.w(this.getClass().getSimpleName(), "empty feed, ignoring");
- else
- onFeedReceived(cbid, feed);
+ } else {
+ onFeedReceived(mCbid, feed);
+ }
}
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitUtils.java b/navit/android/src/org/navitproject/navit/NavitUtils.java
new file mode 100644
index 000000000..bbdf6539e
--- /dev/null
+++ b/navit/android/src/org/navitproject/navit/NavitUtils.java
@@ -0,0 +1,53 @@
+package org.navitproject.navit;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+class NavitUtils {
+
+
+ static void removeFileIfExists(String source) {
+ File file = new File(source);
+
+ if (!file.exists()) {
+ return;
+ }
+
+ file.delete();
+ }
+
+ static void copyFileIfExists(String source, String destination) throws IOException {
+ File file = new File(source);
+
+ if (!file.exists()) {
+ return;
+ }
+
+ FileInputStream is = null;
+ FileOutputStream os = null;
+
+ try {
+ is = new FileInputStream(source);
+ os = new FileOutputStream(destination);
+
+ int len;
+ byte[] buffer = new byte[1024];
+
+ while ((len = is.read(buffer)) != -1) {
+ os.write(buffer, 0, len);
+ }
+ } finally {
+ /* Close the FileStreams to prevent Resource leaks */
+ if (is != null) {
+ is.close();
+ }
+
+ if (os != null) {
+ os.close();
+ }
+ }
+ }
+
+}
diff --git a/navit/android/src/org/navitproject/navit/NavitVehicle.java b/navit/android/src/org/navitproject/navit/NavitVehicle.java
index 200fc3eec..e8c43e474 100644
--- a/navit/android/src/org/navitproject/navit/NavitVehicle.java
+++ b/navit/android/src/org/navitproject/navit/NavitVehicle.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
@@ -41,52 +41,53 @@ import java.util.List;
public class NavitVehicle {
private static final String GPS_FIX_CHANGE = "android.location.GPS_FIX_CHANGE";
+ static Location sLastLocation;
+ private static LocationManager sLocationManager;
+ private Context mContext;
+ private long mVehiclePcbid;
+ private long mVehicleScbid;
+ private long mVehicleFcbid;
+ private String mFastProvider;
- public static Location lastLocation = null;
+ private static NavitLocationListener sPreciseLocationListener;
+ private static NavitLocationListener sFastLocationListener;
- private static LocationManager sLocationManager = null;
- private static Context context = null;
- private int vehicle_pcbid;
- private int vehicle_scbid;
- private int vehicle_fcbid;
- private String preciseProvider;
- private String fastProvider;
+ public native void vehicleCallback(long id, Location location);
- private static NavitLocationListener preciseLocationListener = null;
- private static NavitLocationListener fastLocationListener = null;
+ public native void vehicleCallback(long id, int satsInView, int satsUsed);
- public native void VehicleCallback(int id, Location location);
-
- public native void VehicleCallback(int id, int satsInView, int satsUsed);
-
- public native void VehicleCallback(int id, int enabled);
+ public native void vehicleCallback(long id, int enabled);
private class NavitLocationListener extends BroadcastReceiver implements GpsStatus.Listener, LocationListener {
- public boolean precise = false;
+ boolean mPrecise = false;
public void onLocationChanged(Location location) {
- lastLocation = location;
// Disable the fast provider if still active
- if (precise && fastProvider != null) {
- sLocationManager.removeUpdates(fastLocationListener);
- fastProvider = null;
+ if (mPrecise && mFastProvider != null) {
+ sLocationManager.removeUpdates(sFastLocationListener);
+ mFastProvider = null;
}
-
- VehicleCallback(vehicle_pcbid, location);
- VehicleCallback(vehicle_fcbid, 1);
+ vehicleCallback(mVehiclePcbid, location);
+ vehicleCallback(mVehicleFcbid, 1);
}
- public void onProviderDisabled(String provider) {}
+ public void onProviderDisabled(String provider) {
+ //unhandled
+ }
- public void onProviderEnabled(String provider) {}
+ public void onProviderEnabled(String provider) {
+ //unhandled
+ }
- public void onStatusChanged(String provider, int status, Bundle extras) {}
+ public void onStatusChanged(String provider, int status, Bundle extras) {
+ //unhandled
+ }
/**
* Called when the status of the GPS changes.
*/
public void onGpsStatusChanged(int event) {
- if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION)
+ if (ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
return;
@@ -101,17 +102,17 @@ public class NavitVehicle {
satsUsed++;
}
}
- VehicleCallback(vehicle_scbid, satsInView, satsUsed);
+ vehicleCallback(mVehicleScbid, satsInView, satsUsed);
}
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(GPS_FIX_CHANGE)) {
if (intent.getBooleanExtra("enabled", false)) {
- VehicleCallback(vehicle_fcbid, 1);
+ vehicleCallback(mVehicleFcbid, 1);
} else {
if (!intent.getBooleanExtra("enabled", true)) {
- VehicleCallback(vehicle_fcbid, 0);
+ vehicleCallback(mVehicleFcbid, 0);
}
}
}
@@ -119,25 +120,25 @@ public class NavitVehicle {
}
/**
- * @brief Creates a new {@code NavitVehicle}
+ * Creates a new {@code NavitVehicle}.
*
- * @param context
+ * @param context the context
* @param pcbid The address of the position callback function called when a location update is received
* @param scbid The address of the status callback function called when a status update is received
* @param fcbid The address of the fix callback function called when a
* {@code android.location.GPS_FIX_CHANGE} is received, indicating a change in GPS fix status
*/
- NavitVehicle(Context context, int pcbid, int scbid, int fcbid) {
+ NavitVehicle(Context context, long pcbid, long scbid, long fcbid) {
if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
return;
}
- this.context = context;
+ this.mContext = context;
sLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
- preciseLocationListener = new NavitLocationListener();
- preciseLocationListener.precise = true;
- fastLocationListener = new NavitLocationListener();
+ sPreciseLocationListener = new NavitLocationListener();
+ sPreciseLocationListener.mPrecise = true;
+ sFastLocationListener = new NavitLocationListener();
/* Use 2 LocationProviders, one precise (usually GPS), and one
not so precise, but possible faster. The fast provider is
@@ -159,19 +160,19 @@ public class NavitVehicle {
lowCriteria.setCostAllowed(true);
lowCriteria.setPowerRequirement(Criteria.POWER_HIGH);
- Log.e("NavitVehicle", "Providers " + sLocationManager.getAllProviders());
+ Log.d("NavitVehicle", "Providers " + sLocationManager.getAllProviders());
- preciseProvider = sLocationManager.getBestProvider(highCriteria, false);
- Log.e("NavitVehicle", "Precise Provider " + preciseProvider);
- fastProvider = sLocationManager.getBestProvider(lowCriteria, false);
- Log.e("NavitVehicle", "Fast Provider " + fastProvider);
- vehicle_pcbid = pcbid;
- vehicle_scbid = scbid;
- vehicle_fcbid = fcbid;
+ String mPreciseProvider = sLocationManager.getBestProvider(highCriteria, false);
+ Log.d("NavitVehicle", "Precise Provider " + mPreciseProvider);
+ mFastProvider = sLocationManager.getBestProvider(lowCriteria, false);
+ Log.d("NavitVehicle", "Fast Provider " + mFastProvider);
+ mVehiclePcbid = pcbid;
+ mVehicleScbid = scbid;
+ mVehicleFcbid = fcbid;
- context.registerReceiver(preciseLocationListener, new IntentFilter(GPS_FIX_CHANGE));
- sLocationManager.requestLocationUpdates(preciseProvider, 0, 0, preciseLocationListener);
- sLocationManager.addGpsStatusListener(preciseLocationListener);
+ context.registerReceiver(sPreciseLocationListener, new IntentFilter(GPS_FIX_CHANGE));
+ sLocationManager.requestLocationUpdates(mPreciseProvider, 0, 0, sPreciseLocationListener);
+ sLocationManager.addGpsStatusListener(sPreciseLocationListener);
/*
* Since Android criteria have no way to specify "fast fix", lowCriteria may return the same
@@ -179,32 +180,31 @@ public class NavitVehicle {
* listeners for the same provider but pick the fast provider manually. (Usually there will
* only be two providers in total, which makes the choice easy.)
*/
- if (fastProvider == null || preciseProvider.compareTo(fastProvider) == 0) {
+ if (mFastProvider == null || mPreciseProvider.compareTo(mFastProvider) == 0) {
List<String> fastProviderList = sLocationManager.getProviders(lowCriteria, false);
- fastProvider = null;
+ mFastProvider = null;
for (String fastCandidate: fastProviderList) {
- if (preciseProvider.compareTo(fastCandidate) != 0) {
- fastProvider = fastCandidate;
+ if (mPreciseProvider.compareTo(fastCandidate) != 0) {
+ mFastProvider = fastCandidate;
break;
}
}
}
- if (fastProvider != null) {
- sLocationManager.requestLocationUpdates(fastProvider, 0, 0, fastLocationListener);
+ if (mFastProvider != null) {
+ sLocationManager.requestLocationUpdates(mFastProvider, 0, 0, sFastLocationListener);
}
}
- public static void removeListener() {
+ static void removeListeners(Navit navit) {
if (sLocationManager != null) {
- if (preciseLocationListener != null) {
- sLocationManager.removeUpdates(preciseLocationListener);
- sLocationManager.removeGpsStatusListener(preciseLocationListener);
- context.unregisterReceiver(preciseLocationListener);
+ if (sPreciseLocationListener != null) {
+ sLocationManager.removeUpdates(sPreciseLocationListener);
+ sLocationManager.removeGpsStatusListener(sPreciseLocationListener);
+ navit.unregisterReceiver(sPreciseLocationListener);
}
- if (fastLocationListener != null) {
- sLocationManager.removeUpdates(fastLocationListener);
+ if (sFastLocationListener != null) {
+ sLocationManager.removeUpdates(sFastLocationListener);
}
}
-
}
}
diff --git a/navit/android/src/org/navitproject/navit/NavitWatch.java b/navit/android/src/org/navitproject/navit/NavitWatch.java
index 5f13c83a3..bfa56913e 100644
--- a/navit/android/src/org/navitproject/navit/NavitWatch.java
+++ b/navit/android/src/org/navitproject/navit/NavitWatch.java
@@ -1,4 +1,4 @@
-/**
+/*
* Navit, a modular navigation system.
* Copyright (C) 2005-2008 Navit Team
*
@@ -23,87 +23,88 @@ import android.os.Handler;
import android.os.Message;
import android.util.Log;
-import java.lang.Thread;
+class NavitWatch implements Runnable {
-public class NavitWatch implements Runnable {
- private Thread thread;
- private static Handler handler = new Handler() {
- public void handleMessage(Message m) {
- Log.e("NavitWatch","Handler received message");
- }
- };
- private boolean removed;
- private int watch_func;
- private int watch_fd;
- private int watch_cond;
- private int watch_callbackid;
- private boolean callback_pending;
- private Runnable callback_runnable;
-
- public native void poll(int func, int fd, int cond);
+ private static WatchHandler sHandler = new WatchHandler();
+ private Thread mThread;
+ private boolean mRemoved;
+ private long mWatchFunc;
+ private int mWatchFd;
+ private int mWatchCond;
+ private long mWatchCallbackid;
+ private boolean mCallbackPending;
+ private Runnable mCallbackRunnable;
- public native void WatchCallback(int id);
-
- NavitWatch(int func, int fd, int cond, int callbackid) {
- // Log.e("NavitWatch","Creating new thread for "+fd+" "+cond+" from current thread "
- // + java.lang.Thread.currentThread().getName());
- watch_func = func;
- watch_fd = fd;
- watch_cond = cond;
- watch_callbackid = callbackid;
+ NavitWatch(long func, int fd, int cond, long callbackid) {
+ Log.d("NavitWatch","Creating new thread for " + fd + " " + cond + " from current thread "
+ + java.lang.Thread.currentThread().getName());
+ mWatchFunc = func;
+ mWatchFd = fd;
+ mWatchCond = cond;
+ mWatchCallbackid = callbackid;
final NavitWatch navitwatch = this;
- callback_runnable = new Runnable() {
+ mCallbackRunnable = new Runnable() {
public void run() {
navitwatch.callback();
}
};
- thread = new Thread(this, "poll thread");
- thread.start();
+ mThread = new Thread(this, "poll thread");
+ mThread.start();
}
+ public native void poll(long func, int fd, int cond);
+
+ public native void watchCallback(long id);
+
public void run() {
- for (;;) {
+ for (; ; ) {
// Log.e("NavitWatch","Polling "+watch_fd+" "+watch_cond + " from "
// + java.lang.Thread.currentThread().getName());
- poll(watch_func, watch_fd, watch_cond);
+ poll(mWatchFunc, mWatchFd, mWatchCond);
// Log.e("NavitWatch","poll returned");
- if (removed) {
+ if (mRemoved) {
break;
}
- callback_pending = true;
- handler.post(callback_runnable);
+ mCallbackPending = true;
+ sHandler.post(mCallbackRunnable);
try {
// Log.e("NavitWatch","wait");
synchronized (this) {
- if (callback_pending) {
+ if (mCallbackPending) {
this.wait();
}
}
// Log.e("NavitWatch","wait returned");
} catch (Exception e) {
- Log.e("NavitWatch","Exception " + e.getMessage());
+ Log.e("NavitWatch", "Exception " + e.getMessage());
}
- if (removed) {
+ if (mRemoved) {
break;
}
}
}
- public void callback() {
+ private void callback() {
// Log.e("NavitWatch","Calling Callback");
- if (!removed) {
- WatchCallback(watch_callbackid);
+ if (!mRemoved) {
+ watchCallback(mWatchCallbackid);
}
synchronized (this) {
- callback_pending = false;
+ mCallbackPending = false;
// Log.e("NavitWatch","Waking up");
this.notify();
}
}
public void remove() {
- removed = true;
- thread.interrupt();
+ mRemoved = true;
+ mThread.interrupt();
+ }
+
+ static class WatchHandler extends Handler {
+ public void handleMessage(Message m) {
+ Log.d("NavitWatch", "Handler received message");
+ }
}
}
diff --git a/navit/attr.c b/navit/attr.c
index 78e2a683c..58cfe621d 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -927,17 +927,19 @@ attr_list_dup(struct attr **attrs) {
* parsed value including the terminating NULL character. The minimum safe size is
* `strlen(line) - strlen(name) - *pos` (assuming zero for NULL pointers).
*
- * @param line The line to parse
- * @param name The name of the attribute to retrieve; if NULL,
- * @param pos Offset pointer, see description
- * @param val_ret Points to a buffer which will receive the value as text
- * @param name_ret Points to a buffer which will receive the name of the attribute parsed, can be NULL
+ * @param[in] line The line to parse, must be non-NULL and pointing to a NUL terminated string
+ * @param[in] name The name of the attribute to retrieve; can be NULL (see description)
+ * @param[in,out] pos As input, if pointer is non-NULL, this argument contains the character index inside @p line from which to start the search (see description)
+ * @param[out] val_ret Points to a buffer which will receive the value as text
+ * @param[out] name_ret Points to a buffer which will receive the actual name of the attribute found in the line, if NULL this argument won't be used. Note that the buffer provided here should be long enough to contain the attribute name + a terminating NUL character
*
* @return true if successful, false in case of failure
*/
-int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret) {
- int len=0,quoted;
- char *p,*e,*n;
+int attr_from_line(const char *line, const char *name, int *pos, char *val_ret, char *name_ret) {
+ int len=0,quoted,escaped;
+ const char *p;
+ char *e;
+ const char *n;
dbg(lvl_debug,"get_tag %s from %s", name, line);
if (name)
@@ -958,15 +960,23 @@ int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_r
return 0;
p=e+1;
quoted=0;
+ escaped=0;
while (*p) {
if (*p == ' ' && !quoted)
break;
if (*p == '"')
quoted=1-quoted;
+ if (*p == '\\') { /* Next character is escaped */
+ escaped++;
+ if (*(p+1)) /* Make sure the string is not terminating just after this escape character */
+ p++; /* if the string continues, skip the next character, whatever is is (space, double-quote or backslash) */
+ else
+ dbg(lvl_warning, "Trailing backslash in input string \"%s\"", line);
+ }
p++;
}
- if (name == NULL || (e-n == len && !strncmp(n, name, len))) {
- if (name_ret) {
+ if (name == NULL || (e-n == len && strncmp(n, name, len)==0)) { /* We matched the searched attribute name */
+ if (name_ret) { /* If instructed to, store the actual name into the string pointed by name_ret */
len=e-n;
strncpy(name_ret, n, len);
name_ret[len]='\0';
@@ -977,8 +987,13 @@ int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_r
e++;
len-=2;
}
- strncpy(val_ret, e, len);
- val_ret[len]='\0';
+ /* Note: in the strncpy* calls below, we give a max size_t argument exactly matching the string lengh we want to copy within the source string e, so no terminating NUL char will be appended */
+ if (escaped)
+ strncpy_unescape(val_ret, e, len-escaped); /* Unescape if necessary */
+ else
+ strncpy(val_ret, e, len);
+ /* Because no NUL terminating char was copied over, we manually append it here to terminate the C-string properly, just after the copied string */
+ val_ret[len-escaped]='\0';
if (pos)
*pos=p-line;
return 1;
diff --git a/navit/attr.h b/navit/attr.h
index a9e4d9467..ab4283394 100644
--- a/navit/attr.h
+++ b/navit/attr.h
@@ -243,7 +243,7 @@ struct attr *attr_dup(struct attr *attr);
void attr_list_free(struct attr **attrs);
struct attr **attr_list_dup(struct attr **attrs);
struct attr **attr_list_append(struct attr **attrs, struct attr *attr);
-int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret);
+int attr_from_line(const char *line, const char *name, int *pos, char *val_ret, char *name_ret);
int attr_types_contains(enum attr_type *types, enum attr_type type);
int attr_types_contains_default(enum attr_type *types, enum attr_type type, int deflt);
int attr_rel2real(int attrval, int whole, int treat_neg_as_rel);
diff --git a/navit/attr_def.h b/navit/attr_def.h
index 5a82d9d30..45764ebb2 100644
--- a/navit/attr_def.h
+++ b/navit/attr_def.h
@@ -202,6 +202,7 @@ ATTR(autozoom_max)
ATTR(nav_status)
ATTR(virtual_dpi)
ATTR(real_dpi)
+ATTR(underground_alpha)
ATTR2(0x00027500,type_rel_abs_begin)
/* These attributes are int that can either hold relative or absolute values. See the
* documentation of ATTR_REL_RELSHIFT for details.
@@ -262,6 +263,7 @@ ATTR(waypoints_flag) /* toggle for "set as destination" to switch between start
ATTR(no_warning_if_map_file_missing)
ATTR(duplicate)
ATTR(has_menu_button)
+ATTR(oneway)
ATTR2(0x0002ffff,type_int_end)
ATTR2(0x00030000,type_string_begin)
ATTR(type)
diff --git a/navit/bookmarks.c b/navit/bookmarks.c
index 5df36b7a3..f32b6d89c 100644
--- a/navit/bookmarks.c
+++ b/navit/bookmarks.c
@@ -711,22 +711,32 @@ static GList* find_destination_in_list(struct former_destination* dest_to_remove
}
-
-static void write_former_destinations(GList* former_destinations, char *former_destination_file, enum projection proj) {
+/**
+ * @brief Write all former destinations into a text file
+ *
+ * @param[in] former_destinations A GList of struct coord data elements containing the list of former destinations
+ * @param[in] former_destination_file The name of the output text file
+ * @param proj The projection used to represent coordinates in former_destinations' list elements
+ */
+static void write_former_destinations(const GList* former_destinations, const char *former_destination_file,
+ enum projection proj) {
FILE *f;
- GList* currdest = NULL;
+ const GList* currdest = NULL;
GList* c_list = NULL;
struct coord *c;
struct former_destination *dest;
const char* prostr = projection_to_name(proj);
+ if (prostr == NULL)
+ prostr = ""; /* Protect from NULL pointer dereference below */
+
f=fopen(former_destination_file, "w");
if (f) {
for(currdest = former_destinations; currdest; currdest = g_list_next(currdest)) {
dest = currdest->data;
+ fprintf(f,"type=%s", item_to_name(dest->type));
if (dest->description)
- fprintf(f,"type=%s label=\"%s\"\n", item_to_name(dest->type), dest->description);
- else
- fprintf(f,"type=%s\n", item_to_name(dest->type));
+ fprintf(f," label=\"%s\"", str_escape(escape_mode_quote, dest->description));
+ fputc('\n', f);
c_list = dest->c;
do {
c = (struct coord *)c_list->data;
@@ -742,8 +752,9 @@ static void write_former_destinations(GList* former_destinations, char *former_d
dbg(lvl_error, "Error updating destinations file %s: %s", former_destination_file, strerror(errno));
}
}
+
/**
- * Append recent destination(s) item to the former destionations map.
+ * @brief Append recent destination(s) item to the former destionations map.
* @param former_destination_map
* @param former_destination_file
* @param c coordinates of item point(s). Can be set to NULL when navigation is stopped to remove type_former_itinerary and
diff --git a/navit/callback.c b/navit/callback.c
index edf594c3e..d9d1121f5 100644
--- a/navit/callback.c
+++ b/navit/callback.c
@@ -132,7 +132,7 @@ void callback_call(struct callback *cb, int pcount, void **p) {
return;
if (cb->pcount + pcount <= 8) {
dbg(lvl_debug,"cb->pcount=%d", cb->pcount);
- if (cb->pcount && cb->p)
+ if (cb->pcount)
dbg(lvl_debug,"cb->p[0]=%p", cb->p[0]);
dbg(lvl_debug,"pcount=%d", pcount);
if (pcount) {
diff --git a/navit/color.h b/navit/color.h
index dee10a187..067702ebe 100644
--- a/navit/color.h
+++ b/navit/color.h
@@ -21,7 +21,7 @@
#define NAVIT_COLOR_H
struct color {
- int r,g,b,a;
+ int r,g,b,a;
};
#define COLOR_BITDEPTH 16
@@ -34,6 +34,9 @@ struct color {
#define COLOR_TRANSPARENT ((struct color) {COLOR_TRANSPARENT_})
#define COLOR_FMT "0x%x,0x%x,0x%x,0x%x"
#define COLOR_ARGS(c) (c).r,(c).g,(c).b,(c).a
+/*default alpha value to apply for all things flagged AF_UNDERGROUND
+ *use solid color to not change default behaviour*/
+#define UNDERGROUND_ALPHA_ 0xFFFF
#define COLOR_IS_SAME(c1,c2) ((c1).r==(c2).r && (c1).g==(c2).g && (c1).b==(c2).b && (c1).a==(c2).a)
#define COLOR_IS_WHITE(c) COLOR_IS_SAME(c, COLOR_WHITE)
diff --git a/navit/coord.c b/navit/coord.c
index bb16978c8..c452f1c35 100644
--- a/navit/coord.c
+++ b/navit/coord.c
@@ -293,23 +293,37 @@ void coord_print(enum projection pro, struct coord *c, FILE *out) {
* @brief Converts a lat/lon into a text formatted text string.
* @param lat The latitude (if lat is 360 or greater, the latitude will be omitted)
* @param lng The longitude (if lng is 360 or greater, the longitude will be omitted)
- * @param fmt The format to use.
- * @li DEGREES_DECIMAL=>Degrees with decimal places, i.e. 20.5000°N 110.5000°E
- * @li DEGREES_MINUTES=>Degrees and minutes, i.e. 20°30.00'N 110°30.00'E
- * @li DEGREES_MINUTES_SECONDS=>Degrees, minutes and seconds, i.e. 20°30'30.00"N 110°30'30"E
- *
- *
- * @param buffer A buffer large enough to hold the output + a terminating NULL (up to 31 bytes)
+ * @param fmt The format to use:
+ * @li DEGREES_DECIMAL_ABSOLUTE=>Degrees with decimal places, i.e. -20.500000 -110.500000 (max: 22 bytes)
+ * @li DEGREES_DECIMAL=>Degrees with decimal places, i.e. 20.500000°N 110.500000°E (max: 26 bytes)
+ * @li DEGREES_MINUTES=>Degrees and minutes, i.e. 20°30.0000' N 110°30.0000' E (max: 30 bytes)
+ * @li DEGREES_MINUTES_SECONDS=>Degrees, minutes and seconds, i.e. 20°30'30.00" N 110°30'30.00" E (max: 32 bytes)
+ * @li DEGREES_MINUTES_SECONDS_BRIEF=>Degrees, minutes and seconds but with the shortest possible string, i.e. 20°30'30"N 110°30'30"E (max 24 bytes)
+ * @param[out] buffer A buffer large enough to hold the output (bearing in mind '°' uses 2 bytes in UTF-8).
+ * Maximum size depends on the format, see values above, and add an extra character for the terminating NUL character
* @param size The size of the buffer
+ * @param[in] sep The separator to use (if needed) between latitude and longitude (if NULL we will use a space)
*
*/
-void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int size) {
+void coord_format_with_sep(float lat,float lng, enum coord_format fmt, char *buffer, int size, const char *sep) {
char lat_c='N';
char lng_c='E';
float lat_deg,lat_min,lat_sec;
float lng_deg,lng_min,lng_sec;
int size_used=0;
+ if (sep == NULL)
+ sep = " ";
+
+ if (fmt==DEGREES_DECIMAL_ABSOLUTE) {
+ if (lat<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%02.6f",lat);
+ if ((lat<360)&&(lng<360))
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%s",sep);
+ if (lng<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%03.7f",lng);
+ return;
+ }
if (lng < 0) {
lng=-lng;
@@ -319,6 +333,16 @@ void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int
lat=-lat;
lat_c='S';
}
+
+ if (fmt==DEGREES_DECIMAL) {
+ if (lat<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%02.6f°%c",lat,lat_c);
+ if ((lat<360)&&(lng<360))
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%s",sep);
+ if (lng<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%03.7f°%c",lng,lng_c);
+ return;
+ }
lat_deg=lat;
lat_min=(lat-floor(lat_deg))*60;
lat_sec=fmod(lat*3600,60);
@@ -326,20 +350,11 @@ void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int
lng_min=(lng-floor(lng_deg))*60;
lng_sec=fmod(lng*3600,60);
switch(fmt) {
-
- case DEGREES_DECIMAL:
- if (lat<360)
- size_used+=g_snprintf(buffer+size_used,size-size_used,"%02.6f°%c",lat,lat_c);
- if ((lat<360)&&(lng<360))
- size_used+=g_snprintf(buffer+size_used,size-size_used," ");
- if (lng<360)
- size_used+=g_snprintf(buffer+size_used,size-size_used,"%03.7f°%c",lng,lng_c);
- break;
case DEGREES_MINUTES:
if (lat<360)
size_used+=g_snprintf(buffer+size_used,size-size_used,"%02.0f°%07.4f' %c",floor(lat_deg),lat_min,lat_c);
if ((lat<360)&&(lng<360))
- size_used+=g_snprintf(buffer+size_used,size-size_used," ");
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%s",sep);
if (lng<360)
size_used+=g_snprintf(buffer+size_used,size-size_used,"%03.0f°%07.4f' %c",floor(lng_deg),lng_min,lng_c);
break;
@@ -348,22 +363,118 @@ void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int
size_used+=g_snprintf(buffer+size_used,size-size_used,"%02.0f°%02.0f'%05.2f\" %c",floor(lat_deg),floor(lat_min),
lat_sec,lat_c);
if ((lat<360)&&(lng<360))
- size_used+=g_snprintf(buffer+size_used,size-size_used," ");
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%s",sep);
if (lng<360)
size_used+=g_snprintf(buffer+size_used,size-size_used,"%03.0f°%02.0f'%05.2f\" %c",floor(lng_deg),floor(lng_min),
lng_sec,lng_c);
break;
+ case DEGREES_MINUTES_SECONDS_BRIEF:
+ if (lat<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%.0f°%.0f'%.0f\"%c",floor(lat_deg),floor(lat_min),
+ round(lat_sec),lat_c);
+ if ((lat<360)&&(lng<360))
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%s",sep);
+ if (lng<360)
+ size_used+=g_snprintf(buffer+size_used,size-size_used,"%.0f°%.0f'%.0f\"%c",floor(lng_deg),floor(lng_min),
+ round(lng_sec),lng_c);
+ break;
+ }
+}
+
+/**
+ * @brief Converts a lat/lon into a text formatted text string.
+ * @param lat The latitude (if lat is 360 or greater, the latitude will be omitted)
+ * @param lng The longitude (if lng is 360 or greater, the longitude will be omitted)
+ * @param fmt The format to use.
+ * @li DEGREES_DECIMAL=>Degrees with decimal places, i.e. 20.500000°N 110.500000°E
+ * @li DEGREES_MINUTES=>Degrees and minutes, i.e. 20°30.0000' N 110°30.0000' E
+ * @li DEGREES_MINUTES_SECONDS=>Degrees, minutes and seconds, i.e. 20°30'30.00" N 110°30'30.00" E
+ * @li DEGREES_MINUTES_SECONDS_BRIEF=>Degrees, minutes and seconds but with the shortest possible string, i.e. 20°30'30"N 110°30'30"E
+ * @param[out] buffer A buffer large enough to hold the output + a terminating NUL character (up to 31 bytes)
+ * @param size The size of the buffer
+ *
+ */
+inline void coord_format(float lat,float lng, enum coord_format fmt, char *buffer, int size) {
+ coord_format_with_sep(lat, lng, fmt, buffer, size, NULL);
+}
+/**
+ * @brief Converts a WGS84 coordinate pair to its string representation.
+ *
+ * This function takes a coordinate pair with latitude and longitude in degrees and converts them to a
+ * string of the form {@code 45°28'0"N 9°11'26"E}.
+ *
+ * @param gc A WGS84 coordinate pair
+ * @param[out] buffer A buffer large enough to hold the output + a terminating NUL character (at least 25 bytes)
+ * @param size The size of the buffer
+ * @param[in] sep The separator to use (if needed) between latitude and longitude (if NULL we will use a space)
+ */
+inline void coord_geo_format_short(const struct coord_geo *gc, char *buffer, int size, char *sep) {
+ dbg_assert(gc != NULL);
+ coord_format_with_sep(gc->lat, gc->lng, DEGREES_MINUTES_SECONDS_BRIEF, buffer, size, sep);
+}
- }
+/**
+ * @brief Converts an integer mercator coordinate pair to its string representation.
+ *
+ * This function takes a coordinate pair, transforms it to WGS84 and converts it to a string of the form
+ * {@code 45°28'0"N 9°11'26"E}.
+ *
+ * @param pc Coordinates as integer mercator
+ * @param[out] buffer A buffer large enough to hold the output + a terminating NUL character (at least 25 bytes)
+ * @param size The size of the buffer
+ * @param[in] sep The separator to use (if needed) between latitude and longitude (if NULL we will use a space)
+ */
+inline void pcoord_format_degree_short(const struct pcoord *pc, char *buffer, int size, char *sep) {
+ dbg_assert(pc != NULL);
+ struct coord_geo g;
+ struct coord c;
+ c.x=pc->x;
+ c.y=pc->y;
+ transform_to_geo(pc->pro, &c, &g);
+ coord_format_with_sep(g.lat, g.lng, DEGREES_MINUTES_SECONDS_BRIEF, buffer, size, sep);
+}
+/**
+ * @brief Converts an integer mercator coordinate pair to its string representation.
+ *
+ * This function takes a coordinate pair, transforms it to WGS84 and converts it to a string of the form
+ * {@code 45.28 -9.114333}.
+ *
+ * @param pc Coordinates as integer mercator
+ * @param[out] buffer A buffer large enough to hold the output + a terminating NUL character (at least 23 bytes)
+ * @param size The size of the buffer
+ * @param[in] sep The separator to use (if needed) between latitude and longitude (if NULL we will use a space)
+ */
+inline void pcoord_format_absolute(const struct pcoord *pc, char *buffer, int size, char *sep) {
+ dbg_assert(pc != NULL);
+ struct coord_geo g;
+ struct coord c;
+ c.x=pc->x;
+ c.y=pc->y;
+ transform_to_geo(pc->pro, &c, &g);
+ coord_format_with_sep(g.lat, g.lng, DEGREES_DECIMAL_ABSOLUTE, buffer, size, sep);
}
+/**
+ * @brief Generate a hash from a struct coord pointed by key
+ *
+ * @param[in] key A pointer to the struct coord to hash
+ * @return The resulting hash
+ */
unsigned int coord_hash(const void *key) {
const struct coord *c=key;
return c->x^c->y;
}
+/**
+ * @brief Test if two struct coord structures are equal
+ *
+ * @param[in] a A pointer to the first struct coord
+ * @param[in] b A pointer to the second struct coord
+ *
+ * @return TRUE if a and b are equal, FALSE otherwise
+ */
int coord_equal(const void *a, const void *b) {
const struct coord *c_a=a;
const struct coord *c_b=b;
@@ -371,4 +482,5 @@ int coord_equal(const void *a, const void *b) {
return TRUE;
return FALSE;
}
+
/** @} */
diff --git a/navit/coord.h b/navit/coord.h
index 8387462a2..cad6a86e8 100644
--- a/navit/coord.h
+++ b/navit/coord.h
@@ -65,7 +65,7 @@ struct coord_rect {
/**
* On platforms where we are trying to avoid floats, sometimes we can't.
* It is better on these platforms to use single precision floating points
- * over double percision ones since performance is much better.
+ * over double precision ones since performance is much better.
*/
typedef float navit_float;
#define navit_sin(x) sinf(x)
@@ -113,21 +113,34 @@ struct coord_geo_cart {
enum coord_format
{
/**
+ * Degrees with absolute decimal places (positive or negative)
+ * ie -20.500000 -110.500000
+ */
+ DEGREES_DECIMAL_ABSOLUTE,
+
+ /**
* Degrees with decimal places.
- * Ie 20.5000 N 110.5000 E
+ * ie 20.500000°N 110.500000°E
*/
DEGREES_DECIMAL,
/**
* Degrees and minutes.
- * ie 20 30.00 N 110 30.00 E
+ * ie 20°30.0000' N 110°30.0000' E
*/
DEGREES_MINUTES,
+
/**
* Degrees, minutes and seconds.
- * ie 20 30 30.00 N 110 30 30 E
+ * ie 20°30'30.00" N 110°30'30.00" E
+ */
+ DEGREES_MINUTES_SECONDS,
+
+ /**
+ * Degrees, minutes and seconds, brief
+ * ie 20°30'30"N 110°30'30"E
*/
- DEGREES_MINUTES_SECONDS
+ DEGREES_MINUTES_SECONDS_BRIEF
};
enum projection;
@@ -145,7 +158,12 @@ void coord_rect_destroy(struct coord_rect *r);
int coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2);
int coord_rect_contains(struct coord_rect *r, struct coord *c);
void coord_rect_extend(struct coord_rect *r, struct coord *c);
-void coord_format(float lat,float lng, enum coord_format, char * buffer, int size);
+void coord_format_with_sep(float lat,float lng, enum coord_format fmt, char *buffer, int size, const char *sep);
+void coord_format(float lat,float lng, enum coord_format fmt, char *buffer, int size);
+void coord_geo_format_short(const struct coord_geo *gc, char *buffer, int size, char *sep);
+void pcoord_format_degree_short(const struct pcoord *pc, char *buffer, int size, char *sep);
+void pcoord_format_absolute(const struct pcoord *pc, char *buffer, int size, char *sep);
+char *coordinates_geo(const struct coord_geo *gc, char sep);
/* prototypes */
enum coord_format;
diff --git a/navit/graphics.c b/navit/graphics.c
index 172315488..bc3177322 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -1366,6 +1366,7 @@ struct displayitem {
char *label;
struct displayitem_poly_holes * holes;
int z_order;
+ int flags;
int count;
struct coord c[0];
};
@@ -1433,6 +1434,7 @@ static void display_add(struct hash_entry *entry, struct item *item, int count,
int hole_count=0;
int hole_total_coords=0;
int holes_length;
+ int flags=0;
/* calculate number of bytes required */
/* own length */
@@ -1446,6 +1448,11 @@ static void display_add(struct hash_entry *entry, struct item *item, int count,
len++;
}
}
+ /* check for and remember flags (for underground drawing) */
+ item_attr_rewind(item);
+ if(item_attr_get(item, attr_flags, &attr)) {
+ flags = attr.u.num;
+ }
/* add length for holes */
item_attr_rewind(item);
while(item_attr_get(item, attr_poly_hole, &attr)) {
@@ -1464,6 +1471,7 @@ static void display_add(struct hash_entry *entry, struct item *item, int count,
p+=sizeof(*di)+count*sizeof(*c);
di->item=*item;
di->z_order=0;
+ di->flags=flags;
di->holes=NULL;
if(hole_count > 0) {
di->holes = display_add_holes(item, hole_count, &p);
@@ -1539,34 +1547,101 @@ static void label_line(struct graphics *gra, struct graphics_gc *fg, struct grap
}
}
-static void display_draw_arrow(struct point *p, int dx, int dy, int l, struct graphics_gc *gc, struct graphics *gra) {
- struct point pnt[3];
+static void display_draw_arrow(struct point *p, navit_float dx, navit_float dy, navit_float width,
+ struct display_context *dc,
+ struct graphics *gra, int filled) {
+ struct point pnt[4];
+ /* half the width in every direction */
+ width /= 2;
pnt[0]=pnt[1]=pnt[2]=*p;
- pnt[0].x+=-dx*l/65536+dy*l/65536;
- pnt[0].y+=-dy*l/65536-dx*l/65536;
- pnt[2].x+=-dx*l/65536-dy*l/65536;
- pnt[2].y+=-dy*l/65536+dx*l/65536;
- graphics_draw_lines(gra, gc, pnt, 3);
+ pnt[0].x+=-dx*width+dy*width;
+ pnt[0].y+=-dy*width-dx*width;
+ pnt[2].x+=-dx*width-dy*width;
+ pnt[2].y+=-dy*width+dx*width;
+ if(filled) {
+ /* close the loop */
+ pnt[3]=pnt[0];
+ graphics_draw_polygon(gra, dc->gc, pnt, 4);
+ } else {
+ graphics_draw_lines(gra, dc->gc, pnt, 3);
+ }
+
}
-static void display_draw_arrows(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count) {
- int i,dx,dy,l;
+/**
+ * @brief draw arrows along a multi polygon line
+ *
+ * This function draws arrows along a multi polygon line, and scales the
+ * arrows according to current view settings by interpolating sizes at
+ * given arrow position,
+ *
+ * @param gra current graphics instance handle
+ * @param dc current drawing context
+ * @param pnt array of points for this polyline
+ * @param count number of points in pnt
+ * @param width arrray of integers giving the expexted line width at the corresponding point
+ * @param filled. True to draw filled arrows, false to draw only line arrows.
+ */
+static void display_draw_arrows(struct graphics *gra, struct display_context *dc, struct point *pnt, int count,
+ int *width, int filled) {
+ navit_float dx,dy,dw,l;
+ int i;
struct point p;
+ int w;
for (i = 0 ; i < count-1 ; i++) {
+ /* get the X and Y size */
dx=pnt[i+1].x-pnt[i].x;
dy=pnt[i+1].y-pnt[i].y;
- l=sqrt(dx*dx+dy*dy);
+ dw=width[i+1] - width[i];
+ /* calculate the length of the way segment */
+ l=navit_sqrt(dx*dx+dy*dy);
if (l) {
- dx=dx*65536/l;
- dy=dy*65536/l;
- p=pnt[i];
- p.x+=dx*15/65536;
- p.y+=dy*15/65536;
- display_draw_arrow(&p, dx, dy, 10, gc, gra);
- p=pnt[i+1];
- p.x-=dx*15/65536;
- p.y-=dy*15/65536;
- display_draw_arrow(&p, dx, dy, 10, gc, gra);
+ /* length is not zero */
+ /* calculate the vector per length */
+ dx=dx/l;
+ dy=dy/l;
+ dw=dw/l;
+ /* different behaviour for oneway arrows than for routing graph ones */
+ if(filled) {
+ if(l > (2*width[i])) {
+ /* print arrow at middle point */
+ p=pnt[i];
+ p.x+=dx*(l/2);
+ p.y+=dy*(l/2);
+ w=width[i];
+ w+=dw*(l/2);
+ display_draw_arrow(&p, dx, dy, w, dc, gra, filled);
+ }
+ /* if line is quite long, print arrows at 1/4 and 3/4 length */
+ if(l > (20*width[i])) {
+ /* at 1/4 the line length */
+ p=pnt[i];
+ p.x+=dx*(l/4);
+ p.y+=dy*(l/4);
+ w=width[i];
+ w+=dw*(l/4);
+ display_draw_arrow(&p, dx, dy, w, dc, gra, filled);
+ /* at 3/4 the arrow length */
+ p=pnt[i+1];
+ p.x-=dx*(l/4);
+ p.y-=dy*(l/4);
+ w=width[i+1];
+ w-=dw*(l/4);
+ display_draw_arrow(&p, dx, dy, w, dc, gra, filled);
+ }
+ } else {
+ /*FIXME: what if line length was smaller than 15?*/
+ /* print arrow 15 units from start */
+ p=pnt[i];
+ p.x+=dx*15;
+ p.y+=dy*15;
+ display_draw_arrow(&p, dx, dy, 20, dc, gra, filled);
+ /* print arrow 15 units before end */
+ p=pnt[i+1];
+ p.x-=dx*15;
+ p.y-=dy*15;
+ display_draw_arrow(&p, dx, dy, 20, dc, gra, filled);
+ }
}
}
}
@@ -2137,66 +2212,209 @@ static void poly_intersection(struct point *p1, struct point *p2, struct point_r
}
/**
- * @brief Draw a plain polygon on the display
+ * @brief clip a polygon inside a rectangle
*
- * @param gra The graphics instance on which to draw
- * @param gc The graphics context
- * @param[in] pin An array of points forming the polygon
- * @param count_in The number of elements inside @p pin
+ * This function clippes a given polygon inside a rectangle. It writes the result into provided buffer.
+ *
+ * @param[in] r rectangle to clip into
+ * @param[in] pin point array of input polygon
+ * @param[in] count_in number of points in pin
+ * @param[out] out preallocated buffer of at least count_in *8 +1 points size
+ * @param[out] count_out size of out number of points, number of points used in out at return
*/
-void graphics_draw_polygon_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in) {
- struct point_rect r=gra->r;
- struct point *pout,*p,*s,pi,*p1,*p2;
- int limit=10000;
- struct point *pa1=g_alloca(sizeof(struct point) * (count_in < limit ? count_in*8+1:0));
- struct point *pa2=g_alloca(sizeof(struct point) * (count_in < limit ? count_in*8+1:0));
- int count_out,edge=3;
- int i;
- if (count_in < limit) {
- p1=pa1;
- p2=pa2;
- } else {
- p1=g_new(struct point, count_in*8+1);
- p2=g_new(struct point, count_in*8+1);
+static void graphics_clip_polygon(struct point_rect * r, struct point * in, int count_in, struct point *out,
+ int* count_out) {
+ /* set our self a limit for the in stack buffer. To not overflow stack */
+ const int limit=10000;
+ /* get a temp buffer to store points after one direction clipping.
+ * since we are clipping 4 directions, result is always in out at the end*/
+ struct point *temp=g_alloca(sizeof(struct point) * (count_in < limit ? count_in*8+1:0));
+ struct point *pout;
+ struct point *pin;
+ int edge;
+ int count;
+
+ /* sanity check */
+ if((r == NULL) || (in == NULL) || (out == NULL) || (count_out == NULL) || (*count_out < count_in*8+1)) {
+ return;
+ }
+
+ /* prepare buffers. We have two buffers that we flip over.
+ * 1. the output buffer
+ * 2. temp
+ */
+ if (count_in >= limit) {
+ /* too big. Allocate a buffer (slower) */
+ temp=g_new(struct point, count_in*8+1);
}
+ /* use temp as first buffer. So we get the final result in out*/
+ pout = temp;
+ /* start with input polygon */
+ pin=in;
+ /* start with number of points of source polygon*/
+ count=count_in;
- pout=p1;
+ /* clip all four directions of a rectangle */
for (edge = 0 ; edge < 4 ; edge++) {
- p=pin;
- s=pin+count_in-1;
- count_out=0;
- for (i = 0 ; i < count_in ; i++) {
- if (is_inside(p, &r, edge)) {
- if (! is_inside(s, &r, edge)) {
- poly_intersection(s,p,&r,edge,&pi);
- pout[count_out++]=pi;
+ int i;
+ /* p is first element in current buffer */
+ struct point *p=pin;
+ /* s is lasst element in current buffer */
+ struct point *s=pin+count-1;
+ /* nothing written yet */
+ *count_out=0;
+
+ /* iterate all points in current buffer */
+ for (i = 0 ; i < count ; i++) {
+ if (is_inside(p, r, edge)) {
+ if (! is_inside(s, r, edge)) {
+ struct point pi;
+ /* current segment crosses border from outside to inside. Add crossing point with border first */
+ poly_intersection(s,p,r,edge,&pi);
+ pout[(*count_out)++]=pi;
}
- pout[count_out++]=*p;
+ /* add point if inside */
+ pout[(*count_out)++]=*p;
} else {
- if (is_inside(s, &r, edge)) {
- poly_intersection(p,s,&r,edge,&pi);
- pout[count_out++]=pi;
+ if (is_inside(s, r, edge)) {
+ struct point pi;
+ /*current segment crosses border from inside to outside. Add crossing point with border */
+ poly_intersection(p,s,r,edge,&pi);
+ pout[(*count_out)++]=pi;
}
+ /* skip point if outside */
}
+ /* move one coordinate forward */
s=p;
p++;
}
- count_in=count_out;
- if (pin == p1) {
- pin=p2;
- pout=p1;
+ /* use result of last clipping for next */
+ count=*count_out;
+
+ /* switch buffer */
+ if(pout == temp) {
+ pout=out;
+ pin=temp;
} else {
- pin=p1;
- pout=p2;
+ pin=out;
+ pout=temp;
}
}
- graphics_draw_polygon(gra, gc, pin, count_in);
+
+ /* have clipped poly in out. And number of points now in *count_out */
+
+ /* if we had to allocate the buffer, we need to free it */
+ if (count_in >= limit) {
+ g_free(temp);
+ }
+ return;
+}
+
+/**
+ * @brief Draw a plain polygon on the display
+ *
+ * @param gra The graphics instance on which to draw
+ * @param gc The graphics context
+ * @param[in] pin An array of points forming the polygon
+ * @param count_in The number of elements inside @p pin
+ */
+void graphics_draw_polygon_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in) {
+ struct point_rect r=gra->r;
+ int limit=10000;
+ struct point *pa1=g_alloca(sizeof(struct point) * (count_in < limit ? count_in*8+1:0));
+ struct point *clipped;
+ int count_out = count_in*8+1;
+
+ /* prepare buffer */
+ if (count_in < limit) {
+ /* use on stack buffer */
+ clipped=pa1;
+ } else {
+ /* too big. allocate buffer (slower) */
+ clipped=g_new(struct point, count_in*8+1);
+ }
+
+ graphics_clip_polygon(&r, pin, count_in, clipped, &count_out);
+ graphics_draw_polygon(gra, gc, clipped, count_out);
+
+ /* if we had to allocate buffer, free it */
if (count_in >= limit) {
- g_free(p1);
- g_free(p2);
+ g_free(clipped);
}
}
+/**
+ * @brief Draw a plain polygon with holes on the display
+ *
+ * @param gra The graphics instance on which to draw
+ * @param gc The graphics context
+ * @param[in] pin An array of points forming the polygon
+ * @param count_in The number of elements inside @p pin
+ * @param hole_count The number of hole polygons to cut out
+ * @param pcount array of [hole_count] integers giving the number of
+ * points per hole
+ * @param holes array of point arrays for the hole polygons
+ */
+static void graphics_draw_polygon_with_holes_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pin,
+ int count_in, int hole_count, int* ccount, struct point **holes) {
+ int i;
+ struct point_rect r=gra->r;
+ int limit=10000;
+ struct point *pa1;
+ struct point *clipped;
+ int total_count_in;
+ int count_out;
+ int count_used;
+ int found_hole_count;
+ int *found_ccount;
+ struct point ** found_holes;
+ /* get total node count for polygon plus all holes */
+ total_count_in = count_in;
+ for(i = 0; i < hole_count; i ++) {
+ total_count_in += ccount[i];
+ }
+ count_out = total_count_in*8+1+hole_count;
+
+ /* prepare buffer */
+ pa1=g_alloca(sizeof(struct point) * (total_count_in < limit ? total_count_in*8+1:0));
+ if (count_in < limit) {
+ /* use on stack buffer */
+ clipped=pa1;
+ } else {
+ /* too big. allocate buffer (slower) */
+ clipped=g_new(struct point, count_in*8+1);
+ }
+ count_used=0;
+
+ /* prepare arrays for new holes */
+ found_ccount=g_alloca(sizeof(int)*hole_count);
+ found_holes=g_alloca(sizeof(struct point*)*hole_count);
+ found_hole_count=0;
+
+ /* clip outer polygon */
+ graphics_clip_polygon(&r, pin, count_in, clipped, &count_out);
+ count_used += count_out;
+ /* clip the holes */
+ for (i=0; i < hole_count; i ++) {
+ struct point* buffer = clipped + count_used;
+ int count = total_count_in*8+1+hole_count - count_used;
+ graphics_clip_polygon(&r, holes[i], ccount[i], buffer, &count);
+ count_used +=count;
+ if(count > 0) {
+ /* only if there are points left after clipping */
+ found_ccount[found_hole_count]=count;
+ found_holes[found_hole_count]=buffer;
+ found_hole_count ++;
+ }
+ }
+ /* call drawing function */
+ graphics_draw_polygon_with_holes(gra, gc, clipped, count_out, found_hole_count, found_ccount, found_holes);
+
+ /* if we had to allocate buffer, free it */
+ if (total_count_in >= limit) {
+ g_free(clipped);
+ }
+}
static void display_context_free(struct display_context *dc) {
if (dc->gc)
@@ -2251,13 +2469,6 @@ char *graphics_icon_path(const char *icon) {
ret=g_strdup(icon);
else {
#ifdef HAVE_API_ANDROID
- // get resources for the correct screen density
- //
- // this part not needed, android unpacks only the correct version into res/drawable dir!
- // dbg(lvl_debug,"android icon_path %s",icon);
- // static char *android_density;
- // android_density = getenv("ANDROID_DENSITY");
- // ret=g_strdup_printf("res/drawable-%s/%s",android_density ,icon);
ret=g_strdup_printf("res/drawable/%s",icon);
#else
if (! navit_sharedir)
@@ -2387,9 +2598,9 @@ static void displayitem_free_holes(struct displayitem_poly_holes * holes) {
static inline void displayitem_draw_polygon (struct display_context * dc, struct graphics * gra, struct point * pa,
int count, struct displayitem_poly_holes * holes) {
- /*TODO: implement a "clipped" version of graphics_draw_polygon_with_holes*/
if((holes != NULL) && (holes->count > 0))
- graphics_draw_polygon_with_holes(gra, dc->gc, pa, count, holes->count, holes->ccount, (struct point **)holes->coords);
+ graphics_draw_polygon_with_holes_clipped(gra, dc->gc, pa, count, holes->count, holes->ccount,
+ (struct point **)holes->coords);
else
graphics_draw_polygon_clipped(gra, dc->gc, pa, count);
}
@@ -2457,11 +2668,20 @@ static inline void displayitem_draw_text(struct displayitem *di,struct display_c
}
static inline void displayitem_draw_icon(struct displayitem *di,struct display_context *dc, struct element * e,
- struct graphics * gra, struct point * pa, int count) {
+ struct graphics * gra, struct point * pa, int count, struct layout * l) {
if (count) {
struct graphics_image *img=dc->img;
if (!img || item_is_custom_poi(di->item)) {
+ int icon_width = e->u.icon.width;
+ int icon_height = e->u.icon.height;
char *path;
+ /* get the standard icon size out of the layout if unset */
+ if(l != NULL) {
+ if(icon_height==-1)
+ icon_height=l->icon_h;
+ if(icon_width==-1)
+ icon_width=l->icon_w;
+ }
if (item_is_custom_poi(di->item)) {
char *icon;
char *src;
@@ -2475,7 +2695,7 @@ static inline void displayitem_draw_icon(struct displayitem *di,struct display_c
g_free(icon);
} else
path=graphics_icon_path(e->u.icon.src);
- img=graphics_image_new_scaled_rotated(gra, path, e->u.icon.width, e->u.icon.height, e->u.icon.rotation);
+ img=graphics_image_new_scaled_rotated(gra, path, icon_width, icon_height, e->u.icon.rotation);
if (img)
dc->img=img;
else
@@ -2514,15 +2734,16 @@ static inline void displayitem_draw_image (struct displayitem *di, struct displa
* This function will invoke the appropriate draw primitive depending on the type of the element to draw
*
* @brief di The displayitem to draw
- * @brief dummy Unused
+ * @brief l current layout for getting defaults and underground alpha
* @brief dc The display_context to use to draw items
*/
-static void displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc) {
+static void displayitem_draw(struct displayitem *di, struct layout *l, struct display_context *dc) {
int *width=g_alloca(sizeof(int)*dc->maxlen);
int limit=0;
struct point *pa=g_alloca(sizeof(struct point)*dc->maxlen);
struct graphics *gra=dc->gra;
struct element *e=dc->e;
+ int draw_underground=0;
while (di) {
int count=di->count,mindist=dc->mindist;
@@ -2531,10 +2752,33 @@ static void displayitem_draw(struct displayitem *di, void *dummy, struct display
di->z_order=++(gra->current_z_order);
+ /* Skip elements that are to be drawn on oneway streets only
+ * if street is not oneway or roundabout */
+ if((e->oneway) && ((!(di->flags & AF_ONEWAY)) || (di->flags & AF_ROUNDABOUT))) {
+ di=di->next;
+ continue;
+ }
+
if (! dc->gc) {
struct graphics_gc * gc=graphics_gc_new(gra);
- graphics_gc_set_foreground(gc, &e->color);
dc->gc=gc;
+ graphics_gc_set_foreground(dc->gc, &e->color);
+ }
+
+ /* If the element id flagged AF_UNDERGROUND, we apply predefined transparenc to it if
+ * it's not the text. */
+ if((di->flags & AF_UNDERGROUND) && (dc->e->type != element_text)) {
+ if(!draw_underground) {
+ struct color fg_color = e->color;
+ fg_color.a= (l != NULL) ? l->underground_alpha: UNDERGROUND_ALPHA_;
+ graphics_gc_set_foreground(dc->gc, &fg_color);
+ draw_underground=1;
+ }
+ } else {
+ if(draw_underground) {
+ graphics_gc_set_foreground(dc->gc, &e->color);
+ draw_underground=0;
+ }
}
if (item_type_is_area(dc->type) && (dc->e->type == element_polyline || dc->e->type == element_text))
@@ -2548,6 +2792,8 @@ static void displayitem_draw(struct displayitem *di, void *dummy, struct display
mindist=0;
if (dc->e->type == element_polyline)
count=transform(dc->trans, dc->pro, di->c, pa, count, mindist, e->u.polyline.width, width);
+ else if (dc->e->type == element_arrows)
+ count=transform(dc->trans, dc->pro, di->c, pa, count, mindist, e->u.arrows.width, width);
else
count=transform(dc->trans, dc->pro, di->c, pa, count, mindist, 0, NULL);
switch (e->type) {
@@ -2564,13 +2810,13 @@ static void displayitem_draw(struct displayitem *di, void *dummy, struct display
displayitem_draw_text(di, dc, e, gra, pa, count, &t_holes);
break;
case element_icon:
- displayitem_draw_icon(di, dc, e, gra, pa, count);
+ displayitem_draw_icon(di, dc, e, gra, pa, count, l);
break;
case element_image:
displayitem_draw_image (di, dc, gra, pa, count);
break;
case element_arrows:
- display_draw_arrows(gra,dc->gc,pa,count);
+ display_draw_arrows(gra,dc,pa,count, width, e->oneway);
break;
default:
dbg(lvl_error, "Unhandled element type %d", e->type);
@@ -2588,7 +2834,8 @@ static void displayitem_draw(struct displayitem *di, void *dummy, struct display
* @returns <>
* @author Martin Schaller (04/2008)
*/
-static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *display_list, struct itemgra *itm) {
+static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *display_list, struct itemgra *itm,
+ struct layout * l) {
struct element *e;
GList *es,*types;
struct display_context *dc=&display_list->dc;
@@ -2603,7 +2850,7 @@ static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *dis
dc->type=GPOINTER_TO_INT(types->data);
entry=get_hash_entry(display_list, dc->type);
if (entry && entry->di) {
- displayitem_draw(entry->di, NULL, dc);
+ displayitem_draw(entry->di, l, dc);
display_context_free(dc);
}
types=g_list_next(types);
@@ -2663,7 +2910,8 @@ void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct tra
* @returns <>
* @author Martin Schaller (04/2008)
*/
-static void xdisplay_draw_layer(struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order) {
+static void xdisplay_draw_layer(struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order,
+ struct layout * l) {
GList *itms;
struct itemgra *itm;
@@ -2671,7 +2919,7 @@ static void xdisplay_draw_layer(struct displaylist *display_list, struct graphic
while (itms) {
itm=itms->data;
if (order >= itm->order.min && order <= itm->order.max)
- xdisplay_draw_elements(gra, display_list, itm);
+ xdisplay_draw_elements(gra, display_list, itm, l);
itms=g_list_next(itms);
}
}
@@ -2694,7 +2942,7 @@ static void xdisplay_draw(struct displaylist *display_list, struct graphics *gra
if (lay->active) {
if (lay->ref)
lay=lay->ref;
- xdisplay_draw_layer(display_list, gra, lay, order);
+ xdisplay_draw_layer(display_list, gra, lay, order, l);
}
lays=g_list_next(lays);
}
@@ -2925,7 +3173,7 @@ void graphics_displaylist_draw(struct graphics *gra, struct displaylist *display
graphics_background_gc(gra, gra->gc[0]);
if (flags & 1)
callback_list_call_attr_0(gra->cbl, attr_predraw);
- graphics_draw_mode(gra, draw_mode_begin);
+ graphics_draw_mode(gra, (flags & 8)?draw_mode_begin_clear:draw_mode_begin);
if (!(flags & 2))
graphics_draw_rectangle(gra, gra->gc[0], &gra->r.lu, gra->r.rl.x-gra->r.lu.x, gra->r.rl.y-gra->r.lu.y);
if (l) {
diff --git a/navit/graphics.h b/navit/graphics.h
index 3ea10e271..9a3a33730 100644
--- a/navit/graphics.h
+++ b/navit/graphics.h
@@ -43,7 +43,7 @@ struct mapset;
/* This enum must be synchronized with the constants in NavitGraphics.java. */
enum draw_mode_num {
- draw_mode_begin, draw_mode_end
+ draw_mode_begin, draw_mode_end, draw_mode_begin_clear
};
struct graphics_priv;
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c
index e119cf3cc..c6fd37488 100644
--- a/navit/graphics/android/graphics_android.c
+++ b/navit/graphics/android/graphics_android.c
@@ -483,8 +483,9 @@ static void resize_callback(struct graphics_priv *gra, int w, int h) {
callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h);
}
-static void padding_callback(struct graphics_priv *gra, int left, int top, int right, int bottom) {
- dbg(lvl_debug, "win.padding left=%d top=%d right=%d bottom=%d ok", left, top, right, bottom);
+static void padding_changed_callback(struct graphics_priv *gra, int left, int top, int right,
+ int bottom) {
+ dbg(lvl_error, "win.padding left=%d top=%d right=%d bottom=%d", left, top, right, bottom);
gra->padding->left = left;
gra->padding->top = top;
gra->padding->right = right;
@@ -627,45 +628,45 @@ static int graphics_android_init(struct graphics_priv *ret, struct graphics_priv
if (ret->Paint)
ret->Paint = (*jnienv)->NewGlobalRef(jnienv, ret->Paint);
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setSizeChangedCallback", "(I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setSizeChangedCallback", "(J)V");
if (cid == NULL) {
- dbg(lvl_error,"no SetResizeCallback method found");
+ dbg(lvl_error,"no setResizeCallback method found");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(resize_callback), ret);
- (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb);
+ (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (jlong)cb);
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setPaddingChangedCallback", "(I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setPaddingChangedCallback", "(J)V");
if (cid == NULL) {
- dbg(lvl_error,"no SetPaddingCallback method found");
+ dbg(lvl_error,"no setPaddingCallback method found");
return 0; /* exception thrown */
}
- cb=callback_new_1(callback_cast(padding_callback), ret);
- (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb);
+ cb=callback_new_1(callback_cast(padding_changed_callback), ret);
+ (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (jlong)cb);
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setButtonCallback", "(I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setButtonCallback", "(J)V");
if (cid == NULL) {
- dbg(lvl_error,"no SetButtonCallback method found");
+ dbg(lvl_error,"no setButtonCallback method found");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(button_callback), ret);
- (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb);
+ (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (jlong)cb);
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setMotionCallback", "(I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setMotionCallback", "(J)V");
if (cid == NULL) {
- dbg(lvl_error,"no SetMotionCallback method found");
+ dbg(lvl_error,"no setMotionCallback method found");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(motion_callback), ret);
- (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb);
+ (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (jlong)cb);
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setKeypressCallback", "(I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setKeypressCallback", "(J)V");
if (cid == NULL) {
- dbg(lvl_error,"no SetKeypressCallback method found");
+ dbg(lvl_error,"no setKeypressCallback method found");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(keypress_callback), ret);
- (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (int)cb);
+ (*jnienv)->CallVoidMethod(jnienv, ret->NavitGraphics, cid, (jlong)cb);
if (!find_method(ret->NavitGraphicsClass, "draw_polyline", "(Landroid/graphics/Paint;[I)V",
&ret->NavitGraphics_draw_polyline))
@@ -696,7 +697,7 @@ static int graphics_android_init(struct graphics_priv *ret, struct graphics_priv
return 0;
if (!find_method(ret->NavitGraphicsClass, "overlay_resize", "(IIIII)V", &ret->NavitGraphics_overlay_resize))
return 0;
- if (!find_method(ret->NavitGraphicsClass, "SetCamera", "(I)V", &ret->NavitGraphics_SetCamera))
+ if (!find_method(ret->NavitGraphicsClass, "setCamera", "(I)V", &ret->NavitGraphics_SetCamera))
return 0;
#if 0
set_activity(ret->NavitGraphics);
@@ -732,7 +733,7 @@ static void graphics_android_disable_suspend(struct window *win) {
static void graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, struct attr **in,
struct attr ***out, int *valid) {
int ncmd=0;
- dbg(0,"Running %s",function);
+ dbg(lvl_debug,"Running %s",function);
if(!strcmp(function,"map_download_dialog")) {
ncmd=3;
} else if(!strcmp(function,"backup_restore_dialog")) {
@@ -911,7 +912,7 @@ static jmethodID NavitWatch_remove;
static void do_poll(JNIEnv *env, int fd, int cond) {
struct pollfd pfd;
pfd.fd=fd;
- dbg(lvl_debug,"%p poll called for %d %d", fd, cond);
+ dbg(lvl_debug,"poll called for %d %d", fd, cond);
switch ((enum event_watch_cond)cond) {
case event_watch_cond_read:
pfd.events=POLLIN;
@@ -931,8 +932,8 @@ static void do_poll(JNIEnv *env, int fd, int cond) {
static struct event_watch *event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb) {
jobject ret;
- ret=(*jnienv)->NewObject(jnienv, NavitWatchClass, NavitWatch_init, (int)do_poll, h, (int) cond, (int)cb);
- dbg(lvl_debug,"result for %d,%d,%p=%p",h,cond,cb,ret);
+ ret=(*jnienv)->NewObject(jnienv, NavitWatchClass, NavitWatch_init, (jlong)do_poll, h, (jint) cond, (jlong)cb);
+ dbg(lvl_debug,"result for %d,%d,%p = %p",h,cond,cb,ret);
if (ret)
ret = (*jnienv)->NewGlobalRef(jnienv, ret);
return (struct event_watch *)ret;
@@ -973,7 +974,8 @@ static struct event_timeout *event_android_add_timeout(int timeout, int multi, s
ret->cb = cb;
ret->multi = multi;
ret->handle_timeout = event_android_handle_timeout;
- ret->jni_timeout = (*jnienv)->NewObject(jnienv, NavitTimeoutClass, NavitTimeout_init, timeout, multi, (int)ret);
+ ret->jni_timeout = (*jnienv)->NewObject(jnienv, NavitTimeoutClass, NavitTimeout_init, timeout, multi, (jlong)(ret));
+ dbg(lvl_debug,"result for %d,%d,%p = %p",timeout,multi,cb,ret);
if (ret->jni_timeout)
ret->jni_timeout = (*jnienv)->NewGlobalRef(jnienv, ret->jni_timeout);
return ret;
@@ -1025,7 +1027,7 @@ static struct event_priv *event_android_new(struct event_methods *meth) {
dbg(lvl_debug,"enter");
if (!find_class_global("org/navitproject/navit/NavitTimeout", &NavitTimeoutClass))
return NULL;
- NavitTimeout_init = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "<init>", "(IZI)V");
+ NavitTimeout_init = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "<init>", "(IZJ)V");
if (NavitTimeout_init == NULL)
return NULL;
NavitTimeout_remove = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "remove", "()V");
@@ -1044,7 +1046,7 @@ static struct event_priv *event_android_new(struct event_methods *meth) {
if (!find_class_global("org/navitproject/navit/NavitWatch", &NavitWatchClass))
return NULL;
- NavitWatch_init = (*jnienv)->GetMethodID(jnienv, NavitWatchClass, "<init>", "(IIII)V");
+ NavitWatch_init = (*jnienv)->GetMethodID(jnienv, NavitWatchClass, "<init>", "(JIIJ)V");
if (NavitWatch_init == NULL)
return NULL;
NavitWatch_remove = (*jnienv)->GetMethodID(jnienv, NavitWatchClass, "remove", "()V");
@@ -1056,7 +1058,7 @@ static struct event_priv *event_android_new(struct event_methods *meth) {
Navit_disableSuspend = (*jnienv)->GetMethodID(jnienv, NavitClass, "disableSuspend", "()V");
if (Navit_disableSuspend == NULL)
return NULL;
- Navit_exit = (*jnienv)->GetMethodID(jnienv, NavitClass, "exit", "()V");
+ Navit_exit = (*jnienv)->GetMethodID(jnienv, NavitClass, "onDestroy", "()V");
if (Navit_exit == NULL)
return NULL;
Navit_fullscreen = (*jnienv)->GetMethodID(jnienv, NavitClass, "fullscreen", "(I)V");
@@ -1076,7 +1078,12 @@ static struct event_priv *event_android_new(struct event_methods *meth) {
return NULL;
}
-
+/* below needs review, android resizes the view and the actual height of the keyboard is not
+ * passed down here and is irrelevant, only wether it is onscreen matters, so
+ * android returns a height of 1 px in the case of an onscreen keyboard just
+ * to keep the logic to remove the keyboard from the screen afterwards working untill
+ * the logic in native code is reviewed.
+ * /
/**
* @brief Displays the native input method.
*
@@ -1096,14 +1103,12 @@ static struct event_priv *event_android_new(struct event_methods *meth) {
* @return True if the input method is going to be displayed, false if not.
*/
int show_native_keyboard (struct graphics_keyboard *kbd) {
- kbd->w = -1;
if (Navit_showNativeKeyboard == NULL) {
dbg(lvl_error, "method Navit.showNativeKeyboard() not found, cannot display keyboard");
return 0;
}
kbd->h = (*jnienv)->CallIntMethod(jnienv, android_activity, Navit_showNativeKeyboard);
- dbg(lvl_error, "keyboard size is %d x %d px", kbd->w, kbd->h);
- dbg(lvl_error, "return");
+ dbg(lvl_error, "keyboard height is %d px is a lie", kbd->h);
/* zero height means we're not showing a keyboard, therefore normalize height to boolean */
return !!(kbd->h);
}
diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp
index 10784d6b3..cb9b4c456 100644
--- a/navit/graphics/qt5/graphics_qt5.cpp
+++ b/navit/graphics/qt5/graphics_qt5.cpp
@@ -408,13 +408,7 @@ static void draw_polygon(struct graphics_priv* gr, struct graphics_gc_priv* gc,
polygon.putPoints(i, 1, p[i].x, p[i].y);
gr->painter->setPen(*gc->pen);
gr->painter->setBrush(*gc->brush);
- /* if the polygon is transparent, we need to clear it first */
- if (!gc->brush->isOpaque()) {
- QPainter::CompositionMode mode = gr->painter->compositionMode();
- gr->painter->setCompositionMode(QPainter::CompositionMode_Clear);
- gr->painter->drawPolygon(polygon);
- gr->painter->setCompositionMode(mode);
- }
+
gr->painter->drawPolygon(polygon);
}
@@ -446,13 +440,6 @@ static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_g
if(hole_count > 0)
path = path.subtracted(inner);
- /* if the polygon is transparent, we need to clear it first */
- if (!gc->brush->isOpaque()) {
- QPainter::CompositionMode mode = gr->painter->compositionMode();
- gr->painter->setCompositionMode(QPainter::CompositionMode_Clear);
- gr->painter->drawPath(path);
- gr->painter->setCompositionMode(mode);
- }
gr->painter->drawPath(path);
}
@@ -460,13 +447,6 @@ static void draw_rectangle(struct graphics_priv* gr, struct graphics_gc_priv* gc
// dbg(lvl_debug,"gr=%p gc=%p %d,%d,%d,%d", gr, gc, p->x, p->y, w, h);
if (gr->painter == NULL)
return;
- /* if the rectangle is transparent, we need to clear it first */
- if (!gc->brush->isOpaque()) {
- QPainter::CompositionMode mode = gr->painter->compositionMode();
- gr->painter->setCompositionMode(QPainter::CompositionMode_Clear);
- gr->painter->fillRect(p->x, p->y, w, h, *gc->brush);
- gr->painter->setCompositionMode(mode);
- }
gr->painter->fillRect(p->x, p->y, w, h, *gc->brush);
}
@@ -647,9 +627,11 @@ static void draw_mode(struct graphics_priv* gr, enum draw_mode_num mode) {
case draw_mode_begin:
dbg(lvl_debug, "Begin drawing on context %p (use == %d)", gr, gr->use_count);
gr->use_count++;
- if (gr->painter == NULL)
+ if (gr->painter == NULL) {
+ if(gr->parent != NULL)
+ gr->pixmap->fill(QColor(0,0,0,0));
gr->painter = new QPainter(gr->pixmap);
- else
+ } else
dbg(lvl_debug, "drawing on %p already active", gr);
break;
case draw_mode_end:
diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c
index 4187d4ed6..d92699307 100644
--- a/navit/graphics/sdl/graphics_sdl.c
+++ b/navit/graphics/sdl/graphics_sdl.c
@@ -284,45 +284,47 @@ static void image_free(struct graphics_priv *gr, struct graphics_image_priv * gi
g_free(gi);
}
-static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) {
+static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count,
+ int hole_count, int* ccount, struct point **holes) {
+
+ dbg(lvl_debug, "draw_polygon_with_holes: %p ", gc);
if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent
&& gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) {
return;
}
- Sint16 *vx, *vy;
- Sint16 x, y;
- int i;
-
- vx = alloca(count * sizeof(Sint16));
- vy = alloca(count * sizeof(Sint16));
-
- for(i = 0; i < count; i++) {
- x = (Sint16)p[i].x;
- y = (Sint16)p[i].y;
- vx[i] = x;
- vy[i] = y;
-
- dbg(lvl_debug, "draw_polygon: %p %i %d,%d", gc, i, p[i].x, p[i].y);
- }
+ /* SDL library (SDL_gfx) uses array of X and array of Y instead of array of points
+ * as the rest of navit does. This requires translating the coordinates from one struct
+ * into another. As we have our own version of SDL_gfx anyway, I step aside from this
+ * mechanic and continue using points. This breaks (pseudo= compatibility with stock
+ * sdl_graphics. Since we need to raytrace the polygons anyway, we can prepare the
+ * coordinates for SDL primitives there.
+ */
if(gr->aa) {
- raster_aapolygon(gr->screen, count, vx, vy,
- SDL_MapRGBA(gr->screen->format,
- gc->fore_r,
- gc->fore_g,
- gc->fore_b,
- gc->fore_a));
+ raster_aapolygon_with_holes(gr->screen, p, count, hole_count, ccount, holes,
+ SDL_MapRGBA(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b,
+ gc->fore_a));
} else {
- raster_polygon(gr->screen, count, vx, vy,
- SDL_MapRGBA(gr->screen->format,
- gc->fore_r,
- gc->fore_g,
- gc->fore_b,
- gc->fore_a));
+ raster_polygon_with_holes(gr->screen, p, count, hole_count, ccount, holes,
+ SDL_MapRGBA(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b,
+ gc->fore_a));
}
}
+static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) {
+ dbg(lvl_debug, "draw_polygon: %p ", gc);
+ /* Use polygon with holes primitive as this seems to be better performing than the
+ * traditional SDL_gfx like ones */
+ draw_polygon_with_holes(gr, gc, p, count, 0, NULL, NULL);
+}
+
static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) {
if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent
&& gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) {
@@ -819,6 +821,8 @@ static struct graphics_methods graphics_methods = {
NULL, /* set_attr */
NULL, /* show_native_keyboard */
NULL, /* hide_native_keyboard */
+ NULL, /* get_dpi */
+ draw_polygon_with_holes
};
static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p,
diff --git a/navit/graphics/sdl/raster.c b/navit/graphics/sdl/raster.c
index 6c713844b..8da7cd9a1 100644
--- a/navit/graphics/sdl/raster.c
+++ b/navit/graphics/sdl/raster.c
@@ -16,6 +16,7 @@
#include <math.h>
+#include <glib.h>
#include "raster.h"
@@ -1953,8 +1954,8 @@ void raster_aapolygon(SDL_Surface *dst, int16_t n, int16_t *vx, int16_t *vy, uin
o = p = -1;
}
#else
-
raster_hline(dst, xa+1, xb, y, color);
+
#endif
// raster_rect_inline(dst, xa, y, xb - xa, 1, color);
@@ -1962,3 +1963,199 @@ void raster_aapolygon(SDL_Surface *dst, int16_t n, int16_t *vx, int16_t *vy, uin
}
}
+/**
+ * @brief render filled polygon with holes by raycasting along the y axis
+ *
+ * This function renders a filled polygon that can have holes by SDL primitive
+ * graphic functions by raycasting along the y axis. This works basically the same
+ * as for complex polygons. Only difference is the "holes" are individual
+ * polygon loops not connected to the outer loop.
+ * FIXME: This draws well as long as the "hole" does not intersect with the
+ * outer polygon. However such multipolygons are seen a mapping error in OSM
+ * and therefore the rendering err may even help in detecting them.
+ * But this could be fixed by never starting a line on a vertex that came from a
+ * hole intersection.
+ *
+ * @param s SDL surface to draw on
+ * @param p Array of points containing the outer polygon
+ * @param count Number of points in outer polygon
+ * @param hole_count Number of hole polygons
+ * @param ccount number of points per hole polygon
+ * @oaram holes array of point arrays. One for each "hole"
+ * @param col Color to draw this.
+ */
+void raster_aapolygon_with_holes (SDL_Surface *s, struct point *p, int count, int hole_count, int* ccount,
+ struct point **holes, uint32_t col) {
+ int i;
+ struct point * p1;
+ struct point * p2;
+ /* Check visibility of clipping rectangle */
+ if ((s->clip_rect.w==0) || (s->clip_rect.h==0)) {
+ return;
+ }
+
+ /* Sanity check number of edges */
+ if (count < 3) {
+ return;
+ }
+ /*
+ * Draw antialiased outline
+ */
+ p1 = p2 = p;
+ p2++;
+ for (i = 1; i < count; i++) {
+ raster_aalineColorInt(s, p1->x, p1->y, p2->x, p2->y, col, 0);
+ p1 = p2;
+ p2++;
+ }
+ raster_aalineColorInt(s, p1->x, p1->y, p->x, p->y, col, 0);
+ raster_polygon_with_holes(s, p, count, hole_count, ccount, holes, col);
+}
+
+/**
+ * @brief render filled polygon with holes by raycasting along the y axis
+ *
+ * This function renders a filled polygon that can have holes by SDL primitive
+ * graphic functions by raycasting along the y axis. This works basically the same
+ * as for complex polygons. Only difference is the "holes" are individual
+ * polygon loops not connected to the outer loop.
+ * FIXME: This draws well as long as the "hole" does not intersect with the
+ * outer polygon. However such multipolygons are seen a mapping error in OSM
+ * and therefore the rendering err may even help in detecting them.
+ * But this could be fixed by never starting a line on a vertex that came from a
+ * hole intersection.
+ *
+ * @param s SDL surface to draw on
+ * @param p Array of points containing the outer polygon
+ * @param count Number of points in outer polygon
+ * @param hole_count Number of hole polygons
+ * @param ccount number of points per hole polygon
+ * @oaram holes array of point arrays. One for each "hole"
+ * @param col Color to draw this.
+ */
+void raster_polygon_with_holes (SDL_Surface *s, struct point *p, int count, int hole_count, int* ccount,
+ struct point **holes, uint32_t col) {
+ int vertex_max;
+ int vertex_count;
+ int * vertexes;
+ int miny, maxy;
+ int i;
+ int y;
+
+ /* Check visibility of clipping rectangle */
+ if ((s->clip_rect.w==0) || (s->clip_rect.h==0)) {
+ return;
+ }
+
+ /* Sanity check number of edges */
+ if (count < 3) {
+ return;
+ }
+
+ /*
+ * Prepare a buffer for vertexes. Maximum number of vertexes is the number of points
+ * of polygon and holes
+ */
+ vertex_max = count;
+ for(i =0; i < hole_count; i ++) {
+ vertex_max += ccount[i];
+ }
+ vertexes = g_malloc(sizeof(int) * vertex_max);
+ if(vertexes == NULL) {
+ return;
+ }
+
+ /* calculate y min and max coordinate. We can ignore the holes, as we won't render hole
+ * parts "bigger" than the surrounding polygon.*/
+ miny = p[0].y;
+ maxy = p[0].y;
+ for (i = 1; (i < count); i++) {
+ if (p[i].y < miny) {
+ miny = p[i].y;
+ } else if (p[i].y > maxy) {
+ maxy = p[i].y;
+ }
+ }
+
+ /* scan y coordinates from miny to maxy */
+ for(y = miny; y <= maxy ; y ++) {
+ int h;
+ vertex_count=0;
+ /* calculate the intersecting points of the polygon with current y and add to vertexes array*/
+ for (i = 0; (i < count); i++) {
+ int ind1;
+ int ind2;
+ struct point p1;
+ struct point p2;
+
+ if (!i) {
+ ind1 = count - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ p1.y = p[ind1].y;
+ p2.y = p[ind2].y;
+ if (p1.y < p2.y) {
+ p1.x = p[ind1].x;
+ p2.x = p[ind2].x;
+ } else if (p1.y > p2.y) {
+ p2.y = p[ind1].y;
+ p1.y = p[ind2].y;
+ p2.x = p[ind1].x;
+ p1.x = p[ind2].x;
+ } else {
+ continue;
+ }
+ if ( ((y >= p1.y) && (y < p2.y)) || ((y == maxy) && (y > p1.y) && (y <= p2.y)) ) {
+ vertexes[vertex_count++] = ((65536 * (y - p1.y)) / (p2.y - p1.y)) * (p2.x - p1.x) + (65536 * p1.x);
+ }
+ }
+ for(h= 0; h < hole_count; h ++) {
+ /* add the intersecting points from the holes as well */
+ for (i = 0; (i < ccount[h]); i++) {
+ int ind1;
+ int ind2;
+ struct point p1;
+ struct point p2;
+
+ if (!i) {
+ ind1 = ccount[h] - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ p1.y = holes[h][ind1].y;
+ p2.y = holes[h][ind2].y;
+ if (p1.y < p2.y) {
+ p1.x = holes[h][ind1].x;
+ p2.x = holes[h][ind2].x;
+ } else if (p1.y > p2.y) {
+ p2.y = holes[h][ind1].y;
+ p1.y = holes[h][ind2].y;
+ p2.x = holes[h][ind1].x;
+ p1.x = holes[h][ind2].x;
+ } else {
+ continue;
+ }
+ if ( ((y >= p1.y) && (y < p2.y)) || ((y == maxy) && (y > p1.y) && (y <= p2.y)) ) {
+ vertexes[vertex_count++] = ((65536 * (y - p1.y)) / (p2.y - p1.y)) * (p2.x - p1.x) + (65536 * p1.x);
+ }
+ }
+ }
+
+ /* sort the vertexes */
+ qsort(vertexes, vertex_count, sizeof(int), gfxPrimitivesCompareInt);
+ /* draw the lines between every second vertex */
+ for (i = 0; (i < vertex_count); i +=2) {
+ Sint16 xa;
+ Sint16 xb;
+ xa = (vertexes[i] >> 16);
+ xb = (vertexes[i+1] >> 16);
+ raster_hline(s, xa+1, xb, y, col);
+ }
+ }
+ g_free(vertexes);
+}
diff --git a/navit/graphics/sdl/raster.h b/navit/graphics/sdl/raster.h
index 2e68ea05f..e295f23fb 100644
--- a/navit/graphics/sdl/raster.h
+++ b/navit/graphics/sdl/raster.h
@@ -10,15 +10,21 @@
#include <stdint.h>
#include "SDL.h"
+#include "point.h"
void raster_rect(SDL_Surface *s, int16_t x, int16_t y, int16_t w, int16_t h, uint32_t col);
void raster_line(SDL_Surface *s, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col);
void raster_circle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col);
void raster_polygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col);
+void raster_polygon_with_holes (SDL_Surface *s, struct point *p, int count, int hole_count, int* ccount,
+ struct point **holes, uint32_t col);
void raster_aaline(SDL_Surface *s, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col);
void raster_aacircle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col);
void raster_aapolygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col);
+void raster_aapolygon_with_holes (SDL_Surface *s, struct point *p, int count, int hole_count, int* ccount,
+ struct point **holes, uint32_t col);
+
#endif /* __RASTER_H */
diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c
index 6bcad3be6..6346e59f7 100644
--- a/navit/graphics/win32/graphics_win32.c
+++ b/navit/graphics/win32/graphics_win32.c
@@ -829,8 +829,177 @@ static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc,
#if HAVE_API_WIN32_CE
/*
- * Windows CE doesn't support PaintPath used for other versions. No polygon with holes support for CE yet.
+ * Windows CE doesn't feature GraphicsPath, so in order to draw filled polygons
+ * with holes, we need to resort on manual raycasting. The following functions
+ * have been inspired from SDL backend that does need to raycast all polygons.
*/
+
+/* Helper qsort callback for polygon drawing */
+static int gfxPrimitivesCompareInt(const void *a, const void *b) {
+ return (*(const int *) a) - (*(const int *) b);
+}
+
+/**
+ * @brief render filled polygon with holes by raycasting along the y axis
+ *
+ * This function renders a filled polygon that can have holes by SDL primitive
+ * graphic functions by raycasting along the y axis. This works basically the same
+ * as for complex polygons. Only difference is the "holes" are individual
+ * polygon loops not connected to the outer loop.
+ * FIXME: This draws well as long as the "hole" does not intersect with the
+ * outer polygon. However such multipolygons are seen a mapping error in OSM
+ * and therefore the rendering err may even help in detecting them.
+ * But this could be fixed by never starting a line on a vertex that came from a
+ * hole intersection.
+ *
+ * @param gr graphics instance
+ * @param gc graphics context
+ * @param p Array of points for the outer polygon
+ * @param count Number of points in outer polygon
+ * @param hole_count Number of hole polygons
+ * @param ccount number of points per hole polygon
+ * @oaram holes array of point arrays. One for each "hole"
+ */
+static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count,
+ int hole_count, int* ccount, struct point **holes) {
+ int vertex_max;
+ int vertex_count;
+ int * vertexes;
+ int miny, maxy;
+ int i;
+ int y;
+ HPEN holdpen;
+ HBRUSH holdbrush;
+ HPEN linepen;
+
+ /* Sanity check number of edges */
+ if (count < 3) {
+ return;
+ }
+
+ /*
+ * Prepare a buffer for vertexes. Maximum number of vertexes is the number of points
+ * of polygon and holes
+ */
+ vertex_max = count;
+ for(i =0; i < hole_count; i ++) {
+ vertex_max += ccount[i];
+ }
+ vertexes = g_malloc(sizeof(int) * vertex_max);
+ if(vertexes == NULL) {
+ return;
+ }
+
+ /* create pen to draw the lines */
+ linepen = CreatePen( PS_SOLID, 1, gc->fg_color );
+
+ /* remeber pen and brush */
+ holdpen = SelectObject( gr->hMemDC, linepen );
+ holdbrush = SelectObject( gr->hMemDC, gc->hbrush );
+
+ /* calculate y min and max coordinate. We can ignore the holes, as we won't render hole
+ * parts "bigger" than the surrounding polygon.*/
+ miny = p[0].y;
+ maxy = p[0].y;
+ for (i = 1; (i < count); i++) {
+ if (p[i].y < miny) {
+ miny = p[i].y;
+ } else if (p[i].y > maxy) {
+ maxy = p[i].y;
+ }
+ }
+
+ /* scan y coordinates from miny to maxy */
+ for(y = miny; y <= maxy ; y ++) {
+ int h;
+ vertex_count=0;
+ /* calculate the intersecting points of the polygon with current y and add to vertexes array*/
+ for (i = 0; (i < count); i++) {
+ int ind1;
+ int ind2;
+ struct point p1;
+ struct point p2;
+
+ if (!i) {
+ ind1 = count - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ p1.y = p[ind1].y;
+ p2.y = p[ind2].y;
+ if (p1.y < p2.y) {
+ p1.x = p[ind1].x;
+ p2.x = p[ind2].x;
+ } else if (p1.y > p2.y) {
+ p2.y = p[ind1].y;
+ p1.y = p[ind2].y;
+ p2.x = p[ind1].x;
+ p1.x = p[ind2].x;
+ } else {
+ continue;
+ }
+ if ( ((y >= p1.y) && (y < p2.y)) || ((y == maxy) && (y > p1.y) && (y <= p2.y)) ) {
+ vertexes[vertex_count++] = ((65536 * (y - p1.y)) / (p2.y - p1.y)) * (p2.x - p1.x) + (65536 * p1.x);
+ }
+ }
+ for(h= 0; h < hole_count; h ++) {
+ /* add the intersecting points from the holes as well */
+ for (i = 0; (i < ccount[h]); i++) {
+ int ind1;
+ int ind2;
+ struct point p1;
+ struct point p2;
+
+ if (!i) {
+ ind1 = ccount[h] - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ p1.y = holes[h][ind1].y;
+ p2.y = holes[h][ind2].y;
+ if (p1.y < p2.y) {
+ p1.x = holes[h][ind1].x;
+ p2.x = holes[h][ind2].x;
+ } else if (p1.y > p2.y) {
+ p2.y = holes[h][ind1].y;
+ p1.y = holes[h][ind2].y;
+ p2.x = holes[h][ind1].x;
+ p1.x = holes[h][ind2].x;
+ } else {
+ continue;
+ }
+ if ( ((y >= p1.y) && (y < p2.y)) || ((y == maxy) && (y > p1.y) && (y <= p2.y)) ) {
+ vertexes[vertex_count++] = ((65536 * (y - p1.y)) / (p2.y - p1.y)) * (p2.x - p1.x) + (65536 * p1.x);
+ }
+ }
+ }
+
+ /* sort the vertexes */
+ qsort(vertexes, vertex_count, sizeof(int), gfxPrimitivesCompareInt);
+ /* draw the lines between every second vertex */
+ for (i = 0; (i < vertex_count); i +=2) {
+ int xa;
+ int xb;
+ xa = (vertexes[i] >> 16);
+ xb = (vertexes[i+1] >> 16);
+ MoveToEx( gr->hMemDC, xa+1, y, NULL );
+ LineTo( gr->hMemDC, xb, y );
+ }
+ }
+ /* free vertex buffer */
+ g_free(vertexes);
+
+ /* restore pen and brush */
+ SelectObject( gr->hMemDC, holdbrush);
+ SelectObject( gr->hMemDC, holdpen);
+
+ /* delete linepen */
+ DeleteObject(linepen);
+}
#else
static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count,
int hole_count, int* ccount, struct point **holes) {
@@ -1522,11 +1691,7 @@ static struct graphics_methods graphics_methods = {
NULL, /* show_native_keyboard */
NULL, /* hide_native_keyboard */
NULL, /* get dpi */
-#if HAVE_API_WIN32_CE
- NULL, /* draw_polygon_with_holes */
-#else
draw_polygon_with_holes
-#endif
};
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
index 265f1f28e..77502f03f 100644
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ b/navit/gui/gtk/gui_gtk_poi.c
@@ -37,6 +37,8 @@
#include "navigation.h" /* for FEET_PER_METER and other conversion factors. */
+GdkPixbuf *geticon(const char *name);
+
/**
* @brief Context passed around POI search function
*/
@@ -60,13 +62,16 @@ static struct gtk_poi_search {
* @param name The name of the icon to use (eg: "pharmacy.png"
* @return A pixbuf containing this icon of NULL if the icon could not be loaded
*/
-static GdkPixbuf *geticon(const char *name) {
+GdkPixbuf *geticon(const char *name) {
GdkPixbuf *icon=NULL;
GError *error=NULL;
- icon=gdk_pixbuf_new_from_file(graphics_icon_path(name),&error);
+ char *filename = graphics_icon_path(name);
+ icon=gdk_pixbuf_new_from_file(filename,&error);
if (error) {
dbg(lvl_error, "failed to load icon '%s': %s", name, error->message);
+ icon=NULL;
}
+ g_free(filename);
return icon;
}
diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c
index 1e57004d0..858904ddb 100644
--- a/navit/gui/gtk/gui_gtk_window.c
+++ b/navit/gui/gtk/gui_gtk_window.c
@@ -73,6 +73,8 @@
#define KEY_RIGHT GDK_Right
#endif
+GdkPixbuf *geticon(const char *name);
+
static gboolean keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this) {
int w,h;
struct transformation *t;
@@ -717,6 +719,7 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth,
this->vbox = gtk_vbox_new(FALSE, 0);
gtk_window_set_default_size(GTK_WINDOW(this->win), w, h);
gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
+ gtk_window_set_default_icon(geticon("navit_plain_bk.png"));
gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", "Navit");
gtk_widget_realize(this->win);
gui_gtk_ui_init(this);
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index 726a03d17..61756b485 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -1044,7 +1044,6 @@ void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, s
struct coord_geo g;
struct pcoord pc;
struct coord c;
- char *coord;
if (pc_in) {
pc=*pc_in;
@@ -1067,9 +1066,9 @@ void gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, s
wb=gui_internal_menu(this, name);
w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
gui_internal_widget_append(wb, w);
- coord=gui_internal_coordinates(&pc, ' ');
- gui_internal_widget_append(w, gui_internal_label_new(this, coord));
- g_free(coord);
+ char coord_str[32];
+ pcoord_format_degree_short(&pc, coord_str, sizeof(coord_str), " ");
+ gui_internal_widget_append(w, gui_internal_label_new(this, coord_str));
wtable = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
gui_internal_widget_append(w,wtable);
diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c
index 3148e83e5..910e2e8cf 100644
--- a/navit/gui/internal/gui_internal_command.c
+++ b/navit/gui/internal/gui_internal_command.c
@@ -41,161 +41,6 @@
#include <arpa/inet.h>
#endif
-/**
- * @brief Converts a WGS84 coordinate pair to its string representation.
- *
- * This function takes a coordinate pair with latitude and longitude in degrees and converts them to a
- * string of the form {@code 45°28'0" N 9°11'26" E}.
- *
- * @param gc A WGS84 coordinate pair
- * @param sep The separator character to insert between latitude and longitude
- *
- * @return The coordinates as a formatted string
- */
-static char *coordinates_geo(const struct coord_geo *gc, char sep) {
- char latc='N',lngc='E';
- int lat_deg,lat_min,lat_sec;
- int lng_deg,lng_min,lng_sec;
- struct coord_geo g=*gc;
-
- if (g.lat < 0) {
- g.lat=-g.lat;
- latc='S';
- }
- if (g.lng < 0) {
- g.lng=-g.lng;
- lngc='W';
- }
- lat_sec=fmod(g.lat*3600+0.5,60);
- lat_min=fmod(g.lat*60-lat_sec/60.0+0.5,60);
- lat_deg=g.lat-lat_min/60.0-lat_sec/3600.0+0.5;
- lng_sec=fmod(g.lng*3600+0.5,60);
- lng_min=fmod(g.lng*60-lng_sec/60.0+0.5,60);
- lng_deg=g.lng-lng_min/60.0-lng_sec/3600.0+0.5;;
-
- return g_strdup_printf("%d°%d'%d\" %c%c%d°%d'%d\" %c",lat_deg,lat_min,lat_sec,latc,sep,lng_deg,lng_min,lng_sec,lngc);
-}
-
-/**
- * @brief Converts a coordinate pair to its WGS84 string representation.
- *
- * This function takes a coordinate pair, transforms it to WGS84 and converts it to a string of the form
- * {@code 45°28'0" N 9°11'26" E}.
- *
- * @param gc A coordinate pair
- * @param sep The separator character to insert between latitude and longitude
- *
- * @return The coordinates as a formatted string
- */
-char *gui_internal_coordinates(struct pcoord *pc, char sep) {
- struct coord_geo g;
- struct coord c;
- c.x=pc->x;
- c.y=pc->y;
- transform_to_geo(pc->pro, &c, &g);
- return coordinates_geo(&g, sep);
-
-}
-
-enum escape_mode {
- escape_mode_none=0,
- escape_mode_string=1, /*!< Surround string by double quotes */
- escape_mode_quote=2, /*!< Escape double quotes and backslashes */
- escape_mode_html_amp=4, /*!< Use HTML-style escape sequences for ampersands */
- escape_mode_html_quote=8, /*!< Use HTML-style escape sequences for double quotes */
- escape_mode_html_apos=16, /*!< Use HTML-style escape sequences for single quotes (apostrophes) */
- escape_mode_html_lt=16, /*!< Use HTML-style escape sequences for lower than sign ('<') */
- escape_mode_html_gt=16, /*!< Use HTML-style escape sequences for greater than sign ('>') */
- escape_mode_html=escape_mode_html_amp|escape_mode_html_quote|escape_mode_html_apos|escape_mode_html_lt|escape_mode_html_gt, /*!< Use all known HTML-style escape sequences */
-};
-
-/**
- * @brief Escape special characters from a string
- *
- * @param mode The escape mode that needs to be enabled (see enum escape_mode)
- * @param in The string to escape
- *
- * @return The escaped string
- *
- * @note In html escape mode (escape_mode_html), we will only process HTML escape sequence, and string quoting, but we won't escape backslashes or double quotes
- * @warning The returned string has been allocated and g_free() must thus be called on this string
- */
-static char *gui_internal_escape(enum escape_mode mode, const char *in) {
- int len=mode & escape_mode_string ? 2:0; /* Add 2 characters to the length of the buffer if quoting is enabled */
- char *dst,*out;
- const char *src=in;
- static const char *quot="&quot;";
- static const char *apos="&apos;";
- static const char *amp="&amp;";
- static const char *lt="&lt;";
- static const char *gt="&gt;";
-
- dbg(lvl_debug, "Entering %s with string=\"%s\", escape mode %d", __func__, in, mode);
- while (*src) {
- if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote)))
- len++;
- if (*src == '"' && mode == escape_mode_html_quote)
- len+=strlen(quot);
- else if (*src == '\'' && mode == escape_mode_html_apos)
- len+=strlen(apos);
- else if (*src == '&' && mode == escape_mode_html_amp)
- len+=strlen(amp);
- else if (*src == '<' && mode == escape_mode_html_lt)
- len+=strlen(lt);
- else if (*src == '>' && mode == escape_mode_html_gt)
- len+=strlen(gt);
- else
- len++;
- src++;
- }
- src=in;
- out=dst=g_malloc(len+1); /* +1 character for NUL termination */
-
- /* In string quoting mode (escape_mode_string), prepend the whole string with a double quote */
- if (mode & escape_mode_string)
- *dst++='"';
-
- while (*src) {
- if (mode & escape_mode_html) { /* In html escape mode, only process HTML escape sequence, not backslashes or quotes */
- if (*src == '"' && (mode & escape_mode_html_quote)) {
- strcpy(dst,quot);
- src++;
- dst+=strlen(quot);
- } else if (*src == '\'' && (mode & escape_mode_html_apos)) {
- strcpy(dst,apos);
- src++;
- dst+=strlen(apos);
- } else if (*src == '&' && (mode & escape_mode_html_amp)) {
- strcpy(dst,amp);
- src++;
- dst+=strlen(amp);
- } else if (*src == '<' && (mode & escape_mode_html_lt)) {
- strcpy(dst,lt);
- src++;
- dst+=strlen(lt);
- } else if (*src == '>' && (mode & escape_mode_html_gt)) {
- strcpy(dst,gt);
- src++;
- dst+=strlen(gt);
- } else
- *dst++=*src++;
- } else {
- if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote))) {
- *dst++='\\';
- }
- *dst++=*src++;
- }
- }
-
- /* In string quoting mode (escape_mode_string), append a double quote to the whole string */
- if (mode & escape_mode_string)
- *dst++='"';
-
- *dst++='\0';
- dbg(lvl_debug, "Exitting %s with string=\"%s\"", __func__, out);
- return out;
-}
-
static void gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in, struct attr ***out,
int *valid) {
struct attr escaped;
@@ -209,7 +54,7 @@ static void gui_internal_cmd_escape(struct gui_priv *this, char *function, struc
}
if (ATTR_IS_STRING(in[0]->type)) {
escaped.type=in[0]->type;
- escaped.u.str=gui_internal_escape(escape_mode_string,in[0]->u.str);
+ escaped.u.str=str_escape(escape_mode_string,in[0]->u.str);
} else if (ATTR_IS_INT(in[0]->type)) {
escaped.type=attr_type_string_begin;
escaped.u.str=g_strdup_printf("%ld",in[0]->u.num);
@@ -1103,11 +948,11 @@ void gui_internal_cmd2_quit(struct gui_priv *this, char *function, struct attr *
static char *gui_internal_append_attr(char *str, enum escape_mode mode, char *pre, struct attr *attr, char *post) {
char *astr=NULL;
if (ATTR_IS_STRING(attr->type))
- astr=gui_internal_escape(mode, attr->u.str);
+ astr=str_escape(mode, attr->u.str);
else if (ATTR_IS_COORD_GEO(attr->type)) {
- char *str2=coordinates_geo(attr->u.coord_geo, '\n');
- astr=gui_internal_escape(mode, str2);
- g_free(str2);
+ char coord_str[32];
+ coord_geo_format_short(attr->u.coord_geo, coord_str, sizeof(coord_str), "\n");
+ astr=str_escape(mode, coord_str);
} else if (ATTR_IS_INT(attr->type))
astr=g_strdup_printf("%ld",attr->u.num);
else
@@ -1174,7 +1019,7 @@ static void gui_internal_onclick(struct attr ***in, char **onclick, char *set) {
if (!strcmp(format,"se")) {
replacement=gui_internal_append_attr(NULL, escape_mode_string, "", *i++, "");
if (is_arg) {
- char *arg=gui_internal_escape(escape_mode_string, replacement);
+ char *arg=str_escape(escape_mode_string, replacement);
args=g_strconcat_printf(args, "%s%s", args ? "," : "", arg);
g_free(replacement);
g_free(arg);
@@ -1199,7 +1044,7 @@ static void gui_internal_onclick(struct attr ***in, char **onclick, char *set) {
if (str && strlen(str)) {
char *old=*onclick;
if (set) {
- char *setstr=gui_internal_escape(escape_mode_string,str);
+ char *setstr=str_escape(escape_mode_string,str);
char *argssep="";
if (args && strlen(args))
argssep=",";
@@ -1251,7 +1096,7 @@ static void gui_internal_cmd_img(struct gui_priv * this, char *function, struct
gui_internal_onclick(&in,&onclick,"set");
gui_internal_onclick(&in,&onclick,NULL);
if (strlen(onclick)) {
- char *tmp=gui_internal_escape(escape_mode_html_apos, onclick);
+ char *tmp=str_escape(escape_mode_html_apos, onclick);
str=g_strconcat_printf(str," onclick='%s'",tmp);
g_free(tmp);
}
diff --git a/navit/gui/qt5_qml/skins/modern/navit.svg b/navit/gui/qt5_qml/skins/modern/navit.svg
index 591d9ee57..ff806f7e3 100644
--- a/navit/gui/qt5_qml/skins/modern/navit.svg
+++ b/navit/gui/qt5_qml/skins/modern/navit.svg
@@ -12,185 +12,44 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.48.4 r9939"
- version="1.0"
- sodipodi:docname="navit.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="/home/jeff/projets/navit/navit.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ viewBox="0 0 22.000001 22"
+ id="svg4900"
+ version="1.1"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="navit.svg">
<defs
- id="defs4">
+ id="defs4902">
<linearGradient
inkscape:collect="always"
- id="linearGradient3376">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3378" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3380" />
- </linearGradient>
- <linearGradient
- id="linearGradient3365">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.61904764;"
- offset="0"
- id="stop3367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3369" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3328">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3330" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3332" />
- </linearGradient>
- <linearGradient
- id="linearGradient3320">
- <stop
- style="stop-color:#116cbf;stop-opacity:1;"
- offset="0"
- id="stop3322" />
- <stop
- id="stop3354"
- offset="0.08"
- style="stop-color:#116cbf;stop-opacity:1;" />
- <stop
- id="stop3352"
- offset="0.4893617"
- style="stop-color:#1a6cb6;stop-opacity:1;" />
- <stop
- style="stop-color:#329eff;stop-opacity:1;"
- offset="1"
- id="stop3324" />
- </linearGradient>
- <linearGradient
- id="linearGradient3308">
- <stop
- style="stop-color:#062643;stop-opacity:1;"
- offset="0"
- id="stop3310" />
- <stop
- style="stop-color:#0d5799;stop-opacity:1;"
- offset="1"
- id="stop3312" />
- </linearGradient>
- <linearGradient
- id="linearGradient3235">
- <stop
- style="stop-color:#c17d11;stop-opacity:1;"
- offset="0"
- id="stop3237" />
- <stop
- style="stop-color:#e9cb14;stop-opacity:1;"
- offset="1"
- id="stop3239" />
- </linearGradient>
+ xlink:href="#linearGradient3728"
+ id="linearGradient1325"
+ x1="0.18388532"
+ y1="294.09717"
+ x2="5.6532726"
+ y2="294.09717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.7795279,0,0,3.7795279,-0.58442088,-69.63366)" />
<linearGradient
- id="linearGradient3227">
+ id="linearGradient3728">
<stop
- style="stop-color:#76650c;stop-opacity:1;"
offset="0"
- id="stop3229" />
+ stop-color="#ffda00"
+ id="stop3730" />
<stop
- style="stop-color:#76650c;stop-opacity:0;"
offset="1"
- id="stop3231" />
+ stop-color="#f57f0c"
+ id="stop3732" />
</linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="15.556349 : 133.02972 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
<linearGradient
inkscape:collect="always"
- xlink:href="#linearGradient3235"
- id="linearGradient3241"
- x1="64"
- y1="115.11359"
- x2="64"
- y2="17.40102"
+ xlink:href="#linearGradient3728"
+ id="linearGradient1341"
+ x1="1.5875"
+ y1="294.08957"
+ x2="4.2333331"
+ y2="294.08957"
gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3308"
- id="linearGradient3314"
- x1="-7.7781754"
- y1="4.2563133"
- x2="43.133514"
- y2="4.2563133"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3320"
- id="linearGradient3326"
- x1="7.6363606"
- y1="87.731171"
- x2="58.391151"
- y2="38.450466"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15669503,0.02174581,-0.02174581,0.15669503,4.357122,0.76802046)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3340"
- gradientUnits="userSpaceOnUse"
- x1="63"
- y1="106.75"
- x2="92"
- y2="29.25" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3328"
- id="linearGradient3342"
- gradientUnits="userSpaceOnUse"
- x1="71"
- y1="69.5"
- x2="87.25"
- y2="33.5" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3365"
- id="linearGradient3371"
- x1="-1.5"
- y1="86.5"
- x2="73.5"
- y2="40"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3376"
- id="linearGradient3382"
- x1="62.147858"
- y1="67.453751"
- x2="11.016594"
- y2="24.242672"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter3424">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.90523025"
- id="feGaussianBlur3426" />
- </filter>
+ gradientTransform="matrix(3.7795281,0,0,3.7795281,-0.58442178,-69.63366)" />
</defs>
<sodipodi:namedview
id="base"
@@ -199,26 +58,27 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.894586"
- inkscape:cy="27.303943"
+ inkscape:zoom="22.4"
+ inkscape:cx="8.0714281"
+ inkscape:cy="8.9698474"
inkscape:document-units="px"
- inkscape:current-layer="layer2"
+ inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="948"
+ units="px"
+ inkscape:window-width="1920"
+ inkscape:window-height="926"
inkscape:window-x="0"
- inkscape:window-y="24"
- showborder="true"
+ inkscape:window-y="31"
inkscape:window-maximized="1" />
<metadata
- id="metadata7">
+ id="metadata4905">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -226,168 +86,32 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- style="display:inline">
- <rect
- style="fill:url(#linearGradient3241);fill-opacity:1;stroke:#43350f;stroke-width:0.79098374;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect2403"
- width="18.792814"
- height="15.381022"
- x="2.7210562"
- y="3.1272359"
- rx="1.5819675"
- ry="1.5819675" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="lignes"
- style="display:inline">
+ transform="translate(0,-1030.3623)">
<g
- id="g3336"
- transform="matrix(0.15819674,0,0,0.15819674,5.1568068,0.69315656)">
+ id="g5494"
+ transform="translate(0.55342518,-0.5529)">
<path
- sodipodi:nodetypes="cczzczc"
- id="path3223"
- d="m 92,27 8,-4 c 0,0 -32.803776,29.787015 -21.5,41.25 11.303776,11.462985 5.61873,46.35859 -6,46.25 L 19,110 C 39.916667,101.41667 73.874441,83.136394 61,66.25 48.125559,49.363606 92,27 92,27 z"
- style="fill:url(#linearGradient3340);fill-opacity:1;stroke:none"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ id="circle1307"
+ d="m 10.415579,1036.886 a 5.0000004,5.0000004 0 0 0 -1.4902344,0.2324 l 2.4765624,4.7168 0.9375,2.1113 h 0.05859 c -0.04889,-0.5084 -0.107337,-1.0754 -0.175781,-1.7012 -0.05867,-0.6257 -0.08789,-1.2219 -0.08789,-1.789 v -3.2598 a 5.0000004,5.0000004 0 0 0 -1.718747,-0.3105 z m -3.7226561,1.6699 a 5.0000004,5.0000004 0 0 0 -1.277344,3.3301 5.0000004,5.0000004 0 0 0 1.277344,3.3261 z m 7.4941411,0.057 v 6.5508 a 5.0000004,5.0000004 0 0 0 1.228516,-3.2773 5.0000004,5.0000004 0 0 0 -1.228516,-3.2735 z m -5.7050784,1.1836 c 0.04889,0.528 0.103443,1.095 0.162109,1.7012 0.06844,0.6062 0.101563,1.1926 0.101563,1.7598 v 3.3339 a 5.0000004,5.0000004 0 0 0 1.6699214,0.295 5.0000004,5.0000004 0 0 0 1.550781,-0.252 l -2.4863274,-4.7539 -0.939453,-2.084 z"
+ style="display:inline;fill:url(#linearGradient1341);fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <ellipse
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ ry="5.9375"
+ rx="7.5000005"
+ cy="1038.8679"
+ cx="10.308436"
+ id="ellipse1313"
+ style="display:inline;fill:#000000;fill-opacity:0;stroke-width:0.26458332" />
<path
- sodipodi:nodetypes="czc"
- id="path3244"
- d="M 49.5,110 C 60.666667,104.16667 83.256846,86.358298 72,70.5 60.743153,54.641702 77.5,38.5 92.5,29"
- style="fill:none;stroke:url(#linearGradient3342);stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:9, 9;stroke-dashoffset:0"
- inkscape:connector-curvature="0" />
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ sodipodi:nodetypes="cccccccscccccscccccccccccsccccccccccccccsccccccccccccscccccccccccccccccsccccccccscccccccccsccccccccccczccscccz"
+ inkscape:connector-curvature="0"
+ id="path1315"
+ d="m 10.593714,1049.8749 -9.1e-4,-2.3589 0.266653,-0.019 c 1.330607,-0.098 2.575221,-0.668 3.523588,-1.6136 0.923018,-0.9203 1.48054,-2.0846 1.617879,-3.3788 0.01308,-0.1232 0.02385,-0.2694 0.02392,-0.3254 l 1.81e-4,-0.1016 h 2.328482 c 1.280664,0 2.325431,0 2.321705,0.01 -0.0037,0 -0.687432,0.3008 -1.519342,0.6605 -0.83191,0.3594 -1.518827,0.6597 -1.526483,0.6668 -0.0077,0.01 -0.04908,0.1508 -0.09205,0.3194 -0.132715,0.5206 -0.29037,0.9508 -0.517639,1.4127 -0.167958,0.3413 -0.275467,0.5269 -0.499195,0.8617 -1.000766,1.4979 -2.485149,2.5475 -4.266583,3.0169 l -0.07101,0.019 -0.794147,1.5968 -0.794145,1.5968 -9.1e-4,-2.3589 z m -0.8872994,0.9173 c -0.322031,-0.7436 -0.588278,-1.3594 -0.591664,-1.3683 -0.0039,-0.011 0.01606,-0.011 0.05389,0 0.171281,0.03 0.556063,0.075 0.826463,0.093 l 0.3049514,0.019 v 1.3064 c 0,0.7185 -0.0018,1.3063 -0.0041,1.3062 -0.0022,0 -0.267545,-0.6085 -0.5895754,-1.352 z m 0.3984724,-1.5541 c -0.4129714,-0.015 -0.9841194,-0.1 -1.4231124,-0.2079 -1.1829774,-0.2918 -2.2498931,-0.8648 -3.1847034,-1.7108 -0.6211646,-0.5621 -1.2019874,-1.3307 -1.5867228,-2.0995 -0.4741759,-0.9476 -0.7080315,-1.8427 -0.7754332,-2.9681 l -0.010469,-0.175 h 0.869187 0.8691863 l 0.010318,0.2037 c 0.012284,0.2423 0.061463,0.5948 0.1190551,0.8536 0.4574593,2.0554 2.0220538,3.673 4.067024,4.2048 0.328796,0.085 0.901832,0.1704 1.1509234,0.1704 h 0.08991 v 0.8702 0.87 h -0.03659 c -0.02014,0 -0.09149,0 -0.158574,-0.01 z m -8.5472195,-6.4443 -1.43082728,-0.7144 H 1.4864869 2.8461342 l 0.011112,0.2237 c 0.017688,0.3561 0.1027616,1.0252 0.1499604,1.1792 0.0048,0.015 0.00255,0.03 -0.00499,0.03 -0.00752,0 -0.6575826,-0.3212 -1.4445378,-0.7143 z m 0.1659969,-1.8139 1.6130877,-0.8022 0.018331,-0.071 c 0.4155662,-1.6096 1.3767781,-3.0429 2.7081715,-4.0382 0.5508458,-0.4118 1.194233,-0.7624 1.8459792,-1.0062 0.1497071,-0.056 0.5689748,-0.1874 0.7133978,-0.2237 l 0.07096,-0.019 0.802579,-1.6131 0.8025784,-1.6131 6.51e-4,2.3761 6.51e-4,2.3761 -0.215501,0.011 c -0.9806364,0.048 -2.0201623,0.4154 -2.8581804,1.0096 -0.3839399,0.2721 -0.850989,0.7104 -1.1284755,1.0585 -0.5214527,0.6544 -0.8786801,1.3761 -1.0748315,2.1716 -0.085493,0.3466 -0.155229,0.8333 -0.155229,1.083 v 0.1039 H 2.4892044 0.11057482 Z m 14.3013666,0.7062 c 0,-0.054 -0.01126,-0.2056 -0.02506,-0.3368 -0.167061,-1.5908 -1.005735,-3.0256 -2.319287,-3.9677 -0.567371,-0.407 -1.216407,-0.7054 -1.903171,-0.8749 -0.366618,-0.091 -0.811717,-0.155 -1.072569,-0.155 h -0.112135 v -0.8719 -0.8719 l 0.199234,0.011 c 0.958324,0.054 1.802105,0.254 2.641376,0.6272 1.079455,0.4801 2.048175,1.2373 2.782665,2.1749 0.171677,0.2192 0.473811,0.6716 0.605547,0.9067 0.467664,0.8347 0.773114,1.7663 0.885259,2.6999 0.01939,0.1613 0.05791,0.6526 0.05834,0.744 0,0.01 -0.391502,0.011 -0.870074,0.011 h -0.870129 z m 2.00405,-0.2083 c -0.02098,-0.3284 -0.06477,-0.688 -0.11706,-0.9613 -0.01784,-0.093 -0.03073,-0.1708 -0.02861,-0.1723 0.0021,0 0.655233,0.3212 1.451362,0.7175 l 1.447508,0.7201 h -1.366826 -1.366826 l -0.01954,-0.3061 z m -6.213518,-7.0211 c -0.297191,-0.06 -0.853606,-0.1213 -1.104838,-0.1217 l -0.117914,-10e-5 v -1.3689 c 0,-0.7529 0.0026,-1.3658 0.0058,-1.3621 0.0316,0.038 1.434361,2.8932 1.42013,2.8918 -0.01051,0 -0.101949,-0.019 -0.203203,-0.039 z"
+ style="display:inline;fill:url(#linearGradient1325);fill-opacity:1;stroke:none;stroke-width:0.00430322;stroke-opacity:1" />
</g>
</g>
- <g
- inkscape:groupmode="layer"
- id="layer4"
- inkscape:label="bulle"
- style="display:none">
- <path
- sodipodi:type="arc"
- style="fill:url(#linearGradient3314);fill-opacity:1;stroke:#1f3157;stroke-width:5.30526352;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- id="path3305"
- sodipodi:cx="17.67767"
- sodipodi:cy="4.2563133"
- sodipodi:rx="25.455845"
- sodipodi:ry="25.455845"
- d="m 43.133514,4.2563133 a 25.455845,25.455845 0 1 1 -50.9116894,0 25.455845,25.455845 0 1 1 50.9116894,0 z"
- transform="matrix(1.3194444,0,0,1.3194444,18.394598,29.399489)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer3"
- inkscape:label="rose des vents"
- style="display:none">
- <g
- id="g3256"
- transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,36.903806,-19.093669)"
- style="opacity:0.5">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3258"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3260"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- <g
- id="g3252">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3248"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3250"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer6"
- inkscape:label="ondes"
- style="display:inline">
- <path
- sodipodi:type="spiral"
- style="fill:none;stroke:url(#linearGradient3382);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3424)"
- id="path3374"
- sodipodi:cx="14.142136"
- sodipodi:cy="19.812662"
- sodipodi:expansion="1"
- sodipodi:revolution="7"
- sodipodi:radius="54.341515"
- sodipodi:argument="-17.841497"
- sodipodi:t0="0"
- d="m 14.142136,19.812662 c 0.622964,0.987625 -1.02395,1.327003 -1.641498,1.035408 -1.673515,-0.790205 -1.44576,-3.111369 -0.429317,-4.318403 1.818177,-2.1591 5.16668,-1.702115 6.995307,0.176773 2.683583,2.757343 1.972982,7.252372 -0.782863,9.672211 C 14.610657,29.603916 8.9345884,28.6291 5.934649,24.989699 2.1595315,20.409885 3.4032379,13.538342 7.9296913,9.9636782 13.411833,5.6342815 21.486273,7.1492634 25.632617,12.56481 30.51894,18.946845 28.731319,28.228517 22.425395,32.944641 15.144955,38.389593 4.6532955,36.328487 -0.63134024,29.131329 -6.6360792,20.95346 -4.300928,9.2499464 3.7880618,3.3976889 12.862686,-3.1676594 25.779376,-0.55807441 32.198606,8.4231809 39.325168,18.394077 36.440869,32.524914 26.567024,39.51063 15.700216,47.198863 0.35449515,44.039641 -7.1973295,33.272958 -15.447588,21.510513 -12.013284,4.9493376 -0.35356778,-3.1683003 12.304301,-11.980865 30.081381,-8.2713528 38.764595,4.2815513 48.13969,17.834674 44.154872,36.828022 30.708654,46.076619 16.260416,56.014427 -3.9494981,51.754222 -13.763319,37.414588 -24.263992,22.071347 -19.728335,0.64462208 -4.4951973,-9.7342896 11.742953,-20.797954 34.386694,-15.98679 45.330585,0.1399218 56.957348,17.272902 51.870631,41.133834 34.850283,52.642608 16.822539,64.832562 -8.2557318,59.470254 -20.329308,41.556217 -33.082529,22.633765 -27.444596,-3.6619713 -8.6368269,-16.300279 11.180283,-29.616836 38.693597,-23.70325 51.896574,-4.0017077 65.776525,16.710018 59.587261,45.441005 38.991913,59.208598 17.385609,73.651995 -12.563136,67.187032 -26.895297,45.697847 -41.902187,23.196997 -35.161504,-7.9695799 -12.778456,-22.866268 10.616911,-38.436689 43.001386,-31.420272 58.462563,-8.1433373 74.596552,16.146521 67.304385,49.748954 43.133542,65.774587"
- transform="matrix(-0.15819674,0,0,0.15819674,22.262049,1.7055356)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer5"
- inkscape:label="flèche"
- style="display:inline">
- <path
- style="fill:url(#linearGradient3326);fill-opacity:1;stroke:#1f3157;stroke-width:0.47459021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="M 5.6166617,6.6702162 C 8.5498903,6.3591404 11.366732,6.8627725 14.089084,8.0278339 L 12.323485,12.25995 11.465549,10.2747 C 9.1936105,11.38659 7.6712925,13.621104 6.8096897,16.845097 L 0.57820215,12.334567 C 2.318135,10.026025 5.9650066,8.1110997 8.889601,7.8565979 L 5.6166617,6.6702162 z"
- id="rect3317"
- sodipodi:nodetypes="cccccccc"
- inkscape:connector-curvature="0" />
- <path
- style="fill:url(#linearGradient3371);fill-opacity:1;stroke:none"
- d="M 8.2416433,7.021026 C 9.8257327,6.8500961 11.315051,7.2477939 12.75025,7.9702064 8.920071,9.4835882 6.1923078,11.598289 4.6822166,14.377175 L 1.7555768,12.162421 C 3.6037773,9.8056523 6.570797,8.7541746 9.6654142,7.8515586 L 8.2416433,7.021026 z"
- id="rect3362"
- sodipodi:nodetypes="cccccc"
- inkscape:connector-curvature="0" />
- </g>
</svg>
diff --git a/navit/gui/qt5_qml/skins/navit.svg b/navit/gui/qt5_qml/skins/navit.svg
index 591d9ee57..ff806f7e3 100644
--- a/navit/gui/qt5_qml/skins/navit.svg
+++ b/navit/gui/qt5_qml/skins/navit.svg
@@ -12,185 +12,44 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.48.4 r9939"
- version="1.0"
- sodipodi:docname="navit.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="/home/jeff/projets/navit/navit.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ viewBox="0 0 22.000001 22"
+ id="svg4900"
+ version="1.1"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="navit.svg">
<defs
- id="defs4">
+ id="defs4902">
<linearGradient
inkscape:collect="always"
- id="linearGradient3376">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3378" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3380" />
- </linearGradient>
- <linearGradient
- id="linearGradient3365">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.61904764;"
- offset="0"
- id="stop3367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3369" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3328">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3330" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3332" />
- </linearGradient>
- <linearGradient
- id="linearGradient3320">
- <stop
- style="stop-color:#116cbf;stop-opacity:1;"
- offset="0"
- id="stop3322" />
- <stop
- id="stop3354"
- offset="0.08"
- style="stop-color:#116cbf;stop-opacity:1;" />
- <stop
- id="stop3352"
- offset="0.4893617"
- style="stop-color:#1a6cb6;stop-opacity:1;" />
- <stop
- style="stop-color:#329eff;stop-opacity:1;"
- offset="1"
- id="stop3324" />
- </linearGradient>
- <linearGradient
- id="linearGradient3308">
- <stop
- style="stop-color:#062643;stop-opacity:1;"
- offset="0"
- id="stop3310" />
- <stop
- style="stop-color:#0d5799;stop-opacity:1;"
- offset="1"
- id="stop3312" />
- </linearGradient>
- <linearGradient
- id="linearGradient3235">
- <stop
- style="stop-color:#c17d11;stop-opacity:1;"
- offset="0"
- id="stop3237" />
- <stop
- style="stop-color:#e9cb14;stop-opacity:1;"
- offset="1"
- id="stop3239" />
- </linearGradient>
+ xlink:href="#linearGradient3728"
+ id="linearGradient1325"
+ x1="0.18388532"
+ y1="294.09717"
+ x2="5.6532726"
+ y2="294.09717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.7795279,0,0,3.7795279,-0.58442088,-69.63366)" />
<linearGradient
- id="linearGradient3227">
+ id="linearGradient3728">
<stop
- style="stop-color:#76650c;stop-opacity:1;"
offset="0"
- id="stop3229" />
+ stop-color="#ffda00"
+ id="stop3730" />
<stop
- style="stop-color:#76650c;stop-opacity:0;"
offset="1"
- id="stop3231" />
+ stop-color="#f57f0c"
+ id="stop3732" />
</linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="15.556349 : 133.02972 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
<linearGradient
inkscape:collect="always"
- xlink:href="#linearGradient3235"
- id="linearGradient3241"
- x1="64"
- y1="115.11359"
- x2="64"
- y2="17.40102"
+ xlink:href="#linearGradient3728"
+ id="linearGradient1341"
+ x1="1.5875"
+ y1="294.08957"
+ x2="4.2333331"
+ y2="294.08957"
gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3308"
- id="linearGradient3314"
- x1="-7.7781754"
- y1="4.2563133"
- x2="43.133514"
- y2="4.2563133"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3320"
- id="linearGradient3326"
- x1="7.6363606"
- y1="87.731171"
- x2="58.391151"
- y2="38.450466"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15669503,0.02174581,-0.02174581,0.15669503,4.357122,0.76802046)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3340"
- gradientUnits="userSpaceOnUse"
- x1="63"
- y1="106.75"
- x2="92"
- y2="29.25" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3328"
- id="linearGradient3342"
- gradientUnits="userSpaceOnUse"
- x1="71"
- y1="69.5"
- x2="87.25"
- y2="33.5" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3365"
- id="linearGradient3371"
- x1="-1.5"
- y1="86.5"
- x2="73.5"
- y2="40"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3376"
- id="linearGradient3382"
- x1="62.147858"
- y1="67.453751"
- x2="11.016594"
- y2="24.242672"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter3424">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.90523025"
- id="feGaussianBlur3426" />
- </filter>
+ gradientTransform="matrix(3.7795281,0,0,3.7795281,-0.58442178,-69.63366)" />
</defs>
<sodipodi:namedview
id="base"
@@ -199,26 +58,27 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.894586"
- inkscape:cy="27.303943"
+ inkscape:zoom="22.4"
+ inkscape:cx="8.0714281"
+ inkscape:cy="8.9698474"
inkscape:document-units="px"
- inkscape:current-layer="layer2"
+ inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="948"
+ units="px"
+ inkscape:window-width="1920"
+ inkscape:window-height="926"
inkscape:window-x="0"
- inkscape:window-y="24"
- showborder="true"
+ inkscape:window-y="31"
inkscape:window-maximized="1" />
<metadata
- id="metadata7">
+ id="metadata4905">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -226,168 +86,32 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- style="display:inline">
- <rect
- style="fill:url(#linearGradient3241);fill-opacity:1;stroke:#43350f;stroke-width:0.79098374;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect2403"
- width="18.792814"
- height="15.381022"
- x="2.7210562"
- y="3.1272359"
- rx="1.5819675"
- ry="1.5819675" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="lignes"
- style="display:inline">
+ transform="translate(0,-1030.3623)">
<g
- id="g3336"
- transform="matrix(0.15819674,0,0,0.15819674,5.1568068,0.69315656)">
+ id="g5494"
+ transform="translate(0.55342518,-0.5529)">
<path
- sodipodi:nodetypes="cczzczc"
- id="path3223"
- d="m 92,27 8,-4 c 0,0 -32.803776,29.787015 -21.5,41.25 11.303776,11.462985 5.61873,46.35859 -6,46.25 L 19,110 C 39.916667,101.41667 73.874441,83.136394 61,66.25 48.125559,49.363606 92,27 92,27 z"
- style="fill:url(#linearGradient3340);fill-opacity:1;stroke:none"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ id="circle1307"
+ d="m 10.415579,1036.886 a 5.0000004,5.0000004 0 0 0 -1.4902344,0.2324 l 2.4765624,4.7168 0.9375,2.1113 h 0.05859 c -0.04889,-0.5084 -0.107337,-1.0754 -0.175781,-1.7012 -0.05867,-0.6257 -0.08789,-1.2219 -0.08789,-1.789 v -3.2598 a 5.0000004,5.0000004 0 0 0 -1.718747,-0.3105 z m -3.7226561,1.6699 a 5.0000004,5.0000004 0 0 0 -1.277344,3.3301 5.0000004,5.0000004 0 0 0 1.277344,3.3261 z m 7.4941411,0.057 v 6.5508 a 5.0000004,5.0000004 0 0 0 1.228516,-3.2773 5.0000004,5.0000004 0 0 0 -1.228516,-3.2735 z m -5.7050784,1.1836 c 0.04889,0.528 0.103443,1.095 0.162109,1.7012 0.06844,0.6062 0.101563,1.1926 0.101563,1.7598 v 3.3339 a 5.0000004,5.0000004 0 0 0 1.6699214,0.295 5.0000004,5.0000004 0 0 0 1.550781,-0.252 l -2.4863274,-4.7539 -0.939453,-2.084 z"
+ style="display:inline;fill:url(#linearGradient1341);fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <ellipse
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ ry="5.9375"
+ rx="7.5000005"
+ cy="1038.8679"
+ cx="10.308436"
+ id="ellipse1313"
+ style="display:inline;fill:#000000;fill-opacity:0;stroke-width:0.26458332" />
<path
- sodipodi:nodetypes="czc"
- id="path3244"
- d="M 49.5,110 C 60.666667,104.16667 83.256846,86.358298 72,70.5 60.743153,54.641702 77.5,38.5 92.5,29"
- style="fill:none;stroke:url(#linearGradient3342);stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:9, 9;stroke-dashoffset:0"
- inkscape:connector-curvature="0" />
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ sodipodi:nodetypes="cccccccscccccscccccccccccsccccccccccccccsccccccccccccscccccccccccccccccsccccccccscccccccccsccccccccccczccscccz"
+ inkscape:connector-curvature="0"
+ id="path1315"
+ d="m 10.593714,1049.8749 -9.1e-4,-2.3589 0.266653,-0.019 c 1.330607,-0.098 2.575221,-0.668 3.523588,-1.6136 0.923018,-0.9203 1.48054,-2.0846 1.617879,-3.3788 0.01308,-0.1232 0.02385,-0.2694 0.02392,-0.3254 l 1.81e-4,-0.1016 h 2.328482 c 1.280664,0 2.325431,0 2.321705,0.01 -0.0037,0 -0.687432,0.3008 -1.519342,0.6605 -0.83191,0.3594 -1.518827,0.6597 -1.526483,0.6668 -0.0077,0.01 -0.04908,0.1508 -0.09205,0.3194 -0.132715,0.5206 -0.29037,0.9508 -0.517639,1.4127 -0.167958,0.3413 -0.275467,0.5269 -0.499195,0.8617 -1.000766,1.4979 -2.485149,2.5475 -4.266583,3.0169 l -0.07101,0.019 -0.794147,1.5968 -0.794145,1.5968 -9.1e-4,-2.3589 z m -0.8872994,0.9173 c -0.322031,-0.7436 -0.588278,-1.3594 -0.591664,-1.3683 -0.0039,-0.011 0.01606,-0.011 0.05389,0 0.171281,0.03 0.556063,0.075 0.826463,0.093 l 0.3049514,0.019 v 1.3064 c 0,0.7185 -0.0018,1.3063 -0.0041,1.3062 -0.0022,0 -0.267545,-0.6085 -0.5895754,-1.352 z m 0.3984724,-1.5541 c -0.4129714,-0.015 -0.9841194,-0.1 -1.4231124,-0.2079 -1.1829774,-0.2918 -2.2498931,-0.8648 -3.1847034,-1.7108 -0.6211646,-0.5621 -1.2019874,-1.3307 -1.5867228,-2.0995 -0.4741759,-0.9476 -0.7080315,-1.8427 -0.7754332,-2.9681 l -0.010469,-0.175 h 0.869187 0.8691863 l 0.010318,0.2037 c 0.012284,0.2423 0.061463,0.5948 0.1190551,0.8536 0.4574593,2.0554 2.0220538,3.673 4.067024,4.2048 0.328796,0.085 0.901832,0.1704 1.1509234,0.1704 h 0.08991 v 0.8702 0.87 h -0.03659 c -0.02014,0 -0.09149,0 -0.158574,-0.01 z m -8.5472195,-6.4443 -1.43082728,-0.7144 H 1.4864869 2.8461342 l 0.011112,0.2237 c 0.017688,0.3561 0.1027616,1.0252 0.1499604,1.1792 0.0048,0.015 0.00255,0.03 -0.00499,0.03 -0.00752,0 -0.6575826,-0.3212 -1.4445378,-0.7143 z m 0.1659969,-1.8139 1.6130877,-0.8022 0.018331,-0.071 c 0.4155662,-1.6096 1.3767781,-3.0429 2.7081715,-4.0382 0.5508458,-0.4118 1.194233,-0.7624 1.8459792,-1.0062 0.1497071,-0.056 0.5689748,-0.1874 0.7133978,-0.2237 l 0.07096,-0.019 0.802579,-1.6131 0.8025784,-1.6131 6.51e-4,2.3761 6.51e-4,2.3761 -0.215501,0.011 c -0.9806364,0.048 -2.0201623,0.4154 -2.8581804,1.0096 -0.3839399,0.2721 -0.850989,0.7104 -1.1284755,1.0585 -0.5214527,0.6544 -0.8786801,1.3761 -1.0748315,2.1716 -0.085493,0.3466 -0.155229,0.8333 -0.155229,1.083 v 0.1039 H 2.4892044 0.11057482 Z m 14.3013666,0.7062 c 0,-0.054 -0.01126,-0.2056 -0.02506,-0.3368 -0.167061,-1.5908 -1.005735,-3.0256 -2.319287,-3.9677 -0.567371,-0.407 -1.216407,-0.7054 -1.903171,-0.8749 -0.366618,-0.091 -0.811717,-0.155 -1.072569,-0.155 h -0.112135 v -0.8719 -0.8719 l 0.199234,0.011 c 0.958324,0.054 1.802105,0.254 2.641376,0.6272 1.079455,0.4801 2.048175,1.2373 2.782665,2.1749 0.171677,0.2192 0.473811,0.6716 0.605547,0.9067 0.467664,0.8347 0.773114,1.7663 0.885259,2.6999 0.01939,0.1613 0.05791,0.6526 0.05834,0.744 0,0.01 -0.391502,0.011 -0.870074,0.011 h -0.870129 z m 2.00405,-0.2083 c -0.02098,-0.3284 -0.06477,-0.688 -0.11706,-0.9613 -0.01784,-0.093 -0.03073,-0.1708 -0.02861,-0.1723 0.0021,0 0.655233,0.3212 1.451362,0.7175 l 1.447508,0.7201 h -1.366826 -1.366826 l -0.01954,-0.3061 z m -6.213518,-7.0211 c -0.297191,-0.06 -0.853606,-0.1213 -1.104838,-0.1217 l -0.117914,-10e-5 v -1.3689 c 0,-0.7529 0.0026,-1.3658 0.0058,-1.3621 0.0316,0.038 1.434361,2.8932 1.42013,2.8918 -0.01051,0 -0.101949,-0.019 -0.203203,-0.039 z"
+ style="display:inline;fill:url(#linearGradient1325);fill-opacity:1;stroke:none;stroke-width:0.00430322;stroke-opacity:1" />
</g>
</g>
- <g
- inkscape:groupmode="layer"
- id="layer4"
- inkscape:label="bulle"
- style="display:none">
- <path
- sodipodi:type="arc"
- style="fill:url(#linearGradient3314);fill-opacity:1;stroke:#1f3157;stroke-width:5.30526352;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- id="path3305"
- sodipodi:cx="17.67767"
- sodipodi:cy="4.2563133"
- sodipodi:rx="25.455845"
- sodipodi:ry="25.455845"
- d="m 43.133514,4.2563133 a 25.455845,25.455845 0 1 1 -50.9116894,0 25.455845,25.455845 0 1 1 50.9116894,0 z"
- transform="matrix(1.3194444,0,0,1.3194444,18.394598,29.399489)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer3"
- inkscape:label="rose des vents"
- style="display:none">
- <g
- id="g3256"
- transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,36.903806,-19.093669)"
- style="opacity:0.5">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3258"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3260"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- <g
- id="g3252">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3248"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3250"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer6"
- inkscape:label="ondes"
- style="display:inline">
- <path
- sodipodi:type="spiral"
- style="fill:none;stroke:url(#linearGradient3382);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3424)"
- id="path3374"
- sodipodi:cx="14.142136"
- sodipodi:cy="19.812662"
- sodipodi:expansion="1"
- sodipodi:revolution="7"
- sodipodi:radius="54.341515"
- sodipodi:argument="-17.841497"
- sodipodi:t0="0"
- d="m 14.142136,19.812662 c 0.622964,0.987625 -1.02395,1.327003 -1.641498,1.035408 -1.673515,-0.790205 -1.44576,-3.111369 -0.429317,-4.318403 1.818177,-2.1591 5.16668,-1.702115 6.995307,0.176773 2.683583,2.757343 1.972982,7.252372 -0.782863,9.672211 C 14.610657,29.603916 8.9345884,28.6291 5.934649,24.989699 2.1595315,20.409885 3.4032379,13.538342 7.9296913,9.9636782 13.411833,5.6342815 21.486273,7.1492634 25.632617,12.56481 30.51894,18.946845 28.731319,28.228517 22.425395,32.944641 15.144955,38.389593 4.6532955,36.328487 -0.63134024,29.131329 -6.6360792,20.95346 -4.300928,9.2499464 3.7880618,3.3976889 12.862686,-3.1676594 25.779376,-0.55807441 32.198606,8.4231809 39.325168,18.394077 36.440869,32.524914 26.567024,39.51063 15.700216,47.198863 0.35449515,44.039641 -7.1973295,33.272958 -15.447588,21.510513 -12.013284,4.9493376 -0.35356778,-3.1683003 12.304301,-11.980865 30.081381,-8.2713528 38.764595,4.2815513 48.13969,17.834674 44.154872,36.828022 30.708654,46.076619 16.260416,56.014427 -3.9494981,51.754222 -13.763319,37.414588 -24.263992,22.071347 -19.728335,0.64462208 -4.4951973,-9.7342896 11.742953,-20.797954 34.386694,-15.98679 45.330585,0.1399218 56.957348,17.272902 51.870631,41.133834 34.850283,52.642608 16.822539,64.832562 -8.2557318,59.470254 -20.329308,41.556217 -33.082529,22.633765 -27.444596,-3.6619713 -8.6368269,-16.300279 11.180283,-29.616836 38.693597,-23.70325 51.896574,-4.0017077 65.776525,16.710018 59.587261,45.441005 38.991913,59.208598 17.385609,73.651995 -12.563136,67.187032 -26.895297,45.697847 -41.902187,23.196997 -35.161504,-7.9695799 -12.778456,-22.866268 10.616911,-38.436689 43.001386,-31.420272 58.462563,-8.1433373 74.596552,16.146521 67.304385,49.748954 43.133542,65.774587"
- transform="matrix(-0.15819674,0,0,0.15819674,22.262049,1.7055356)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer5"
- inkscape:label="flèche"
- style="display:inline">
- <path
- style="fill:url(#linearGradient3326);fill-opacity:1;stroke:#1f3157;stroke-width:0.47459021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="M 5.6166617,6.6702162 C 8.5498903,6.3591404 11.366732,6.8627725 14.089084,8.0278339 L 12.323485,12.25995 11.465549,10.2747 C 9.1936105,11.38659 7.6712925,13.621104 6.8096897,16.845097 L 0.57820215,12.334567 C 2.318135,10.026025 5.9650066,8.1110997 8.889601,7.8565979 L 5.6166617,6.6702162 z"
- id="rect3317"
- sodipodi:nodetypes="cccccccc"
- inkscape:connector-curvature="0" />
- <path
- style="fill:url(#linearGradient3371);fill-opacity:1;stroke:none"
- d="M 8.2416433,7.021026 C 9.8257327,6.8500961 11.315051,7.2477939 12.75025,7.9702064 8.920071,9.4835882 6.1923078,11.598289 4.6822166,14.377175 L 1.7555768,12.162421 C 3.6037773,9.8056523 6.570797,8.7541746 9.6654142,7.8515586 L 8.2416433,7.021026 z"
- id="rect3362"
- sodipodi:nodetypes="cccccc"
- inkscape:connector-curvature="0" />
- </g>
</svg>
diff --git a/navit/icons/desktop_icons/108x108/navit.png b/navit/icons/desktop_icons/108x108/navit.png
index ccc080c19..57a104e9e 100644
--- a/navit/icons/desktop_icons/108x108/navit.png
+++ b/navit/icons/desktop_icons/108x108/navit.png
Binary files differ
diff --git a/navit/icons/desktop_icons/128x128/navit.png b/navit/icons/desktop_icons/128x128/navit.png
index abdec4b8d..a27c89582 100644
--- a/navit/icons/desktop_icons/128x128/navit.png
+++ b/navit/icons/desktop_icons/128x128/navit.png
Binary files differ
diff --git a/navit/icons/desktop_icons/22x22/navit.png b/navit/icons/desktop_icons/22x22/navit.png
index 3ae880a40..83d269285 100644
--- a/navit/icons/desktop_icons/22x22/navit.png
+++ b/navit/icons/desktop_icons/22x22/navit.png
Binary files differ
diff --git a/navit/icons/desktop_icons/256x256/navit.png b/navit/icons/desktop_icons/256x256/navit.png
index ef84304d3..1c5e96e20 100644
--- a/navit/icons/desktop_icons/256x256/navit.png
+++ b/navit/icons/desktop_icons/256x256/navit.png
Binary files differ
diff --git a/navit/icons/desktop_icons/86x86/navit.png b/navit/icons/desktop_icons/86x86/navit.png
index 103855850..7dc7de235 100644
--- a/navit/icons/desktop_icons/86x86/navit.png
+++ b/navit/icons/desktop_icons/86x86/navit.png
Binary files differ
diff --git a/navit/icons/navit.svg b/navit/icons/navit.svg
index 591d9ee57..ff806f7e3 100644
--- a/navit/icons/navit.svg
+++ b/navit/icons/navit.svg
@@ -12,185 +12,44 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="22"
height="22"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.48.4 r9939"
- version="1.0"
- sodipodi:docname="navit.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- inkscape:export-filename="/home/jeff/projets/navit/navit.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ viewBox="0 0 22.000001 22"
+ id="svg4900"
+ version="1.1"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="navit.svg">
<defs
- id="defs4">
+ id="defs4902">
<linearGradient
inkscape:collect="always"
- id="linearGradient3376">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3378" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3380" />
- </linearGradient>
- <linearGradient
- id="linearGradient3365">
- <stop
- style="stop-color:#ffffff;stop-opacity:0.61904764;"
- offset="0"
- id="stop3367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3369" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3328">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3330" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3332" />
- </linearGradient>
- <linearGradient
- id="linearGradient3320">
- <stop
- style="stop-color:#116cbf;stop-opacity:1;"
- offset="0"
- id="stop3322" />
- <stop
- id="stop3354"
- offset="0.08"
- style="stop-color:#116cbf;stop-opacity:1;" />
- <stop
- id="stop3352"
- offset="0.4893617"
- style="stop-color:#1a6cb6;stop-opacity:1;" />
- <stop
- style="stop-color:#329eff;stop-opacity:1;"
- offset="1"
- id="stop3324" />
- </linearGradient>
- <linearGradient
- id="linearGradient3308">
- <stop
- style="stop-color:#062643;stop-opacity:1;"
- offset="0"
- id="stop3310" />
- <stop
- style="stop-color:#0d5799;stop-opacity:1;"
- offset="1"
- id="stop3312" />
- </linearGradient>
- <linearGradient
- id="linearGradient3235">
- <stop
- style="stop-color:#c17d11;stop-opacity:1;"
- offset="0"
- id="stop3237" />
- <stop
- style="stop-color:#e9cb14;stop-opacity:1;"
- offset="1"
- id="stop3239" />
- </linearGradient>
+ xlink:href="#linearGradient3728"
+ id="linearGradient1325"
+ x1="0.18388532"
+ y1="294.09717"
+ x2="5.6532726"
+ y2="294.09717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.7795279,0,0,3.7795279,-0.58442088,-69.63366)" />
<linearGradient
- id="linearGradient3227">
+ id="linearGradient3728">
<stop
- style="stop-color:#76650c;stop-opacity:1;"
offset="0"
- id="stop3229" />
+ stop-color="#ffda00"
+ id="stop3730" />
<stop
- style="stop-color:#76650c;stop-opacity:0;"
offset="1"
- id="stop3231" />
+ stop-color="#f57f0c"
+ id="stop3732" />
</linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="15.556349 : 133.02972 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
<linearGradient
inkscape:collect="always"
- xlink:href="#linearGradient3235"
- id="linearGradient3241"
- x1="64"
- y1="115.11359"
- x2="64"
- y2="17.40102"
+ xlink:href="#linearGradient3728"
+ id="linearGradient1341"
+ x1="1.5875"
+ y1="294.08957"
+ x2="4.2333331"
+ y2="294.08957"
gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3308"
- id="linearGradient3314"
- x1="-7.7781754"
- y1="4.2563133"
- x2="43.133514"
- y2="4.2563133"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3320"
- id="linearGradient3326"
- x1="7.6363606"
- y1="87.731171"
- x2="58.391151"
- y2="38.450466"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15669503,0.02174581,-0.02174581,0.15669503,4.357122,0.76802046)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3340"
- gradientUnits="userSpaceOnUse"
- x1="63"
- y1="106.75"
- x2="92"
- y2="29.25" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3328"
- id="linearGradient3342"
- gradientUnits="userSpaceOnUse"
- x1="71"
- y1="69.5"
- x2="87.25"
- y2="33.5" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3365"
- id="linearGradient3371"
- x1="-1.5"
- y1="86.5"
- x2="73.5"
- y2="40"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.15819674,0,0,0.15819674,1.9928719,0.69315656)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3376"
- id="linearGradient3382"
- x1="62.147858"
- y1="67.453751"
- x2="11.016594"
- y2="24.242672"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter3424">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.90523025"
- id="feGaussianBlur3426" />
- </filter>
+ gradientTransform="matrix(3.7795281,0,0,3.7795281,-0.58442178,-69.63366)" />
</defs>
<sodipodi:namedview
id="base"
@@ -199,26 +58,27 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.894586"
- inkscape:cy="27.303943"
+ inkscape:zoom="22.4"
+ inkscape:cx="8.0714281"
+ inkscape:cy="8.9698474"
inkscape:document-units="px"
- inkscape:current-layer="layer2"
+ inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1280"
- inkscape:window-height="948"
+ units="px"
+ inkscape:window-width="1920"
+ inkscape:window-height="926"
inkscape:window-x="0"
- inkscape:window-y="24"
- showborder="true"
+ inkscape:window-y="31"
inkscape:window-maximized="1" />
<metadata
- id="metadata7">
+ id="metadata4905">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -226,168 +86,32 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- style="display:inline">
- <rect
- style="fill:url(#linearGradient3241);fill-opacity:1;stroke:#43350f;stroke-width:0.79098374;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="rect2403"
- width="18.792814"
- height="15.381022"
- x="2.7210562"
- y="3.1272359"
- rx="1.5819675"
- ry="1.5819675" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="lignes"
- style="display:inline">
+ transform="translate(0,-1030.3623)">
<g
- id="g3336"
- transform="matrix(0.15819674,0,0,0.15819674,5.1568068,0.69315656)">
+ id="g5494"
+ transform="translate(0.55342518,-0.5529)">
<path
- sodipodi:nodetypes="cczzczc"
- id="path3223"
- d="m 92,27 8,-4 c 0,0 -32.803776,29.787015 -21.5,41.25 11.303776,11.462985 5.61873,46.35859 -6,46.25 L 19,110 C 39.916667,101.41667 73.874441,83.136394 61,66.25 48.125559,49.363606 92,27 92,27 z"
- style="fill:url(#linearGradient3340);fill-opacity:1;stroke:none"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ id="circle1307"
+ d="m 10.415579,1036.886 a 5.0000004,5.0000004 0 0 0 -1.4902344,0.2324 l 2.4765624,4.7168 0.9375,2.1113 h 0.05859 c -0.04889,-0.5084 -0.107337,-1.0754 -0.175781,-1.7012 -0.05867,-0.6257 -0.08789,-1.2219 -0.08789,-1.789 v -3.2598 a 5.0000004,5.0000004 0 0 0 -1.718747,-0.3105 z m -3.7226561,1.6699 a 5.0000004,5.0000004 0 0 0 -1.277344,3.3301 5.0000004,5.0000004 0 0 0 1.277344,3.3261 z m 7.4941411,0.057 v 6.5508 a 5.0000004,5.0000004 0 0 0 1.228516,-3.2773 5.0000004,5.0000004 0 0 0 -1.228516,-3.2735 z m -5.7050784,1.1836 c 0.04889,0.528 0.103443,1.095 0.162109,1.7012 0.06844,0.6062 0.101563,1.1926 0.101563,1.7598 v 3.3339 a 5.0000004,5.0000004 0 0 0 1.6699214,0.295 5.0000004,5.0000004 0 0 0 1.550781,-0.252 l -2.4863274,-4.7539 -0.939453,-2.084 z"
+ style="display:inline;fill:url(#linearGradient1341);fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <ellipse
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ ry="5.9375"
+ rx="7.5000005"
+ cy="1038.8679"
+ cx="10.308436"
+ id="ellipse1313"
+ style="display:inline;fill:#000000;fill-opacity:0;stroke-width:0.26458332" />
<path
- sodipodi:nodetypes="czc"
- id="path3244"
- d="M 49.5,110 C 60.666667,104.16667 83.256846,86.358298 72,70.5 60.743153,54.641702 77.5,38.5 92.5,29"
- style="fill:none;stroke:url(#linearGradient3342);stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:9, 9;stroke-dashoffset:0"
- inkscape:connector-curvature="0" />
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ sodipodi:nodetypes="cccccccscccccscccccccccccsccccccccccccccsccccccccccccscccccccccccccccccsccccccccscccccccccsccccccccccczccscccz"
+ inkscape:connector-curvature="0"
+ id="path1315"
+ d="m 10.593714,1049.8749 -9.1e-4,-2.3589 0.266653,-0.019 c 1.330607,-0.098 2.575221,-0.668 3.523588,-1.6136 0.923018,-0.9203 1.48054,-2.0846 1.617879,-3.3788 0.01308,-0.1232 0.02385,-0.2694 0.02392,-0.3254 l 1.81e-4,-0.1016 h 2.328482 c 1.280664,0 2.325431,0 2.321705,0.01 -0.0037,0 -0.687432,0.3008 -1.519342,0.6605 -0.83191,0.3594 -1.518827,0.6597 -1.526483,0.6668 -0.0077,0.01 -0.04908,0.1508 -0.09205,0.3194 -0.132715,0.5206 -0.29037,0.9508 -0.517639,1.4127 -0.167958,0.3413 -0.275467,0.5269 -0.499195,0.8617 -1.000766,1.4979 -2.485149,2.5475 -4.266583,3.0169 l -0.07101,0.019 -0.794147,1.5968 -0.794145,1.5968 -9.1e-4,-2.3589 z m -0.8872994,0.9173 c -0.322031,-0.7436 -0.588278,-1.3594 -0.591664,-1.3683 -0.0039,-0.011 0.01606,-0.011 0.05389,0 0.171281,0.03 0.556063,0.075 0.826463,0.093 l 0.3049514,0.019 v 1.3064 c 0,0.7185 -0.0018,1.3063 -0.0041,1.3062 -0.0022,0 -0.267545,-0.6085 -0.5895754,-1.352 z m 0.3984724,-1.5541 c -0.4129714,-0.015 -0.9841194,-0.1 -1.4231124,-0.2079 -1.1829774,-0.2918 -2.2498931,-0.8648 -3.1847034,-1.7108 -0.6211646,-0.5621 -1.2019874,-1.3307 -1.5867228,-2.0995 -0.4741759,-0.9476 -0.7080315,-1.8427 -0.7754332,-2.9681 l -0.010469,-0.175 h 0.869187 0.8691863 l 0.010318,0.2037 c 0.012284,0.2423 0.061463,0.5948 0.1190551,0.8536 0.4574593,2.0554 2.0220538,3.673 4.067024,4.2048 0.328796,0.085 0.901832,0.1704 1.1509234,0.1704 h 0.08991 v 0.8702 0.87 h -0.03659 c -0.02014,0 -0.09149,0 -0.158574,-0.01 z m -8.5472195,-6.4443 -1.43082728,-0.7144 H 1.4864869 2.8461342 l 0.011112,0.2237 c 0.017688,0.3561 0.1027616,1.0252 0.1499604,1.1792 0.0048,0.015 0.00255,0.03 -0.00499,0.03 -0.00752,0 -0.6575826,-0.3212 -1.4445378,-0.7143 z m 0.1659969,-1.8139 1.6130877,-0.8022 0.018331,-0.071 c 0.4155662,-1.6096 1.3767781,-3.0429 2.7081715,-4.0382 0.5508458,-0.4118 1.194233,-0.7624 1.8459792,-1.0062 0.1497071,-0.056 0.5689748,-0.1874 0.7133978,-0.2237 l 0.07096,-0.019 0.802579,-1.6131 0.8025784,-1.6131 6.51e-4,2.3761 6.51e-4,2.3761 -0.215501,0.011 c -0.9806364,0.048 -2.0201623,0.4154 -2.8581804,1.0096 -0.3839399,0.2721 -0.850989,0.7104 -1.1284755,1.0585 -0.5214527,0.6544 -0.8786801,1.3761 -1.0748315,2.1716 -0.085493,0.3466 -0.155229,0.8333 -0.155229,1.083 v 0.1039 H 2.4892044 0.11057482 Z m 14.3013666,0.7062 c 0,-0.054 -0.01126,-0.2056 -0.02506,-0.3368 -0.167061,-1.5908 -1.005735,-3.0256 -2.319287,-3.9677 -0.567371,-0.407 -1.216407,-0.7054 -1.903171,-0.8749 -0.366618,-0.091 -0.811717,-0.155 -1.072569,-0.155 h -0.112135 v -0.8719 -0.8719 l 0.199234,0.011 c 0.958324,0.054 1.802105,0.254 2.641376,0.6272 1.079455,0.4801 2.048175,1.2373 2.782665,2.1749 0.171677,0.2192 0.473811,0.6716 0.605547,0.9067 0.467664,0.8347 0.773114,1.7663 0.885259,2.6999 0.01939,0.1613 0.05791,0.6526 0.05834,0.744 0,0.01 -0.391502,0.011 -0.870074,0.011 h -0.870129 z m 2.00405,-0.2083 c -0.02098,-0.3284 -0.06477,-0.688 -0.11706,-0.9613 -0.01784,-0.093 -0.03073,-0.1708 -0.02861,-0.1723 0.0021,0 0.655233,0.3212 1.451362,0.7175 l 1.447508,0.7201 h -1.366826 -1.366826 l -0.01954,-0.3061 z m -6.213518,-7.0211 c -0.297191,-0.06 -0.853606,-0.1213 -1.104838,-0.1217 l -0.117914,-10e-5 v -1.3689 c 0,-0.7529 0.0026,-1.3658 0.0058,-1.3621 0.0316,0.038 1.434361,2.8932 1.42013,2.8918 -0.01051,0 -0.101949,-0.019 -0.203203,-0.039 z"
+ style="display:inline;fill:url(#linearGradient1325);fill-opacity:1;stroke:none;stroke-width:0.00430322;stroke-opacity:1" />
</g>
</g>
- <g
- inkscape:groupmode="layer"
- id="layer4"
- inkscape:label="bulle"
- style="display:none">
- <path
- sodipodi:type="arc"
- style="fill:url(#linearGradient3314);fill-opacity:1;stroke:#1f3157;stroke-width:5.30526352;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- id="path3305"
- sodipodi:cx="17.67767"
- sodipodi:cy="4.2563133"
- sodipodi:rx="25.455845"
- sodipodi:ry="25.455845"
- d="m 43.133514,4.2563133 a 25.455845,25.455845 0 1 1 -50.9116894,0 25.455845,25.455845 0 1 1 50.9116894,0 z"
- transform="matrix(1.3194444,0,0,1.3194444,18.394598,29.399489)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer3"
- inkscape:label="rose des vents"
- style="display:none">
- <g
- id="g3256"
- transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,36.903806,-19.093669)"
- style="opacity:0.5">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3258"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3260"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- <g
- id="g3252">
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 -5.673657,-27.511429 -27.511429,-5.673655 27.511429,-5.673657 5.673655,-27.5114293 5.673657,27.5114293 27.5114293,5.673655 -27.5114293,5.673657 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="2.3561945"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="8.0237608"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3248"
- style="fill:#167bd9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- <path
- transform="translate(67.5,7)"
- d="m -25.999999,61.185085 6.826343,-33.011429 -40.011429,-0.173655 33.011429,6.826343 0.173655,-40.0114293 -6.826343,33.0114293 40.0114293,0.173655 -33.0114293,-6.826343 z"
- inkscape:randomized="0"
- inkscape:rounded="0"
- inkscape:flatsided="false"
- sodipodi:arg2="0.025433549"
- sodipodi:arg1="1.5707963"
- sodipodi:r2="6.8285527"
- sodipodi:r1="33.185085"
- sodipodi:cy="28"
- sodipodi:cx="-26"
- sodipodi:sides="4"
- id="path3250"
- style="fill:#c3dff9;fill-opacity:1;stroke:none"
- sodipodi:type="star" />
- </g>
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer6"
- inkscape:label="ondes"
- style="display:inline">
- <path
- sodipodi:type="spiral"
- style="fill:none;stroke:url(#linearGradient3382);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3424)"
- id="path3374"
- sodipodi:cx="14.142136"
- sodipodi:cy="19.812662"
- sodipodi:expansion="1"
- sodipodi:revolution="7"
- sodipodi:radius="54.341515"
- sodipodi:argument="-17.841497"
- sodipodi:t0="0"
- d="m 14.142136,19.812662 c 0.622964,0.987625 -1.02395,1.327003 -1.641498,1.035408 -1.673515,-0.790205 -1.44576,-3.111369 -0.429317,-4.318403 1.818177,-2.1591 5.16668,-1.702115 6.995307,0.176773 2.683583,2.757343 1.972982,7.252372 -0.782863,9.672211 C 14.610657,29.603916 8.9345884,28.6291 5.934649,24.989699 2.1595315,20.409885 3.4032379,13.538342 7.9296913,9.9636782 13.411833,5.6342815 21.486273,7.1492634 25.632617,12.56481 30.51894,18.946845 28.731319,28.228517 22.425395,32.944641 15.144955,38.389593 4.6532955,36.328487 -0.63134024,29.131329 -6.6360792,20.95346 -4.300928,9.2499464 3.7880618,3.3976889 12.862686,-3.1676594 25.779376,-0.55807441 32.198606,8.4231809 39.325168,18.394077 36.440869,32.524914 26.567024,39.51063 15.700216,47.198863 0.35449515,44.039641 -7.1973295,33.272958 -15.447588,21.510513 -12.013284,4.9493376 -0.35356778,-3.1683003 12.304301,-11.980865 30.081381,-8.2713528 38.764595,4.2815513 48.13969,17.834674 44.154872,36.828022 30.708654,46.076619 16.260416,56.014427 -3.9494981,51.754222 -13.763319,37.414588 -24.263992,22.071347 -19.728335,0.64462208 -4.4951973,-9.7342896 11.742953,-20.797954 34.386694,-15.98679 45.330585,0.1399218 56.957348,17.272902 51.870631,41.133834 34.850283,52.642608 16.822539,64.832562 -8.2557318,59.470254 -20.329308,41.556217 -33.082529,22.633765 -27.444596,-3.6619713 -8.6368269,-16.300279 11.180283,-29.616836 38.693597,-23.70325 51.896574,-4.0017077 65.776525,16.710018 59.587261,45.441005 38.991913,59.208598 17.385609,73.651995 -12.563136,67.187032 -26.895297,45.697847 -41.902187,23.196997 -35.161504,-7.9695799 -12.778456,-22.866268 10.616911,-38.436689 43.001386,-31.420272 58.462563,-8.1433373 74.596552,16.146521 67.304385,49.748954 43.133542,65.774587"
- transform="matrix(-0.15819674,0,0,0.15819674,22.262049,1.7055356)" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer5"
- inkscape:label="flèche"
- style="display:inline">
- <path
- style="fill:url(#linearGradient3326);fill-opacity:1;stroke:#1f3157;stroke-width:0.47459021;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="M 5.6166617,6.6702162 C 8.5498903,6.3591404 11.366732,6.8627725 14.089084,8.0278339 L 12.323485,12.25995 11.465549,10.2747 C 9.1936105,11.38659 7.6712925,13.621104 6.8096897,16.845097 L 0.57820215,12.334567 C 2.318135,10.026025 5.9650066,8.1110997 8.889601,7.8565979 L 5.6166617,6.6702162 z"
- id="rect3317"
- sodipodi:nodetypes="cccccccc"
- inkscape:connector-curvature="0" />
- <path
- style="fill:url(#linearGradient3371);fill-opacity:1;stroke:none"
- d="M 8.2416433,7.021026 C 9.8257327,6.8500961 11.315051,7.2477939 12.75025,7.9702064 8.920071,9.4835882 6.1923078,11.598289 4.6822166,14.377175 L 1.7555768,12.162421 C 3.6037773,9.8056523 6.570797,8.7541746 9.6654142,7.8515586 L 8.2416433,7.021026 z"
- id="rect3362"
- sodipodi:nodetypes="cccccc"
- inkscape:connector-curvature="0" />
- </g>
</svg>
diff --git a/navit/icons/navit_plain_bk.svg b/navit/icons/navit_plain_bk.svg
new file mode 100755
index 000000000..3458e7286
--- /dev/null
+++ b/navit/icons/navit_plain_bk.svg
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ viewBox="0 0 22 22"
+ id="svg4305"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="navit_plain_background_black.svg">
+ <defs
+ id="defs4307" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.4"
+ inkscape:cx="7.9398986"
+ inkscape:cy="11.526786"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ units="px"
+ inkscape:window-width="1920"
+ inkscape:window-height="1028"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata4310">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1030.3622)">
+ <g
+ id="g4867"
+ transform="translate(0.01785654,0.07143042)">
+ <rect
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ ry="3.9341094"
+ y="1030.2908"
+ x="-0.017856542"
+ height="21.999998"
+ width="21.999998"
+ id="rect886"
+ style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.53104264;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <circle
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ r="4.9999995"
+ cy="1041.2909"
+ cx="10.982141"
+ id="circle870"
+ style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <ellipse
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ ry="5.9374995"
+ rx="7.4999995"
+ cy="1038.2731"
+ cx="10.875"
+ id="ellipse876"
+ style="display:inline;fill:#000000;fill-opacity:0;stroke-width:0.26458332" />
+ <path
+ inkscape:export-ydpi="96"
+ inkscape:export-xdpi="96"
+ sodipodi:nodetypes="cccccccscccccscccccccccccsccccccccccccccsccccccccccccscccccccccccccccccsccccccccscccccccccsccccccccccczccscccz"
+ inkscape:connector-curvature="0"
+ id="path878"
+ d="m 11.16028,1049.28 -9.11e-4,-2.3589 0.266653,-0.019 c 1.330608,-0.098 2.575221,-0.668 3.523588,-1.6137 0.923021,-0.9203 1.480539,-2.0846 1.617879,-3.3787 0.01323,-0.1232 0.02381,-0.2695 0.02381,-0.3254 l 1.82e-4,-0.1017 2.328483,0 c 1.280663,0 2.32543,0 2.321704,0.01 -0.0037,0 -0.687428,0.3009 -1.51934,0.6606 -0.831912,0.3594 -1.51883,0.6597 -1.526483,0.6668 -0.0076,0.01 -0.04906,0.1508 -0.09203,0.3193 -0.132699,0.5206 -0.290381,0.9509 -0.51764,1.4127 -0.167962,0.3413 -0.275452,0.5269 -0.499196,0.8618 -1.000766,1.4979 -2.485149,2.5475 -4.266583,3.0168 l -0.07101,0.019 -0.794147,1.5968 -0.794145,1.5969 -9.1e-4,-2.3589 z m -0.8873,0.9172 c -0.3220306,-0.7436 -0.5882783,-1.3593 -0.5916636,-1.3683 -0.00389,-0.011 0.016063,-0.011 0.053889,0 0.1712806,0.03 0.5560626,0.075 0.8264616,0.093 l 0.304952,0.019 0,1.3064 c 0,0.7185 -0.0018,1.3064 -0.0041,1.3063 -0.0022,0 -0.267546,-0.6085 -0.589575,-1.3521 z m 0.398472,-1.5541 c -0.412971,-0.015 -0.9841186,-0.1 -1.4231118,-0.2078 -1.1829774,-0.2918 -2.2498931,-0.8648 -3.1847031,-1.7108 -0.621165,-0.5622 -1.201987,-1.3307 -1.586723,-2.0996 -0.474176,-0.9476 -0.708031,-1.8427 -0.775433,-2.968 l -0.01047,-0.175 0.869187,0 0.869186,0 0.01032,0.2037 c 0.01228,0.2423 0.06146,0.5948 0.119055,0.8535 0.45746,2.0555 2.022054,3.6731 4.0670236,4.2048 0.3287962,0.085 0.9018323,0.1705 1.1509243,0.1705 l 0.08991,0 0,0.8701 0,0.8701 -0.03659,0 c -0.02015,0 -0.09149,0 -0.158574,-0.01 z m -8.5472179,-6.4443 -1.43082704,-0.7144 1.35964604,0 1.359647,0 0.01111,0.2238 c 0.01769,0.356 0.102762,1.0251 0.149961,1.1791 0.0048,0.015 0.0026,0.03 -0.005,0.03 -0.0075,0 -0.657583,-0.3213 -1.444538,-0.7144 z m 0.165996,-1.8139 1.613088,-0.8022 0.01833,-0.071 c 0.415566,-1.6096 1.376778,-3.043 2.708171,-4.0382 0.550846,-0.4119 1.1942329,-0.7625 1.8459792,-1.0062 0.1497071,-0.056 0.5689742,-0.1875 0.7133975,-0.2238 l 0.070964,-0.019 0.8025792,-1.6132 0.802579,-1.6131 6.5e-4,2.3762 6.51e-4,2.376 -0.215501,0.011 c -0.9806353,0.048 -2.0201614,0.4153 -2.8581794,1.0096 -0.3839395,0.2721 -0.8509885,0.7103 -1.1284755,1.0585 -0.521453,0.6543 -0.87868,1.376 -1.074831,2.1716 -0.08549,0.3465 -0.155229,0.8332 -0.155229,1.0829 l 0,0.104 -2.378629,0 -2.37863004,0 z m 14.3013649,0.7062 c 0,-0.054 -0.01134,-0.2056 -0.02494,-0.3367 -0.16706,-1.5909 -1.005741,-3.0256 -2.319293,-3.9678 -0.567371,-0.4069 -1.216406,-0.7053 -1.90317,-0.8749 -0.366618,-0.091 -0.811717,-0.1549 -1.072569,-0.1549 l -0.112135,0 0,-0.8719 0,-0.872 0.199234,0.011 c 0.958324,0.054 1.802105,0.2539 2.641376,0.6272 1.079455,0.4801 2.048175,1.2372 2.782665,2.1749 0.171667,0.2192 0.47381,0.6715 0.605549,0.9066 0.467663,0.8347 0.773113,1.7663 0.885256,2.6999 0.01928,0.1614 0.0579,0.6527 0.05836,0.7441 0,0.01 -0.391499,0.011 -0.870074,0.011 l -0.870142,0 z m 2.004053,-0.2082 c -0.02079,-0.3284 -0.06478,-0.688 -0.117052,-0.9613 -0.01776,-0.093 -0.03061,-0.1709 -0.02873,-0.1724 0.0021,0 0.655234,0.3213 1.451362,0.7175 l 1.44751,0.7201 -1.366829,0 -1.366824,0 -0.01965,-0.3061 z m -6.213519,-7.0211 c -0.297192,-0.06 -0.853607,-0.1213 -1.104839,-0.1217 l -0.117913,-2e-4 0,-1.3688 c 0,-0.753 0.0026,-1.3659 0.0058,-1.3622 0.0316,0.038 1.434361,2.8932 1.42013,2.8918 -0.01051,-10e-4 -0.101949,-0.019 -0.203202,-0.039 z"
+ style="display:inline;fill:#ffffff;fill-opacity:1;stroke-width:0.00430322" />
+ <path
+ inkscape:connector-curvature="0"
+ id="circle1355-6-5-2-1"
+ d="m 10.982164,1036.2918 a 4.9999995,4.9999993 0 0 1 0.349606,0.019 4.9999995,4.9999993 0 0 0 -0.349606,-0.019 z m 0,0 a 4.9999995,4.9999993 0 0 0 -0.439453,0.023 4.9999995,4.9999993 0 0 1 0.439453,-0.023 z m -0.439453,0.023 a 4.9999995,4.9999993 0 0 0 -0.181644,0.023 4.9999995,4.9999993 0 0 1 0.181644,-0.023 z m -0.181644,0.023 a 4.9999995,4.9999993 0 0 0 -0.332032,0.051 4.9999995,4.9999993 0 0 1 0.332032,-0.051 z m -0.332032,0.051 a 4.9999995,4.9999993 0 0 0 -0.1230612,0.026 4.9999995,4.9999993 0 0 1 0.1230612,-0.026 z m -0.1230612,0.026 a 4.9999995,4.9999993 0 0 0 -0.3808589,0.098 4.9999995,4.9999993 0 0 1 0.3808589,-0.098 z m -0.3808589,0.098 a 4.9999995,4.9999993 0 0 0 -0.03326,0.011 l 0,0 a 4.9999995,4.9999993 0 0 1 0.03326,-0.011 z m -0.03326,0.011 a 4.9999995,4.9999993 0 0 0 -2.2324188,1.4355 l 0,6.6562 a 4.9999995,4.9999993 0 0 1 -0.876957,-1.3788 4.9999995,4.9999993 0 0 0 3.3750012,2.8945 4.9999995,4.9999993 0 0 1 -0.4453115,-0.1369 l 0,-3.3339 c 0,-0.5672 -0.03326,-1.1536 -0.1015559,-1.7598 -0.058658,-0.6062 -0.1132346,-1.1732 -0.1621039,-1.7012 l 0.058583,0 0.93945,2.084 2.486329,4.7539 a 4.9999995,4.9999993 0 0 0 2.220702,-1.4707 l 0,-6.5508 a 4.9999995,4.9999993 0 0 0 -2.052733,-1.414 l 0,3.2578 c 0,0.5671 0.0291,1.1633 0.08787,1.789 0.06845,0.6258 0.126879,1.1928 0.175786,1.7012 l -0.05858,0 -0.9375,-2.1113 -2.4765615,-4.7149 z m 5.2617181,8.0429 a 4.9999995,4.9999993 0 0 0 0.308598,-0.3925 4.9999995,4.9999993 0 0 1 -0.308598,0.3925 z m 0.308598,-0.3925 a 4.9999995,4.9999993 0 0 0 0.253909,-0.3985 4.9999995,4.9999993 0 0 1 -0.253909,0.3985 z m -5.3046871,1.957 a 4.9999995,4.9999993 0 0 0 0.062513,0.015 4.9999995,4.9999993 0 0 1 -0.062513,-0.015 z m 0.062513,0.015 a 4.9999995,4.9999993 0 0 0 0.4121081,0.08 4.9999995,4.9999993 0 0 1 -0.4121081,-0.08 z m 0.4121081,0.08 a 4.9999995,4.9999993 0 0 0 0.08398,0.015 4.9999995,4.9999993 0 0 1 -0.08398,-0.015 z m 0.08398,0.015 a 4.9999995,4.9999993 0 0 0 0.351572,0.034 4.9999995,4.9999993 0 0 1 -0.351572,-0.034 z m 0.351572,0.034 a 4.9999995,4.9999993 0 0 0 0.314456,0.015 4.9999995,4.9999993 0 0 1 -0.314456,-0.015 z m 0.314456,0.015 a 4.9999995,4.9999993 0 0 0 0.441408,-0.023 4.9999995,4.9999993 0 0 1 -0.441407,0.023 z m 0.441408,-0.023 a 4.9999995,4.9999993 0 0 0 0.189468,-0.023 4.9999995,4.9999993 0 0 1 -0.189468,0.023 z m 0.189468,-0.023 a 4.9999995,4.9999993 0 0 0 0.318349,-0.051 4.9999995,4.9999993 0 0 1 -0.318349,0.051 z m 0.318349,-0.051 a 4.9999995,4.9999993 0 0 0 0.123062,-0.026 4.9999995,4.9999993 0 0 1 -0.123062,0.026 z m 0.123062,-0.026 a 4.9999995,4.9999993 0 0 0 0.404296,-0.1054 4.9999995,4.9999993 0 0 1 -0.404296,0.1054 z m -5.6718749,-2.9297 a 4.9999995,4.9999993 0 0 1 -0.144529,-0.3887 4.9999995,4.9999993 0 0 0 0.144529,0.3887 z m -0.144529,-0.3887 a 4.9999995,4.9999993 0 0 1 -0.04101,-0.1251 4.9999995,4.9999993 0 0 0 0.04101,0.1251 z m -0.04101,-0.1251 a 4.9999995,4.9999993 0 0 1 -0.08595,-0.3379 4.9999995,4.9999993 0 0 0 0.08595,0.3379 z m -0.08595,-0.3379 a 4.9999995,4.9999993 0 0 1 -0.03137,-0.1466 4.9999995,4.9999993 0 0 0 0.03137,0.1466 z m -0.03137,-0.1466 a 4.9999995,4.9999993 0 0 1 -0.0508,-0.3183 4.9999995,4.9999993 0 0 0 0.0508,0.3183 z m -0.0508,-0.3183 a 4.9999995,4.9999993 0 0 1 -0.02343,-0.1935 4.9999995,4.9999993 0 0 0 0.02343,0.1935 z m -0.02343,-0.1935 a 4.9999995,4.9999993 0 0 1 -0.02343,-0.4375 4.9999995,4.9999993 0 0 0 0.02343,0.4375 z m -0.02343,-0.4375 a 4.9999995,4.9999993 0 0 1 0.01361,-0.2755 4.9999995,4.9999993 0 0 0 -0.01361,0.2755 z m 0.01361,-0.2755 a 4.9999995,4.9999993 0 0 1 0.02532,-0.3065 4.9999995,4.9999993 0 0 0 -0.02532,0.3065 z m 0.02532,-0.3065 a 4.9999995,4.9999993 0 0 1 0.02948,-0.1992 4.9999995,4.9999993 0 0 0 -0.02948,0.1992 z m 0.02948,-0.1992 a 4.9999995,4.9999993 0 0 1 0.05469,-0.3009 4.9999995,4.9999993 0 0 0 -0.05469,0.3009 z m 0.05469,-0.3009 a 4.9999995,4.9999993 0 0 1 0.04687,-0.1836 4.9999995,4.9999993 0 0 0 -0.04687,0.1836 z m 0.04687,-0.1836 a 4.9999995,4.9999993 0 0 1 0.08787,-0.3047 4.9999995,4.9999993 0 0 0 -0.08787,0.3047 z m 0.08787,-0.3047 a 4.9999995,4.9999993 0 0 1 0.04687,-0.1289 4.9999995,4.9999993 0 0 0 -0.04687,0.1289 z m 0.04687,-0.1289 a 4.9999995,4.9999993 0 0 1 0.142564,-0.3552 4.9999995,4.9999993 0 0 0 -0.142564,0.3552 z m 0.142564,-0.3552 a 4.9999995,4.9999993 0 0 1 0.04101,-0.084 4.9999995,4.9999993 0 0 0 -0.04101,0.084 z m 0.04101,-0.084 a 4.9999995,4.9999993 0 0 1 0.19336,-0.3693 4.9999995,4.9999993 0 0 0 -0.19336,0.3693 z m 4.8613259,-2.8438 a 4.9999995,4.9999993 0 0 1 0.33789,0.034 4.9999995,4.9999993 0 0 0 -0.33789,-0.034 z m 0.33789,0.034 a 4.9999995,4.9999993 0 0 1 0.117203,0.019 4.9999995,4.9999993 0 0 0 -0.117203,-0.019 z m 0.117203,0.019 a 4.9999995,4.9999993 0 0 1 0.408204,0.086 4.9999995,4.9999993 0 0 0 -0.408204,-0.086 z m 0.408204,0.086 a 4.9999995,4.9999993 0 0 1 0.05666,0.015 4.9999995,4.9999993 0 0 0 -0.05666,-0.015 z m 0.05666,0.015 a 4.9999995,4.9999993 0 0 1 0.425778,0.1308 4.9999995,4.9999993 0 0 0 -0.425783,-0.1308 z m -4.9980519,1.5039 a 4.9999995,4.9999993 0 0 0 -0.296881,0.3693 4.9999995,4.9999993 0 0 1 0.296881,-0.3693 z m 7.5468809,0.1055 a 4.9999995,4.9999993 0 0 1 0.292951,0.3828 4.9999995,4.9999993 0 0 0 -0.292951,-0.3828 z m -7.8593789,0.2831 a 4.9999995,4.9999993 0 0 0 -0.250016,0.3828 4.9999995,4.9999993 0 0 1 0.250016,-0.3828 z m 8.1699229,0.1232 a 4.9999995,4.9999993 0 0 1 0.240227,0.3926 4.9999995,4.9999993 0 0 0 -0.240227,-0.3926 z m 0.259767,0.4278 a 4.9999995,4.9999993 0 0 1 0.197254,0.4062 4.9999995,4.9999993 0 0 0 -0.197254,-0.4062 z m 0.218759,0.457 a 4.9999995,4.9999993 0 0 1 0.12892,0.3477 4.9999995,4.9999993 0 0 0 -0.12892,-0.3477 z m 0.12892,0.3477 a 4.9999995,4.9999993 0 0 1 0.0508,0.1523 4.9999995,4.9999993 0 0 0 -0.0508,-0.1523 z m 0.0508,0.1523 a 4.9999995,4.9999993 0 0 1 0.08787,0.3398 4.9999995,4.9999993 0 0 0 -0.08787,-0.3398 z m 0.08787,0.3398 a 4.9999995,4.9999993 0 0 1 0.02948,0.1345 4.9999995,4.9999993 0 0 0 -0.02948,-0.1345 z m 0.02948,0.1345 a 4.9999995,4.9999993 0 0 1 0.05076,0.3323 4.9999995,4.9999993 0 0 0 -0.05076,-0.3323 z m 0.05076,0.3323 a 4.9999995,4.9999993 0 0 1 0.02154,0.1799 4.9999995,4.9999993 0 0 0 -0.02154,-0.1799 z m 0.02154,0.1799 a 4.9999995,4.9999993 0 0 1 0.02343,0.4413 4.9999995,4.9999993 0 0 0 -0.02343,-0.4413 z m 0.02343,0.4413 a 4.9999995,4.9999993 0 0 1 -0.01172,0.2597 4.9999995,4.9999993 0 0 0 0.01172,-0.2597 z m -0.01172,0.2597 a 4.9999995,4.9999993 0 0 1 -0.01965,0.2929 4.9999995,4.9999993 0 0 0 0.01965,-0.2929 z m -0.01965,0.2929 a 4.9999995,4.9999993 0 0 1 -0.02721,0.1818 4.9999995,4.9999993 0 0 0 0.02721,-0.1818 z m -0.02721,0.1818 a 4.9999995,4.9999993 0 0 1 -0.0508,0.2971 4.9999995,4.9999993 0 0 0 0.0508,-0.2971 z m -0.0508,0.2971 a 4.9999995,4.9999993 0 0 1 -0.04687,0.1893 4.9999995,4.9999993 0 0 0 0.04687,-0.1893 z m -0.04687,0.1893 a 4.9999995,4.9999993 0 0 1 -0.08787,0.3183 4.9999995,4.9999993 0 0 0 0.08787,-0.3183 z m -0.121096,0.4083 a 4.9999995,4.9999993 0 0 1 -0.138671,0.3632 4.9999995,4.9999993 0 0 0 0.138671,-0.3632 z m -0.138671,0.3632 a 4.9999995,4.9999993 0 0 1 -0.06251,0.1307 4.9999995,4.9999993 0 0 0 0.06251,-0.1307 z m -0.06251,0.1307 a 4.9999995,4.9999993 0 0 1 -0.169928,0.3341 4.9999995,4.9999993 0 0 0 0.169928,-0.3341 z"
+ style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/navit/layout.c b/navit/layout.c
index f2f3d1a75..65e4b7265 100644
--- a/navit/layout.c
+++ b/navit/layout.c
@@ -39,7 +39,9 @@ layout_new(struct attr *parent, struct attr **attrs) {
struct layout *l;
struct navit *navit;
struct color def_color = {COLOR_BACKGROUND_};
- struct attr *name_attr,*color_attr,*order_delta_attr,*font_attr,*day_attr,*night_attr,*active_attr;
+ int def_underground_alpha = UNDERGROUND_ALPHA_;
+ struct attr *name_attr,*color_attr,*order_delta_attr,*font_attr,*day_attr,*night_attr,*active_attr,
+ *underground_alpha_attr,*icon_attr;
if (! (name_attr=attr_search(attrs, NULL, attr_name)))
return NULL;
@@ -67,6 +69,21 @@ layout_new(struct attr *parent, struct attr **attrs) {
l->color = *color_attr->u.color;
else
l->color = def_color;
+ if ((underground_alpha_attr=attr_search(attrs, NULL, attr_underground_alpha))) {
+ int a = underground_alpha_attr->u.num;
+ /* for convenience, the alpha value is just 8 bit as usual if using
+ * corresponding attr. therefore we need to shift that up */
+ l->underground_alpha = (a << 8) | a;
+ } else
+ l->underground_alpha = def_underground_alpha;
+ if ((icon_attr=attr_search(attrs, NULL, attr_icon_w)))
+ l->icon_w = icon_attr->u.num;
+ else
+ l->icon_w = -1;
+ if ((icon_attr=attr_search(attrs, NULL, attr_icon_h)))
+ l->icon_h = icon_attr->u.num;
+ else
+ l->icon_h = -1;
if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta)))
l->order_delta=order_delta_attr->u.num;
if ((active_attr=attr_search(attrs, NULL, attr_active)))
@@ -389,6 +406,13 @@ int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) {
}
}
+static void element_set_oneway(struct element *e, struct attr **attrs) {
+ struct attr *oneway;
+ oneway=attr_search(attrs, NULL, attr_oneway);
+ if (oneway)
+ e->oneway=oneway->u.num;
+}
+
static void element_set_color(struct element *e, struct attr **attrs) {
struct attr *color;
color=attr_search(attrs, NULL, attr_color);
@@ -412,6 +436,15 @@ static void element_set_text_size(struct element *e, struct attr **attrs) {
e->text_size=text_size->u.num;
}
+static void element_set_arrows_width(struct element *e, struct attr **attrs) {
+ struct attr *width;
+ width=attr_search(attrs, NULL, attr_width);
+ if (width)
+ e->u.arrows.width=width->u.num;
+ else
+ e->u.arrows.width=10;
+}
+
static void element_set_polyline_width(struct element *e, struct attr **attrs) {
struct attr *width;
width=attr_search(attrs, NULL, attr_width);
@@ -468,6 +501,7 @@ polygon_new(struct attr *parent, struct attr **attrs) {
e = g_new0(struct element, 1);
e->type=element_polygon;
element_set_color(e, attrs);
+ element_set_oneway(e, attrs);
return (struct polygon *)e;
}
@@ -479,6 +513,7 @@ polyline_new(struct attr *parent, struct attr **attrs) {
e = g_new0(struct element, 1);
e->type=element_polyline;
element_set_color(e, attrs);
+ element_set_oneway(e, attrs);
element_set_polyline_width(e, attrs);
element_set_polyline_directed(e, attrs);
element_set_polyline_dash(e, attrs);
@@ -498,6 +533,7 @@ circle_new(struct attr *parent, struct attr **attrs) {
e->u.circle.background_color = color_white;
element_set_color(e, attrs);
element_set_background_color(&e->u.circle.background_color, attrs);
+ element_set_oneway(e, attrs);
element_set_text_size(e, attrs);
element_set_circle_width(e, attrs);
element_set_circle_radius(e, attrs);
@@ -518,6 +554,7 @@ text_new(struct attr *parent, struct attr **attrs) {
e->u.text.background_color = color_white;
element_set_color(e, attrs);
element_set_background_color(&e->u.text.background_color, attrs);
+ element_set_oneway(e, attrs);
return (struct text *)e;
}
@@ -572,6 +609,8 @@ arrows_new(struct attr *parent, struct attr **attrs) {
e = g_malloc0(sizeof(*e));
e->type=element_arrows;
element_set_color(e, attrs);
+ element_set_oneway(e, attrs);
+ element_set_arrows_width(e, attrs);
return (struct arrows *)e;
}
diff --git a/navit/layout.h b/navit/layout.h
index 700e6245a..8b8a63194 100644
--- a/navit/layout.h
+++ b/navit/layout.h
@@ -37,6 +37,7 @@ struct element {
enum { element_point, element_polyline, element_polygon, element_circle, element_text, element_icon, element_image, element_arrows } type;
struct color color;
int text_size;
+ int oneway;
union {
struct element_point {
char stub;
@@ -67,6 +68,9 @@ struct element {
struct element_text {
struct color background_color;
} text;
+ struct element_arrows {
+ int width;
+ } arrows;
} u;
int coord_count;
struct coord *coord;
@@ -105,6 +109,9 @@ struct layout {
char* nightname;
char *font;
struct color color;
+ int underground_alpha;
+ int icon_w;
+ int icon_h;
GList *layers;
GList *cursors;
int order_delta;
diff --git a/navit/main.c b/navit/main.c
index f4a59970d..898fb9dca 100644
--- a/navit/main.c
+++ b/navit/main.c
@@ -81,20 +81,22 @@ void setenv(char *var, char *val, int overwrite) {
* environment_vars[0] is the name of the variable
* environment_vars[1] is the value used when running from source dir
* environment_vars[2] is the value used on Linux
- * environment_vars[3] is the value used on Windows (see main_init())
+ * environment_vars[3] is the value used on Windows CE (see main_init())
* environment_vars[4] is the value used on Android
+ * environment_vars[5] is the value used on Windows
* ':' is replaced with NAVIT_PREFIX
* '::' is replaced with NAVIT_PREFIX and LIBDIR
- * '~' is replaced with HOME
+ * '~' is replaced with HOME on Linux, or USERPROFILE on Windows (not on Windows CE)
*/
-static char *environment_vars[][5]= {
- {"NAVIT_LIBDIR", ":", ":/"LIB_DIR, ":\\lib", ":/lib"},
- {"NAVIT_SHAREDIR", ":", ":/"SHARE_DIR, ":", ":/share"},
- {"NAVIT_LOCALEDIR", ":/../locale",":/"LOCALE_DIR, ":\\locale", ":/locale"},
- {"NAVIT_USER_DATADIR",":", "~/.navit", ":\\data", ":/home"},
- {"NAVIT_LOGFILE", NULL, NULL, ":\\navit.log",NULL},
- {"NAVIT_LIBPREFIX", "*/.libs/", NULL, NULL, NULL},
- {NULL, NULL, NULL, NULL, NULL},
+
+static char *environment_vars[][6]= {
+ {"NAVIT_LIBDIR", ":", ":/"LIB_DIR, ":\\lib", ":/lib", ":\\lib"},
+ {"NAVIT_SHAREDIR", ":", ":/"SHARE_DIR, ":", ":/share", ":"},
+ {"NAVIT_LOCALEDIR", ":/../locale",":/"LOCALE_DIR, ":\\locale", ":/locale", ":\\locale"},
+ {"NAVIT_USER_DATADIR",":", "~/.navit", ":\\data", ":/home", "~\\navit"},
+ {"NAVIT_LOGFILE", NULL, NULL, ":\\navit.log",NULL, ":\\navit.log"},
+ {"NAVIT_LIBPREFIX", "*/.libs/", NULL, NULL, NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL, NULL},
};
static void main_setup_environment(int mode) {
@@ -111,7 +113,11 @@ static void main_setup_environment(int mode) {
val=g_strdup_printf("%s%s", getenv("NAVIT_PREFIX"), val+1);
break;
case '~':
+#if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE) // For Windows only, excluding WinCE
+ homedir=getenv("USERPROFILE");
+#else
homedir=getenv("HOME");
+#endif
if (!homedir)
homedir="./";
val=g_strdup_printf("%s%s", homedir, val+1);
@@ -125,6 +131,9 @@ static void main_setup_environment(int mode) {
}
i++;
}
+#if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE) // For Windows only, excluding WinCE
+ navit_get_user_data_directory(1); /* Create the user data directory */
+#endif
}
#ifdef HAVE_API_WIN32_BASE
@@ -369,11 +378,11 @@ void main_init(const char *program) {
} else
setenv("NAVIT_PREFIX", PREFIX, 0);
}
-#ifdef HAVE_API_ANDROID
+# ifdef HAVE_API_ANDROID
main_setup_environment(3);
-#else
+# else
main_setup_environment(1);
-#endif
+# endif
}
#else /* _WIN32 || _WIN32_WCE */
@@ -383,12 +392,12 @@ void main_init(const char *program) {
int len;
*filename = '\0';
-#ifdef _UNICODE /* currently for wince */
+# ifdef _UNICODE /* currently for wince */
if (GetModuleFileNameW(NULL, wfilename, MAX_PATH)) {
wcstombs(filename, wfilename, MAX_PATH);
-#else
+# else
if (GetModuleFileName(NULL, filename, MAX_PATH)) {
-#endif
+# endif
end = strrchr(filename, L'\\'); /* eliminate the file name which is on the right side */
if(end)
*end = '\0';
@@ -401,7 +410,21 @@ void main_init(const char *program) {
}
if (!getenv("HOME"))
setenv("HOME", getenv("NAVIT_PREFIX"), 0);
+# if defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE)
+ main_setup_environment(4);
+# else /* not (defined(HAVE_API_WIN32) && !defined(HAVE_API_WIN32_CE)) */
+# if defined(HAVE_API_WIN32_CE) && !defined(HAVE_API_WIN32)
main_setup_environment(2);
+# else /* not (defined(HAVE_API_WIN32_CE) && !defined(HAVE_API_WIN32)) */
+# if defined(HAVE_API_WIN32_CE)
+# warning HAVE_API_WIN32_CE is defined
+# endif
+# if defined(HAVE_API_WIN32)
+# warning HAVE_API_WIN32 is defined
+# endif
+# error Exactly only one directive amongst HAVE_API_WIN32_CE or HAVE_API_WIN32 should be defined when preprocessor reach this section of code
+# endif
+# endif
#endif /* _WIN32 || _WIN32_WCE */
s = getenv("NAVIT_WID");
diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c
index 6fd05674d..caba43e94 100644
--- a/navit/maptool/osm.c
+++ b/navit/maptool/osm.c
@@ -138,7 +138,22 @@ char *osm_types[]= {"unknown","node","way","relation"};
struct country_table {
int countryid;
char *names;
- char *admin_levels;
+ char *admin_levels; /**<
+ * String indicating how to interpret admin levels for this country.
+ *
+ * Each character of the string specifies how to treat the corresponding admin level.
+ * The first character corresponds to level 3, each following character to the next
+ * lower level (usually up to level 8, but that is just a convention):
+ * `s`: use the name as the state label, `c`: use the name as the county label,
+ * `m`: use the name as the municipality label, `M`: same as `m`, but additionally
+ * use the boundary as the town boundary, `T`: use the boundary the town boundary and
+ * ignore the name. All other characters are ignored; by convention use the digit
+ * corresponding to the admin level to indicate this level should be skipped.
+ *
+ * See
+ * https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#10_admin_level_values_for_specific_countries
+ * for values used in specific countries.
+ */
FILE *file;
int size;
struct rect r;
@@ -154,8 +169,8 @@ struct country_table {
{ 28,"Antigua and Barbuda"},
{ 31,"Azerbaijan"},
{ 32,"Argentina,República Argentina,AR "},
- { 36,"Australia,AUS"},
- { 40,"Austria,Österreich,AUT"},
+ { 36,"Australia,AUS","3s456c8"},
+ { 40,"Austria,Österreich,AUT","3s5c78"},
{ 44,"Bahamas"},
{ 48,"Bahrain"},
{ 50,"Bangladesh"},
@@ -168,19 +183,19 @@ struct country_table {
{ 70,"Bosnia and Herzegovina,Bosna i Hercegovina,Босна и Херцеговина"},
{ 72,"Botswana"},
{ 74,"Bouvet Island"},
- { 76,"Brazil"},
+ { 76,"Brazil","3s5cm8"},
{ 84,"Belize"},
{ 86,"British Indian Ocean Territory"},
{ 90,"Solomon Islands"},
{ 92,"Virgin Islands, British"},
{ 96,"Brunei Darussalam"},
- { 100,"Bulgaria,България"},
+ { 100,"Bulgaria,България","3s5cm8"},
{ 104,"Myanmar"},
{ 108,"Burundi"},
- { 112,"Belarus"},
+ { 112,"Belarus","3s5c78"},
{ 116,"Cambodia"},
{ 120,"Cameroon"},
- { 124,"Canada"},
+ { 124,"Canada","3scm78"},
{ 132,"Cape Verde"},
{ 136,"Cayman Islands"},
{ 140,"Central African Republic"},
@@ -198,12 +213,12 @@ struct country_table {
{ 180,"Congo, the Democratic Republic of the"},
{ 184,"Cook Islands"},
{ 188,"Costa Rica"},
- { 191,"Croatia,Republika Hrvatska,HR"},
+ { 191,"Croatia,Republika Hrvatska,HR","34scm8"},
{ 192,"Cuba"},
- { 196,"Cyprus"},
- { 203,"Czech Republic,Česká republika,CZ"},
+ { 196,"Cyprus","345c7m"},
+ { 203,"Czech Republic,Česká republika,CZ","345cm8"},
{ 204,"Benin"},
- { 208,"Denmark,Danmark,DK"},
+ { 208,"Denmark,Danmark,DK","3c56m8"},
{ 212,"Dominica"},
{ 214,"Dominican Republic"},
{ 218,"Ecuador"},
@@ -211,12 +226,12 @@ struct country_table {
{ 226,"Equatorial Guinea"},
{ 231,"Ethiopia"},
{ 232,"Eritrea"},
- { 233,"Estonia"},
+ { 233,"Estonia,Eesti","345cm8"},
{ 234,"Faroe Islands,Føroyar"},
{ 238,"Falkland Islands (Malvinas)"},
{ 239,"South Georgia and the South Sandwich Islands"},
{ 242,"Fiji"},
- { 246,"Finland,Suomi"},
+ { 246,"Finland,Suomi","3s5cm8"},
{ 248,"Åland Islands"},
{ 250,"France,République française,FR","3s5c7M"},
{ 254,"French Guiana"},
@@ -224,10 +239,10 @@ struct country_table {
{ 260,"French Southern Territories"},
{ 262,"Djibouti"},
{ 266,"Gabon"},
- { 268,"Georgia"},
+ { 268,"Georgia","3s5c78"},
{ 270,"Gambia"},
{ 275,"Palestinian Territory, Occupied"},
- { 276,"Germany,Deutschland,Bundesrepublik Deutschland","345c7M"},
+ { 276,"Germany,Deutschland,Bundesrepublik Deutschland","3s5c7M"},
{ 288,"Ghana"},
{ 292,"Gibraltar"},
{ 296,"Kiribati"},
@@ -244,35 +259,35 @@ struct country_table {
{ 336,"Holy See (Vatican City State)"},
{ 340,"Honduras"},
{ 344,"Hong Kong"},
- { 348,"Hungary,Magyarország"},
- { 352,"Iceland"},
- { 356,"India"},
+ { 348,"Hungary,Magyarország","345c78"},
+ { 352,"Iceland","34cm78"},
+ { 356,"India","3sc6m8"},
{ 360,"Indonesia"},
{ 364,"Iran, Islamic Republic of"},
{ 368,"Iraq"},
- { 372,"Ireland"},
+ { 372,"Ireland","345c78"},
{ 376,"Israel"},
- { 380,"Italy,Italia"},
+ { 380,"Italy,Italia","3s5c78"},
{ 384,"Côte d'Ivoire"},
{ 388,"Jamaica"},
- { 392,"Japan"},
+ { 392,"Japan","3s5cm8"},
{ 398,"Kazakhstan"},
{ 400,"Jordan"},
{ 404,"Kenya"},
- { 408,"Korea, Democratic People's Republic of"},
- { 410,"Korea, Republic of"},
+ { 408,"Korea, Democratic People's Republic of","3s5cm8"},
+ { 410,"Korea, Republic of","3s5cm8"},
{ 412,"Kosovo,Kosova"},
{ 414,"Kuwait"},
{ 417,"Kyrgyzstan"},
{ 418,"Lao People's Democratic Republic"},
{ 422,"Lebanon"},
{ 426,"Lesotho"},
- { 428,"Latvia"},
+ { 428,"Latvia,Latvija","345c78"},
{ 430,"Liberia"},
{ 434,"Libyan Arab Jamahiriya"},
{ 438,"Liechtenstein"},
- { 440,"Lithuania,Lietuva"},
- { 442,"Luxembourg"},
+ { 440,"Lithuania,Lietuva","3cm67T"},
+ { 442,"Luxembourg","3s5c78"},
{ 446,"Macao"},
{ 450,"Madagascar"},
{ 454,"Malawi"},
@@ -283,7 +298,7 @@ struct country_table {
{ 474,"Martinique"},
{ 478,"Mauritania"},
{ 480,"Mauritius"},
- { 484,"Mexico"},
+ { 484,"Mexico","3s5m78"},
{ 492,"Monaco"},
{ 496,"Mongolia"},
{ 498,"Moldova, Republic of"},
@@ -303,13 +318,13 @@ struct country_table {
{ 535,"Bonaire, Sint Eustatius and Saba"},
{ 540,"New Caledonia"},
{ 548,"Vanuatu"},
- { 554,"New Zealand"},
+ { 554,"New Zealand","3s5m78"},
{ 558,"Nicaragua"},
{ 562,"Niger"},
{ 566,"Nigeria"},
{ 570,"Niue"},
{ 574,"Norfolk Island"},
- { 578,"Norway,Norge,Noreg,NO"},
+ { 578,"Norway,Norge,Noreg,NO","3c56m8"},
{ 580,"Northern Mariana Islands"},
{ 581,"United States Minor Outlying Islands"},
{ 583,"Micronesia, Federated States of"},
@@ -323,13 +338,13 @@ struct country_table {
{ 608,"Philippines"},
{ 612,"Pitcairn"},
{ 616,"Poland,Polska,PL","3s5cmT"},
- { 620,"Portugal"},
+ { 620,"Portugal","345cm8"},
{ 624,"Guinea-Bissau"},
{ 626,"Timor-Leste"},
{ 630,"Puerto Rico"},
{ 634,"Qatar"},
{ 638,"Réunion"},
- { 642,"România,Romania,RO"},
+ { 642,"România,Romania,RO","sc5m78"},
{ 643,"Россия,Российская Федерация,Russia,Russian Federation","3s5c7m"},
{ 646,"Rwanda"},
{ 652,"Saint Barthélemy"},
@@ -344,13 +359,13 @@ struct country_table {
{ 678,"Sao Tome and Principe"},
{ 682,"Saudi Arabia"},
{ 686,"Senegal"},
- { 688,"Srbija,Србија,Serbia"},
+ { 688,"Srbija,Србија,Serbia","3scm78"},
{ 690,"Seychelles"},
{ 694,"Sierra Leone"},
{ 702,"Singapore"},
- { 703,"Slovakia,Slovensko,SK"},
+ { 703,"Slovakia,Slovensko,SK","3c567m"},
{ 704,"Viet Nam"},
- { 705,"Slovenia,Republika Slovenija,SI"},
+ { 705,"Slovenia,Republika Slovenija,SI","34s6cm"},
{ 706,"Somalia"},
{ 710,"South Africa"},
{ 716,"Zimbabwe"},
@@ -361,7 +376,7 @@ struct country_table {
{ 740,"Suriname"},
{ 744,"Svalbard and Jan Mayen"},
{ 748,"Swaziland"},
- { 752,"Sweden,Sverige,Konungariket Sverige,SE"},
+ { 752,"Sweden,Sverige,Konungariket Sverige,SE","3c56m8"},
{ 756,"Switzerland,Schweiz","3s5c7M"},
{ 760,"Syrian Arab Republic"},
{ 762,"Tajikistan"},
@@ -372,7 +387,7 @@ struct country_table {
{ 780,"Trinidad and Tobago"},
{ 784,"United Arab Emirates"},
{ 788,"Tunisia"},
- { 792,"Turkey"},
+ { 792,"Turkey","sc5m78"},
{ 795,"Turkmenistan"},
{ 796,"Turks and Caicos Islands"},
{ 798,"Tuvalu"},
diff --git a/navit/navit.c b/navit/navit.c
index ae39aca59..63ed65807 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -2450,6 +2450,9 @@ void navit_set_center_cursor(struct navit *this_, int autozoom, int keep_orienta
struct point pn;
struct navit_vehicle *nv=this_->vehicle;
struct attr attr;
+ if (!nv || !nv->vehicle) {
+ return;
+ }
if (vehicle_get_attr(nv->vehicle, attr_position_valid, &attr, NULL) && (attr.u.num == attr_position_valid_invalid))
return;
navit_get_cursor_pnt(this_, &pn, keep_orientation, &dir);
diff --git a/navit/navit_layout_bike_shipped.xml b/navit/navit_layout_bike_shipped.xml
index dd5a9943a..ae30093dd 100644
--- a/navit/navit_layout_bike_shipped.xml
+++ b/navit/navit_layout_bike_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Bike" color="#ffefb7" font="Liberation Sans">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Bike" color="#ffefb7" icon_w="22" icon_h="22" font="Liberation Sans">
<cursor w="26" h="26">
<itemgra>
<circle color="#0000ff" radius="24" width="2">
diff --git a/navit/navit_layout_car_android_shipped.xml b/navit/navit_layout_car_android_shipped.xml
index 046d52d37..256ab3db2 100644
--- a/navit/navit_layout_car_android_shipped.xml
+++ b/navit/navit_layout_car_android_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-Android" color="#fef9ee" font="Liberation Sans">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-Android" color="#fef9ee" icon_w="22" icon_h="22" font="Liberation Sans">
<cursor w="57" h="57">
<itemgra speed_range="-2">
<polyline color="#00BC00" radius="0" width="4">
diff --git a/navit/navit_layout_car_dark_shipped.xml b/navit/navit_layout_car_dark_shipped.xml
index b24978a57..61407837c 100644
--- a/navit/navit_layout_car_dark_shipped.xml
+++ b/navit/navit_layout_car_dark_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-dark" daylayout="Car" color="#011001">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-dark" daylayout="Car" icon_w="22" icon_h="22" color="#011001">
<cursor w="57" h="57">
<itemgra speed_range="-2">
<polyline color="#0000BC" radius="0" width="4">
diff --git a/navit/navit_layout_car_shipped.xml b/navit/navit_layout_car_shipped.xml
index e772ab9f4..11f471370 100644
--- a/navit/navit_layout_car_shipped.xml
+++ b/navit/navit_layout_car_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car" nightlayout="Car-dark" color="#ffefb7" font="Liberation Sans">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car" nightlayout="Car-dark" color="#ffefb7" icon_w="22" icon_h="22" underground_alpha="0x77" font="Liberation Sans">
<cursor w="57" h="57">
<itemgra speed_range="-2">
<polyline color="#00BC00" radius="0" width="4">
@@ -70,10 +70,6 @@
<itemgra item_types="image" order="0-">
<image/>
</itemgra>
- <itemgra item_types="poly_nature_reserve" order="10-">
- <polygon color="#cedec6"/>
- <text text_size="5"/>
- </itemgra>
<itemgra item_types="poly_glacier" order="10-">
<polygon color="#ddecec"/>
<text text_size="5"/>
@@ -86,14 +82,6 @@
<polygon color="#6a9993"/>
<text text_size="5"/>
</itemgra>
- <itemgra item_types="poly_airfield" order="10-">
- <polygon color="#ecd3cf"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_university" order="8-">
- <polygon color="#d68fb8"/>
- <polyline color="#881155"/>
- </itemgra>
<itemgra item_types="poly_college" order="10-">
<polygon color="#f4f4f4"/>
<text text_size="5"/>
@@ -102,18 +90,6 @@
<polygon color="#01a36c"/>
<text text_size="5"/>
</itemgra>
- <itemgra item_types="poly_theme_park" order="10-">
- <polygon color="#01a36c"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_water_park" order="10-">
- <polygon color="#8cc1c8"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_zoo" order="10-">
- <polygon color="#ccbda5"/>
- <text text_size="5"/>
- </itemgra>
<itemgra item_types="poly_depot" order="10-">
<polygon color="#c2b098"/>
<text text_size="5"/>
@@ -259,8 +235,8 @@
<text text_size="5"/>
</itemgra>
<itemgra item_types="poly_farm" order="0-">
- <polygon color="#c7f1a3"/>
- <polyline color="#79c691"/>
+ <polygon color="#eef0d5"/>
+ <polyline color="#c7c9ae"/>
<text text_size="5"/>
</itemgra>
<itemgra item_types="poly_meadow" order="0-">
@@ -275,7 +251,7 @@
<polyline color="#ffefb7"/>
<text text_size="5"/>
</itemgra>
- <itemgra item_types="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="9-">
+ <itemgra item_types="poly_flats,poly_scrub,poly_marine,plantation,tundra" order="9-">
<polygon color="#a0a0a0"/>
<text text_size="5"/>
</itemgra>
@@ -336,9 +312,6 @@
<polyline color="#dddddd" width="34"/>
<polygon color="#dddddd"/>
</itemgra>
- <itemgra item_types="poly_airport" order="0-">
- <polygon color="#a0a0a0"/>
- </itemgra>
<itemgra item_types="poly_sport,poly_sports_pitch" order="0-">
<polygon color="#4af04f"/>
</itemgra>
@@ -466,10 +439,6 @@
<polygon color="#b6554e"/>
<text text_size="5"/>
</itemgra>
- <itemgra item_types="poly_barracks" order="10-">
- <polygon color="#b6a6a6"/>
- <text text_size="5"/>
- </itemgra>
<itemgra item_types="poly_garages" order="10-">
<polygon color="#deddcc"/>
<text text_size="5"/>
@@ -490,6 +459,41 @@
<itemgra item_types="border_state" order="0-">
<polyline color="#808080" width="1"/>
</itemgra>
+ <itemgra item_types="poly_university" order="8-">
+ <polygon color="#d68fb888"/>
+ <polyline color="#88115588"/>
+ </itemgra>
+ <itemgra item_types="poly_barracks" order="10-">
+ <polygon color="#b6a6a6aa"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_zoo" order="10-">
+ <polyline color="#ccbda599" width="10"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_nature_reserve" order="10-">
+ <polyline color="#cedec666" width="10"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_theme_park" order="10-">
+ <polyline color="#01a36c99" width="10"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_water_park" order="10-">
+ <polyline color="#8cc1c899" width="10"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_military_zone" order="9-">
+ <polygon color="#a0a0a044"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_airport" order="0-">
+ <polygon color="#a0a0a066"/>
+ </itemgra>
+ <itemgra item_types="poly_airfield" order="10-">
+ <polygon color="#ecd3cf66"/>
+ <text text_size="5"/>
+ </itemgra>
</layer>
<layer name="heightlines">
<itemgra item_types="height_line_1" order="7">
@@ -787,22 +791,27 @@
<itemgra item_types="street_pedestrian,living_street" order="14">
<polyline color="#d2d2d2" width="13"/>
<polyline color="#dddddd" width="9"/>
+ <arrows color="#0000FF" width="7" oneway="1"/>
</itemgra>
<itemgra item_types="street_pedestrian,living_street" order="15">
<polyline color="#d2d2d2" width="18"/>
<polyline color="#dddddd" width="14"/>
+ <arrows color="#0000FF" width="12" oneway="1"/>
</itemgra>
<itemgra item_types="street_pedestrian,living_street" order="16">
<polyline color="#d2d2d2" width="21"/>
<polyline color="#dddddd" width="17"/>
+ <arrows color="#0000FF" width="15" oneway="1"/>
</itemgra>
<itemgra item_types="street_pedestrian,living_street" order="17">
<polyline color="#d2d2d2" width="25"/>
<polyline color="#dddddd" width="21"/>
+ <arrows color="#0000FF" width="19" oneway="1"/>
</itemgra>
<itemgra item_types="street_pedestrian,living_street" order="18">
<polyline color="#d2d2d2" width="40"/>
<polyline color="#dddddd" width="34"/>
+ <arrows color="#0000FF" width="32" oneway="1"/>
</itemgra>
<itemgra item_types="street_service" order="10">
<polyline color="#d2d2d2" width="4"/>
@@ -823,22 +832,27 @@
<itemgra item_types="street_service" order="14">
<polyline color="#d2d2d2" width="7"/>
<polyline color="#fefefe" width="5"/>
+ <arrows color="#0000FF" width="4" oneway="1"/>
</itemgra>
<itemgra item_types="street_service" order="15">
<polyline color="#d2d2d2" width="8"/>
<polyline color="#fefefe" width="6"/>
+ <arrows color="#0000FF" width="5" oneway="1"/>
</itemgra>
<itemgra item_types="street_service" order="16">
<polyline color="#d2d2d2" width="9"/>
<polyline color="#fefefe" width="7"/>
+ <arrows color="#0000FF" width="7" oneway="1"/>
</itemgra>
<itemgra item_types="street_service" order="17">
<polyline color="#d2d2d2" width="10"/>
<polyline color="#fefefe" width="8"/>
+ <arrows color="#0000FF" width="7" oneway="1"/>
</itemgra>
<itemgra item_types="street_service" order="18">
<polyline color="#d2d2d2" width="11"/>
<polyline color="#fefefe" width="9"/>
+ <arrows color="#0000FF" width="7" oneway="1"/>
</itemgra>
<itemgra item_types="street_parking_lane" order="12">
<polyline color="#d2d2d2" width="4"/>
@@ -855,18 +869,22 @@
<itemgra item_types="street_parking_lane" order="15">
<polyline color="#d2d2d2" width="6"/>
<polyline color="#fefefe" width="4"/>
+ <arrows color="#0000FF" width="4" oneway="1"/>
</itemgra>
<itemgra item_types="street_parking_lane" order="16">
<polyline color="#d2d2d2" width="7"/>
<polyline color="#fefefe" width="5"/>
+ <arrows color="#0000FF" width="4" oneway="1"/>
</itemgra>
<itemgra item_types="street_parking_lane" order="17">
<polyline color="#d2d2d2" width="8"/>
<polyline color="#fefefe" width="6"/>
+ <arrows color="#0000FF" width="4" oneway="1"/>
</itemgra>
<itemgra item_types="street_parking_lane" order="18">
<polyline color="#d2d2d2" width="9"/>
<polyline color="#fefefe" width="7"/>
+ <arrows color="#0000FF" width="5" oneway="1"/>
</itemgra>
<itemgra item_types="street_0,street_1_city,street_1_land" order="10">
<polyline color="#d2d2d2" width="4"/>
@@ -887,22 +905,27 @@
<itemgra item_types="street_0,street_1_city,street_1_land" order="14">
<polyline color="#d2d2d2" width="17"/>
<polyline color="#ffffff" width="13"/>
+ <arrows color="#0000FF" width="12" oneway="1"/>
</itemgra>
<itemgra item_types="street_0,street_1_city,street_1_land" order="15">
<polyline color="#d2d2d2" width="18"/>
<polyline color="#ffffff" width="14"/>
+ <arrows color="#0000FF" width="12" oneway="1"/>
</itemgra>
<itemgra item_types="street_0,street_1_city,street_1_land" order="16">
<polyline color="#d2d2d2" width="30"/>
<polyline color="#ffffff" width="26"/>
+ <arrows color="#0000FF" width="24" oneway="1"/>
</itemgra>
<itemgra item_types="street_0,street_1_city,street_1_land" order="17">
<polyline color="#d2d2d2" width="67"/>
<polyline color="#ffffff" width="61"/>
+ <arrows color="#0000FF" width="59" oneway="1"/>
</itemgra>
<itemgra item_types="street_0,street_1_city,street_1_land" order="18">
<polyline color="#d2d2d2" width="132"/>
<polyline color="#ffffff" width="126"/>
+ <arrows color="#0000FF" width="124" oneway="1"/>
</itemgra>
<itemgra item_types="street_2_city,street_2_land,ramp" order="7-8">
<polyline color="#c0c0c0" width="2"/>
@@ -930,22 +953,27 @@
<itemgra item_types="street_2_city,street_2_land,ramp" order="14">
<polyline color="#c0c0c0" width="14"/>
<polyline color="#ffff00" width="11"/>
+ <arrows color="#0000FF" width="9" oneway="1"/>
</itemgra>
<itemgra item_types="street_2_city,street_2_land,ramp" order="15">
<polyline color="#c0c0c0" width="19"/>
<polyline color="#ffff00" width="15"/>
+ <arrows color="#0000FF" width="13" oneway="1"/>
</itemgra>
<itemgra item_types="street_2_city,street_2_land,ramp" order="16">
<polyline color="#c0c0c0" width="30"/>
<polyline color="#ffff00" width="26"/>
+ <arrows color="#0000FF" width="24" oneway="1"/>
</itemgra>
<itemgra item_types="street_2_city,street_2_land,ramp" order="17">
<polyline color="#c0c0c0" width="63"/>
<polyline color="#ffff00" width="57"/>
+ <arrows color="#0000FF" width="55" oneway="1"/>
</itemgra>
<itemgra item_types="street_2_city,street_2_land,ramp" order="18">
<polyline color="#c0c0c0" width="100"/>
<polyline color="#ffff00" width="90"/>
+ <arrows color="#0000FF" width="88" oneway="1"/>
</itemgra>
<itemgra item_types="street_3_city,street_3_land,roundabout" order="7-8">
<polyline color="#a0a0a0" width="3"/>
@@ -974,22 +1002,27 @@
<itemgra item_types="street_3_city,street_3_land,roundabout" order="14">
<polyline color="#a0a0a0" width="21"/>
<polyline color="#ffff00" width="17"/>
+ <arrows color="#0000FF" width="15" oneway="1"/>
</itemgra>
<itemgra item_types="street_3_city,street_3_land,roundabout" order="15">
<polyline color="#a0a0a0" width="25"/>
<polyline color="#ffff00" width="21"/>
+ <arrows color="#0000FF" width="19" oneway="1"/>
</itemgra>
<itemgra item_types="street_3_city,street_3_land,roundabout" order="16">
<polyline color="#a0a0a0" width="40"/>
<polyline color="#ffff00" width="34"/>
+ <arrows color="#0000FF" width="32" oneway="1"/>
</itemgra>
<itemgra item_types="street_3_city,street_3_land,roundabout" order="17">
<polyline color="#a0a0a0" width="79"/>
<polyline color="#ffff00" width="73"/>
+ <arrows color="#0000FF" width="70" oneway="1"/>
</itemgra>
<itemgra item_types="street_3_city,street_3_land,roundabout" order="18">
<polyline color="#a0a0a0" width="156"/>
<polyline color="#ffff00" width="150"/>
+ <arrows color="#0000FF" width="148" oneway="1"/>
</itemgra>
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-6">
<polyline color="#404040" width="1"/>
@@ -1021,22 +1054,27 @@
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
<polyline color="#000000" width="21"/>
<polyline color="#ff0000" width="17"/>
+ <arrows color="#0000FF" width="15" oneway="1"/>
</itemgra>
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
<polyline color="#000000" width="24"/>
<polyline color="#ff0000" width="20"/>
+ <arrows color="#0000FF" width="18" oneway="1"/>
</itemgra>
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
<polyline color="#000000" width="39"/>
<polyline color="#ff0000" width="33"/>
+ <arrows color="#0000FF" width="30" oneway="1"/>
</itemgra>
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
<polyline color="#000000" width="78"/>
<polyline color="#ff0000" width="72"/>
+ <arrows color="#0000FF" width="70" oneway="1"/>
</itemgra>
<itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
<polyline color="#000000" width="156"/>
<polyline color="#ff0000" width="150"/>
+ <arrows color="#0000FF" width="148" oneway="1"/>
</itemgra>
<itemgra item_types="highway_city,highway_land" order="2">
<polyline color="#ff0000" width="1"/>
@@ -1093,11 +1131,13 @@
<polyline color="#ff0000" width="133"/>
<polyline color="#ffff00" width="127"/>
<polyline color="#ff0000" width="1"/>
+ <arrows color="#0000FF" width="125" oneway="1"/>
</itemgra>
<itemgra item_types="highway_city,highway_land" order="18">
<polyline color="#ff0000" width="264"/>
<polyline color="#ffff00" width="258"/>
<polyline color="#ff0000" width="1"/>
+ <arrows color="#0000FF" width="256" oneway="1"/>
</itemgra>
<itemgra item_types="tracking_0" order="0-">
<polyline color="#000000" width="3"/>
diff --git a/navit/navit_layout_car_simple_shipped.xml b/navit/navit_layout_car_simple_shipped.xml
index 4029833f5..82d730a6e 100644
--- a/navit/navit_layout_car_simple_shipped.xml
+++ b/navit/navit_layout_car_simple_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-simple" color="#839ea9">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="Car-simple" icon_w="22" icon_h="22" color="#839ea9">
<layer name="polygon">
<itemgra item_types="poly_town" order="8-">
<polygon color="#6b8091"/>
diff --git a/navit/navit_layout_th_shipped.xml b/navit/navit_layout_th_shipped.xml
index aebc79d6e..bf4ad6731 100644
--- a/navit/navit_layout_th_shipped.xml
+++ b/navit/navit_layout_th_shipped.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="T@H" font="Liberation Sans">
+<layout xmlns:xi="http://www.w3.org/2001/XInclude" name="T@H" icon_w="22" icon_h="22" font="Liberation Sans">
<cursor w="26" h="26">
<itemgra>
<circle color="#0000ff" radius="24" width="2">
diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c
index fb0574166..a2aa24bfd 100644
--- a/navit/speech/android/speech_android.c
+++ b/navit/speech/android/speech_android.c
@@ -94,8 +94,6 @@ static struct speech_priv *speech_android_new(struct speech_methods *meth, struc
struct attr *flags;
*meth=speech_android_meth;
this=g_new0(struct speech_priv,1);
- if (android_version < 4)
- this->flags=3;
if (!speech_android_init(this)) {
dbg(lvl_error,"Failed to init speech %p",this->NavitSpeechClass);
g_free(this);
diff --git a/navit/support/glib/fake.h b/navit/support/glib/fake.h
index ba9b17750..ae9f0c88f 100644
--- a/navit/support/glib/fake.h
+++ b/navit/support/glib/fake.h
@@ -6,6 +6,7 @@
#include <pthread.h>
#endif
#include "debug.h"
+#include "gtypes.h"
#define g_return_if_fail
@@ -20,6 +21,11 @@
# define g_private_new(xd) g_private_new_navit()
# define g_private_get(xd) pthread_getspecific(xd)
# define g_private_set(a,b) pthread_setspecific(a, b)
+
+pthread_mutex_t* g_mutex_new_navit(void);
+void g_get_current_time (GTimeVal *result);
+GPrivate g_private_new_navit ();
+
#else
# if HAVE_API_WIN32_BASE
# define GMutex CRITICAL_SECTION
diff --git a/navit/support/glib/glibconfig.h b/navit/support/glib/glibconfig.h
index 6baa58873..bb3e68cb3 100644
--- a/navit/support/glib/glibconfig.h
+++ b/navit/support/glib/glibconfig.h
@@ -69,7 +69,7 @@ typedef unsigned __int64 guint64;
#define G_GINT64_FORMAT "I64i"
#define G_GUINT64_FORMAT "I64u"
-#if defined(_WIN64) || defined(_M_X64) || defined(_M_AMD64)
+#if defined(_WIN64) || defined(_M_X64) || defined(_M_AMD64) || defined(__LP64__)
#define GLIB_SIZEOF_VOID_P 8
#define GLIB_SIZEOF_LONG 4
@@ -107,7 +107,7 @@ typedef gint64 goffset;
#define G_MINOFFSET G_MININT64
#define G_MAXOFFSET G_MAXINT64
-#ifndef _WIN64
+#if !defined(_WIN64) && !defined(__LP64__)
#define GPOINTER_TO_INT(p) ((gint) (p))
#define GPOINTER_TO_UINT(p) ((guint) (p))
diff --git a/navit/support/glib/gslice.c b/navit/support/glib/gslice.c
index 29165bc5a..82394c8b2 100644
--- a/navit/support/glib/gslice.c
+++ b/navit/support/glib/gslice.c
@@ -34,6 +34,7 @@
#include "gthreadprivate.h"
#include "glib.h"
#include "galias.h"
+#include "fake.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* sysconf() */
#endif
@@ -1265,17 +1266,17 @@ smc_notify_free (void *pointer,
found_one = smc_tree_lookup (adress, &real_size);
if (!found_one)
{
- fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
+// fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
return 0;
}
if (real_size != size && (real_size || size))
{
- fprintf (stderr, "GSlice: MemChecker: attempt to release block with invalid size: %p size=%" G_GSIZE_FORMAT " invalid-size=%" G_GSIZE_FORMAT "\n", pointer, real_size, size);
+// fprintf (stderr, "GSlice: MemChecker: attempt to release block with invalid size: %p size=%" G_GSIZE_FORMAT " invalid-size=%" G_GSIZE_FORMAT "\n", pointer, real_size, size);
return 0;
}
if (!smc_tree_remove (adress))
{
- fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
+// fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
return 0;
}
return 1; /* all fine */
diff --git a/navit/traffic/traff_android/traffic_traff_android.c b/navit/traffic/traff_android/traffic_traff_android.c
index 91d408777..1612b3a5f 100644
--- a/navit/traffic/traff_android/traffic_traff_android.c
+++ b/navit/traffic/traff_android/traffic_traff_android.c
@@ -117,13 +117,13 @@ static int traffic_traff_android_init(struct traffic_priv * this_) {
if (!android_find_class_global("org/navitproject/navit/NavitTraff", &this_->NavitTraffClass))
return 0;
- cid = (*jnienv)->GetMethodID(jnienv, this_->NavitTraffClass, "<init>", "(Landroid/content/Context;I)V");
+ cid = (*jnienv)->GetMethodID(jnienv, this_->NavitTraffClass, "<init>", "(Landroid/content/Context;J)V");
if (cid == NULL) {
dbg(lvl_error,"no method found");
return 0; /* exception thrown */
}
- this_->NavitTraff=(*jnienv)->NewObject(jnienv, this_->NavitTraffClass, cid, android_application,
- (int) this_->cbid);
+ this_->NavitTraff=(*jnienv)->NewObject(jnienv, this_->NavitTraffClass, cid, android_activity,
+ (jlong) this_->cbid);
dbg(lvl_debug,"result=%p", this_->NavitTraff);
if (!this_->NavitTraff)
return 0;
diff --git a/navit/util.c b/navit/util.c
index 944dc2a21..cf4412938 100644
--- a/navit/util.c
+++ b/navit/util.c
@@ -114,6 +114,129 @@ static void strtrim(char *s) {
}
/**
+ * @brief Escape special characters from a string
+ *
+ * @param mode The escape mode that needs to be enabled (see enum escape_mode)
+ * @param in The string to escape
+ *
+ * @return The escaped string
+ *
+ * @note In html escape mode (escape_mode_html), we will only process HTML escape sequence, and string quoting, but we won't escape backslashes or double quotes
+ * @warning The returned string has been allocated and g_free() must thus be called on this string
+ */
+char *str_escape(enum escape_mode mode, const char *in) {
+ int len=mode & escape_mode_string ? 2:0; /* Add 2 characters to the length of the buffer if quoting is enabled */
+ char *dst,*out;
+ const char *src=in;
+ static const char *quot="&quot;";
+ static const char *apos="&apos;";
+ static const char *amp="&amp;";
+ static const char *lt="&lt;";
+ static const char *gt="&gt;";
+
+ dbg(lvl_debug, "Will escape string=\"%s\", escape mode %d", in, mode);
+ while (*src) {
+ if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote)))
+ len++;
+ if (*src == '"' && mode == escape_mode_html_quote)
+ len+=strlen(quot);
+ else if (*src == '\'' && mode == escape_mode_html_apos)
+ len+=strlen(apos);
+ else if (*src == '&' && mode == escape_mode_html_amp)
+ len+=strlen(amp);
+ else if (*src == '<' && mode == escape_mode_html_lt)
+ len+=strlen(lt);
+ else if (*src == '>' && mode == escape_mode_html_gt)
+ len+=strlen(gt);
+ else
+ len++;
+ src++;
+ }
+ src=in;
+ out=dst=g_malloc(len+1); /* +1 character for NUL termination */
+
+ /* In string quoting mode (escape_mode_string), prepend the whole string with a double quote */
+ if (mode & escape_mode_string)
+ *dst++='"';
+
+ while (*src) {
+ if (mode & escape_mode_html) { /* In html escape mode, only process HTML escape sequence, not backslashes or quotes */
+ if (*src == '"' && (mode & escape_mode_html_quote)) {
+ strcpy(dst,quot);
+ src++;
+ dst+=strlen(quot);
+ } else if (*src == '\'' && (mode & escape_mode_html_apos)) {
+ strcpy(dst,apos);
+ src++;
+ dst+=strlen(apos);
+ } else if (*src == '&' && (mode & escape_mode_html_amp)) {
+ strcpy(dst,amp);
+ src++;
+ dst+=strlen(amp);
+ } else if (*src == '<' && (mode & escape_mode_html_lt)) {
+ strcpy(dst,lt);
+ src++;
+ dst+=strlen(lt);
+ } else if (*src == '>' && (mode & escape_mode_html_gt)) {
+ strcpy(dst,gt);
+ src++;
+ dst+=strlen(gt);
+ } else
+ *dst++=*src++;
+ } else {
+ if ((*src == '"' || *src == '\\') && (mode & (escape_mode_string | escape_mode_quote))) {
+ *dst++='\\';
+ }
+ *dst++=*src++;
+ }
+ }
+
+ /* In string quoting mode (escape_mode_string), append a double quote to the whole string */
+ if (mode & escape_mode_string)
+ *dst++='"';
+
+ *dst++='\0';
+ dbg(lvl_debug, "Result of escaped string=\"%s\"", out);
+ return out;
+}
+
+/**
+ * @brief Copy a string from @p src to @p dest, unescaping characters
+ *
+ * @note Escaped characters are "\\\\" (double backslash) resulting in '\\' (single backslash)
+ * and "\\\"" (backslash followed by double quote), resulting in '"' (double quote)
+ * but we will escape any other character, for example "\\ " will result in ' ' (space)
+ * This is the reverse of function str_escape, except that we assume (and only support) unescaping mode escape_mode_quote here
+ *
+ * @param[out] dest The location where to store the unescaped string
+ * @param[in] src The source string to copy (and to unescape)
+ * @param n The maximum amount of bytes copied into dest. Warning: If there is no null byte among the n bytes written to dest, the string placed in dest will not be null-terminated.
+ *
+ * @return A pointer to the destination string @p dest
+ */
+char *strncpy_unescape(char *dest, const char *src, size_t n) {
+ char *dest_ptr; /* A pointer to the currently parsed character inside string dest */
+
+ for (dest_ptr=dest; (dest_ptr-dest) < n && (*src != '\0'); src++, dest_ptr++) {
+ if (*src == '\\') {
+ src++;
+ }
+ *dest_ptr = *src;
+ if (*dest_ptr == '\0') {
+ /* This is only possible if we just parsed an escaped sequence '\\' followed by a NUL termination, which is not really sane, but we will silently accept this case */
+ return dest;
+ }
+ }
+ if ((dest_ptr-dest) < n)
+ *dest_ptr='\0'; /* Add a trailing '\0' if any room is remaining */
+ else {
+ // strncpy_unescape will return a non NUL-terminated string. Trouble ahead if this is not handled properly
+ }
+
+ return dest;
+}
+
+/**
* @brief Parser states for `parse_for_systematic_comparison()`.
*/
enum parse_state {
diff --git a/navit/util.h b/navit/util.h
index 685adc080..6da7808b4 100644
--- a/navit/util.h
+++ b/navit/util.h
@@ -26,10 +26,27 @@
#define MAX_MISMATCH 100
+/**
+ * @brief Escape modes for function str_escape()
+ */
+enum escape_mode {
+ escape_mode_none=0,
+ escape_mode_string=1, /*!< Surround string by double quotes */
+ escape_mode_quote=2, /*!< Escape double quotes and backslashes */
+ escape_mode_html_amp=4, /*!< Use HTML-style escape sequences for ampersands */
+ escape_mode_html_quote=8, /*!< Use HTML-style escape sequences for double quotes */
+ escape_mode_html_apos=16, /*!< Use HTML-style escape sequences for single quotes (apostrophes) */
+ escape_mode_html_lt=32, /*!< Use HTML-style escape sequences for lower than sign ('<') */
+ escape_mode_html_gt=64, /*!< Use HTML-style escape sequences for greater than sign ('>') */
+ escape_mode_html=escape_mode_html_amp|escape_mode_html_quote|escape_mode_html_apos|escape_mode_html_lt|escape_mode_html_gt, /*!< Use all known HTML-style escape sequences */
+};
+
void strtoupper(char *dest, const char *src);
void strtolower(char *dest, const char *src);
unsigned int uint_sqrt(unsigned int n);
int navit_utf8_strcasecmp(const char *s1, const char *s2);
+char *str_escape(enum escape_mode mode, const char *in);
+char *strncpy_unescape(char *dest, const char *src, size_t n);
int compare_name_systematic(const char *s1, const char *s2);
GList * g_hash_to_list(GHashTable *h);
GList * g_hash_to_list_keys(GHashTable *h);
diff --git a/navit/vehicle/android/vehicle_android.c b/navit/vehicle/android/vehicle_android.c
index f6173e1b3..4db8c875d 100644
--- a/navit/vehicle/android/vehicle_android.c
+++ b/navit/vehicle/android/vehicle_android.c
@@ -233,14 +233,13 @@ static int vehicle_android_init(struct vehicle_priv *ret) {
if (!android_find_class_global("org/navitproject/navit/NavitVehicle", &ret->NavitVehicleClass))
return 0;
dbg(lvl_debug,"at 3");
- cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;III)V");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;JJJ)V");
if (cid == NULL) {
dbg(lvl_error,"no method found");
return 0; /* exception thrown */
}
- dbg(lvl_debug, "at 4 android_application=%p", android_application);
- ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_application,
- (int) ret->pcb, (int) ret->scb, (int) ret->fcb);
+ ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity,
+ (jlong) ret->pcb, (jlong) ret->scb, (jlong) ret->fcb);
dbg(lvl_debug,"result=%p",ret->NavitVehicle);
if (!ret->NavitVehicle)
return 0;
diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c
index 807d4998d..1502b9860 100644
--- a/navit/vehicle/file/vehicle_file.c
+++ b/navit/vehicle/file/vehicle_file.c
@@ -684,6 +684,7 @@ static void vehicle_file_io(struct vehicle_priv *priv) {
case 0:
vehicle_file_close(priv);
vehicle_file_open(priv);
+ vehicle_file_enable_watch(priv);
break;
case 1:
vehicle_file_disable_watch(priv);
diff --git a/navit/xslt/android.xslt b/navit/xslt/android.xslt
index 3a1fdaf02..7a29ae4c8 100644
--- a/navit/xslt/android.xslt
+++ b/navit/xslt/android.xslt
@@ -34,6 +34,7 @@
<xsl:attribute name="icon_s"><xsl:value-of select="number($ICON_MEDIUM)"/></xsl:attribute>
<xsl:attribute name="icon_l"><xsl:value-of select="number($ICON_BIG)"/></xsl:attribute>
<xsl:attribute name="spacing"><xsl:value-of select="round(2*number($OSD_SIZE))"/></xsl:attribute>
+ <xsl:attribute name="keyboard">false</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
diff --git a/navit/xslt/sailfish_svg.xslt b/navit/xslt/sailfish_svg.xslt
index 7203ed34d..63d384a5a 100644
--- a/navit/xslt/sailfish_svg.xslt
+++ b/navit/xslt/sailfish_svg.xslt
@@ -12,6 +12,17 @@
</xsl:copy>
</xsl:template>
+ <!-- Force default cursor size of all layouts, force tunnel transparency -->
+ <xsl:template match="/layout">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ <xsl:attribute name="icon_w">16</xsl:attribute>
+ <xsl:attribute name="icon_h">16</xsl:attribute>
+ <xsl:attribute name="underground_alpha">0x33</xsl:attribute>
+ <xsl:apply-templates select="node()"/>
+ </xsl:copy>
+ </xsl:template>
+
<!-- Force all png icons to svg and add w and h if not exist -->
<xsl:template match="icon">
<xsl:copy>
@@ -21,12 +32,6 @@
<xsl:value-of select="concat(substring(@src,1, string-length(@src)-3),'svg')"/>
</xsl:attribute>
</xsl:if>
- <xsl:if test="not(@h)">
- <xsl:attribute name="h">15</xsl:attribute>
- </xsl:if>
- <xsl:if test="not(@w)">
- <xsl:attribute name="w">15</xsl:attribute>
- </xsl:if>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>