diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-09-08 15:39:51 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-09-08 15:39:51 +0100 |
commit | 2fe7ab388bc48ffc3458f2ae0d3b5721262e8c35 (patch) | |
tree | c905267cff119d1b517cea0cc514595c1ead6dc5 /web/js/map-bing-ol.js | |
parent | b35a27ba34dd96b829284bbd33d22abdb744c35f (diff) |
Move copyright on to map.
Diffstat (limited to 'web/js/map-bing-ol.js')
-rw-r--r-- | web/js/map-bing-ol.js | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 032ac1e89..391f837c6 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -4,14 +4,40 @@ function set_map_config(perm) { new OpenLayers.Control.ArgParser(), new OpenLayers.Control.Navigation(), perm, + //new OpenLayers.Control.ZoomPanel() new OpenLayers.Control.PanZoomFMS() ]; fixmystreet.map_type = OpenLayers.Layer.Bing; } OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { - attribution: '<a href="http://www.bing.com/maps/">' + - '<img border=0 src="http://dev.virtualearth.net/Branding/logo_powered_by.png"></a>', + attributionTemplate: '${logo}${copyrights}', + + setMap: function() { + OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments); + this.updateAttribution(); + this.map.events.register("moveend", this, this.updateAttribution); + }, + + updateAttribution: function() { + var z = this.map.getZoom() + this.zoomOffset; + var copyrights; + var logo = ''; + if (z >= 16) { + copyrights = 'Contains Ordnance Survey data © Crown copyright and database right 2010'; + } else { + logo = '<a href="http://www.bing.com/maps/"><img border=0 src="http://dev.virtualearth.net/Branding/logo_powered_by.png"></a>'; + copyrights = '© 2011 <a href="http://www.bing.com/maps/">Microsoft</a>. © AND, Navteq, Ordnance Survey'; + } + this.attribution = OpenLayers.String.format(this.attributionTemplate, { + logo: logo, + copyrights: copyrights + }); + this.map && this.map.events.triggerEvent("changelayer", { + layer: this, + property: "attribution" + }); + }, initialize: function(name, options) { var url = []; |