#616: untiled layers set layer.tileSize on setMap and every moveTo

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2974 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-04-02 15:13:50 +00:00
parent d68caa00a5
commit 9e688ebb37
2 changed files with 249 additions and 247 deletions
+13 -12
View File
@@ -99,6 +99,10 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
//determine new tile size
this.tileSize = map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
},
@@ -145,9 +149,9 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
center.lat + (tileHeight / 2));
//determine new tile size
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
this.tileSize = this.map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
//formulate request url string
var url = this.getURL(tileBounds);
@@ -156,7 +160,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var pos = this.map.getLayerPxFromLonLat(ul);
if ( this.tile && !this.tile.size.equals(tileSize)) {
if ( this.tile && !this.tile.size.equals(this.tileSize)) {
this.tile.destroy();
this.tile = null;
}
@@ -165,7 +169,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
this.doneLoading = false;
if (!this.tile) {
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
url, tileSize);
url, this.tileSize);
this.tile.draw();
var onload = function() {
this.doneLoading = true;
@@ -181,16 +185,13 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
},
getURL: function(bounds) {
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
var url = this.getFullRequestString(
{mapext:bounds.toBBOX().replace(/,/g," "),
imgext:bounds.toBBOX().replace(/,/g," "),
map_size:tileSize.w+' '+tileSize.h,
imgx: tileSize.w/2,
imgy: tileSize.h/2,
imgxy: tileSize.w+" "+tileSize.h
map_size: this.tileSize.w + " " + this.tileSize.h,
imgx: this.tileSize.w / 2,
imgy: this.tileSize.h / 2,
imgxy: this.tileSize.w + " " + this.tileSize.h
});
return url;
},
+11 -10
View File
@@ -102,6 +102,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
//determine new tile size
this.tileSize = map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
},
@@ -148,9 +152,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
center.lat + (tileHeight / 2));
//determine new tile size
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
this.tileSize = this.map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
//formulate request url string
var url = this.getURL(tileBounds);
@@ -159,7 +163,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var pos = this.map.getLayerPxFromLonLat(ul);
if ( this.tile && !this.tile.size.equals(tileSize)) {
if ( this.tile && !this.tile.size.equals(this.tileSize)) {
this.tile.destroy();
this.tile = null;
}
@@ -168,7 +172,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
this.doneLoading = false;
if (!this.tile) {
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
url, tileSize);
url, this.tileSize);
this.tile.draw();
var onload = function() {
this.doneLoading = true;
@@ -184,12 +188,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
},
getURL: function(bounds) {
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
return this.getFullRequestString( {'BBOX': bounds.toBBOX(),
'WIDTH': tileSize.w,
'HEIGHT': tileSize.h} );
'WIDTH': this.tileSize.w,
'HEIGHT': this.tileSize.h} );
},