diff options
| author | Pierre Grandin <grandinp@altern.org> | 2016-12-20 14:31:32 -0800 |
|---|---|---|
| committer | Pierre Grandin <grandinp@altern.org> | 2016-12-20 14:31:32 -0800 |
| commit | 9d163c7d7dcb67aa77f0acd5ff6b79a69ef87138 (patch) | |
| tree | 2b7e70f8e98154caacdbcf92cc670041427157d3 /navit | |
| parent | 8256261645d7267690022778fef42b9e4908333e (diff) | |
| parent | b8ec86052d0147d812e206f6eb62badb32ea4537 (diff) | |
| download | navit-qt5.tar.gz | |
Update:branch:Updating qt5 branch with trunkqt5
Diffstat (limited to 'navit')
73 files changed, 455 insertions, 239 deletions
diff --git a/navit/Makefile.am b/navit/Makefile.am index 7115a6c6e..16cb81d58 100644 --- a/navit/Makefile.am +++ b/navit/Makefile.am @@ -213,6 +213,7 @@ if SOURCE_MODE_SVN else echo "#define SVN_VERSION \"@SOURCE_MODE@\"" >>version.h.tmp endif + echo "#define GIT_VERSION \"$(shell git describe --abbrev=8 --dirty --always --tags)\"" >>version.h.tmp echo "#define NAVIT_VARIANT \"@NAVIT_VARIANT@\"" >>version.h.tmp if ! diff version.h.tmp version.h >/dev/null 2>/dev/null; \ then \ diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java index a0c61bd72..c8578df07 100644 --- a/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/android/src/org/navitproject/navit/Navit.java @@ -301,7 +301,8 @@ public class Navit extends Activity NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
Notification NavitNotification = new Notification(R.drawable.ic_notify, getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
- NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
+// FIXME : needs a fix for sdk 23
+// NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT; // Ensure that the notification appears in Ongoing
nm.notify(R.string.app_name, NavitNotification); // Set the notification
diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java index 031331f68..a41ab52be 100644 --- a/navit/android/src/org/navitproject/navit/NavitGraphics.java +++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java @@ -369,7 +369,7 @@ public class NavitGraphics { float x = a.x - b.x; float y = a.y - b.y; - return FloatMath.sqrt(x * x + y * y); + return (float)Math.sqrt(x * x + y * y); } private PointF getFloatValue(Object instance, Object argument) diff --git a/navit/event.c b/navit/event.c index 96d2e0dd8..667e5bdc3 100644 --- a/navit/event.c +++ b/navit/event.c @@ -129,7 +129,7 @@ event_request_system(const char *system, const char *requestor) } return 1; } - event_type_new=plugin_get_event_type(system); + event_type_new=plugin_get_category_event(system); if (! event_type_new) { dbg(lvl_error,"unsupported event system '%s' requested from '%s'\n", system, requestor); return 0; diff --git a/navit/event_glib.c b/navit/event_glib.c index 9ffb12cbc..e9bad6c40 100644 --- a/navit/event_glib.c +++ b/navit/event_glib.c @@ -196,5 +196,5 @@ event_glib_new(struct event_methods *meth) void event_glib_init(void) { - plugin_register_event_type("glib", event_glib_new); + plugin_register_category_event("glib", event_glib_new); } diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index f41eff314..0508c5870 100644 --- a/navit/font/freetype/font_freetype.c +++ b/navit/font/freetype/font_freetype.c @@ -658,7 +658,7 @@ font_freetype_new(void *meth) void plugin_init(void) { - plugin_register_font_type("freetype", font_freetype_new); + plugin_register_category_font("freetype", font_freetype_new); #ifdef HAVE_FONTCONFIG FcInit(); #endif diff --git a/navit/graphics.c b/navit/graphics.c index 1813a8c36..7680d96ce 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -274,7 +274,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) return NULL; } - graphicstype_new=plugin_get_graphics_type(type_attr->u.str); + graphicstype_new=plugin_get_category_graphics(type_attr->u.str); if (! graphicstype_new) { dbg(lvl_error,"Failed to load graphics plugin %s.\n", type_attr->u.str); return NULL; diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index 41f441c96..0d6aa30d2 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -1198,6 +1198,6 @@ void plugin_init(void) { dbg(lvl_debug,"enter\n"); - plugin_register_graphics_type("android", graphics_android_new); - plugin_register_event_type("android", event_android_new); + plugin_register_category_graphics("android", graphics_android_new); + plugin_register_category_event("android", event_android_new); } diff --git a/navit/graphics/gd/graphics_gd.c b/navit/graphics/gd/graphics_gd.c index 908007a0e..3ef6c520b 100644 --- a/navit/graphics/gd/graphics_gd.c +++ b/navit/graphics/gd/graphics_gd.c @@ -826,7 +826,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin dbg(lvl_debug,"enter\n"); ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; font_freetype_new(&ret->freetype_methods); @@ -855,7 +855,7 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** struct font_priv * (*font_freetype_new)(void *meth); struct graphics_priv *ret; event_request_system("glib","graphics_gd_new"); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; *meth=graphics_methods; @@ -881,5 +881,5 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** void plugin_init(void) { - plugin_register_graphics_type("gd", graphics_gd_new); + plugin_register_category_graphics("gd", graphics_gd_new); } diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index 9d6dd998b..387003c40 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -1081,7 +1081,7 @@ static struct graphics_priv * graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { struct font_priv * (*font_freetype_new)(void *meth); - font_freetype_new=plugin_get_font_type("freetype"); + font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) return NULL; struct graphics_priv *this=g_new0(struct graphics_priv,1); @@ -1150,5 +1150,5 @@ plugin_init(void) #ifdef HAVE_API_WIN32 setlocale(LC_NUMERIC, "C"); /* WIN32 gtk resets LC_NUMERIC */ #endif - plugin_register_graphics_type("gtk_drawing_area", graphics_gtk_drawing_area_new); + plugin_register_category_graphics("gtk_drawing_area", graphics_gtk_drawing_area_new); } diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index ce4dc6de2..ecac7d528 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -354,6 +354,6 @@ event_null_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("null", graphics_null_new); - plugin_register_event_type("null", event_null_new); + plugin_register_category_graphics("null", graphics_null_new); + plugin_register_category_event("null", event_null_new); } diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index da82cd107..98230f0dc 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -1440,7 +1440,7 @@ static struct graphics_priv * graphics_opengl_new_helper(struct graphics_methods *meth) { struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { return NULL; @@ -1817,6 +1817,6 @@ event_opengl_new(struct event_methods *meth) void plugin_init(void) { - plugin_register_graphics_type("opengl", graphics_opengl_new); - plugin_register_event_type("opengl", event_opengl_new); + plugin_register_category_graphics("opengl", graphics_opengl_new); + plugin_register_category_event("opengl", event_opengl_new); } diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp index 1cdb92796..c4411252b 100644 --- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp +++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp @@ -859,7 +859,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct return NULL; #endif #ifdef QT_QPAINTER_USE_FREETYPE - font_freetype_new=(struct font_priv *(*)(void *))plugin_get_font_type("freetype"); + font_freetype_new=(struct font_priv *(*)(void *))plugin_get_category_font("freetype"); if (!font_freetype_new) { dbg(lvl_error,"no freetype\n"); return NULL; @@ -926,9 +926,9 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct //############################################################################################################## void plugin_init(void) { - plugin_register_graphics_type("qt_qpainter", graphics_qt_qpainter_new); + plugin_register_category_graphics("qt_qpainter", graphics_qt_qpainter_new); #ifdef QT_QPAINTER_USE_EVENT_QT - plugin_register_event_type("qt", event_qt_new); + plugin_register_category_event("qt", event_qt_new); #endif } diff --git a/navit/graphics/sdl/event.c b/navit/graphics/sdl/event.c index cd4b81802..f96b079b3 100644 --- a/navit/graphics/sdl/event.c +++ b/navit/graphics/sdl/event.c @@ -377,5 +377,5 @@ event_sdl_new(struct event_methods* methods) { /* ---------- SDL Eventhandling ---------- */ void sdl_event_init(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c index d640d5edb..28fe4fafb 100644 --- a/navit/graphics/sdl/event_sdl.c +++ b/navit/graphics/sdl/event_sdl.c @@ -339,5 +339,5 @@ event_sdl_new(struct event_methods* methods) void event_sdl_register(void) { - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index b0cc66776..b1a9c17b9 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -986,7 +986,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin struct font_priv *(*font_freetype_new) (void *meth); - font_freetype_new = plugin_get_font_type ("freetype"); + font_freetype_new = plugin_get_category_font ("freetype"); if (!font_freetype_new) { @@ -1407,7 +1407,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr * this->cbl = cbl; /* initialize fonts */ - font_freetype_new = plugin_get_font_type("freetype"); + font_freetype_new = plugin_get_category_font("freetype"); if (!font_freetype_new) { g_free(this); @@ -1852,9 +1852,9 @@ void plugin_init(void) { #ifdef USE_WEBOS - plugin_register_event_type("sdl", event_sdl_new); + plugin_register_category_event("sdl", event_sdl_new); #endif - plugin_register_graphics_type("sdl", graphics_sdl_new); + plugin_register_category_graphics("sdl", graphics_sdl_new); } // vim: sw=4 ts=8 diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 609e61ce8..3d8fa351d 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -1845,6 +1845,6 @@ static struct event_priv * void plugin_init(void) { - plugin_register_graphics_type("win32", graphics_win32_new); - plugin_register_event_type("win32", event_win32_new); + plugin_register_category_graphics("win32", graphics_win32_new); + plugin_register_category_event("win32", event_win32_new); } diff --git a/navit/gui.c b/navit/gui.c index ab16d8a9e..9b2ba4971 100644 --- a/navit/gui.c +++ b/navit/gui.c @@ -45,7 +45,7 @@ gui_new(struct attr *parent, struct attr **attrs) return NULL; } - guitype_new=plugin_get_gui_type(type_attr->u.str); + guitype_new=plugin_get_category_gui(type_attr->u.str); if (! guitype_new) return NULL; diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c index 71bd26315..1741a54a0 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -808,5 +808,5 @@ plugin_init(void) #endif - plugin_register_gui_type("gtk", gui_gtk_new); + plugin_register_category_gui("gtk", gui_gtk_new); } diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index cf7db42a7..fd450b57c 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -3118,12 +3118,14 @@ static struct gui_internal_widget_methods gui_internal_widget_methods = { gui_internal_set_default_background, }; - -/* - * @brief Displays Route information +/** + * @brief finds the intersection point of 2 lines + * + * @param coord a1, a2, b1, b2 : coords of the start and + * end of the first and the second line + * @param coord res, will become the coords of the intersection if found + * @return : TRUE if intersection found, otherwise FALSE */ -/* FIXME where is the implementation? */ - int line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct coord *b2, struct coord *res) { @@ -3141,18 +3143,19 @@ line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct b = -b; } if (a < 0 || b < 0) - return 0; + return FALSE; if (a > n || b > n) - return 0; + return FALSE; if (n == 0) { dbg(lvl_info,"a=%d b=%d n=%d\n", a, b, n); dbg(lvl_info,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady); dbg(lvl_info,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy); - dbg_assert(n != 0); + dbg(lvl_info,"No intersection found, lines assumed parallel ?\n"); + return FALSE; } res->x = a1->x + a * adx / n; res->y = a1->y + a * ady / n; - return 1; + return TRUE; } struct heightline * @@ -3182,18 +3185,6 @@ item_get_heightline(struct item *item) return ret; } - -/* - * @brief Displays Route Height Profile - * - * @li The name of the active vehicle - * @param wm The button that was pressed. - * @param v Unused - */ -/* FIXME where is the implementation? */ - - - /** * @brief Called when the route is updated. */ @@ -3461,5 +3452,5 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods //############################################################################################################## void plugin_init(void) { - plugin_register_gui_type("internal", gui_internal_new); + plugin_register_category_gui("internal", gui_internal_new); } diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 12de558fb..d26bd677d 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -446,13 +446,21 @@ gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct a navit_attr_iter_destroy(iter); gui_internal_menu_render(this); } + +/* + * @brief Displays Route Height Profile + * + * displays a heightprofile if a route is active and + * some heightinfo is provided by means of a map + * + * the name of the file providing the heightlines must + * comply with *.heightlines.bin + * + */ static void gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) { - - struct widget * menu, *box; - struct map * map=NULL; struct map_rect * mr=NULL; struct route * route; @@ -460,17 +468,18 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st struct mapset *ms; struct mapset_handle *msh; int x,i,first=1,dist=0; + int diagram_points_count = 0; struct coord c,last,res; struct coord_rect rbbox,dbbox; struct map_selection sel; struct heightline *heightline,*heightlines=NULL; struct diagram_point *min,*diagram_point,*diagram_points=NULL; + struct point p[2]; sel.next=NULL; sel.order=18; sel.range.min=type_height_line_1; sel.range.max=type_height_line_3; - menu=gui_internal_menu(this,_("Height Profile")); box = gui_internal_box_new(this, gravity_left_top| orientation_vertical | flags_fill | flags_expand); gui_internal_widget_append(menu, box); @@ -491,11 +500,24 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st } } map_rect_destroy(mr); + mr = NULL; ms=navit_get_mapset(this->nav); if (!first && ms) { + int heightmap_installed = FALSE; msh=mapset_open(ms); while ((map=mapset_next(msh, 1))) { - mr=map_rect_new(map, &sel); + struct attr name_attr; + if (map_get_attr(map, attr_name, &name_attr, NULL)){ + dbg(lvl_debug,"map name = %s\n",name_attr.u.str); + if (strstr(name_attr.u.str,".heightlines.bin")){ + dbg(lvl_info,"reading heightlines from map %s\n",name_attr.u.str); + mr=map_rect_new(map, &sel); + heightmap_installed = TRUE; + } + else { + dbg(lvl_debug,"ignoring map %s\n",name_attr.u.str); + } + } if (mr) { while((item = map_rect_get_item(mr))) { if (item->type >= sel.range.min && item->type <= sel.range.max) { @@ -507,9 +529,20 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st } } map_rect_destroy(mr); + mr = NULL; } } mapset_close(msh); + if (!heightmap_installed){ + char *text; + struct widget *w; + text=g_strdup_printf("%s",_("please install a map *.heightlines.bin to provide elevationdata")); + gui_internal_widget_append(box, w=gui_internal_label_new(this, text)); + w->flags=gravity_bottom_center|orientation_horizontal|flags_fill; + g_free(text); + gui_internal_menu_render(this); + return; + } } } map=NULL; @@ -539,7 +572,8 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st diagram_point->c.y=heightline->height; diagram_point->next=diagram_points; diagram_points=diagram_point; - dbg(lvl_info,"%d %d\n", diagram_point->c.x, diagram_point->c.y); + diagram_points_count ++; + dbg(lvl_debug,"%d %d\n", diagram_point->c.x, diagram_point->c.y); } } } @@ -550,18 +584,30 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st } last=c; } - } } - + while (heightlines){ + heightline=heightlines; + heightlines=heightlines->next; + g_free(heightline); + } if(mr) map_rect_destroy(mr); - gui_internal_menu_render(this); - - if(!diagram_points) + if(diagram_points_count < 2){ + char *text; + struct widget *w; + text=g_strdup_printf("%s",_("The route must cross at least 2 heightlines")); + gui_internal_widget_append(box, w=gui_internal_label_new(this, text)); + w->flags=gravity_bottom_center|orientation_horizontal|flags_fill; + g_free(text); + gui_internal_menu_render(this); + if(diagram_points) + g_free(diagram_points); return; + } + gui_internal_menu_render(this); first=1; diagram_point=diagram_points; while (diagram_point) { @@ -573,38 +619,42 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st coord_rect_extend(&dbbox, &diagram_point->c); diagram_point=diagram_point->next; } - dbg(lvl_info,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y); + dbg(lvl_debug,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y); if (dbbox.rl.x > dbbox.lu.x && dbbox.lu.x*100/(dbbox.rl.x-dbbox.lu.x) <= 25) dbbox.lu.x=0; if (dbbox.lu.y > dbbox.rl.y && dbbox.rl.y*100/(dbbox.lu.y-dbbox.rl.y) <= 25) dbbox.rl.y=0; - dbg(lvl_info,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h); + dbg(lvl_debug,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h); x=dbbox.lu.x; first=1; - for (;;) { - struct point p[2]; - min=NULL; - diagram_point=diagram_points; - while (diagram_point) { - if (diagram_point->c.x >= x && (!min || min->c.x > diagram_point->c.x)) - min=diagram_point; - diagram_point=diagram_point->next; + if (diagram_points_count > 1 && dbbox.rl.x != dbbox.lu.x && dbbox.lu.y != dbbox.rl.y){ + for (;;) { + min=NULL; + diagram_point=diagram_points; + while (diagram_point) { + if (diagram_point->c.x >= x && (!min || min->c.x > diagram_point->c.x)) + min=diagram_point; + diagram_point=diagram_point->next; + } + if (! min) + break; + p[1].x=(min->c.x-dbbox.lu.x)*(box->w-10)/(dbbox.rl.x-dbbox.lu.x)+box->p.x+5; + p[1].y=(box->h)-5-(min->c.y-dbbox.rl.y)*(box->h-10)/(dbbox.lu.y-dbbox.rl.y)+box->p.y; + dbg(lvl_debug,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y); + graphics_draw_circle(this->gra, this->foreground, &p[1], 2); + if (first) + first=0; + else + graphics_draw_lines(this->gra, this->foreground, p, 2); + p[0]=p[1]; + x=min->c.x+1; } - if (! min) - break; - p[1].x=(min->c.x-dbbox.lu.x)*(box->w-10)/(dbbox.rl.x-dbbox.lu.x)+box->p.x+5; - p[1].y=(min->c.y-dbbox.rl.y)*(box->h-10)/(dbbox.lu.y-dbbox.rl.y)+box->p.y+5; - dbg(lvl_info,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y); - graphics_draw_circle(this->gra, this->foreground, &p[1], 2); - if (first) - first=0; - else - graphics_draw_lines(this->gra, this->foreground, p, 2); - p[0]=p[1]; - x=min->c.x+1; } - - + while (diagram_points){ + diagram_point=diagram_points; + diagram_points=diagram_points->next; + g_free(diagram_point); + } } static void @@ -1079,7 +1129,6 @@ error: return; } - static void gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid) { diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp index cee0574bd..7a1016473 100644 --- a/navit/gui/qml/gui_qml.cpp +++ b/navit/gui/qml/gui_qml.cpp @@ -473,5 +473,5 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth } void plugin_init(void) { - plugin_register_gui_type("qml",gui_qml_new); + plugin_register_category_gui("qml",gui_qml_new); } diff --git a/navit/gui/win32/gui_win32.c b/navit/gui/win32/gui_win32.c index bdbdb357d..8a8cb37b9 100644 --- a/navit/gui/win32/gui_win32.c +++ b/navit/gui/win32/gui_win32.c @@ -639,5 +639,5 @@ static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *me void plugin_init(void) { - plugin_register_gui_type("win32", win32_gui_new); + plugin_register_category_gui("win32", win32_gui_new); } diff --git a/navit/map.c b/navit/map.c index 51cda59be..2736da9f8 100644 --- a/navit/map.c +++ b/navit/map.c @@ -24,7 +24,7 @@ * This file contains the code that makes navit able to load maps. Because * navit is able to open maps in different formats, this code does not handle * any map format itself. This is done by map plugins which register to this - * code by calling plugin_register_map_type(). + * code by calling plugin_register_category_map(). * * When opening a new map, the map plugin will return a pointer to a map_priv * struct, which can be defined by the map plugin and contains whatever private @@ -99,7 +99,7 @@ map_new(struct attr *parent, struct attr **attrs) dbg(lvl_error,"missing type\n"); return NULL; } - maptype_new=plugin_get_map_type(type->u.str); + maptype_new=plugin_get_category_map(type->u.str); if (! maptype_new) { dbg(lvl_error,"invalid type '%s'\n", type->u.str); return NULL; diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c index 4ca4c6bf5..6b5108659 100644 --- a/navit/map/binfile/binfile.c +++ b/navit/map/binfile/binfile.c @@ -2848,6 +2848,6 @@ plugin_init(void) if (sizeof(struct zip_cd) != 46) { dbg(lvl_error,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd)); } - plugin_register_map_type("binfile", map_new_binfile); + plugin_register_category_map("binfile", map_new_binfile); } diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index ea36432d1..2726e8ab9 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> #include <math.h> +#include <errno.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -864,7 +865,8 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list fclose(fp); } else { - dbg(lvl_error,"Error opening csv map file %s, starting with empty map\n", m->filename); + dbg(lvl_error,"Error opening csv map file '%s': %s\n", m->filename, strerror(errno)); + return NULL; } } else { dbg(lvl_debug,"No data attribute, starting with in-memory map\n"); @@ -878,6 +880,6 @@ void plugin_init(void) { dbg(lvl_debug,"csv: plugin_init\n"); - plugin_register_map_type("csv", map_new_csv); + plugin_register_category_map("csv", map_new_csv); } diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c index 63817ecc7..cecae7fc0 100644 --- a/navit/map/filter/filter.c +++ b/navit/map/filter/filter.c @@ -430,6 +430,6 @@ void plugin_init(void) { dbg(lvl_debug,"filter: plugin_init\n"); - plugin_register_map_type("filter", map_filter_new); + plugin_register_category_map("filter", map_filter_new); } diff --git a/navit/map/garmin/garmin.c b/navit/map/garmin/garmin.c index 609bcab0e..d00cb9794 100644 --- a/navit/map/garmin/garmin.c +++ b/navit/map/garmin/garmin.c @@ -993,5 +993,5 @@ gmap_new(struct map_methods *meth, struct attr **attrs, struct callback_list *cb void plugin_init(void) { - plugin_register_map_type("garmin", gmap_new); + plugin_register_category_map("garmin", gmap_new); } diff --git a/navit/map/garmin_img/garmin_img.c b/navit/map/garmin_img/garmin_img.c index 58fe489da..f7dccf89c 100644 --- a/navit/map/garmin_img/garmin_img.c +++ b/navit/map/garmin_img/garmin_img.c @@ -1508,6 +1508,6 @@ map_new_garmin_img(struct map_methods *meth, struct attr **attrs) void plugin_init(void) { - plugin_register_map_type("garmin_img", map_new_garmin_img); + plugin_register_category_map("garmin_img", map_new_garmin_img); } diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c index 9b0805e2d..13561e154 100644 --- a/navit/map/mg/map.c +++ b/navit/map/mg/map.c @@ -609,5 +609,5 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list * void plugin_init(void) { - plugin_register_map_type("mg", map_new_mg); + plugin_register_category_map("mg", map_new_mg); } diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c index e67aaafee..e3eb4b723 100644 --- a/navit/map/shapefile/shapefile.c +++ b/navit/map/shapefile/shapefile.c @@ -682,7 +682,7 @@ void plugin_init(void) { dbg(lvl_debug,"shapefile: plugin_init\n"); - plugin_register_map_type("shapefile", map_new_shapefile); + plugin_register_category_map("shapefile", map_new_shapefile); } /************************************************************************/ diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c index d70f989f9..43be12368 100644 --- a/navit/map/textfile/textfile.c +++ b/navit/map/textfile/textfile.c @@ -394,6 +394,6 @@ void plugin_init(void) { dbg(lvl_debug,"textfile: plugin_init\n"); - plugin_register_map_type("textfile", map_new_textfile); + plugin_register_category_map("textfile", map_new_textfile); } diff --git a/navit/maptool/maptool.h b/navit/maptool/maptool.h index 7fde891dd..eca708591 100644 --- a/navit/maptool/maptool.h +++ b/navit/maptool/maptool.h @@ -115,11 +115,11 @@ struct item_bin_sink { void *priv_data[8]; GList *sink_funcs; }; - +#define NODE_ID_BITS 56 struct node_item { - unsigned int id; - char ref_way; struct coord c; + unsigned long long int nd_id:NODE_ID_BITS; + char ref_way; }; struct zip_info; @@ -131,7 +131,7 @@ struct country_table; * Must be at least 64 bit wide because IDs will soon exceed 32 bit. */ typedef unsigned long long int osmid; -#define OSMID_FMT LONGLONG_FMT +#define OSMID_FMT ULONGLONG_FMT /** Files needed for processing a relation. */ struct files_relation_processing { @@ -418,3 +418,6 @@ int zip_get_zipnum(struct zip_info *info); void zip_set_zipnum(struct zip_info *info, int num); void zip_close(struct zip_info *info); void zip_destroy(struct zip_info *info); + +/* Break compilation on 32 bit architectures, as we're going to cast osmid's to gpointer to use them as keys to GHashTable's */ +struct maptool_force_64 {char s[sizeof(gpointer)<sizeof(osmid)?-1:1];}; diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c index 131d7f0eb..f30b06365 100644 --- a/navit/maptool/osm.c +++ b/navit/maptool/osm.c @@ -120,10 +120,16 @@ char *attr_strings[attr_string_last]; char *osm_types[]={"unknown","node","way","relation"}; -#define REF_MARKER (1 << 30) -#define IS_REF(c) ((c).x == REF_MARKER) -#define GET_REF(c) ((unsigned)(c).y) -#define SET_REF(c,ref) do { (c).x = REF_MARKER; (c).y = ref ; } while(0) +/* + * These macros are designed to handle maptool internal node id reference representation. This representation does not leak + * to binfile, so it's safe to change it without breaking binfile binary compatibility. + * Currently it keeps low 31 bits in y coordinate and up to 30 high order bits in x coordinate, allowing for 61 bit osm node id in total. + */ +#define REF_MARKER (1ull << 30) +#define REF_MASK (3ull << 30) +#define IS_REF(c) (((c).x & REF_MASK)==REF_MARKER) +#define GET_REF(c) ((((osmid)(c).x & ~REF_MARKER)<<31) + (c).y ) +#define SET_REF(c,ref) do { (c).x = REF_MARKER | ((osmid)(ref)>>31); (c).y = (osmid)(ref) & 0x7fffffffull; } while(0) /* Table of country codes with possible is_in spellings. * Note: If you update this list, check also country array in country.c @@ -397,7 +403,6 @@ struct country_table { static char *attrmap={ "n *=* point_unkn\n" -// "n Annehmlichkeit=Hochsitz poi_hunting_stand\n" "? addr:housenumber=* house_number\n" "? aeroway=aerodrome poi_airport\n" "? aeroway=airport poi_airport\n" @@ -508,7 +513,7 @@ static char *attrmap={ "? shop=car_repair poi_repair_service\n" "? shop=clothes poi_shop_apparel\n" "? shop=convenience poi_shop_grocery\n" - "? shop=drogist poi_shop_drugstore\n" + "? shop=chemist poi_shop_drugstore\n" "? shop=florist poi_shop_florist\n" "? shop=fruit poi_shop_fruit\n" "? shop=furniture poi_shop_furniture\n" @@ -793,7 +798,7 @@ build_attrmap_line(char *line) kvl=NULL; if (!(idx=(int)(long)g_hash_table_lookup(attr_hash, kv))) { idx=attr_present_count++; - g_hash_table_insert(attr_hash, kv, (gpointer)(long)idx); + g_hash_table_insert(attr_hash, kv, (gpointer)(long long)idx); } attr_mapping=g_realloc(attr_mapping, sizeof(struct attr_mapping)+(attr_mapping_count+1)*sizeof(int)); attr_mapping->attr_present_idx[attr_mapping_count++]=idx; @@ -926,7 +931,7 @@ item_bin_get_nodeid(struct item_bin *ib) osmid item_bin_get_wayid(struct item_bin *ib) { - long long *ret=item_bin_get_attr(ib, attr_osm_wayid, NULL); + unsigned long long *ret=item_bin_get_attr(ib, attr_osm_wayid, NULL); if (ret) return *ret; return 0; @@ -1325,8 +1330,9 @@ node_buffer_to_hash(void) { int i,count=node_buffer.size/sizeof(struct node_item); struct node_item *ni=(struct node_item *)node_buffer.base; + for (i = 0 ; i < count ; i++) - g_hash_table_insert(node_hash, (gpointer)(long)(ni[i].id), (gpointer)(long)i); + g_hash_table_insert(node_hash, (gpointer)(long long)(ni[i].nd_id), (gpointer)(long long)i); } void @@ -1374,23 +1380,24 @@ osm_add_node(osmid id, double lat, double lon) osmid_attr_value=id; current_node=allocate_node_item_in_buffer(); - current_node->id=id; + dbg_assert(id < ((2ull<<NODE_ID_BITS)-1)); + current_node->nd_id=id; current_node->ref_way=0; current_node->c.x=lon*6371000.0*M_PI/180; current_node->c.y=log(tan(M_PI_4+lat*M_PI/360))*6371000.0; if (! node_hash) { - if (current_node->id > id_last_node) { - id_last_node=current_node->id; + if (current_node->nd_id > id_last_node) { + id_last_node=current_node->nd_id; } else { fprintf(stderr,"INFO: Nodes out of sequence (new " OSMID_FMT " vs old " OSMID_FMT "), adding hash\n", - (osmid)current_node->id, id_last_node); + (osmid)current_node->nd_id, id_last_node); node_hash=g_hash_table_new(NULL, NULL); node_buffer_to_hash(); } } else - if (!g_hash_table_lookup(node_hash, (gpointer)(long)(current_node->id))) - g_hash_table_insert(node_hash, (gpointer)(long)(current_node->id), - (gpointer)(long)(current_node-(struct node_item *)node_buffer.base)); + if (!g_hash_table_lookup(node_hash, (gpointer)(long long)(current_node->nd_id))) + g_hash_table_insert(node_hash, (gpointer)(long long)(current_node->nd_id), + (gpointer)(long long)(current_node-(struct node_item *)node_buffer.base)); else { remove_last_node_item_from_buffer(); nodeid=0; @@ -1415,21 +1422,21 @@ node_item_find_index_in_ordered_list(osmid id) long long node_count=node_buffer.size/sizeof(struct node_item); long long search_step=node_count>4 ? node_count/4 : 1; long long search_index=node_count/2; - if (node_buffer_base[0].id > id) + if (node_buffer_base[0].nd_id > id) return -1; - if (node_buffer_base[node_count-1].id < id) + if (node_buffer_base[node_count-1].nd_id < id) return -1; - while (node_buffer_base[search_index].id != id) { + while (node_buffer_base[search_index].nd_id != id) { #if 0 fprintf(stderr,"search_index=%d node_count=%d search_step=%d id=%d node_buffer_base[search_index].id=%d\n", search_index, node_count, search_step, id, node_buffer_base[search_index].id); #endif - if (node_buffer_base[search_index].id < id) { + if (node_buffer_base[search_index].nd_id < id) { search_index+=search_step; if (search_step == 1) { if (search_index >= node_count) return -1; - if (node_buffer_base[search_index].id > id) + if (node_buffer_base[search_index].nd_id > id) return -1; } else { if (search_index >= node_count) @@ -1440,7 +1447,7 @@ node_item_find_index_in_ordered_list(osmid id) if (search_step == 1) { if (search_index < 0) return -1; - if (node_buffer_base[search_index].id < id) + if (node_buffer_base[search_index].nd_id < id) return -1; } else { if (search_index < 0) @@ -1461,7 +1468,7 @@ node_item_get(osmid id) if (node_hash) { // Use g_hash_table_lookup_extended instead of g_hash_table_lookup // to distinguish a key with a value 0 from a missing key. - if (!g_hash_table_lookup_extended (node_hash, (gpointer)(long)(id), NULL, + if (!g_hash_table_lookup_extended (node_hash, (gpointer)(id), NULL, (gpointer)&result_index)) { result_index=-1; } @@ -1755,9 +1762,9 @@ osm_end_way(struct maptool_osm *osm) return; if (dedupe_ways_hash) { - if (g_hash_table_lookup(dedupe_ways_hash, (gpointer)(long)wayid)) + if (g_hash_table_lookup(dedupe_ways_hash, (gpointer)(long long)wayid)) return; - g_hash_table_insert(dedupe_ways_hash, (gpointer)(long)wayid, (gpointer)1); + g_hash_table_insert(dedupe_ways_hash, (gpointer)(long long)wayid, (gpointer)1); } count=attr_longest_match(attr_mapping_way, attr_mapping_way_count, types, sizeof(types)/sizeof(enum item_type)); @@ -3002,8 +3009,8 @@ write_item_way_subsection_index(FILE *out, FILE *out_index, FILE *out_graph, str idx[0]=item_bin_get_wayid(orig); idx[1]=ftello(out); if (way_hash) { - if (!(g_hash_table_lookup_extended(way_hash, (gpointer)(long)idx[0], NULL, NULL))) - g_hash_table_insert(way_hash, (gpointer)(long)idx[0], (gpointer)(long)idx[1]); + if (!(g_hash_table_lookup_extended(way_hash, (gpointer)(long long)idx[0], NULL, NULL))) + g_hash_table_insert(way_hash, (gpointer)(long long)idx[0], (gpointer)(long long)idx[1]); } else { if (!last_id || *last_id != idx[0]) dbg_assert(fwrite(idx, sizeof(idx), 1, out_index)==1); @@ -3067,6 +3074,7 @@ resolve_ways(FILE *in, FILE *out) c[i].x=ni->c.x; c[i].y=ni->c.y; } + } item_bin_write(ib,out); } @@ -3122,7 +3130,6 @@ map_resolve_coords_and_split_at_intersections(FILE *in, FILE *out, FILE *out_ind struct item_bin *ib; struct node_item *ni; long long last_id=0; - processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0; sig_alrm(0); while ((ib=read_item(in))) { diff --git a/navit/maptool/osm_o5m.c b/navit/maptool/osm_o5m.c index 1ca3b1c3c..d6957067d 100644 --- a/navit/maptool/osm_o5m.c +++ b/navit/maptool/osm_o5m.c @@ -16,7 +16,7 @@ struct o5m { int error; int lat, lon, uid, version; - long long id, rid[3], changeset; + unsigned long long id, rid[3], changeset; time_t timestamp; char *user; }; @@ -49,24 +49,24 @@ static unsigned long long get_uval(unsigned char **p) { unsigned char c; - long long ret=0; + unsigned long long ret=0; int shift=0; for (;;) { c=*((*p)++); - ret+=((long long)c & 0x7f) << shift; + ret+=((unsigned long long)c & 0x7f) << shift; if (!(c & 0x80)) return ret; shift+=7; } } -static unsigned long long +static long long get_sval(unsigned char **p) { - long long ret=get_uval(p); + unsigned long long ret=get_uval(p); if (ret & 1) { - return -((ret >> 1)+1); + return -((long long)(ret >> 1)+1); } else { return ret >> 1; } diff --git a/navit/maptool/osm_relations.c b/navit/maptool/osm_relations.c index 1ad04a281..591ca7d9d 100644 --- a/navit/maptool/osm_relations.c +++ b/navit/maptool/osm_relations.c @@ -135,7 +135,7 @@ relations_process(struct relations *rel, FILE *nodes, FILE *ways) { char buffer[128]; struct item_bin *ib=(struct item_bin *)buffer; - long long *id; + osmid *id; struct coord *c=(struct coord *)(ib+1),cn={0,0}; struct node_item *ni; GList *l; @@ -146,7 +146,7 @@ relations_process(struct relations *rel, FILE *nodes, FILE *ways) item_bin_add_attr_longlong(ib, attr_osm_nodeid, 0); id=item_bin_get_attr(ib, attr_osm_nodeid, NULL); while ((ni=read_node_item(nodes))) { - *id=ni->id; + *id=ni->nd_id; *c=ni->c; l=g_hash_table_lookup(rel->member_hash[0], id); while (l) { diff --git a/navit/navigation.c b/navit/navigation.c index 92b73796d..cdad6331c 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -4444,7 +4444,7 @@ navigation_set_route(struct navigation *this_, struct route *route) void navigation_init(void) { - plugin_register_map_type("navigation", navigation_map_new); + plugin_register_category_map("navigation", navigation_map_new); } struct object_func navigation_func = { diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml index 8c2d16e68..eb2191963 100644 --- a/navit/navit_shipped.xml +++ b/navit/navit_shipped.xml @@ -88,13 +88,14 @@ Navigation</text></img> <img cond='fullscreen==1' src='gui_leave_fullscreen' onclick='fullscreen=0'><text>Window Mode</text></img> <img cond='navit.pitch==0' src='gui_map' onclick='navit.pitch=pitch;redraw_map();back_to_map()'><text>3D</text></img> <img cond='navit.pitch!=0' src='gui_map' onclick='navit.pitch=0;redraw_map();back_to_map()'><text>2D</text></img> + <a href='#Settings Layers'><img src='gui_layers'><text>Layers</text></img></a> </a> <a name='Tools'><text>Tools</text> <img src='gui_actions' onclick='locale()'><text>Show Locale</text></img> </a> <a name='Route'><text>Route</text> <img src='gui_actions' onclick='route_description()'><text>Description</text></img> - <img src='gui_actions' onclick='route_height_profile()'><text>Height Profile</text></img> + <img src='gui_heightprofile' onclick='route_height_profile()'><text>Height Profile</text></img> <img cond='navit.waypoints_flag && (navit.route.route_status&1)' src='cursor_still' onclick='waypoints()'><text>Waypoints</text></img> <img cond='navit.waypoints_flag && (navit.route.route_status&1)' src='gui_stop' onclick='navit.route_remove_last_waypoint()'><text>Drop last Waypoint</text></img> @@ -122,6 +123,17 @@ Waypoint</text></img> "","navit.mapset.map[@data==%{se}].active=%{d}*",map.data,!map.active,"redraw_map();refresh();"); </script> </a> + <a name='Settings Layers' class='clist'><text>Layers</text> + <script> + foreach(layer;navit.layout.layer) + if (layer.name) + img("centry",layer.active?"gui_active":"gui_inactive",layer.name, + "","navit.layout.layer[@name==%{se}].active=%{d}*",layer.name,!layer.active,"redraw_map();refresh();"); + else + img("centry",layer.active?"gui_active":"gui_inactive", + "","navit.layout.layer[@name==%{se}].active=%{d}*",layer.name,!layer.active,"redraw_map();refresh();"); + </script> + </a> <a name='Settings Vehicles' class='clist'><text>Vehicle</text> <script> foreach(vehicle;navit.vehicle) @@ -152,7 +164,9 @@ Waypoint</text></img> ]]></gui> <!-- for a debug log --> <log enabled="no" type="textfile_debug" data="debug_%Y%m%d-%i.txt" flush_size="1000" flush_time="30"/> - <!-- osd items allow to position display and control items directly on top of the map: --> + <!-- osd items allow to position display and control items directly on top of the map. + You can find a list of all the available OSDs items here: + http://wiki.navit-project.org/index.php/OSD --> <osd enabled="no" type="compass"/> <osd enabled="no" type="navigation_next_turn"/> @@ -643,14 +657,28 @@ Waypoint</text></img> <itemgra item_types="border_state" order="0-"> <polyline color="#808080" width="1"/> </itemgra> - <itemgra item_types="height_line_1" order="0-"> - <polyline color="#000000" width="4"/> + </layer> + <layer name="heightlines"> + <itemgra item_types="height_line_1" order="7"> + <polyline color="#000000" width="1"/> </itemgra> - <itemgra item_types="height_line_2" order="0-"> + <itemgra item_types="height_line_1" order="8-"> + <polyline color="#000000" width="3"/> + <text text_size="8"/> + </itemgra> + <itemgra item_types="height_line_2" order="8"> + <polyline color="#000000" width="1"/> + </itemgra> + <itemgra item_types="height_line_2" order="9-"> <polyline color="#000000" width="2"/> + <text text_size="8"/> + </itemgra> + <itemgra item_types="height_line_3" order="9-11"> + <polyline color="#000000" width="1"/> </itemgra> - <itemgra item_types="height_line_3" order="0-"> + <itemgra item_types="height_line_3" order="12-"> <polyline color="#000000" width="1"/> + <text text_size="8"/> </itemgra> </layer> <layer name="streets"> diff --git a/navit/osd.c b/navit/osd.c index a2b88b0ad..a0c9183d1 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -52,7 +52,7 @@ osd_new(struct attr *parent, struct attr **attrs) if (! type) return NULL; - new=plugin_get_osd_type(type->u.str); + new=plugin_get_category_osd(type->u.str); if (! new) { dbg(lvl_error, "invalid OSD type '%s'\n", type->u.str); return NULL; diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c index 4d38591e2..9b43a160b 100644 --- a/navit/osd/core/osd_core.c +++ b/navit/osd/core/osd_core.c @@ -3880,21 +3880,21 @@ osd_auxmap_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs) void plugin_init(void) { - plugin_register_osd_type("compass", osd_compass_new); - plugin_register_osd_type("navigation_next_turn", osd_nav_next_turn_new); - plugin_register_osd_type("button", osd_button_new); - plugin_register_osd_type("toggle_announcer", osd_nav_toggle_announcer_new); - plugin_register_osd_type("speed_warner", osd_speed_warner_new); - plugin_register_osd_type("speed_cam", osd_speed_cam_new); - plugin_register_osd_type("text", osd_text_new); - plugin_register_osd_type("gps_status", osd_gps_status_new); - plugin_register_osd_type("volume", osd_volume_new); - plugin_register_osd_type("scale", osd_scale_new); - plugin_register_osd_type("image", osd_image_new); - plugin_register_osd_type("stopwatch", osd_stopwatch_new); - plugin_register_osd_type("odometer", osd_odometer_new); - plugin_register_osd_type("auxmap", osd_auxmap_new); - plugin_register_osd_type("cmd_interface", osd_cmd_interface_new); - plugin_register_osd_type("route_guard", osd_route_guard_new); - plugin_register_osd_type("navigation_status", osd_navigation_status_new); + plugin_register_category_osd("compass", osd_compass_new); + plugin_register_category_osd("navigation_next_turn", osd_nav_next_turn_new); + plugin_register_category_osd("button", osd_button_new); + plugin_register_category_osd("toggle_announcer", osd_nav_toggle_announcer_new); + plugin_register_category_osd("speed_warner", osd_speed_warner_new); + plugin_register_category_osd("speed_cam", osd_speed_cam_new); + plugin_register_category_osd("text", osd_text_new); + plugin_register_category_osd("gps_status", osd_gps_status_new); + plugin_register_category_osd("volume", osd_volume_new); + plugin_register_category_osd("scale", osd_scale_new); + plugin_register_category_osd("image", osd_image_new); + plugin_register_category_osd("stopwatch", osd_stopwatch_new); + plugin_register_category_osd("odometer", osd_odometer_new); + plugin_register_category_osd("auxmap", osd_auxmap_new); + plugin_register_category_osd("cmd_interface", osd_cmd_interface_new); + plugin_register_category_osd("route_guard", osd_route_guard_new); + plugin_register_category_osd("navigation_status", osd_navigation_status_new); } diff --git a/navit/plugin.c b/navit/plugin.c index 2edf9ed74..8c61bc9b7 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -378,9 +378,9 @@ plugins_destroy(struct plugins *pls) } static void * -find_by_name(enum plugin_type type, const char *name) +find_by_name(enum plugin_category category, const char *name) { - GList *name_list=plugin_types[type]; + GList *name_list=plugin_categories[category]; while (name_list) { struct name_val *nv=name_list->data; if (!g_ascii_strcasecmp(nv->name, name)) @@ -391,23 +391,23 @@ find_by_name(enum plugin_type type, const char *name) } void * -plugin_get_type(enum plugin_type type, const char *type_name, const char *name) +plugin_get_category(enum plugin_category category, const char *category_name, const char *name) { GList *plugin_list; struct plugin *pl; char *mod_name, *filename=NULL, *corename=NULL; void *result=NULL; - dbg(lvl_debug, "type=\"%s\", name=\"%s\"\n", type_name, name); + dbg(lvl_debug, "category=\"%s\", name=\"%s\"\n", category_name, name); - if ((result=find_by_name(type, name))) { + if ((result=find_by_name(category, name))) { return result; } if (!pls) return NULL; plugin_list=pls->list; - filename=g_strjoin("", "lib", type_name, "_", name, NULL); - corename=g_strjoin("", "lib", type_name, "_", "core", NULL); + filename=g_strjoin("", "lib", category_name, "_", name, NULL); + corename=g_strjoin("", "lib", category_name, "_", "core", NULL); while (plugin_list) { pl=plugin_list->data; if ((mod_name=g_strrstr(pl->name, "/"))) @@ -421,7 +421,7 @@ plugin_get_type(enum plugin_type type, const char *type_name, const char *name) plugin_set_active(pl, 0); if (plugin_get_active(pl)) plugin_call_init(pl); - if ((result=find_by_name(type, name))) { + if ((result=find_by_name(category, name))) { g_free(filename); g_free(corename); return result; diff --git a/navit/plugin.h b/navit/plugin.h index 23901b4ed..4687a6460 100644 --- a/navit/plugin.h +++ b/navit/plugin.h @@ -25,16 +25,32 @@ extern "C" { struct plugin; -enum plugin_type { - plugin_type_graphics, - plugin_type_gui, - plugin_type_map, - plugin_type_osd, - plugin_type_speech, - plugin_type_vehicle, - plugin_type_event, - plugin_type_font, - plugin_type_last, +/** + * @brief All existing plugin categories. + * + * Plugins are grouped into categories. Plugins within one category offer the same + * functionality (GUI, graphics, map etc.). Consequently the category determines the API + * offered by a plugin. + */ +enum plugin_category { + /** Category for plugins which implement a graphics backend. */ + plugin_category_graphics, + /** Category for plugins which implement a GUI frontend. */ + plugin_category_gui, + /** Category for plugins which implement a driver for providing/loading map data. */ + plugin_category_map, + /** Category for plugins which implement an OSD. */ + plugin_category_osd, + /** Category for plugins which implement speech output. */ + plugin_category_speech, + /** Category for plugins which supply position data (typically from a GPS receiver). */ + plugin_category_vehicle, + /** Category for plugins which implement/wrap an event subsystem. */ + plugin_category_event, + /** Category for plugins which load fonts. */ + plugin_category_font, + /** Dummy for last entry. */ + plugin_category_last, }; #endif @@ -44,7 +60,7 @@ struct popup_item; #undef PLUGIN_FUNC1 #undef PLUGIN_FUNC3 #undef PLUGIN_FUNC4 -#undef PLUGIN_TYPE +#undef PLUGIN_CATEGORY #define PLUGIN_PROTO(name,...) void name(__VA_ARGS__) #ifdef PLUGIN_C @@ -81,25 +97,25 @@ struct name_val { void *val; }; -GList *plugin_types[plugin_type_last]; +GList *plugin_categories[plugin_category_last]; -#define PLUGIN_TYPE(type,newargs) \ -struct type##_priv; \ -struct type##_methods; \ +#define PLUGIN_CATEGORY(category,newargs) \ +struct category##_priv; \ +struct category##_methods; \ void \ -plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs) \ +plugin_register_category_##category(const char *name, struct category##_priv *(*new_) newargs) \ { \ struct name_val *nv; \ nv=g_new(struct name_val, 1); \ nv->name=g_strdup(name); \ nv->val=new_; \ - plugin_types[plugin_type_##type]=g_list_append(plugin_types[plugin_type_##type], nv); \ + plugin_categories[plugin_category_##category]=g_list_append(plugin_categories[plugin_category_##category], nv); \ } \ \ void * \ -plugin_get_##type##_type(const char *name) \ +plugin_get_category_##category(const char *name) \ { \ - return plugin_get_type(plugin_type_##type, #type, name); \ + return plugin_get_category(plugin_category_##category, #category, name); \ } #else @@ -115,11 +131,11 @@ void plugin_call_##name(t1 p1,t2 p2,t3 p3); void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3,t4 p4)); \ void plugin_call_##name(t1 p1,t2 p2,t3 p3,t4 p4); -#define PLUGIN_TYPE(type,newargs) \ -struct type##_priv; \ -struct type##_methods; \ -void plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs); \ -void *plugin_get_##type##_type(const char *name); +#define PLUGIN_CATEGORY(category,newargs) \ +struct category##_priv; \ +struct category##_methods; \ +void plugin_register_category_##category(const char *name, struct category##_priv *(*new_) newargs); \ +void *plugin_get_category_##category(const char *name); #endif @@ -148,7 +164,7 @@ struct plugins *plugins_new(void); struct plugin *plugin_new(struct attr *parent, struct attr ** attrs); void plugins_init(struct plugins *pls); void plugins_destroy(struct plugins *pls); -void *plugin_get_type(enum plugin_type type, const char *type_name, const char *name); +void *plugin_get_category(enum plugin_category category, const char *category_name, const char *name); /* end of prototypes */ #ifdef __cplusplus diff --git a/navit/plugin/j1850/j1850.c b/navit/plugin/j1850/j1850.c index b4648bcfe..26e18057d 100644 --- a/navit/plugin/j1850/j1850.c +++ b/navit/plugin/j1850/j1850.c @@ -502,5 +502,5 @@ plugin_init(void) struct attr callback,navit; struct attr_iter *iter; - plugin_register_osd_type("j1850", osd_j1850_new); + plugin_register_category_osd("j1850", osd_j1850_new); } diff --git a/navit/plugin/pedestrian/pedestrian.c b/navit/plugin/pedestrian/pedestrian.c index 444543694..7e5a4361d 100644 --- a/navit/plugin/pedestrian/pedestrian.c +++ b/navit/plugin/pedestrian/pedestrian.c @@ -1369,8 +1369,8 @@ plugin_init(void) (*jnienv)->CallVoidMethod(jnienv, android_activity, Activity_setRequestedOrientation, 0); #endif - plugin_register_osd_type("marker", osd_marker_new); - plugin_register_map_type("route_occluded", map_route_occluded_new); + plugin_register_category_osd("marker", osd_marker_new); + plugin_register_category_map("route_occluded", map_route_occluded_new); callback.type=attr_callback; callback.u.callback=callback_new_attr_0(callback_cast(pedestrian_navit), attr_navit); config_add_attr(config, &callback); diff --git a/navit/plugin_def.h b/navit/plugin_def.h index 01acea7bf..985160e6f 100644 --- a/navit/plugin_def.h +++ b/navit/plugin_def.h @@ -23,11 +23,11 @@ struct callback_list; struct gui; PLUGIN_FUNC1(draw, struct container *, co) PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list) -PLUGIN_TYPE(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)) -PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)) -PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)) -PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs)) -PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent)) -PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)) -PLUGIN_TYPE(event, (struct event_methods *meth)) -PLUGIN_TYPE(font, (void *meth)) +PLUGIN_CATEGORY(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)) +PLUGIN_CATEGORY(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)) +PLUGIN_CATEGORY(map, (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)) +PLUGIN_CATEGORY(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs)) +PLUGIN_CATEGORY(speech, (struct speech_methods *meth, struct attr **attrs, struct attr *parent)) +PLUGIN_CATEGORY(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)) +PLUGIN_CATEGORY(event, (struct event_methods *meth)) +PLUGIN_CATEGORY(font, (void *meth)) diff --git a/navit/route.c b/navit/route.c index 3fdc38964..e367c3855 100644 --- a/navit/route.c +++ b/navit/route.c @@ -4202,8 +4202,8 @@ route_attr_iter_destroy(struct attr_iter *iter) void route_init(void) { - plugin_register_map_type("route", route_map_new); - plugin_register_map_type("route_graph", route_graph_map_new); + plugin_register_category_map("route", route_map_new); + plugin_register_category_map("route_graph", route_graph_map_new); } void diff --git a/navit/speech.c b/navit/speech.c index d3b09ae3a..cabd998dc 100644 --- a/navit/speech.c +++ b/navit/speech.c @@ -45,7 +45,7 @@ speech_new(struct attr *parent, struct attr **attrs) return NULL; } dbg(lvl_debug,"type='%s'\n", attr->u.str); - speech_new=plugin_get_speech_type(attr->u.str); + speech_new=plugin_get_category_speech(attr->u.str); dbg(lvl_debug,"new=%p\n", speech_new); if (! speech_new) { dbg(lvl_error,"wrong type '%s'\n", attr->u.str); diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c index 3323245aa..2b3f2612c 100644 --- a/navit/speech/android/speech_android.c +++ b/navit/speech/android/speech_android.c @@ -145,5 +145,5 @@ speech_android_new(struct speech_methods *meth, struct attr **attrs, struct attr void plugin_init(void) { - plugin_register_speech_type("android", speech_android_new); + plugin_register_category_speech("android", speech_android_new); } diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c index 49252f346..490811ce5 100644 --- a/navit/speech/cmdline/speech_cmdline.c +++ b/navit/speech/cmdline/speech_cmdline.c @@ -261,5 +261,5 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *paren void plugin_init(void) { - plugin_register_speech_type("cmdline", speechd_new); + plugin_register_category_speech("cmdline", speechd_new); } diff --git a/navit/speech/dbus/speech_dbus.c b/navit/speech/dbus/speech_dbus.c index 53ab46f03..0fdfb71ab 100644 --- a/navit/speech/dbus/speech_dbus.c +++ b/navit/speech/dbus/speech_dbus.c @@ -73,5 +73,5 @@ speech_dbus_new(struct speech_methods *meth, struct attr **attrs, struct attr *p void plugin_init(void) { - plugin_register_speech_type("dbus", speech_dbus_new); + plugin_register_category_speech("dbus", speech_dbus_new); } diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c index 523679b38..329a05d01 100644 --- a/navit/speech/espeak/speak.c +++ b/navit/speech/espeak/speak.c @@ -514,5 +514,5 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent void plugin_init(void) { - plugin_register_speech_type("espeak", espeak_new); + plugin_register_category_speech("espeak", espeak_new); } diff --git a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c index 05228187c..d22b3f795 100644 --- a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c +++ b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c @@ -77,5 +77,5 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *attr) void plugin_init(void) { - plugin_register_speech_type("speech_dispatcher", speechd_new); + plugin_register_category_speech("speech_dispatcher", speechd_new); } diff --git a/navit/track.c b/navit/track.c index 7e9f6fdff..5c16e4261 100644 --- a/navit/track.c +++ b/navit/track.c @@ -1227,5 +1227,5 @@ tracking_map_new(struct map_methods *meth, struct attr **attrs, struct callback_ void tracking_init(void) { - plugin_register_map_type("tracking", tracking_map_new); + plugin_register_category_map("tracking", tracking_map_new); } diff --git a/navit/types.h b/navit/types.h index 987b42a71..b91e01bd8 100644 --- a/navit/types.h +++ b/navit/types.h @@ -29,9 +29,11 @@ typedef int32_t s32; typedef uint32_t u32; #ifdef HAVE_API_WIN32_BASE +#define ULONGLONG_FMT "%I64u" #define LONGLONG_FMT "%I64d" #define LONGLONG_HEX_FMT "%I64x" #else +#define ULONGLONG_FMT "%llu" #define LONGLONG_FMT "%lld" #define LONGLONG_HEX_FMT "%llx" #endif diff --git a/navit/vehicle.c b/navit/vehicle.c index a280fb024..33cecb0e9 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -122,7 +122,7 @@ vehicle_new(struct attr *parent, struct attr **attrs) *colon = '\0'; dbg(lvl_debug, "source='%s' type='%s'\n", source->u.str, type); - vehicletype_new = plugin_get_vehicle_type(type); + vehicletype_new = plugin_get_category_vehicle(type); if (!vehicletype_new) { dbg(lvl_error, "invalid source '%s': unknown type '%s'\n", source->u.str, type); g_free(type); diff --git a/navit/vehicle/android/vehicle_android.c b/navit/vehicle/android/vehicle_android.c index d4b784a0e..89882d048 100644 --- a/navit/vehicle/android/vehicle_android.c +++ b/navit/vehicle/android/vehicle_android.c @@ -292,5 +292,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("android", vehicle_android_new_android); + plugin_register_category_vehicle("android", vehicle_android_new_android); } diff --git a/navit/vehicle/demo/vehicle_demo.c b/navit/vehicle/demo/vehicle_demo.c index c5cf7e045..59a119204 100644 --- a/navit/vehicle/demo/vehicle_demo.c +++ b/navit/vehicle/demo/vehicle_demo.c @@ -298,5 +298,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("demo", vehicle_demo_new); + plugin_register_category_vehicle("demo", vehicle_demo_new); } diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c index f7a0024b9..bb6134042 100644 --- a/navit/vehicle/file/vehicle_file.c +++ b/navit/vehicle/file/vehicle_file.c @@ -1046,8 +1046,8 @@ vehicle_file_new_file(struct vehicle_methods void plugin_init(void) { dbg(lvl_debug, "vehicle_file:plugin_init:enter\n"); - plugin_register_vehicle_type("file", vehicle_file_new_file); - plugin_register_vehicle_type("pipe", vehicle_file_new_file); - plugin_register_vehicle_type("socket", vehicle_file_new_file); - plugin_register_vehicle_type("serial", vehicle_file_new_file); + plugin_register_category_vehicle("file", vehicle_file_new_file); + plugin_register_category_vehicle("pipe", vehicle_file_new_file); + plugin_register_category_vehicle("socket", vehicle_file_new_file); + plugin_register_category_vehicle("serial", vehicle_file_new_file); } diff --git a/navit/vehicle/file/vehicle_pipe.c b/navit/vehicle/file/vehicle_pipe.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_pipe.c +++ b/navit/vehicle/file/vehicle_pipe.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/file/vehicle_serial.c b/navit/vehicle/file/vehicle_serial.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_serial.c +++ b/navit/vehicle/file/vehicle_serial.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/file/vehicle_socket.c b/navit/vehicle/file/vehicle_socket.c index 0750edef3..420390d4e 100644 --- a/navit/vehicle/file/vehicle_socket.c +++ b/navit/vehicle/file/vehicle_socket.c @@ -23,5 +23,5 @@ void plugin_init(void) { - plugin_get_vehicle_type("file"); + plugin_get_category_vehicle("file"); } diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 73d9e648d..a8c29cd97 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -471,5 +471,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd); + plugin_register_category_vehicle("gpsd", vehicle_gpsd_new_gpsd); } diff --git a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c index dda774e35..fa5eb8780 100644 --- a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c +++ b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c @@ -244,5 +244,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gpsd_dbus", vehicle_gpsd_dbus_new); + plugin_register_category_vehicle("gpsd_dbus", vehicle_gpsd_dbus_new); } diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c index 2ff9389f7..589e53a3f 100644 --- a/navit/vehicle/gypsy/vehicle_gypsy.c +++ b/navit/vehicle/gypsy/vehicle_gypsy.c @@ -493,5 +493,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("gypsy", vehicle_gypsy_new_gypsy); + plugin_register_category_vehicle("gypsy", vehicle_gypsy_new_gypsy); } diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c index 4c25c0235..94fec114a 100644 --- a/navit/vehicle/iphone/vehicle_iphone.c +++ b/navit/vehicle/iphone/vehicle_iphone.c @@ -161,5 +161,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("iphone", vehicle_iphone_new); + plugin_register_category_vehicle("iphone", vehicle_iphone_new); } diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c index 661202d67..d686a6a03 100644 --- a/navit/vehicle/maemo/vehicle_maemo.c +++ b/navit/vehicle/maemo/vehicle_maemo.c @@ -325,5 +325,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("maemo", vehicle_maemo_new_maemo); + plugin_register_category_vehicle("maemo", vehicle_maemo_new_maemo); } diff --git a/navit/vehicle/null/vehicle_null.c b/navit/vehicle/null/vehicle_null.c index 134538cc3..643945c71 100644 --- a/navit/vehicle/null/vehicle_null.c +++ b/navit/vehicle/null/vehicle_null.c @@ -179,5 +179,5 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("null", vehicle_null_new_null); + plugin_register_category_vehicle("null", vehicle_null_new_null); } diff --git a/navit/vehicle/webos/vehicle_webos.c b/navit/vehicle/webos/vehicle_webos.c index e0a849b97..a5bba4bce 100644 --- a/navit/vehicle/webos/vehicle_webos.c +++ b/navit/vehicle/webos/vehicle_webos.c @@ -381,6 +381,6 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("webos", vehicle_webos_new); + plugin_register_category_vehicle("webos", vehicle_webos_new); } diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c index 8dd3e40db..38cab3f1c 100644 --- a/navit/vehicle/wince/vehicle_wince.c +++ b/navit/vehicle/wince/vehicle_wince.c @@ -949,6 +949,6 @@ void plugin_init(void) { dbg(lvl_debug, "enter\n"); - plugin_register_vehicle_type("wince", vehicle_wince_new); - plugin_register_vehicle_type("file", vehicle_wince_new); + plugin_register_category_vehicle("wince", vehicle_wince_new); + plugin_register_category_vehicle("file", vehicle_wince_new); } diff --git a/navit/xpm/gui_heightprofile.svg b/navit/xpm/gui_heightprofile.svg new file mode 100644 index 000000000..0d80b5c12 --- /dev/null +++ b/navit/xpm/gui_heightprofile.svg @@ -0,0 +1,20 @@ +<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> + <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ for Navit --> + <defs> + <linearGradient y2="0%" x2="100%" y1="0%" x1="0%" id="grad1"> + <stop stop-color="rgb(90,90,90)" offset="0%"/> + <stop stop-color="rgb(175,175,175)" offset="100%"/> + </linearGradient> + </defs> + <g> + <title>Layer 1</title> + <polygon transform="translate(0, -3)" id="svg_2" fill="url(#grad1)" points="10,165 30,165 60,80 75,120 85,120 115,20 160,180 190,180 190,190 10,190"/> + <line id="svg_3" fill="none" stroke="gainsboro" stroke-width="6" y2="165" x2="30" y1="165" x1="10"/> + <line id="svg_4" fill="none" stroke="gainsboro" stroke-width="6" y2="80" x2="60" y1="165" x1="30" stroke-linecap="round"/> + <line id="svg_5" fill="none" stroke="gainsboro" stroke-width="6" y2="120" x2="75" y1="80" x1="60" stroke-linecap="round"/> + <line id="svg_6" fill="none" stroke="gainsboro" stroke-width="6" y2="120" x2="85" y1="120" x1="75" stroke-linecap="round"/> + <line id="svg_7" fill="none" stroke="gainsboro" stroke-width="6" y2="20" x2="115" y1="120" x1="85" stroke-linecap="round"/> + <line id="svg_8" fill="none" stroke="gainsboro" stroke-width="6" y2="180" x2="160" y1="20" x1="115" stroke-linecap="round"/> + <line id="svg_9" fill="none" stroke="gainsboro" stroke-width="6" y2="180" x2="190" y1="180" x1="160"/> + </g> +</svg> diff --git a/navit/xpm/gui_layers.svg b/navit/xpm/gui_layers.svg new file mode 100644 index 000000000..810b5a1d6 --- /dev/null +++ b/navit/xpm/gui_layers.svg @@ -0,0 +1,33 @@ +<?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:xlink="http://www.w3.org/1999/xlink" version="1.1" width="18.02128" height="18" id="svg5952">
+ <defs id="defs5954">
+ <linearGradient id="linearGradient2485-94">
+ <stop id="stop2486-7" style="stop-color:#ffffff;stop-opacity:1" offset="0"/>
+ <stop id="stop2487-83" style="stop-color:#aaaaaa;stop-opacity:1" offset="1"/>
+ </linearGradient>
+ <linearGradient id="linearGradient5704-5">
+ <stop id="stop5706-120" style="stop-color:#5a5a5a;stop-opacity:1" offset="0"/>
+ <stop id="stop5708-16" style="stop-color:#000000;stop-opacity:1" offset="1"/>
+ </linearGradient>
+ <linearGradient x1="974.19751" y1="182.46863" x2="979.80444" y2="184.8026" id="linearGradient4351" xlink:href="#linearGradient2485-94" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-173.95451)"/>
+ <linearGradient x1="968.88806" y1="178.31856" x2="977.93347" y2="181.70978" id="linearGradient4353" xlink:href="#linearGradient5704-5" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-173.95451)"/>
+ <linearGradient x1="974.19751" y1="182.46863" x2="979.80444" y2="184.8026" id="linearGradient4356" xlink:href="#linearGradient2485-94" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-170.95451)"/>
+ <linearGradient x1="968.88806" y1="178.31856" x2="977.93347" y2="181.70978" id="linearGradient4358" xlink:href="#linearGradient5704-5" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-170.95451)"/>
+ <linearGradient x1="974.19751" y1="182.46863" x2="979.80444" y2="184.8026" id="linearGradient4362" xlink:href="#linearGradient2485-94" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-167.95454)"/>
+ <linearGradient x1="968.88806" y1="178.31856" x2="977.93347" y2="181.70978" id="linearGradient4364" xlink:href="#linearGradient5704-5" gradientUnits="userSpaceOnUse" gradientTransform="translate(-963.97872,-167.95454)"/>
+ </defs>
+ <metadata id="metadata5957">
+ <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/>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <use transform="translate(-961.86731,-168.04527)" id="use13602" x="0" y="0" width="1250" height="1250" xlink:href="#rect12856"/>
+ <path d="m 5.5212776,14.545453 11.0000004,0 -4,-4.9999999 -11.0000004,0 4,4.9999999 z" id="use8977" style="color:#000000;fill:url(#linearGradient4362);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4364);stroke-width:0.99994743;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline"/>
+ <path d="m 5.5212776,11.545483 11.0000004,0 -4,-4.9999999 -11.0000004,0 4,4.9999999 z" id="use8059" style="color:#000000;fill:url(#linearGradient4356);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4358);stroke-width:0.99994743;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline"/>
+ <path d="m 5.5212776,8.5454831 11.0000004,0 -4,-5 -11.0000004,0 4,5 z" id="use8061" style="color:#000000;fill:url(#linearGradient4351);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4353);stroke-width:0.99994743;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline"/>
+</svg>
\ No newline at end of file diff --git a/navit/xslt/iphone.xslt b/navit/xslt/iphone.xslt index f15d04938..1e9540503 100644 --- a/navit/xslt/iphone.xslt +++ b/navit/xslt/iphone.xslt @@ -4,6 +4,7 @@ <xsl:param name="ICON_SMALL" select="32"/> <xsl:param name="ICON_MEDIUM" select="32"/> <xsl:param name="ICON_BIG" select="64"/> + <xsl:param name="OSD_USE_OVERLAY">yes</xsl:param> <xsl:output method="xml" doctype-system="navit.dtd" cdata-section-elements="gui"/> <xsl:include href="osd_minimum.xslt"/> diff --git a/navit/xslt/tomtom.xslt b/navit/xslt/tomtom.xslt new file mode 100644 index 000000000..3e34d9224 --- /dev/null +++ b/navit/xslt/tomtom.xslt @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0"> + + <xsl:output method="xml" indent="yes" cdata-section-elements="gui" doctype-system="navit.dtd"/> + + <xsl:template match="/"> + <xsl:apply-templates select="config"/> + </xsl:template> + + <xsl:template match="config"> + <xsl:copy> + <xsl:apply-templates select="navit"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="navit"> + <xsl:copy> + <xsl:attribute name="zoom">32</xsl:attribute> + <xsl:attribute name="tracking">1</xsl:attribute> + <xsl:attribute name="orientation">-1</xsl:attribute> + <xsl:attribute name="autozoom_active">1</xsl:attribute> + <xsl:attribute name="recent_dest">25</xsl:attribute> + <graphics type="sdl" w="480" h="272" bpp="16" frame="0" flags="1"/> + <xsl:copy-of select="gui[@type='internal']"/> + <osd enabled="yes" type="text" x="80" y="0" w="320" h="40" font_size="360" align="0" label="${{tracking.item.street_name}} ${{tracking.item.street_name_systematic}}" background_color="#00008080"/> + <osd enabled="yes" type="text" x="80" y="232" w="80" h="40" font_size="360" align="0" label="${{navigation.item[1].length[named]}}" background_color="#00008080"/> + <osd enabled="yes" type="text" x="160" y="232" w="240" h="40" font_size="360" align="0" label="${{vehicle.position_speed}} / ${{tracking.item.route_speed}}" background_color="#00008080"/> + <osd enabled="yes" type="text" x="400" y="232" w="80" h="40" font_size="360" align="0" label="${{navigation.item.destination_length[named]}}" background_color="#00008080"/> + <osd enabled="yes" type="text" x="400" y="192" w="80" h="40" font_size="360" align="0" label="${{navigation.item.destination_time[arrival]}}" background_color="#00008080"/> + <osd enabled="yes" type="compass" x="400" y="80" w="80" h="112" background_color="#00008080" font_size="300"/> + <osd enabled="yes" type="gps_status" x="0" y="80" w="80" h="40" background_color="#00008080"/> + <osd enabled="yes" type="speed_warner" x="0" y="120" w="80" h="72" background_color="#00008080" font_size="300"/> + <osd enabled="yes" type="navigation_next_turn" x="0" y="192" w="80" h="80" icon_w="48" icon_h="48" icon_src="%s_wh_48_48.png" background_color="#00008080"/> + <osd enabled="yes" type="button" x="400" y="0" command="zoom_in()" src="tomtom_plus_80_80.png"/> + <osd enabled="yes" type="button" x="0" y="0" command="zoom_out()" src="tomtom_minus_80_80.png"/> + <vehicle name="Local GPS" profilename="car" enabled="yes" active="yes" follow="1" source="file:/var/run/gpspipe"> + <!-- Navit can write a tracklog in several formats (gpx, nmea or textfile): --> + <log enabled="no" type="gpx" attr_types="position_time_iso8601,position_direction,position_speed,position_radius" data="/mnt/sdcard/navit/track_%Y%m%d-%%i.gpx" flush_size="1000" flush_time="30"/> + </vehicle> + <vehicle name="Demo" profilename="car" enabled="yes" active="no" follow="1" source="demo://" speed="100"/> + <xsl:copy-of select="tracking"/> + + <xsl:copy-of select="vehicleprofile[@name='car']"/> + <xsl:copy-of select="vehicleprofile[@name='car_shortest']"/> + <xsl:copy-of select="vehicleprofile[@name='car_avoid_tolls']"/> + <xsl:copy-of select="vehicleprofile[@name='bike']"/> + <xsl:copy-of select="vehicleprofile[@name='pedestrian']"/> + + <xsl:copy-of select="route"/> + <xsl:copy-of select="navigation"/> + + <xsl:comment>Use espeak.</xsl:comment> + <speech type="cmdline" data="/mnt/sdcard/navit/bin/espeakdsp -v en '%s'"/> + + <mapset enabled="yes"> + <map type="binfile" enabled="yes" data="$NAVIT_SHAREDIR/maps/*.bin"/> + </mapset> + <xsl:copy-of select="layer"/> + <xsl:copy-of select="layout"/> + </xsl:copy> + </xsl:template> +</xsl:transform> |
