From fd438f232b9de4e54ac3c655c68e99ab9cc8612b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 9 Dec 2013 16:02:22 +0100 Subject: [PATCH] Add gutter option to ol.source.TileWMS --- src/objectliterals.jsdoc | 9 +++++++++ src/ol/source/tilewmssource.js | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 83e0e9a6e1..6a513d3e5b 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -703,6 +703,15 @@ * @property {ol.Extent|undefined} extent Extent. * @property {ol.source.WMSGetFeatureInfoOptions|undefined} getFeatureInfoOptions * Options for GetFeatureInfo. + * @property {number|undefined} gutter The size in pixels of the + * gutter around image tiles to ignore. By setting this property to a + * non-zero value, images will be requested that are wider and taller than + * the tile size by a value of `2 x gutter`. Defaults to zero. Using a + * non-zero value allows artifacts of rendering at tile edges to be ignored. If + * you control the WMS service it is recommended to address "artifacts at tile + * edges" issues by properly configuring the WMS service. For example, MapServer + * has a `tile_map_edge_buffer` configuration parameter for this. See + * http://mapserver.org/output/tile_mode.html. * @property {string|undefined} logo Logo. * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. * @property {number|undefined} maxZoom Maximum zoom. diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index 77cba28dc4..8a5631277e 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -35,6 +35,12 @@ ol.source.TileWMS = function(options) { urls = ol.TileUrlFunction.expandUrl(options.url); } + /** + * @private + * @type {number} + */ + this.gutter_ = goog.isDef(options.gutter) ? options.gutter : 0; + /** * @private * @type {Object} @@ -117,6 +123,14 @@ ol.source.TileWMS = function(options) { goog.inherits(ol.source.TileWMS, ol.source.TileImage); +/** + * @inheritDoc + */ +ol.source.TileWMS.prototype.getGutter = function() { + return this.gutter_; +}; + + /** * @inheritDoc */