#529 give tiles gutters - all layers that use Tile.Image must now look after layer.imageSize and layer.imageOffset - this is handled by layer.setTileSize - for untiled layers, setTileSize must be defined by the subclass - gutters are currently supported in Layer.Mapserver and Layer.WMS

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2979 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-04-02 17:18:38 +00:00
parent 7f0ccb69f0
commit b6a5e6619a
14 changed files with 351 additions and 56 deletions

View File

@@ -87,7 +87,9 @@ OpenLayers.Layer.MapServer.prototype =
* @type String
*/
getURL: function (bounds) {
if(this.gutter) {
bounds = this.adjustBoundsByGutter(bounds);
}
// Make a list, so that getFullRequestString uses literal ","
var extent = [bounds.left, bounds. bottom, bounds.right, bounds.top];
@@ -95,10 +97,10 @@ OpenLayers.Layer.MapServer.prototype =
var url = this.getFullRequestString(
{mapext: extent,
imgext: extent,
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]
map_size: [this.imageSize.w, this.imageSize.h],
imgx: this.imageSize.w / 2,
imgy: this.imageSize.h / 2,
imgxy: [this.imageSize.w, this.imageSize.h]
});
return url;

View File

@@ -99,12 +99,21 @@ 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);
},
/**
* Set the tile size based on the map size. This also sets layer.imageSize
* and layer.imageOffset for use by Tile.Image.
*/
setTileSize: function() {
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
this.tileSize = tileSize;
this.imageSize = tileSize;
this.imageOffset = new OpenLayers.Pixel(0, 0);
},
/** When it is not a dragging move (ie when done dragging)
* reload and recenter the div.
@@ -149,9 +158,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
center.lat + (tileHeight / 2));
//determine new tile size
this.tileSize = this.map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
this.setTileSize();
//formulate request url string
var url = this.getURL(tileBounds);

View File

@@ -24,7 +24,7 @@ OpenLayers.Layer.WMS.prototype =
},
reproject: true,
/**
* @constructor
*
@@ -93,10 +93,13 @@ OpenLayers.Layer.WMS.prototype =
* @type String
*/
getURL: function (bounds) {
if(this.gutter) {
bounds = this.adjustBoundsByGutter(bounds);
}
return this.getFullRequestString(
{BBOX:bounds.toBBOX(),
WIDTH:this.tileSize.w,
HEIGHT:this.tileSize.h});
WIDTH:this.imageSize.w,
HEIGHT:this.imageSize.h});
},
/**
@@ -109,7 +112,7 @@ OpenLayers.Layer.WMS.prototype =
* @type OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
url = this.getURL(bounds);
var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
},

View File

@@ -102,13 +102,22 @@ 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);
},
/**
* Set the tile size based on the map size. This also sets layer.imageSize
* and layer.imageOffset for use by Tile.Image.
*/
setTileSize: function() {
var tileSize = this.map.getSize();
tileSize.w = tileSize.w * this.ratio;
tileSize.h = tileSize.h * this.ratio;
this.tileSize = tileSize;
this.imageSize = tileSize;
this.imageOffset = new OpenLayers.Pixel(0, 0);
},
/** When it is not a dragging move (ie when done dragging)
* reload and recenter the div.
*
@@ -152,9 +161,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
center.lat + (tileHeight / 2));
//determine new tile size
this.tileSize = this.map.getSize();
this.tileSize.w = this.tileSize.w * this.ratio;
this.tileSize.h = this.tileSize.h * this.ratio;
this.setTileSize();
//formulate request url string
var url = this.getURL(tileBounds);