#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:
@@ -99,6 +99,10 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(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);
|
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -145,9 +149,9 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
|||||||
center.lat + (tileHeight / 2));
|
center.lat + (tileHeight / 2));
|
||||||
|
|
||||||
//determine new tile size
|
//determine new tile size
|
||||||
var tileSize = this.map.getSize();
|
this.tileSize = this.map.getSize();
|
||||||
tileSize.w = tileSize.w * this.ratio;
|
this.tileSize.w = this.tileSize.w * this.ratio;
|
||||||
tileSize.h = tileSize.h * this.ratio;
|
this.tileSize.h = this.tileSize.h * this.ratio;
|
||||||
|
|
||||||
//formulate request url string
|
//formulate request url string
|
||||||
var url = this.getURL(tileBounds);
|
var url = this.getURL(tileBounds);
|
||||||
@@ -156,7 +160,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
|||||||
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
||||||
var pos = this.map.getLayerPxFromLonLat(ul);
|
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.destroy();
|
||||||
this.tile = null;
|
this.tile = null;
|
||||||
}
|
}
|
||||||
@@ -165,7 +169,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
|||||||
this.doneLoading = false;
|
this.doneLoading = false;
|
||||||
if (!this.tile) {
|
if (!this.tile) {
|
||||||
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
||||||
url, tileSize);
|
url, this.tileSize);
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
var onload = function() {
|
var onload = function() {
|
||||||
this.doneLoading = true;
|
this.doneLoading = true;
|
||||||
@@ -181,16 +185,13 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
getURL: function(bounds) {
|
getURL: function(bounds) {
|
||||||
var tileSize = this.map.getSize();
|
|
||||||
tileSize.w = tileSize.w * this.ratio;
|
|
||||||
tileSize.h = tileSize.h * this.ratio;
|
|
||||||
var url = this.getFullRequestString(
|
var url = this.getFullRequestString(
|
||||||
{mapext:bounds.toBBOX().replace(/,/g," "),
|
{mapext:bounds.toBBOX().replace(/,/g," "),
|
||||||
imgext:bounds.toBBOX().replace(/,/g," "),
|
imgext:bounds.toBBOX().replace(/,/g," "),
|
||||||
map_size:tileSize.w+' '+tileSize.h,
|
map_size: this.tileSize.w + " " + this.tileSize.h,
|
||||||
imgx: tileSize.w/2,
|
imgx: this.tileSize.w / 2,
|
||||||
imgy: tileSize.h/2,
|
imgy: this.tileSize.h / 2,
|
||||||
imgxy: tileSize.w+" "+tileSize.h
|
imgxy: this.tileSize.w + " " + this.tileSize.h
|
||||||
});
|
});
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(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);
|
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -148,9 +152,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
center.lat + (tileHeight / 2));
|
center.lat + (tileHeight / 2));
|
||||||
|
|
||||||
//determine new tile size
|
//determine new tile size
|
||||||
var tileSize = this.map.getSize();
|
this.tileSize = this.map.getSize();
|
||||||
tileSize.w = tileSize.w * this.ratio;
|
this.tileSize.w = this.tileSize.w * this.ratio;
|
||||||
tileSize.h = tileSize.h * this.ratio;
|
this.tileSize.h = this.tileSize.h * this.ratio;
|
||||||
|
|
||||||
//formulate request url string
|
//formulate request url string
|
||||||
var url = this.getURL(tileBounds);
|
var url = this.getURL(tileBounds);
|
||||||
@@ -159,7 +163,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
||||||
var pos = this.map.getLayerPxFromLonLat(ul);
|
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.destroy();
|
||||||
this.tile = null;
|
this.tile = null;
|
||||||
}
|
}
|
||||||
@@ -168,7 +172,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
this.doneLoading = false;
|
this.doneLoading = false;
|
||||||
if (!this.tile) {
|
if (!this.tile) {
|
||||||
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
||||||
url, tileSize);
|
url, this.tileSize);
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
var onload = function() {
|
var onload = function() {
|
||||||
this.doneLoading = true;
|
this.doneLoading = true;
|
||||||
@@ -184,12 +188,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
getURL: function(bounds) {
|
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(),
|
return this.getFullRequestString( {'BBOX': bounds.toBBOX(),
|
||||||
'WIDTH': tileSize.w,
|
'WIDTH': this.tileSize.w,
|
||||||
'HEIGHT': tileSize.h} );
|
'HEIGHT': this.tileSize.h} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user