From 7eb3f4bb9a744fa11b92e446a3e9cad249e7bb75 Mon Sep 17 00:00:00 2001 From: euzuro Date: Wed, 18 Oct 2006 19:12:31 +0000 Subject: [PATCH] allow specification of untiled tile ratio. patch for #355 from crschmidt git-svn-id: http://svn.openlayers.org/trunk/openlayers@1705 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/WMS/Untiled.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Layer/WMS/Untiled.js b/lib/OpenLayers/Layer/WMS/Untiled.js index dee755a86c..356b30c7e0 100644 --- a/lib/OpenLayers/Layer/WMS/Untiled.js +++ b/lib/OpenLayers/Layer/WMS/Untiled.js @@ -23,6 +23,10 @@ OpenLayers.Layer.WMS.Untiled.prototype = }, reproject: true, + /** the ratio of image/tile size to map size (this is the untiled buffer) + * @type int */ + ratio: 2, + /** @type OpenLayers.Tile.Image */ tile: null, @@ -125,16 +129,18 @@ OpenLayers.Layer.WMS.Untiled.prototype = //determine new tile bounds var center = bounds.getCenterLonLat(); + var tileWidth = bounds.getWidth() * this.ratio; + var tileHeight = bounds.getHeight() * this.ratio; var tileBounds = - new OpenLayers.Bounds(center.lon - bounds.getWidth(), - center.lat - bounds.getHeight(), - center.lon + bounds.getWidth(), - center.lat + bounds.getHeight()); + new OpenLayers.Bounds(center.lon - (tileWidth / 2), + center.lat - (tileHeight / 2), + center.lon + (tileWidth / 2), + center.lat + (tileHeight / 2)); //determine new tile size var tileSize = this.map.getSize(); - tileSize.w = tileSize.w * 2; - tileSize.h = tileSize.h * 2; + tileSize.w = tileSize.w * this.ratio; + tileSize.h = tileSize.h * this.ratio; //formulate request url string var url = this.getURL(tileBounds); @@ -156,8 +162,8 @@ OpenLayers.Layer.WMS.Untiled.prototype = getURL: function(bounds) { var tileSize = this.map.getSize(); - tileSize.w = tileSize.w * 2; - tileSize.h = tileSize.h * 2; + tileSize.w = tileSize.w * this.ratio; + tileSize.h = tileSize.h * this.ratio; return this.getFullRequestString( {'BBOX': bounds.toBBOX(), 'WIDTH': tileSize.w, 'HEIGHT': tileSize.h} );