From 0623e88d3931243f1b3afea3321ad4123de9acad Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 19 May 2008 09:57:58 +0000 Subject: [PATCH 1/1] Add the cycle map to the main site. --- public/export/embed.html | 9 ++++++++- public/javascripts/map.js | 6 ++++++ public/openlayers/OpenStreetMap.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/public/export/embed.html b/public/export/embed.html index ae82eb54a..af45a6b1f 100644 --- a/public/export/embed.html +++ b/public/export/embed.html @@ -37,13 +37,20 @@ attribution: attribution }); map.addLayer(mapnik); - } else { + } else if (args.layer == "osmarender") { var osmarender = new OpenLayers.Layer.OSM.Osmarender("Osmarender", { displayOutsideMaxExtent: true, wrapDateLine: true, attribution: attribution }); map.addLayer(osmarender); + } else if (args.layer == "cycle map") { + var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", { + displayOutsideMaxExtent: true, + wrapDateLine: true, + attribution: attribution + }); + map.addLayer(cyclemap); } if (args.marker) { diff --git a/public/javascripts/map.js b/public/javascripts/map.js index db5b85616..e1baba50e 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -34,6 +34,12 @@ function createMap(divName) { }); map.addLayer(osmarender); + var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle Map", { + displayOutsideMaxExtent: true, + wrapDateLine: true + }); + map.addLayer(cyclemap); + var maplint = new OpenLayers.Layer.OSM.Maplint("Maplint", { displayOutsideMaxExtent: true, wrapDateLine: true diff --git a/public/openlayers/OpenStreetMap.js b/public/openlayers/OpenStreetMap.js index c2acf2e0c..c783dba20 100644 --- a/public/openlayers/OpenStreetMap.js +++ b/public/openlayers/OpenStreetMap.js @@ -155,6 +155,34 @@ OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, { CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender" }); +/** + * Class: OpenLayers.Layer.OSM.CycleMap + * + * Inherits from: + * - + */ +OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, { + /** + * Constructor: OpenLayers.Layer.OSM.CycleMap + * + * Parameters: + * name - {String} + * options - {Object} Hashtable of extra options to tag onto the layer + */ + initialize: function(name, options) { + var url = [ + "http://a.thunderflames.org/tiles/cycle/", + "http://b.thunderflames.org/tiles/cycle/", + "http://c.thunderflames.org/tiles/cycle/" + ]; + options = OpenLayers.Util.extend({ numZoomLevels: 17 }, options); + var newArguments = [name, url, options]; + OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); + }, + + CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap" +}); + /** * Class: OpenLayers.Layer.OSM.Maplint * -- 2.43.2