]> err.no Git - mapper/commitdiff
Start to add support for OpenStreetMap POI icon collection.
authorKaj-Michael Lang <milang@onion.tal.org>
Tue, 2 Oct 2007 15:04:24 +0000 (18:04 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Tue, 2 Oct 2007 15:04:24 +0000 (18:04 +0300)
src/map-poi.c
src/poi.c

index 98731461d299d0105d08a8d5239cc1966f4a4d2c..54f96254f56174a9d8de12dd93c59a7960761706 100644 (file)
@@ -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;
 }
index eb8d59542873f3220df3196a3df572e3fa9d2f37..b90fd4d6e8c86ec8d0b2319de31bc5b0cb0bec59 100644 (file)
--- a/src/poi.c
+++ b/src/poi.c
 
 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);
 }