aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js')
-rw-r--r--web/js/map-OpenLayers.js2
-rw-r--r--web/js/map-bing-ol.js43
-rw-r--r--web/js/map-fms.js12
-rw-r--r--web/js/map-mastermap.js5
4 files changed, 54 insertions, 8 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index d5fd36e97..3db59f218 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -958,6 +958,8 @@ $.extend(fixmystreet.utils, {
);
} else if (layer_options.matrixIds) {
layer = new fixmystreet.map_type(layer_options);
+ } else if (fixmystreet.layer_options[i].map_type) {
+ layer = new fixmystreet.layer_options[i].map_type(fixmystreet.layer_name, layer_options);
} else {
layer = new fixmystreet.map_type(fixmystreet.layer_name, layer_options);
}
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js
index a99fdd849..bbaf22940 100644
--- a/web/js/map-bing-ol.js
+++ b/web/js/map-bing-ol.js
@@ -10,9 +10,21 @@ fixmystreet.maps.config = function() {
if ( fixmystreet.page == 'report' ) {
fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
}
- fixmystreet.map_type = OpenLayers.Layer.Bing;
};
+(function() {
+ $(function(){
+ $('#map_layer_toggle').toggle(function(){
+ $(this).text('Roads');
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]);
+ }, function(){
+ $(this).text('Aerial');
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]);
+ });
+ });
+
+})();
+
OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
tile_base: '//t{S}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/${id}?mkt=en-US&it=G,L&src=t&shading=hill&og=969&n=z',
attributionTemplate: '${logo}${copyrights}',
@@ -100,3 +112,32 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
CLASS_NAME: "OpenLayers.Layer.Bing"
});
+
+OpenLayers.Layer.BingAerial = OpenLayers.Class(OpenLayers.Layer.Bing, {
+ tile_base: '//t{S}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/${id}?mkt=en-US&it=A,G,L&src=t&og=969&n=z',
+
+ setMap: function() {
+ OpenLayers.Layer.Bing.prototype.setMap.apply(this, arguments);
+ this.map.events.register("moveend", this, this.updateAttribution);
+ },
+
+ updateAttribution: function() {
+ var z = this.map.getZoom() + this.zoomOffset;
+ var year = (new Date()).getFullYear();
+ var copyrights = '&copy; ' + year + ' <a href="https://www.bing.com/maps/">Microsoft</a>, HERE, ';
+ if (z >= 13) {
+ copyrights += 'Maxar, CNES Distribution Airbus DS';
+ } else {
+ copyrights += 'Earthstar Geographics SIO';
+ }
+ var logo = '<a href="https://www.bing.com/maps/"><img border=0 src="//dev.virtualearth.net/Branding/logo_powered_by.png"></a>';
+ this._updateAttribution(copyrights, logo);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.BingAerial"
+});
+
+fixmystreet.layer_options = [
+ { map_type: OpenLayers.Layer.Bing },
+ { map_type: OpenLayers.Layer.BingAerial }
+];
diff --git a/web/js/map-fms.js b/web/js/map-fms.js
index 8af6adec3..bb51467a7 100644
--- a/web/js/map-fms.js
+++ b/web/js/map-fms.js
@@ -1,12 +1,5 @@
fixmystreet.maps.tile_base = '//{S}tilma.mysociety.org/oml';
-fixmystreet.maps.config = (function(original) {
- return function(){
- original();
- fixmystreet.map_type = OpenLayers.Layer.BingUK;
- };
-})(fixmystreet.maps.config);
-
OpenLayers.Layer.BingUK = OpenLayers.Class(OpenLayers.Layer.Bing, {
uk_bounds: [
new OpenLayers.Bounds(-6.6, 49.8, 1.102680, 51),
@@ -78,3 +71,8 @@ OpenLayers.Layer.BingUK = OpenLayers.Class(OpenLayers.Layer.Bing, {
CLASS_NAME: "OpenLayers.Layer.BingUK"
});
+
+fixmystreet.layer_options = [
+ { map_type: OpenLayers.Layer.BingUK },
+ { map_type: OpenLayers.Layer.BingAerial }
+];
diff --git a/web/js/map-mastermap.js b/web/js/map-mastermap.js
index bb9adf532..663ccbdfb 100644
--- a/web/js/map-mastermap.js
+++ b/web/js/map-mastermap.js
@@ -23,3 +23,8 @@ OpenLayers.Layer.MasterMap = OpenLayers.Class(OpenLayers.Layer.BingUK, {
CLASS_NAME: "OpenLayers.Layer.MasterMap"
});
+
+fixmystreet.layer_options = [
+ { map_type: OpenLayers.Layer.MasterMap },
+ { map_type: OpenLayers.Layer.BingAerial }
+];