aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-bing-ol.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-09-08 15:39:51 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-09-08 15:39:51 +0100
commit2fe7ab388bc48ffc3458f2ae0d3b5721262e8c35 (patch)
treec905267cff119d1b517cea0cc514595c1ead6dc5 /web/js/map-bing-ol.js
parentb35a27ba34dd96b829284bbd33d22abdb744c35f (diff)
Move copyright on to map.
Diffstat (limited to 'web/js/map-bing-ol.js')
-rw-r--r--web/js/map-bing-ol.js30
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 &copy; 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 = '&copy; 2011 <a href="http://www.bing.com/maps/">Microsoft</a>. &copy; 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 = [];