/* #define DEBUG_OSM */
#define OSM_PLACE_CACHE_MAX_ITEMS (64)
--#define OSM_DB_PROGRESS_NUM (5000)
--#define OSM_RANGE_START (8192)
++
++#define OSM_DB_PROGRESS_NUM (10000)
++
++/* Node search ranges */
++#define OSM_RANGE_START (16384)
#define OSM_RANGE_STEP (8192)
--#define OSM_RANGE_STOP (49152)
++#define OSM_RANGE_STOP (65535)
struct sql_select_stmt {
sqlite3_stmt *select_way;
}
/**
-- * Search for the nearest place, type
++ * Search for the nearest place with given type
*/
gboolean
osm_find_nearest_place(node_type_t type, gint lat, gint lon, osm_place **nr)
return FALSE;
}
--/* Way helper */
++/*
++ * Way helper
++ *
++ */
static GList *
osm_find_nearest_way_nodes(gint lat, gint lon, guint range)
{
g_printf("Trying with range: %d\n", range);
}
++if (g_list_length(w)==0)
++ return NULL;
++
#ifdef DEBUG_OSM
g_printf("Found ways: %d\n", g_list_length(w));
#endif
--if (g_list_length(w)==0)
-- return NULL;
--
for (iter=w; iter!=NULL; iter=iter->next) {
osm_way_node *wnn;
osm_way_node *wnp;
}
#ifdef DEBUG_OSM
--g_printf("BEST WAY(%d): %s (%s,%s)\n",
++g_printf("BEST WAY(%d): %s [%s][%s]\n",
cw->id, cw->name, cw->ref, cw->int_ref);
--g_printf("\tT: %d F: %d N: %d D: %f\n",
++g_printf("\tType: %d Flags: %d Nodes: %d Dist: %f\n",
cw->type, cw->flags, cw->nodecnt, cw->dist);
--g_printf("\tNF: %d NT: %d DT %f\n",
++g_printf("\tNF: %d NT: %d Distance: %f\n",
cw->node_f->num,
-- cw->node_t->num, cw->distance);
++ cw->node_t->num,
++ cw->distance);
#endif
return cw;
}
++/* XXX: These two should be combined to save memory */
++/**
++ * Get previous node/segment of given way node
++ *
++ */
osm_way_node *
osm_way_get_prev_node(osm_way *w)
{
return NULL;
}
++/**
++ * Get next node/segment of given way node
++ *
++ */
osm_way_node *
osm_way_get_next_node(osm_way *w)
{
/**
* Get list of nodes for given way
++ *
*/
gboolean
osm_way_get_nodes(osm_way *w)
/**
* Get way name
++ *
*/
gboolean
osm_way_get_name(osm_way *w)
/**
* Get Way ref and int_ref
++ *
*/
gboolean
osm_way_get_ref(osm_way *w)
/* We didn't know our location, so check it, but only if we have moved */
if (d>way_dist_range) {
g_print("*** Must check location\n");
++ check_place=TRUE;
osm_way_free(map_loc->street);
map_loc->street=osm_find_nearest_way(lat, lon);
#if 0
if (!map_loc->street) {
g_print("*** Street not known\n");
++ map_loc->nfcnt++;
map_loc->changed=TRUE;
} else {
g_print("*** Street known\n");
++ map_loc->nfcnt=0;
map_loc->changed=TRUE;
check_place=TRUE;
}
map_loc->speed=_gps.speed;
}
++g_printf("NFC: %d\n", map_loc->nfcnt);
g_printf("D: %ld %ld\n", d,(gulong)way_dist_range);
if (check_place==TRUE && d>way_dist_range*4) {
static GtkActionEntry ui_entries[] = {
{"file", NULL, N_("_File"), NULL, NULL, NULL },
{"file_settings", GTK_STOCK_PREFERENCES, N_("_Settings..."), NULL, NULL, G_CALLBACK(menu_cb_settings) },
- {"file_help", GTK_STOCK_HELP, N_("_Help"), NULL, NULL, G_CALLBACK(menu_cb_help) },
- {"file_about", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK(menu_cb_about) },
{"file_quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, G_CALLBACK(gtk_main_quit) },
+ {"help", NULL, N_("_Help"), NULL, NULL, NULL },
+ {"help_help", GTK_STOCK_HELP, N_("_Help"), NULL, NULL, G_CALLBACK(menu_cb_help) },
+ {"help_about", GTK_STOCK_ABOUT, N_("_About"), "<control>A", NULL, G_CALLBACK(menu_cb_about) },
+
{"track", NULL, N_("_Track"), NULL, NULL, NULL },
{"track_open", GTK_STOCK_OPEN, N_("_Open..."), NULL, NULL, G_CALLBACK(menu_cb_track_open) },
- {"track_save", GTK_STOCK_SAVE, N_("_Save..."), NULL, NULL, G_CALLBACK(menu_cb_track_save) },
+ {"track_save", GTK_STOCK_SAVE, N_("_Save..."), "<control>S", NULL, G_CALLBACK(menu_cb_track_save) },
{"track_clear", GTK_STOCK_CLEAR, N_("_Clear"), NULL, NULL, G_CALLBACK(menu_cb_track_clear) },
- {"track_insert_break", NULL, N_("Insert Break"), NULL, NULL, G_CALLBACK(menu_cb_track_insert_break) },
- {"track_insert_mark", NULL, N_("Insert Mark..."), NULL, NULL, G_CALLBACK(menu_cb_track_insert_mark) },
- {"track_dist_last_mark", NULL, N_("Distance to last mark"), NULL, NULL, G_CALLBACK(menu_cb_track_distlast) },
- {"track_dist_first", NULL, N_("Distance from first"), NULL, NULL, G_CALLBACK(menu_cb_track_distfirst) },
+ {"track_insert_break", NULL, N_("Insert _Break"), NULL, NULL, G_CALLBACK(menu_cb_track_insert_break) },
+ {"track_insert_mark", NULL, N_("Insert _Mark..."), NULL, NULL, G_CALLBACK(menu_cb_track_insert_mark) },
+ {"track_dist_last_mark", NULL, N_("Distance to _last mark"), NULL, NULL, G_CALLBACK(menu_cb_track_distlast) },
+ {"track_dist_first", NULL, N_("Distance from _first"), NULL, NULL, G_CALLBACK(menu_cb_track_distfirst) },
{"track_filter", NULL, N_("_Filter..."), NULL, NULL, G_CALLBACK(menu_cb_track_filter) },
{"route", NULL, N_("_Route"), NULL, NULL, NULL },
{"poi", NULL, N_("_Poi"), NULL, NULL, NULL },
{"poi_categories", GTK_STOCK_INDEX, N_("_Categories"), NULL, NULL, G_CALLBACK(menu_cb_category) },
{"poi_settings", GTK_STOCK_PREFERENCES, N_("_Settings..."), NULL, NULL, NULL },
- {"poi_add", GTK_STOCK_ADD, N_("Add"), "<control>A", NULL, G_CALLBACK(cb_add_poi) },
- {"poi_quick_add", GTK_STOCK_ABOUT, N_("Quick Add"), "<control>E", NULL, G_CALLBACK(cb_add_poi) },
- {"poi_search", GTK_STOCK_FIND, N_("Search"), NULL, NULL, NULL },
- {"poi_add", GTK_STOCK_ADD, N_("_Add"), NULL, NULL, G_CALLBACK(cb_add_poi) },
- {"poi_quick_add", GTK_STOCK_ABOUT, N_("_Quick Add"), NULL, NULL, G_CALLBACK(cb_add_poi) },
++ {"poi_add", GTK_STOCK_ADD, N_("_Add"), "<control>A", NULL, G_CALLBACK(cb_add_poi) },
++ {"poi_quick_add", GTK_STOCK_ABOUT, N_("_Quick Add"), "<control>E", NULL, G_CALLBACK(cb_add_poi) },
+ {"poi_search", GTK_STOCK_FIND, N_("_Search"), NULL, NULL, NULL },
{"map", NULL, N_("_Map"), NULL, NULL, NULL },
{"map_maps", NULL, N_("_Maps"), NULL, NULL, NULL },
{"map_manager", NULL, N_("Manager..."), NULL, NULL, G_CALLBACK(menu_cb_mapman) },
- {"map_repositories", NULL, N_("Repositories..."), NULL, NULL, G_CALLBACK(menu_cb_maps_repoman) },
- {"autocenter", NULL, N_("Autocenter"), NULL, NULL, NULL },
+ {"map_repositories", NULL, N_("_Repositories..."), NULL, NULL, G_CALLBACK(menu_cb_maps_repoman) },
+ {"autocenter", NULL, N_("_Autocenter"), NULL, NULL, NULL },
{"view", NULL, N_("_View"), NULL, NULL, NULL },
- {"view_zoom_in", GTK_STOCK_ZOOM_IN, N_("Zoom in"), "<control>+", NULL, G_CALLBACK(cb_zoomin) },
- {"view_zoom_out", GTK_STOCK_ZOOM_OUT, N_("Zoom out"), "<control>-", NULL, G_CALLBACK(cb_zoomout) },
- {"view_zoom_normal", GTK_STOCK_ZOOM_100, N_("Zoom normal"), "<control>0", NULL, G_CALLBACK(cb_zoom_base) },
+ {"view_zoom_in", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), NULL, NULL, G_CALLBACK(cb_zoomin) },
+ {"view_zoom_out", GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), NULL, NULL, G_CALLBACK(cb_zoomout) },
- {"view_zoom_normal", GTK_STOCK_ZOOM_100, N_("Zoom _normal"), NULL, NULL, G_CALLBACK(cb_zoom_base) },
++ {"view_zoom_normal", GTK_STOCK_ZOOM_100, N_("Zoom _normal"), "<control>0", NULL, G_CALLBACK(cb_zoom_base) },
- {"view_items", NULL, N_("Features"), NULL, NULL, NULL },
+ {"view_items", NULL, N_("_Features"), NULL, NULL, NULL },
{"goto", NULL, N_("_Go"), NULL, NULL, NULL },
- {"goto_home", GTK_STOCK_HOME, N_("_Home"), NULL, NULL, G_CALLBACK(menu_cb_goto_home) },
- {"goto_destination", GTK_STOCK_JUMP_TO, N_("_Destination"), NULL, NULL, G_CALLBACK(menu_cb_goto_destination) },
- {"goto_gps", NULL, N_("_GPS"), NULL, NULL, G_CALLBACK(menu_cb_goto_gps) },
+ {"goto_home", GTK_STOCK_HOME, N_("_Home"), "<control>H", NULL, G_CALLBACK(menu_cb_goto_home) },
+ {"goto_destination", GTK_STOCK_JUMP_TO, N_("_Destination"), "<control>J", NULL, G_CALLBACK(menu_cb_goto_destination) },
+ {"goto_gps", NULL, N_("_GPS"), "<control>G", NULL, G_CALLBACK(menu_cb_goto_gps) },
{"goto_address", GTK_STOCK_FIND, N_("Address..."), NULL, NULL, NULL },
{"goto_latlon", NULL, N_("Lat/Lon"), NULL, NULL, G_CALLBACK(menu_cb_goto_latlon) },
{"goto_nextway", NULL, N_("Next Waypoint"), NULL, NULL, G_CALLBACK(menu_cb_goto_nextway) },