]> git.street.me.uk Git - andy/viking.git/blobdiff - src/osm.c
[QA] Use correct type in sizeof function for memory allocation.
[andy/viking.git] / src / osm.c
index edb0f946185313c5b1cf28e6ff83f80d11a93e7d..07a41cb92885bbd566d66996247025f5b49c74fa 100644 (file)
--- a/src/osm.c
+++ b/src/osm.c
@@ -27,6 +27,7 @@
 #include <glib/gi18n.h>
 
 #include "osm.h"
+#include "map_ids.h"
 #include "vikmapslayer.h"
 #include "vikslippymapsource.h"
 #include "vikwmscmapsource.h"
@@ -45,7 +46,7 @@
 void osm_init () {
   VikMapSource *mapnik_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 13,
+                                "id", MAP_ID_OSM_MAPNIK,
                                 "label", "OpenStreetMap (Mapnik)",
                                 "name", "OSM-Mapnik",
                                 "hostname", "tile.openstreetmap.org",
@@ -60,7 +61,7 @@ void osm_init () {
                                 NULL));
   VikMapSource *cycle_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 17,
+                                "id", MAP_ID_OSM_CYCLE,
                                 "label", "OpenStreetMap (Cycle)",
                                 "name", "OSM-Cycle",
                                 "hostname", "tile.opencyclemap.org",
@@ -75,7 +76,7 @@ void osm_init () {
                                 NULL));
   VikMapSource *transport_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 20,
+                                "id", MAP_ID_OSM_TRANSPORT,
                                 "label", "OpenStreetMap (Transport)",
                                 "name", "OSM-Transport",
                                 "hostname", "tile2.opencyclemap.org",
@@ -90,7 +91,7 @@ void osm_init () {
                                 NULL));
   VikMapSource *mapquest_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 19,
+                                "id", MAP_ID_MAPQUEST_OSM,
                                 "name", "OSM-MapQuest",
                                 "label", "OpenStreetMap (MapQuest)",
                                 "hostname", "otile1.mqcdn.com",
@@ -105,7 +106,7 @@ void osm_init () {
                                 NULL));
   VikMapSource *hot_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 22,
+                                "id", MAP_ID_OSM_HUMANITARIAN,
                                 "name", "OSM-Humanitarian",
                                 "label", "OpenStreetMap (Humanitarian)",
                                 "hostname", "c.tile.openstreetmap.fr",
@@ -122,7 +123,7 @@ void osm_init () {
   // NB no cache needed for this type!!
   VikMapSource *direct_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 21,
+                                "id", MAP_ID_OSM_ON_DISK,
                                 "label", _("On Disk OSM Tile Format"),
                                 // For using your own generated data assumed you know the license already!
                                 "copyright", "© OpenStreetMap contributors", // probably
@@ -132,7 +133,7 @@ void osm_init () {
   // NB no cache needed for this type!!
   VikMapSource *mbtiles_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 23,
+                                "id", MAP_ID_MBTILES,
                                 "label", _("MBTiles File"),
                                 // For using your own generated data assumed you know the license already!
                                 "copyright", "© OpenStreetMap contributors", // probably
@@ -143,7 +144,7 @@ void osm_init () {
   // NB no cache needed for this type!!
   VikMapSource *metatiles_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
-                                "id", 24,
+                                "id", MAP_ID_OSM_METATILES,
                                 "label", _("OSM Metatiles"),
                                 // For using your own generated data assumed you know the license already!
                                 "copyright", "© OpenStreetMap contributors", // probably
@@ -162,7 +163,7 @@ void osm_init () {
 
   // Webtools
   VikWebtoolCenter *webtool = NULL;
-  webtool = vik_webtool_center_new_with_members ( _("OSM (view)"), "http://openstreetmap.org/?lat=%s&lon=%s&zoom=%d" );
+  webtool = vik_webtool_center_new_with_members ( _("OSM (view)"), "http://www.openstreetmap.org/?lat=%s&lon=%s&zoom=%d" );
   vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) );
   g_object_unref ( webtool );
 
@@ -170,6 +171,11 @@ void osm_init () {
   vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) );
   g_object_unref ( webtool );
 
+  // Note the use of positional parameters
+  webtool = vik_webtool_center_new_with_members ( _("OSM (query)"), "http://www.openstreetmap.org/query?lat=%1$s&lon=%2$s#map=%3$d/%1$s/%2$s" );
+  vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) );
+  g_object_unref ( webtool );
+
   webtool = vik_webtool_center_new_with_members ( _("OSM (render)"), "http://www.informationfreeway.org/?lat=%s&lon=%s&zoom=%d&layers=B0000F000F" );
   vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) );
   g_object_unref ( webtool );
@@ -190,7 +196,7 @@ void osm_init () {
 
   // Datasource
   VikWebtoolDatasource *vwtds = NULL;
-  vwtds = vik_webtool_datasource_new_with_members ( _("OpenStreetMap Notes"), "http://api.openstreetmap.org/api/0.6/notes.gpx?bbox=%s,%s,%s,%s&amp;closed=0", "LBRT", NULL, NULL );
+  vwtds = vik_webtool_datasource_new_with_members ( _("OpenStreetMap Notes"), "http://api.openstreetmap.org/api/0.6/notes.gpx?bbox=%s,%s,%s,%s&amp;closed=0", "LBRT", NULL, NULL, NULL );
   vik_ext_tool_datasources_register ( VIK_EXT_TOOL ( vwtds ) );
   g_object_unref ( vwtds );
 
@@ -216,7 +222,7 @@ void osm_init () {
     g_object_unref ( namefinder );
 
   // Not really OSM but can't be bothered to create somewhere else to put it...
-  webtool = vik_webtool_center_new_with_members ( _("Wikimedia Toolserver GeoHack"), "http://toolserver.org/~geohack/geohack.php?params=%s;%s" );
+  webtool = vik_webtool_center_new_with_members ( _("Wikimedia Toolserver GeoHack"), "http://tools.wmflabs.org/geohack/geohack.php?params=%s;%s" );
   vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) );
   g_object_unref ( webtool );