add outgoing layers information to permalink
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1589 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -76,10 +76,25 @@ OpenLayers.Control.Permalink.prototype =
|
||||
*/
|
||||
updateLink: function() {
|
||||
var center = this.map.getCenter();
|
||||
var zoom = this.map.getZoom();
|
||||
var lat = Math.round(center.lat*100000)/100000;
|
||||
var lon = Math.round(center.lon*100000)/100000;
|
||||
this.element.href = this.base+"?lat="+lat+"&lon="+lon+"&zoom="+zoom;
|
||||
var zoom = "zoom=" + this.map.getZoom();
|
||||
var lat = "lat=" + Math.round(center.lat*100000)/100000;
|
||||
var lon = "lon=" + Math.round(center.lon*100000)/100000;
|
||||
|
||||
var layers = "layers=";
|
||||
var first = true;
|
||||
for(var i=0; i< this.map.layers.length; i++) {
|
||||
var layer = this.map.layers[i];
|
||||
if (layer.getVisibility()) {
|
||||
if (!first) {
|
||||
layers += ",";
|
||||
}
|
||||
layers += i;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
var href = this.base + "?" + lat + "&" + lon + "&" +
|
||||
zoom + "&" + layers;
|
||||
this.element.href = href;
|
||||
},
|
||||
|
||||
setCenter: function() {
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
if (/MSIE/.test(navigator.userAgent)) {
|
||||
t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
|
||||
t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2&layers=0", "Panning sets permalink");
|
||||
} else {
|
||||
t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
|
||||
t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=0", "Panning sets permalink");
|
||||
}
|
||||
}
|
||||
function test_03_Control_Permalink_updateLinksBase (t) {
|
||||
@@ -37,7 +37,7 @@
|
||||
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
$('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2';
|
||||
$('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2&layers=0';
|
||||
t.eq($('permalink').href, $('edit_permalink').href, "Panning sets permalink with base");
|
||||
}
|
||||
function test_04_Control_Permalink_noElement (t) {
|
||||
|
||||
Reference in New Issue
Block a user