From: Kaj-Michael Lang Date: Mon, 15 Oct 2007 08:37:52 +0000 (+0300) Subject: Fixes to destination and way marker X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5578299575ec9bdb1b02944aeeaf819eeee9fd2a;p=mapper Fixes to destination and way marker --- diff --git a/src/gtkcompass.c b/src/gtkcompass.c index d2936d4..b5dc29f 100644 --- a/src/gtkcompass.c +++ b/src/gtkcompass.c @@ -257,7 +257,7 @@ if (!compass->gc_w) { } static void -gtk_compass_draw_mark(GtkCompass *compass, GdkGC *gc, gdouble angle, gint size) +gtk_compass_draw_mark(GtkCompass *compass, GdkGC *gc, gfloat angle, gint size) { GtkWidget *widget; gint hs; @@ -267,10 +267,10 @@ widget=GTK_WIDGET(compass); hs=compass->size/2; gdk_draw_line(widget->window,gc, - compass->xoffset+hs+((hs-size)*sin(angle)), - compass->yoffset+compass->size-((hs-size)*cos(angle)), - compass->xoffset+hs+((hs+size)*sin(angle)), - compass->yoffset+compass->size-((hs+size)*cos(angle))); + compass->xoffset+hs+((hs-size)*sinf(angle)), + compass->yoffset+compass->size-((hs-size)*cosf(angle)), + compass->xoffset+hs+((hs+size)*sinf(angle)), + compass->yoffset+compass->size-((hs+size)*cosf(angle))); } static void @@ -393,11 +393,15 @@ for (i = 0; i < 5; i++) { gdk_draw_layout(widget->window, compass->gc_h, x, y, compass->layout); } -if (compass->dest_valid) - gtk_compass_draw_mark(compass, compass->gc_d, compass->dest_heading, 10); +if (compass->dest_valid) { + tmp=((compass->dest_heading-compass->data->heading) * (1.f / 180.f)) * G_PI; + gtk_compass_draw_mark(compass, compass->gc_d, tmp, 10); +} -if (compass->way_valid) - gtk_compass_draw_mark(compass, compass->gc_w, compass->way_heading, 10); +if (compass->way_valid) { + tmp=((compass->way_heading-compass->data->heading) * (1.f / 180.f)) * G_PI; + gtk_compass_draw_mark(compass, compass->gc_w, tmp, 10); +} return; }