Merge branch 'master' of github.com:systemed/iD

This commit is contained in:
Saman Bemel-Benrud
2012-12-13 14:52:14 -05:00
2 changed files with 16 additions and 0 deletions

View File

@@ -28,6 +28,12 @@ iD.BackgroundSource.template = function(template, subdomains, scaleExtent) {
return generator;
};
iD.BackgroundSource.Custom = function() {
var template = window.prompt('Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.');
if (!template) return null;
return iD.BackgroundSource.template(template, null, [0, 20]);
};
iD.BackgroundSource.Bing = iD.BackgroundSource.template(
'http://ecn.t{t}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z',
[0, 1, 2, 3], [0, 20]);

View File

@@ -12,6 +12,10 @@ iD.layerswitcher = function(map) {
name: 'OSM',
source: iD.BackgroundSource.OSM,
description: 'The default OpenStreetMap layer.'
}, {
name: 'Custom',
source: iD.BackgroundSource.Custom,
description: 'A custom layer (requires configuration)'
}],
opacities = [1, 0.5, 0];
@@ -101,6 +105,12 @@ iD.layerswitcher = function(map) {
.call(bootstrap.tooltip().placement('right'))
.on('click.set-source', function(d) {
d3.event.preventDefault();
if (d.name === 'Custom') {
var configured = d.source();
if (!configured) return;
d.source = configured;
d.name = 'Custom (configured)';
}
map.background.source(d.source);
map.redraw();
selectLayer(d);