]> err.no Git - mapper/commitdiff
Fixes to destination and way marker
authorKaj-Michael Lang <milang@angel.tal.org>
Mon, 15 Oct 2007 08:37:52 +0000 (11:37 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Mon, 15 Oct 2007 08:37:52 +0000 (11:37 +0300)
src/gtkcompass.c

index d2936d41d1a25fac6e277525c5f5e9c766506c9a..b5dc29f92e09924b6652b11b1911788a87c54d8a 100644 (file)
@@ -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;
 }