]> err.no Git - mapper/commitdiff
Display markers for upcoming waypoint and set destination
authorKaj-Michael Lang <milang@angel.tal.org>
Fri, 10 Aug 2007 12:44:05 +0000 (15:44 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Fri, 10 Aug 2007 12:44:05 +0000 (15:44 +0300)
src/gps-panels.c

index 5304426af2c4f90a6cf551d98f1016620e1540ff..e197d542fd69f8c7bbb3b9dae2a90ec57aa15321 100644 (file)
@@ -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__);