3
#include <glib/gprintf.h>
10
static GdkPixbuf *wp_icon = NULL;
11
static GdkPixbuf *myposition_icon = NULL;
12
static GdkGC *gc_map = NULL;
17
do_paint_myposition();
22
set_current_wp(double lat, double lon)
39
if(global_wp_on) do_paint_wp();
45
int pixel_x, pixel_y, x,y;
51
gc = gdk_gc_new(pixmap);
55
gdk_gc_set_rgb_fg_color(gc, &color);
60
wp_icon = gdk_pixbuf_new_from_file_at_size (
61
PACKAGE_PIXMAPS_DIR "/tangogps-wp.png", 36,36,
65
g_print ("%s(): loading pixbuf failure. %s\n", __FUNCTION__,
72
if (pixmap && !gc_map)
73
gc_map = gdk_gc_new(pixmap);
77
printf("*** %s(): \n",__PRETTY_FUNCTION__);
87
pixel_x = lon2pixel(global_zoom, lon);
88
pixel_y = lat2pixel(global_zoom, lat);
90
x = pixel_x - global_x;
91
y = pixel_y - global_y;
115
GDK_RGB_DITHER_NONE, 0, 0);
117
gtk_widget_queue_draw_area (
122
printf("WAYPOINT: lat %f - lon %f\n",lat, lon);
132
PangoContext *context = NULL;
133
PangoLayout *layout = NULL;
134
PangoFontDescription *desc = NULL;
140
static gchar distunit[3];
143
static int width = 0, height = 0;
146
double unit_conv = 1;
148
printf("** %s(): \n",__PRETTY_FUNCTION__);
150
if(gpsdata && mouse_dx == 0 && mouse_dy == 0)
152
switch (global_speed_unit)
156
g_sprintf(distunit, "%s", "km");
159
unit_conv = 1.0 / 1.609344;
160
g_sprintf(distunit, "%s", "m");
163
unit_conv = 1.0 / 1.852;
164
g_sprintf(distunit, "%s", "NM");
169
distance = get_distance(deg2rad(gpsdata->fix.latitude),
170
deg2rad(gpsdata->fix.longitude),
171
global_wp.lat,global_wp.lon);
172
buffer = g_strdup_printf("%.3f\n%.1f°",
175
rad2deg(gpsdata->fix.bearing));
178
context = gtk_widget_get_pango_context (map_drawable);
179
layout = pango_layout_new (context);
180
desc = pango_font_description_new();
182
pango_font_description_set_size (desc, 16 * PANGO_SCALE);
183
pango_layout_set_font_description (layout, desc);
184
pango_layout_set_text (layout, buffer, strlen(buffer));
187
gc = gdk_gc_new (map_drawable->window);
194
gdk_gc_set_rgb_fg_color (gc, &color);
202
map_drawable->window,
203
map_drawable->style->fg_gc[GTK_WIDGET_STATE (map_drawable)],
205
global_drawingarea_width - width - 10,
206
global_drawingarea_height - height - 10,
207
global_drawingarea_width - width - 10,
208
global_drawingarea_height - height - 10,
213
pango_layout_get_pixel_size(layout, &width, &height);
217
gdk_draw_layout(map_drawable->window,
219
global_drawingarea_width - width - 10,
220
global_drawingarea_height - height -10,
227
pango_font_description_free (desc);
228
g_object_unref (layout);
240
if(global_myposition.lat) do_paint_myposition();
244
do_paint_myposition()
246
int pixel_x, pixel_y, x,y;
250
GError *error = NULL;
252
gc = gdk_gc_new(pixmap);
256
gdk_gc_set_rgb_fg_color(gc, &color);
261
myposition_icon = gdk_pixbuf_new_from_file_at_size (
262
PACKAGE_PIXMAPS_DIR "/tangogps-myposition.png", 36,36,
266
g_print ("%s(): loading pixbuf failure. %s\n", __FUNCTION__,
268
g_error_free (error);
273
if (pixmap && !gc_map)
274
gc_map = gdk_gc_new(pixmap);
278
printf("*** %s(): \n",__PRETTY_FUNCTION__);
282
lat = deg2rad(global_myposition.lat);
283
lon = deg2rad(global_myposition.lon);
288
pixel_x = lon2pixel(global_zoom, lon);
289
pixel_y = lat2pixel(global_zoom, lat);
291
x = pixel_x - global_x;
292
y = pixel_y - global_y;
294
printf("%d %d %f %f\n",x,y,lat,lon);
316
GDK_RGB_DITHER_NONE, 0, 0);
318
gtk_widget_queue_draw_area (
323
printf("MYPOSITION: lat %f - lon %f\n",lat, lon);