This control adapts maps to low-bandwidth conditions. By default, it requests
a test tile to determine speed, but accepts options that allow you to subsitute
your own detection method. This method only works on composited tiles – that is,
combinations of tilesets with the characteristic ,
between their tileset
names.
<div id='map-div'></div>
<a href='#' id='trigger-low'>low quality</a>
<a href='#' id='trigger-high'>high quality</a>
<script>
var mm = com.modestmaps;
var tilejson = {
tilejson: '1.0.0',
scheme: 'tms',
tiles: ['http://a.tiles.mapbox.com/mapbox/1.0.0/blue-marble-topo-jul' +
',world-bank-borders-ar/{z}/{x}/{y}.png']
};
var m = new mm.Map('map-div',
new wax.mm.connector(tilejson), null,
[new mm.MouseHandler(), new mm.TouchHandler()]);
var bw = wax.mm.bwdetect(m, {
png: '.png32'
});
document.getElementById('trigger-low').onclick = function() {
bw.bw(0); return false;
};
document.getElementById('trigger-high').onclick = function() {
bw.bw(1); return false;
};
m.setCenterZoom(new mm.Location(39, -98), 2);
</script>
bwdetect = wax.mm.bwdetect(map, options
bwdetect.bw(0 or 1)