gboolean curl_download_timeout();
gchar *map_construct_url(guint tilex, guint tiley, guint zoom);
gboolean map_download_idle_refresh(ProgressUpdateInfo * pui);
+static void map_update_location(gint x, gint y);
gboolean get_next_pui(gpointer key, gpointer value, ProgressUpdateInfo ** data)
{
_mark_x1 - _draw_width, _mark_y1 - _draw_width,
2 * _draw_width, 2 * _draw_width, 0, 360 * 64);
gdk_draw_line(_map_widget->window,
- _conn_state == RCVR_FIXED
- ? (_show_velvec
- ? _gc[COLORABLE_MARK_VELOCITY] : _gc[COLORABLE_MARK])
- : _gc[COLORABLE_MARK_OLD],
+ _conn_state == RCVR_FIXED ? (_show_velvec ? _gc[COLORABLE_MARK_VELOCITY] : _gc[COLORABLE_MARK]) : _gc[COLORABLE_MARK_OLD],
_mark_x1, _mark_y1, _mark_x2, _mark_y2);
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
if (_speed_limit_on)
speed_limit();
+ map_update_location(_pos.unitx, _pos.unity);
+
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
}
-static void map_draw_route(gint x, gint y)
+static void
+map_draw_route(gint x, gint y)
{
- cmenu_route_add_way(x, y);
+cmenu_route_add_way(x, y);
}
-static void map_draw_track(gint x, gint y)
+static void
+map_draw_track(gint x, gint y)
{
- _pos.unitx = x2unit((gint) (x + 0.5));
- _pos.unity = y2unit((gint) (y + 0.5));
- unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon);
- _gps.speed = 20.f;
- integerize_data();
- track_add(time(NULL), FALSE);
- refresh_mark();
+_pos.unitx = x2unit((gint) (x + 0.5));
+_pos.unity = y2unit((gint) (y + 0.5));
+unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon);
+_gps.speed = 20.f;
+integerize_data();
+track_add(time(NULL), FALSE);
+refresh_mark();
}
-void
+static void
map_set_place_information(osm_way *s, osm_place *mp, osm_place *sp, PoiInfo *p)
{
gchar buffer[256];
}
/* XXX: */
-static void map_print_int_latlon(gint x, gint y)
+static void
+map_update_location(gint x, gint y)
{
-gint ux, uy;
gint ilat, ilon;
gdouble lat,lon;
osm_way *street;
osm_place splace;
PoiInfo *p;
-ux = x2unit((gint) (x + 0.5));
-uy = y2unit((gint) (y + 0.5));
-unit2latlon(ux, uy, lat, lon);
+unit2latlon(x, y, lat, lon);
ilat=lat2mp_int(lat);
ilon=lon2mp_int(lon);
mplace.name=NULL;
splace.name=NULL;
-g_printf("IntPos: %d , %d\n", ilat, ilon);
-
street=osm_find_nearest_way(ilat, ilon);
if (street)
g_printf("WAY: %d %s %s\n", street->id, street->name, street->ref);
}
map_set_place_information(street, &mplace, &splace, p);
+osm_way_free(street);
}
gboolean map_cb_scroll_event(GtkWidget * widget, GdkEventScroll * event)
gboolean map_cb_button_release(GtkWidget * widget, GdkEventButton * event)
{
+gint ux,uy;
printf("%s()\n", __PRETTY_FUNCTION__);
switch (event->button) {
break;
}
- map_print_int_latlon(event->x,event->y);
+ ux = x2unit((gint) (event->x + 0.5));
+ uy = y2unit((gint) (event->y + 0.5));
+
+ map_update_location(ux, uy);
map_center_unit(x2unit((gint) (event->x + 0.5)),
y2unit((gint) (event->y + 0.5)));