From c9eef2a87935ed244236d7dba97c3ef6279f8b2a Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 10 Aug 2007 15:44:05 +0300 Subject: [PATCH] Display markers for upcoming waypoint and set destination --- src/gps-panels.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/gps-panels.c b/src/gps-panels.c index 5304426..e197d54 100644 --- a/src/gps-panels.c +++ b/src/gps-panels.c @@ -20,6 +20,8 @@ #include "settings.h" #include "mapper-types.h" #include "ui-common.h" +#include "latlon.h" +#include "route.h" void gps_display_data_speed(GtkWidget *widget, gfloat s) @@ -384,6 +386,56 @@ for (i = 0; i < 5; i++) { widget->style->fg_gc[GTK_STATE_NORMAL], x, y, _heading_panel_layout); g_free(text); + + if (_dest.valid || _next_way) { + GdkColor color; + GdkGC *gc; + gdouble t; + + gc = gdk_gc_new(widget->window); + gdk_gc_set_line_attributes(gc, 6, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND); + + if (_dest.valid) { + gdouble dc=calculate_course(_gps.lat,_gps.lon, _dest.lat, _dest.lon); + + color.red = 0x5000; + color.green = 0xffff; + color.blue = 0; + gdk_gc_set_rgb_fg_color(gc, &color); + + t = ((dc-_gps.heading) * (1.f / 180.f)) * PI; + gdk_draw_line(widget->window,gc, + xoffset + size / 2 + ((size / 2 - 5) * sin(t)), + yoffset + size - ((size / 2 - 5) * cos(t)), + xoffset + size / 2 + ((size / 2 + 5) * sin(t)), + yoffset + size - ((size / 2 + 5) * cos(t))); + + + } + + if (_next_way) { + gdouble lat,lon; + gdouble wc; + + unit2latlon(_next_way->point->unitx,_next_way->point->unity, lat, lon); + wc=calculate_course(_gps.lat,_gps.lon, lat, lon); + + color.red = 0; + color.green = 0xffff; + color.blue = 0; + gdk_gc_set_rgb_fg_color(gc, &color); + + t = ((wc-_gps.heading) * (1.f / 180.f)) * PI; + gdk_draw_line(widget->window,gc, + xoffset + size / 2 + ((size / 2 - 5) * sin(t)), + yoffset + size - ((size / 2 - 5) * cos(t)), + xoffset + size / 2 + ((size / 2 + 5) * sin(t)), + yoffset + size - ((size / 2 + 5) * cos(t))); + + } + g_object_unref(gc); + } + } vprintf("%s(): return\n", __PRETTY_FUNCTION__); -- 2.39.5