]> err.no Git - mapper/blobdiff - src/poi.h
Add header and cast properly.
[mapper] / src / poi.h
index 0eb49a18436dda5212ccf8e2b2ba18b9a5808ea8..e488e78858c0cbd43688ffa44428abc3253ad15e 100644 (file)
--- a/src/poi.h
+++ b/src/poi.h
 #include <glib.h>
 #include <sqlite3.h>
 
+#include "osm.h"
+
+/** Category list **/
+typedef enum {
+       CAT_ID,
+       CAT_ENABLED,
+       CAT_LABEL,
+       CAT_DESC,
+       CAT_POI_CNT,
+       CAT_ICON,
+       CAT_NUM_COLUMNS
+} CategoryList;
+
 typedef enum {
        POI_TYPE_POINT=0,
        POI_TYPE_LANDMARK=1,
@@ -19,8 +32,15 @@ typedef enum {
        POI_SEARCH_NEAR=0,
        POI_SEARCH_TEXT,
        POI_SEARCH_TEXT_CAT,
+       POI_SEARCH_CAT,
 } poi_search_type;
 
+typedef enum {
+       POI_SOURCE_USER=0,
+       POI_SOURCE_OSM=1,
+       POI_SOURCE_GPX_IMPORT=2,
+} poi_source;
+
 typedef struct _poi_db poi_db;
 struct _poi_db {
        sqlite3 *db;
@@ -28,21 +48,31 @@ struct _poi_db {
        guint zoom;
 };
 
-/** Data to describe a POI. */
+/** 
+ * Data to describe a POI. 
+ */
 typedef struct _poi_info poi_info;
 struct _poi_info {
        guint poi_id;
        guint cat_id;
-       guint is_in;
+       guint is_in_c;
+       guint is_in_p;
+       guint source;
+       time_t addtime;
        gdouble lat;
        gdouble lon;
+       gboolean public;
        gchar *label;
        gchar *desc;
        gchar *cat_label;
        gchar *cat_desc;
+       gchar *postal_code;
+       gchar *url;
 };
 
-/** Data used during action: add or edit category/poi **/
+/** 
+ * Data used during action: add or edit category/poi 
+ */
 typedef struct _delete_poi delete_poi;
 struct _delete_poi {
        GtkWidget *dialog;
@@ -50,6 +80,9 @@ struct _delete_poi {
        guint id;
 };
 
+/**
+ * Data describing a single POI category 
+ */
 typedef struct _poi_category poi_category;
 struct _poi_category {
        guint id;
@@ -59,16 +92,18 @@ struct _poi_category {
        gchar *desc;
 };
 
+/* POI SQL */
 struct sql_poi_stmt {
        sqlite3_stmt *select_poi;
+       sqlite3_stmt *select_poi_by_id;
        sqlite3_stmt *select_nearest_poi;
        sqlite3_stmt *select_poi_search;
        sqlite3_stmt *select_poi_search_cat;
+       sqlite3_stmt *select_poi_by_cat;
        sqlite3_stmt *insert_poi;
        sqlite3_stmt *update_poi;
        sqlite3_stmt *delete_poi;
        sqlite3_stmt *delete_poi_by_catid;
-       sqlite3_stmt *nextlabel_poi;
        sqlite3_stmt *select_cat;
        sqlite3_stmt *insert_cat;
        sqlite3_stmt *update_cat;
@@ -90,20 +125,32 @@ gboolean poi_db_prepare(sqlite3 *db);
 poi_info *poi_new(void);
 void poi_free(poi_info *p);
 
-gboolean poi_get_list_near(guint unitx, guint unity, GtkListStore **store, guint *num_cats);
-gboolean poi_update(guint poi_id, guint cat_id, gchar *poi_label, gchar *poi_desc);
-gboolean poi_add(gdouble lat, gdouble lon, guint cat_id, gchar *poi_label, gchar *poi_desc);
+gboolean poi_get_list_near_unit(guint unitx, guint unity, guint range, GtkListStore **store, guint *num_poi);
+gboolean poi_get_list_inside(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2, GtkListStore **store, guint *num_poi);
+
+poi_info *poi_get_by_id(guint id);
+
+gboolean poi_update(poi_info *p);
+gboolean poi_add(poi_info *p);
 gboolean poi_delete(guint id);
 
 gboolean poi_search(poi_search_type pst, gdouble lat, gdouble lon, gchar *text, guint cat, GtkListStore **store);
+poi_info *poi_find_nearest(gdouble lat, gdouble lon);
+
+gboolean poi_get_list_near_unit(guint unitx, guint unity, guint range, GtkListStore **store, guint *num_poi);
 
 poi_category *poi_category_new(void);
 void poi_category_free(poi_category *c);
+
 gboolean poi_category_get(guint cat_id, poi_category **c);
 gboolean poi_category_delete(guint id);
 gboolean poi_category_update(guint cat_id, poi_category *c);
-poi_info *poi_find_nearest(gdouble lat, gdouble lon);
 gboolean poi_category_toggle(guint cat_id, gboolean cat_enabled);
+
+GdkPixbuf *poi_get_icon(gchar *icon, gboolean big);
+const gchar *poi_get_icon_from_type(node_type_t t);
+void poi_icon_hash_clear(void);
+
 GtkListStore *poi_category_generate_store(void);
 
 #endif