From 1404d73fa7e196858fee6356c6e19924f7049feb Mon Sep 17 00:00:00 2001 From: jandegr Date: Mon, 5 Sep 2016 16:13:48 +0200 Subject: gui_internal_heightprofile show a notification in heightprofile when no map is found providing heightlines --- navit/gui/internal/gui_internal_command.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 16a4cd25b..21e299162 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -456,15 +456,11 @@ gui_internal_cmd2_setting_layout(struct gui_priv *this, char *function, struct a * the name of the file providing the heightlines must * comply with *.heightlines.bin * - * todo : make it show a flat segment when using a tunnel */ 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; @@ -507,6 +503,7 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st 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))) { struct attr name_attr; @@ -515,6 +512,7 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st 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); @@ -535,6 +533,14 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st } } 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); + } } } map=NULL; @@ -576,7 +582,6 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st } last=c; } - } } if(mr) -- cgit v1.2.1