#include "osm.h"
#include "latlon.h"
+#include "osm-db.h"
+
/* #define DEBUG_OSM */
#define OSM_PLACE_CACHE_MAX_ITEMS 40
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 */
/*****************************************************************************/
-int
+static int
osm_progress(void *ud)
{
g_print(".");
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;
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;
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;
+#ifndef _OSM_DB_H
+#define _OSM_DB_H
+
#include <glib.h>
#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