From: Kaj-Michael Lang Date: Tue, 2 Oct 2007 15:04:24 +0000 (+0300) Subject: Start to add support for OpenStreetMap POI icon collection. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fcb3e3335dcb3a03fa7825ffb92f67aeb339005;p=mapper Start to add support for OpenStreetMap POI icon collection. --- diff --git a/src/map-poi.c b/src/map-poi.c index 9873146..54f9625 100644 --- a/src/map-poi.c +++ b/src/map-poi.c @@ -61,14 +61,14 @@ pixbuf = g_hash_table_lookup(poi_icon_hash, icon); if (pixbuf) return pixbuf; -snprintf(buffer, sizeof(buffer), DATADIR "/pixmaps/osm/%s.png", icon); +snprintf(buffer, sizeof(buffer), DATADIR "/map-icons/classic.small/%s.png", icon); pixbuf=gdk_pixbuf_new_from_file(buffer, &error); -g_printf("POI icon: %s\n", buffer); - if (error) return NULL; +g_printf("Found POI icon: %s.png\n", buffer); + g_hash_table_insert(poi_icon_hash, g_strdup(icon), pixbuf); return pixbuf; } diff --git a/src/poi.c b/src/poi.c index eb8d595..b90fd4d 100644 --- a/src/poi.c +++ b/src/poi.c @@ -31,47 +31,47 @@ struct _poi_categories { node_type_t type; - const gchar *name, *desc; + const gchar *name, *desc, *icon, *color; }; static struct _poi_categories default_poi_categories[] = { - {NODE_AMENITY_PARKING, "Parking", "Parking place for vehicles." }, - {NODE_AMENITY_FUEL, "Fuel", "Stations for purchasing fuel for vehicles." }, - {NODE_AMENITY_SPEEDCAM, "Speed Cam", "Automatic speed cameras." }, - {NODE_AMENITY_HOSPITAL, "Hospital", "" }, - {NODE_AMENITY_PHARMACY, "Pharmacy", "Place to get drugs." }, - {NODE_AMENITY_POLICE, "Police", "Police station"}, - {NODE_AMENITY_HOTEL, "Hotel", "Places to stay temporarily or for the night."}, - {NODE_AMENITY_HOSTEL, "Hostel", "Places to stay temporarily or for the night. Cheap."}, - {NODE_AMENITY_MOTEL, "Motel", "Places to stay temporarily or for the night. Cheap."}, - {NODE_AMENITY_ATM, "ATM", "Automatic Teller Machine/Cashpoint."}, - {NODE_AMENITY_BANK, "Bank", "Place to take care of your money."}, - {NODE_AMENITY_POST, "Post office", "Place to handle mail."}, - {NODE_AMENITY_POST_BOX, "Post box", "Send letters."}, - {NODE_AMENITY_TOURISM_INFO, "Tourism info", "A place for tourists to get information."}, - {NODE_AMENITY_TAXI, "Taxi station", "Get a Taxi here."}, - {NODE_AMENITY_RAILWAY_STATION, "Railway station", "Transportation by train."}, - {NODE_AMENITY_RAILWAY_HALT, "Railway halt", ""}, - {NODE_AMENITY_BUS_STATION, "Bus station", "Transportation by bus."}, - {NODE_AMENITY_BOAT, "Harbour", "Transportation by boat."}, - {NODE_AMENITY_AIRPORT, "Airport", "Transportation by air."}, - {NODE_AMENITY_CAMP_SITE, "Camp site", "Place to go camping"}, - {NODE_AMENITY_CARAVAN_SITE, "Caravan site", ""}, - {NODE_AMENITY_PICNIC_SITE, "Picnic", "Place to have a Picnic"}, - {NODE_AMENITY_FOOD, "Restaurant, Fast food", "Places to eat or drink."}, - {NODE_AMENITY_PUB, "Pub, Disco, Club", "Place to drink and party."}, - {NODE_AMENITY_CAFE, "Cafe", "Place to drink coffe or tee and eat."}, - {NODE_AMENITY_CINEMA, "Cinema", "Place to see movies"}, - {NODE_AMENITY_THEATRE, "Theatre", "Place to see people performing"}, - {NODE_AMENITY_SHOP, "Shopping", "Places to shop or acquire services."}, - {NODE_AMENITY_POW, "Place of Worchip", ""}, - {NODE_AMENITY_THEME_PARK, "Theme Park", "Place to have fun and ride for example rollercoasters."}, - {NODE_AMENITY_COLLEGE, "College Campus/Building", ""}, - {NODE_AMENITY_SCHOOL, "School", ""}, - {NODE_AMENITY_WC, "WC/Toilets", ""}, - {NODE_AMENITY_TELEPHONE, "Telephone", "Public telephone"}, - {NODE_AMENITY_ATTRACTION, "Attraction", "Something interesting"}, - {NODE_AMENITY_GENERIC, "Other", "Miscellaneous category for everything else."}, + {NODE_AMENITY_PARKING, "Parking", "Parking place for vehicles." , "vehicle/parking", "#aaaaff" }, + {NODE_AMENITY_FUEL, "Fuel", "Stations for purchasing fuel for vehicles." , "", "#aaeeaa" }, + {NODE_AMENITY_SPEEDCAM, "Speed Cam", "Automatic speed cameras." , "", "#ff0000" }, + {NODE_AMENITY_HOSPITAL, "Hospital", "" , "health/hospital", "#faeeaa" }, + {NODE_AMENITY_PHARMACY, "Pharmacy", "Place to get drugs." , "health/pharmacy", "#aaffaa" }, + {NODE_AMENITY_POLICE, "Police", "Police station" , "public/police", "#aaeeff" }, + {NODE_AMENITY_HOTEL, "Hotel", "Places to stay temporarily or for the night." , "", "#baeeba" }, + {NODE_AMENITY_HOSTEL, "Hostel", "Places to stay temporarily or for the night. Cheap." , "", "#abeeba" }, + {NODE_AMENITY_MOTEL, "Motel", "Places to stay temporarily or for the night. Cheap." , "", "#aceeca" }, + {NODE_AMENITY_ATM, "ATM", "Automatic Teller Machine/Cashpoint." , "", "#aaeeaa" }, + {NODE_AMENITY_BANK, "Bank", "Place to take care of your money." , "", "#aaeeaa" }, + {NODE_AMENITY_POST, "Post office", "Place to handle mail." , "public/post_office", "#aaeeaa" }, + {NODE_AMENITY_POST_BOX, "Post box", "Send letters." , "public/post_box", "#aaeeaa" }, + {NODE_AMENITY_TOURISM_INFO, "Tourism info", "A place for tourists to get information." , "", "#aaeeaa" }, + {NODE_AMENITY_TAXI, "Taxi station", "Get a Taxi here." , "", "#aaffff" }, + {NODE_AMENITY_RAILWAY_STATION, "Railway station", "Transportation by train." , "", "#aaeeaa" }, + {NODE_AMENITY_RAILWAY_HALT, "Railway halt", "" , "", "#aaeeaa" }, + {NODE_AMENITY_BUS_STATION, "Bus station", "Transportation by bus." , "", "#aaeeaa" }, + {NODE_AMENITY_BOAT, "Harbour", "Transportation by boat." , "", "#9090e0" }, + {NODE_AMENITY_AIRPORT, "Airport", "Transportation by air." , "", "#aaeeaa" }, + {NODE_AMENITY_CAMP_SITE, "Camp site", "Place to go camping" , "", "#a0f0e0" }, + {NODE_AMENITY_CARAVAN_SITE, "Caravan site", "" , "", "#aaeeaa" }, + {NODE_AMENITY_PICNIC_SITE, "Picnic", "Place to have a Picnic" , "", "#a5f8e5" }, + {NODE_AMENITY_FOOD, "Restaurant, Fast food", "Places to eat or drink." , "food/fastfood", "#aaeeaa" }, + {NODE_AMENITY_PUB, "Pub, Disco, Club", "Place to drink and party." , "food/pub", "#aaeeaa" }, + {NODE_AMENITY_CAFE, "Cafe", "Place to drink coffe or tee and eat." , "food/cafe", "#aaeeaa" }, + {NODE_AMENITY_CINEMA, "Cinema", "Place to see movies" , "", "#aaeeaa" }, + {NODE_AMENITY_THEATRE, "Theatre", "Place to see people performing" , "", "#aaeeaa" }, + {NODE_AMENITY_SHOP, "Shopping", "Places to shop or acquire services." , "", "#aaeeaa" }, + {NODE_AMENITY_POW, "Place of Worchip", "" , "religion/church", "#aaeeaa" }, + {NODE_AMENITY_THEME_PARK, "Theme Park", "Place to have fun and ride for example rollercoasters." , "", "#aaeeaa" }, + {NODE_AMENITY_COLLEGE, "College Campus/Building", "" , "education/college", "#aaeeaa" }, + {NODE_AMENITY_SCHOOL, "School", "" , "education/school", "#aaeeaa" }, + {NODE_AMENITY_WC, "WC/Toilets", "" , "public/toilets", "#aaeeaa" }, + {NODE_AMENITY_TELEPHONE, "Telephone", "Public telephone" , "", "#aaeeaa" }, + {NODE_AMENITY_ATTRACTION, "Attraction", "Something interesting" , "", "#aaeeaa" }, + {NODE_AMENITY_GENERIC, "Other", "Miscellaneous category for everything else." , "", "#aaeeaa" }, {NODE_POI_END, NULL, NULL } }; @@ -82,16 +82,19 @@ sqlite3_stmt *sql_cat; gint i; g_printf("Checking default categories\n"); -sqlite3_prepare_v2(db,"insert or replace into category (cat_id, label, desc, enabled, priority)" - " values (?, ?, ?, 1, ?)", +sqlite3_prepare_v2(db,"insert or replace into category (cat_id, label, desc, enabled, priority, icon, color)" + " values (?, ?, ?, 1, ?, ?, ?)", -1, &sql_cat, NULL); for (i=0; default_poi_categories[i].name; i++) { sqlite3_bind_int(sql_cat, 1, default_poi_categories[i].type); - sqlite3_bind_text(sql_cat, 2, default_poi_categories[i].name , -1, SQLITE_TRANSIENT); - sqlite3_bind_text(sql_cat, 3, default_poi_categories[i].desc , -1, SQLITE_TRANSIENT); + sqlite3_bind_text(sql_cat, 2, default_poi_categories[i].name, -1, SQLITE_TRANSIENT); + sqlite3_bind_text(sql_cat, 3, default_poi_categories[i].desc, -1, SQLITE_TRANSIENT); sqlite3_bind_int(sql_cat, 4, default_poi_categories[i].type/100); - sqlite3_step(sql_cat); + sqlite3_bind_text(sql_cat, 5, default_poi_categories[i].icon, -1, SQLITE_TRANSIENT); + sqlite3_bind_text(sql_cat, 6, default_poi_categories[i].color, -1, SQLITE_TRANSIENT); + if (sqlite3_step(sql_cat)==SQLITE_OK) + g_printf("Failed to update category: %d [%s]\n", i, default_poi_categories[i].name); sqlite3_reset(sql_cat); sqlite3_clear_bindings(sql_cat); }