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:
euzuro
2006-10-05 15:09:56 +00:00
parent 67ced536c0
commit efa9499d57
2 changed files with 22 additions and 7 deletions

View File

@@ -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() {