]> git.street.me.uk Git - andy/viking.git/blobdiff - src/osm.c
Fix crashing on invoking the Customize Toolbar from the preferences dialog.
[andy/viking.git] / src / osm.c
index c7cdf128616d7225824608ce7a12e7f9224bb83b..f5f28f319a36395814bce6d45383ab4eaef890f8 100644 (file)
--- a/src/osm.c
+++ b/src/osm.c
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
  * Copyright (C) 2007,2013, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
- * Copyright (c) 2012, Rob Norris <rw_norris@hotmail.com>
+ * Copyright (c) 2012-2014, Rob Norris <rw_norris@hotmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@
 #include "vikwmscmapsource.h"
 #include "vikwebtoolcenter.h"
 #include "vikwebtoolbounds.h"
+#include "vikwebtoolformat.h"
 #include "vikwebtool_datasource.h"
 #include "vikexttools.h"
 #include "vikexttool_datasources.h"
@@ -46,10 +47,13 @@ void osm_init () {
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
                                 "id", 13,
                                 "label", "OpenStreetMap (Mapnik)",
+                                "name", "OSM-Mapnik",
                                 "hostname", "tile.openstreetmap.org",
                                 "url", "/%d/%d/%d.png",
                                 "check-file-server-time", FALSE,
                                 "use-etag", TRUE,
+                                "zoom-min", 0,
+                                "zoom-max", 19,
                                 "copyright", "© OpenStreetMap contributors",
                                 "license", "CC-BY-SA",
                                 "license-url", "http://www.openstreetmap.org/copyright",
@@ -58,10 +62,13 @@ void osm_init () {
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
                                 "id", 17,
                                 "label", "OpenStreetMap (Cycle)",
+                                "name", "OSM-Cycle",
                                 "hostname", "tile.opencyclemap.org",
                                 "url", "/cycle/%d/%d/%d.png",
                                 "check-file-server-time", TRUE,
                                 "use-etag", FALSE,
+                                "zoom-min", 0,
+                                "zoom-max", 18,
                                 "copyright", "Tiles courtesy of Andy Allan © OpenStreetMap contributors",
                                 "license", "CC-BY-SA",
                                 "license-url", "http://www.openstreetmap.org/copyright",
@@ -70,10 +77,13 @@ void osm_init () {
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
                                 "id", 20,
                                 "label", "OpenStreetMap (Transport)",
+                                "name", "OSM-Transport",
                                 "hostname", "tile2.opencyclemap.org",
                                 "url", "/transport/%d/%d/%d.png",
                                 "check-file-server-time", TRUE,
                                 "use-etag", FALSE,
+                                "zoom-min", 0,
+                                "zoom-max", 18,
                                 "copyright", "Tiles courtesy of Andy Allan © OpenStreetMap contributors",
                                 "license", "CC-BY-SA",
                                 "license-url", "http://www.openstreetmap.org/copyright",
@@ -81,11 +91,14 @@ void osm_init () {
   VikMapSource *mapquest_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
                                 "id", 19,
+                                "name", "OSM-MapQuest",
                                 "label", "OpenStreetMap (MapQuest)",
                                 "hostname", "otile1.mqcdn.com",
                                 "url", "/tiles/1.0.0/osm/%d/%d/%d.png",
                                 "check-file-server-time", TRUE,
                                 "use-etag", FALSE,
+                                "zoom-min", 0,
+                                "zoom-max", 19,
                                 "copyright", "Tiles Courtesy of MapQuest © OpenStreetMap contributors",
                                 "license", "MapQuest Specific",
                                 "license-url", "http://developer.mapquest.com/web/info/terms-of-use",
@@ -93,11 +106,14 @@ void osm_init () {
   VikMapSource *hot_type =
     VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
                                 "id", 22,
+                                "name", "OSM-Humanitarian",
                                 "label", "OpenStreetMap (Humanitarian)",
                                 "hostname", "c.tile.openstreetmap.fr",
                                 "url", "/hot/%d/%d/%d.png",
                                 "check-file-server-time", TRUE,
                                 "use-etag", FALSE,
+                                "zoom-min", 0,
+                                "zoom-max", 20, // Super detail!!
                                 "copyright", "© OpenStreetMap contributors. Tiles courtesy of Humanitarian OpenStreetMap Team",
                                 "license", "CC-BY-SA",
                                 "license-url", "http://www.openstreetmap.org/copyright",
@@ -124,6 +140,17 @@ void osm_init () {
                                 "is-mbtiles", TRUE,
                                 NULL));
 
+  // NB no cache needed for this type!!
+  VikMapSource *metatiles_type =
+    VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE,
+                                "id", 24,
+                                "label", _("OSM Metatiles"),
+                                // For using your own generated data assumed you know the license already!
+                                "copyright", "© OpenStreetMap contributors", // probably
+                                "use-direct-file-access", TRUE,
+                                "is-osm-meta-tiles", TRUE,
+                                NULL));
+
   maps_layer_register_map_source (mapquest_type);
   maps_layer_register_map_source (mapnik_type);
   maps_layer_register_map_source (cycle_type);
@@ -131,6 +158,7 @@ void osm_init () {
   maps_layer_register_map_source (hot_type);
   maps_layer_register_map_source (direct_type);
   maps_layer_register_map_source (mbtiles_type);
+  maps_layer_register_map_source (metatiles_type);
 
   // Webtools
   VikWebtoolCenter *webtool = NULL;
@@ -153,9 +181,16 @@ void osm_init () {
   vik_ext_tools_register ( VIK_EXT_TOOL ( webtoolbounds ) );
   g_object_unref ( webtoolbounds );
 
+  VikWebtoolFormat *vwtf = NULL;
+  vwtf = vik_webtool_format_new_with_members ( _("Geofabrik Map Compare"),
+                                               "http://tools.geofabrik.de/mc/#%s/%s/%s",
+                                               "ZAO" );
+  vik_ext_tools_register ( VIK_EXT_TOOL ( vwtf ) );
+  g_object_unref ( vwtf );
+
   // 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 );
+  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 );