From bbce356fba68d50a4b13da7b5eadb39aabfcfd97 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 2 Aug 2007 12:13:39 +0300 Subject: [PATCH] misc --- src/osm-db.c | 18 +++++++++--------- src/osm-db.h | 14 +++++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/osm-db.c b/src/osm-db.c index 3702ef1..c942166 100644 --- a/src/osm-db.c +++ b/src/osm-db.c @@ -12,6 +12,8 @@ #include "osm.h" #include "latlon.h" +#include "osm-db.h" + /* #define DEBUG_OSM */ #define OSM_PLACE_CACHE_MAX_ITEMS 40 @@ -24,11 +26,6 @@ struct sql_select_stmt { sqlite3_stmt *select_near_place; }; static struct sql_select_stmt sql; - -gboolean osm_way_get_nodes(osm_way *w); -gboolean osm_way_get_name(osm_way *w); -gboolean osm_way_get_ref(osm_way *w); - static GTimer *dbt; /* Cache hash tables */ @@ -36,7 +33,7 @@ static GHashTable *_place_cache; /*****************************************************************************/ -int +static int osm_progress(void *ud) { g_print("."); @@ -360,7 +357,8 @@ g_printf("Query took: %f sec, found: %d ways\n", g_timer_elapsed(dbt, &tms), wc) return ways; } -inline gdouble magnitude(gdouble x1, gdouble y1, gdouble x2, gdouble y2) +inline gdouble +magnitude(gdouble x1, gdouble y1, gdouble x2, gdouble y2) { gdouble x,y; x=x2-x1; @@ -369,7 +367,8 @@ y=y2-y1; return sqrt((x*x)+(y*y)); } -gboolean distance_point_to_line(gdouble x, gdouble y, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble *d) +static gboolean +distance_point_to_line(gdouble x, gdouble y, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble *d) { gdouble lm,u,tmp; gdouble ix,iy; @@ -392,7 +391,8 @@ iy=y1+u*(y2-y1); return TRUE; } -gboolean osm_way_distance(gint lat, gint lon, osm_way_node *f, osm_way_node *t, gdouble *d) +gboolean +osm_way_distance(gint lat, gint lon, osm_way_node *f, osm_way_node *t, gdouble *d) { if (!f || !t) return FALSE; diff --git a/src/osm-db.h b/src/osm-db.h index 5df5149..14a02d6 100644 --- a/src/osm-db.h +++ b/src/osm-db.h @@ -1,6 +1,18 @@ +#ifndef _OSM_DB_H +#define _OSM_DB_H + #include #include "osm.h" -gboolean osm_find_nearest_place(node_type_t type, gint lat, gint lon, osm_place *n); +gboolean osm_init(void); +void osm_deinit(void); + +gboolean osm_way_get_nodes(osm_way *w); +gboolean osm_way_get_name(osm_way *w); +gboolean osm_way_get_ref(osm_way *w); + +gboolean osm_find_nearest_place(node_type_t type, gint lat, gint lon, osm_place **nr); osm_way *osm_find_nearest_way(gint lat, gint lon); gboolean osm_way_distance(gint lat, gint lon, osm_way_node *f, osm_way_node *t, gdouble *d); + +#endif -- 2.39.5