From 084506cdb5561781c3d5febc8cc6e530bc942833 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 26 Oct 2012 21:36:30 +0200 Subject: [PATCH 01/12] Adding tiled WMS source As shown in the example, this adds support for tiled WMS layers. --- examples/standalone/wms-standalone.html | 23 +++++ examples/wms.html | 47 +++++++++ examples/wms.js | 33 ++++++ src/objectliterals.exports | 11 ++ src/ol/source/tiledwms.exports | 1 + src/ol/source/tiledwmssource.js | 131 ++++++++++++++++++++++++ 6 files changed, 246 insertions(+) create mode 100644 examples/standalone/wms-standalone.html create mode 100644 examples/wms.html create mode 100644 examples/wms.js create mode 100644 src/ol/source/tiledwms.exports create mode 100644 src/ol/source/tiledwmssource.js diff --git a/examples/standalone/wms-standalone.html b/examples/standalone/wms-standalone.html new file mode 100644 index 0000000000..2544878635 --- /dev/null +++ b/examples/standalone/wms-standalone.html @@ -0,0 +1,23 @@ + + + + + + + + + ol3 full-screen demo + + + +
+ + + diff --git a/examples/wms.html b/examples/wms.html new file mode 100644 index 0000000000..5ed1d5392d --- /dev/null +++ b/examples/wms.html @@ -0,0 +1,47 @@ + + + + + + + + + wms example + + +
+
+

Tiled WMS example

+
Example of a tiled WMS layer.
+
+

See the + wms.js source + to see how this is done.

+
+
+
+
wms, tile, tilelayer
+ + + diff --git a/examples/wms.js b/examples/wms.js new file mode 100644 index 0000000000..7f53e21c07 --- /dev/null +++ b/examples/wms.js @@ -0,0 +1,33 @@ +goog.require('goog.debug.Console'); +goog.require('goog.debug.Logger'); +goog.require('goog.debug.Logger.Level'); +goog.require('ol.Collection'); +goog.require('ol.Coordinate'); +goog.require('ol.Map'); +goog.require('ol.source.MapQuestOpenAerial'); +goog.require('ol.source.TiledWMS'); + + +if (goog.DEBUG) { + goog.debug.Console.autoInstall(); + goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO); +} + + +var layers = new ol.Collection([ + new ol.layer.TileLayer({ + source: new ol.source.MapQuestOpenAerial() + }), + new ol.layer.TileLayer({ + source: new ol.source.TiledWMS({ + url: 'http://demo.opengeo.org/geoserver/wms', + params: {'LAYERS': 'topp:states', 'TILED': true} + }) + }) +]); +var map = new ol.Map({ + center: new ol.Coordinate(-10997148, 4569099), + layers: layers, + target: 'map', + zoom: 4 +}); diff --git a/src/objectliterals.exports b/src/objectliterals.exports index bd7499907b..1117bd1909 100644 --- a/src/objectliterals.exports +++ b/src/objectliterals.exports @@ -59,3 +59,14 @@ @exportObjectLiteralProperty ol.source.BingMapsOptions.culture string|undefined @exportObjectLiteralProperty ol.source.BingMapsOptions.key string @exportObjectLiteralProperty ol.source.BingMapsOptions.style ol.BingMapsStyle + +@exportObjectLiteral ol.source.TiledWMSOptions +@exportObjectLiteralProperty ol.source.TiledWMSOptions.params Object +@exportObjectLiteralProperty ol.source.TiledWMSOptions.version string|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.crossOrigin string|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.Projection|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.|undefined diff --git a/src/ol/source/tiledwms.exports b/src/ol/source/tiledwms.exports new file mode 100644 index 0000000000..7d26e4f685 --- /dev/null +++ b/src/ol/source/tiledwms.exports @@ -0,0 +1 @@ +@exportSymbol ol.source.TiledWMS \ No newline at end of file diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js new file mode 100644 index 0000000000..efbfe447df --- /dev/null +++ b/src/ol/source/tiledwmssource.js @@ -0,0 +1,131 @@ +// FIXME add minZoom support + +goog.provide('ol.source.TiledWMS'); +goog.provide('ol.source.TiledWMSOptions'); + +goog.require('goog.asserts'); +goog.require('goog.object'); +goog.require('ol.Attribution'); +goog.require('ol.Projection'); +goog.require('ol.TileCoord'); +goog.require('ol.TileUrlFunction'); +goog.require('ol.source.TileSource'); +goog.require('ol.tilegrid.TileGrid'); + + +/** + * @typedef {{attributions: (Array.|undefined), + * params: Object, + * version: (string|undefined), + * crossOrigin: (string|undefined), + * extent: (ol.Extent|undefined), + * tileGrid: (ol.tilegrid.TileGrid|undefined), + * maxZoom: (number|undefined), + * projection: (ol.Projection|undefined), + * url: (string|undefined), + * urls: (Array.|undefined)}} + */ +ol.source.TiledWMSOptions; + + + +/** + * @constructor + * @extends {ol.source.TileSource} + * @param {ol.source.TiledWMSOptions} tiledWMSOptions options. + */ +ol.source.TiledWMS = function(tiledWMSOptions) { + goog.asserts.assert(tiledWMSOptions.params); + + var projection = goog.isDef(tiledWMSOptions.projection) ? + tiledWMSOptions.projection : ol.Projection.getFromCode('EPSG:3857'); + + var extent = goog.isDef(tiledWMSOptions.extent) ? + tiledWMSOptions.extent : projection.getExtent(); + + var version = goog.isDef(tiledWMSOptions.version) ? + tiledWMSOptions.version : '1.3'; + + var tileGrid = tiledWMSOptions.tileGrid; + if (!goog.isDef(tileGrid)) { + // FIXME Factor this out to a more central/generic place. + var size = Math.max(extent.maxX - extent.minX, extent.maxY - extent.minY); + var maxZoom = goog.isDef(tiledWMSOptions.maxZoom) ? + tiledWMSOptions.maxZoom : 18; + var resolutions = new Array(maxZoom + 1); + for (var z = 0, zz = resolutions.length; z < zz; ++z) { + resolutions[z] = size / (256 << z); + } + tileGrid = new ol.tilegrid.TileGrid({ + origin: extent.getTopLeft(), + resolutions: resolutions + }); + } + + function tileUrlFunction(tileCoord) { + if (goog.isNull(tileCoord)) { + return undefined; + } + var tileSize = tileGrid.getTileSize(); + var tileExtent = tileGrid.getTileCoordExtent(tileCoord); + var params = { + 'SERVICE': 'WMS', + 'VERSION': version, + 'REQUEST': 'GetMap', + 'WIDTH': tileSize.width, + 'HEIGHT': tileSize.height, + 'STYLES': '', + 'FORMAT': 'image/png', + 'TRANSPARENT': true, + // FIXME Projection dependant axis order. + 'BBOX': [ + tileExtent.minX, tileExtent.minY, tileExtent.maxX, tileExtent.maxY + ].join(',') + }; + params[version >= '1.3' ? 'CRS' : 'SRS'] = projection.getCode(); + goog.object.extend(params, tiledWMSOptions.params); + var url = tiledWMSOptions.urls ? + tiledWMSOptions.urls[goog.math.modulo( + tileCoord.hash(), tiledWMSOptions.urls.length)] : + tiledWMSOptions.url; + for (var param in params) { + url += (~url.indexOf('?') ? '&' : '?') + + param + '=' + encodeURIComponent(params[param]); + } + return url; + } + + function tileCoordTransform(tileCoord) { + if (tileGrid.getResolutions().length <= tileCoord.z) { + return null; + } + var x = tileCoord.x; + var projectionExtent = projection.getExtent(); + // FIXME do we want a wrapDateLine param? The code below will break maps + // with projections that do not span the whole world width. + if (extent.minX === projectionExtent.minX && + extent.maxX === projectionExtent.maxX) { + var n = 1 << tileCoord.z; + x = goog.math.modulo(x, n); + } + var tileExtent = tileGrid.getTileCoordExtent( + new ol.TileCoord(tileCoord.z, x, tileCoord.y)); + // FIXME We shouldn't need a typecast here. + if (!tileExtent.intersects(/** @type {ol.Extent} */ (extent))) { + return null; + } + return new ol.TileCoord(tileCoord.z, x, tileCoord.y); + } + + goog.base(this, { + attributions: tiledWMSOptions.attributions, + crossOrigin: tiledWMSOptions.crossOrigin, + extent: extent, + tileGrid: tileGrid, + projection: projection, + tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform( + tileCoordTransform, tileUrlFunction) + }); + +}; +goog.inherits(ol.source.TiledWMS, ol.source.TileSource); From 433b12c39ab51bac3b90d5a615396b55ae6f2e54 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 26 Oct 2012 22:51:30 +0200 Subject: [PATCH 02/12] Using the projection's extent for resolutions math by default This ensures that maps with WMS layers with different extents do not scale the tiles differently for each layer when the default tileGrid is used. Note that it is always possible to configure WMS sources with a custom tileGrid. --- src/ol/source/tiledwmssource.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index efbfe447df..8ad8e4be12 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -39,6 +39,7 @@ ol.source.TiledWMS = function(tiledWMSOptions) { var projection = goog.isDef(tiledWMSOptions.projection) ? tiledWMSOptions.projection : ol.Projection.getFromCode('EPSG:3857'); + var projectionExtent = projection.getExtent(); var extent = goog.isDef(tiledWMSOptions.extent) ? tiledWMSOptions.extent : projection.getExtent(); @@ -49,7 +50,9 @@ ol.source.TiledWMS = function(tiledWMSOptions) { var tileGrid = tiledWMSOptions.tileGrid; if (!goog.isDef(tileGrid)) { // FIXME Factor this out to a more central/generic place. - var size = Math.max(extent.maxX - extent.minX, extent.maxY - extent.minY); + var size = Math.max( + projectionExtent.maxX - projectionExtent.minX, + projectionExtent.maxY - projectionExtent.minY); var maxZoom = goog.isDef(tiledWMSOptions.maxZoom) ? tiledWMSOptions.maxZoom : 18; var resolutions = new Array(maxZoom + 1); @@ -100,7 +103,6 @@ ol.source.TiledWMS = function(tiledWMSOptions) { return null; } var x = tileCoord.x; - var projectionExtent = projection.getExtent(); // FIXME do we want a wrapDateLine param? The code below will break maps // with projections that do not span the whole world width. if (extent.minX === projectionExtent.minX && From b872b5a74f7cd688bf7bde64823bd7b55feda35a Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 27 Oct 2012 09:16:09 +0200 Subject: [PATCH 03/12] Cross origin handling to make example work in Firefox The WMS used in the example does not send CORS headers (I think not many WMS services do). It seems that the WebGL renderer needs script access to the image data, so the example only works with the DOM renderer in Firefox. --- examples/wms.js | 4 +++- src/ol/source/tiledwmssource.js | 2 +- src/ol/source/tilesource.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/wms.js b/examples/wms.js index 7f53e21c07..f68fcae9ac 100644 --- a/examples/wms.js +++ b/examples/wms.js @@ -21,13 +21,15 @@ var layers = new ol.Collection([ new ol.layer.TileLayer({ source: new ol.source.TiledWMS({ url: 'http://demo.opengeo.org/geoserver/wms', + crossOrigin: null, params: {'LAYERS': 'topp:states', 'TILED': true} }) }) ]); var map = new ol.Map({ - center: new ol.Coordinate(-10997148, 4569099), + renderer: ol.RendererHint.DOM, layers: layers, target: 'map', + center: new ol.Coordinate(-10997148, 4569099), zoom: 4 }); diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index 8ad8e4be12..32353495a7 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -17,7 +17,7 @@ goog.require('ol.tilegrid.TileGrid'); * @typedef {{attributions: (Array.|undefined), * params: Object, * version: (string|undefined), - * crossOrigin: (string|undefined), + * crossOrigin: (null|string|undefined), * extent: (ol.Extent|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), * maxZoom: (number|undefined), diff --git a/src/ol/source/tilesource.js b/src/ol/source/tilesource.js index bd8293f7d3..9b915efe16 100644 --- a/src/ol/source/tilesource.js +++ b/src/ol/source/tilesource.js @@ -14,7 +14,7 @@ goog.require('ol.tilegrid.TileGrid'); /** * @typedef {{attributions: (Array.|undefined), - * crossOrigin: (string|undefined), + * crossOrigin: (null|string|undefined), * extent: (ol.Extent|undefined), * projection: (ol.Projection|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), From e5308fec40c3546e78cbfb9a644eaac6311f2e6b Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 27 Oct 2012 17:28:08 +0200 Subject: [PATCH 04/12] No extent magic Setting the extent on a tile source now only means that tiles won't be drawn outside that extent. Now the only way to specify the origin of the tile grid is to provide a custom tileGrid. By default, the grid origin is the top left corner of the projection's extent. --- examples/wms.js | 3 ++- src/ol/source/tiledwmssource.js | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/wms.js b/examples/wms.js index f68fcae9ac..e475b8ab65 100644 --- a/examples/wms.js +++ b/examples/wms.js @@ -22,7 +22,8 @@ var layers = new ol.Collection([ source: new ol.source.TiledWMS({ url: 'http://demo.opengeo.org/geoserver/wms', crossOrigin: null, - params: {'LAYERS': 'topp:states', 'TILED': true} + params: {'LAYERS': 'topp:states', 'TILED': true}, + extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219) }) }) ]); diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index 32353495a7..327fe92b06 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -35,14 +35,12 @@ ol.source.TiledWMSOptions; * @param {ol.source.TiledWMSOptions} tiledWMSOptions options. */ ol.source.TiledWMS = function(tiledWMSOptions) { - goog.asserts.assert(tiledWMSOptions.params); - var projection = goog.isDef(tiledWMSOptions.projection) ? tiledWMSOptions.projection : ol.Projection.getFromCode('EPSG:3857'); var projectionExtent = projection.getExtent(); var extent = goog.isDef(tiledWMSOptions.extent) ? - tiledWMSOptions.extent : projection.getExtent(); + tiledWMSOptions.extent : projectionExtent; var version = goog.isDef(tiledWMSOptions.version) ? tiledWMSOptions.version : '1.3'; @@ -60,7 +58,7 @@ ol.source.TiledWMS = function(tiledWMSOptions) { resolutions[z] = size / (256 << z); } tileGrid = new ol.tilegrid.TileGrid({ - origin: extent.getTopLeft(), + origin: projectionExtent.getTopLeft(), resolutions: resolutions }); } From dd93c24a07263637b72e055a9c8d1752e496ce5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Moullet?= Date: Sat, 27 Oct 2012 16:00:57 +0200 Subject: [PATCH 05/12] Add tiled wms with custom projection --- examples/wms-custom-proj.html | 48 +++++++++++++++++++++++++++++++++++ examples/wms-custom-proj.js | 39 ++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 examples/wms-custom-proj.html create mode 100644 examples/wms-custom-proj.js diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html new file mode 100644 index 0000000000..1ed545a2a3 --- /dev/null +++ b/examples/wms-custom-proj.html @@ -0,0 +1,48 @@ + + + + + + + + + wms example + + +
+
+

Tiled WMS with custom projection example

+
Example of a tiled WMS layer using the projection EPSG:21781.
+
+

See the + wms-custom-proj.js source + to see how this is done.

+
+
+
+
wms, tile, tilelayer, projection
+ + + + diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js new file mode 100644 index 0000000000..ee262faec5 --- /dev/null +++ b/examples/wms-custom-proj.js @@ -0,0 +1,39 @@ +goog.require('goog.debug.Console'); +goog.require('goog.debug.Logger'); +goog.require('goog.debug.Logger.Level'); +goog.require('ol.Collection'); +goog.require('ol.Coordinate'); +goog.require('ol.Map'); +goog.require('ol.Projection'); +goog.require('ol.source.TiledWMS'); + + +if (goog.DEBUG) { + goog.debug.Console.autoInstall(); + goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO); +} + +var extent = new ol.Extent(420000, 30000, 900000, 350000); + +var epsg21781 = new ol.Projection('EPSG:21781', + ol.ProjectionUnits.METERS, + extent +); + +var layers = new ol.Collection([ + new ol.layer.TileLayer({ + source: new ol.source.TiledWMS({ + url: 'http://wms.geo.admin.ch/?', + params: {'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale'}, + projection: epsg21781 + }) + }) +]); + +var map = new ol.Map({ + center: new ol.Coordinate(600000, 200000), + projection: epsg21781, + layers: layers, + target: 'map', + zoom: 8 +}); From b907befd68ba0b885c5b1775a8a636404167bf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Moullet?= Date: Sun, 28 Oct 2012 04:21:56 +0100 Subject: [PATCH 06/12] Add title to WMS tiled custom projection example --- examples/wms-custom-proj.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html index 1ed545a2a3..8dc04d889d 100644 --- a/examples/wms-custom-proj.html +++ b/examples/wms-custom-proj.html @@ -27,7 +27,7 @@ } } - wms example + Tiled WMS with custom projection example
From bb957a1149819f6819b390ee6aa62b85ea72e07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Moullet?= Date: Sun, 28 Oct 2012 04:54:03 +0100 Subject: [PATCH 07/12] Add new layer national park, attributions and layer extent to the Tiled WMS with custom projection example --- examples/wms-custom-proj.html | 4 ++-- examples/wms-custom-proj.js | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html index 8dc04d889d..0638842076 100644 --- a/examples/wms-custom-proj.html +++ b/examples/wms-custom-proj.html @@ -33,10 +33,10 @@

Tiled WMS with custom projection example

-
Example of a tiled WMS layer using the projection EPSG:21781.
+
Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.

See the - wms-custom-proj.js source + wms-custom-proj.js source to see how this is done.

diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index ee262faec5..270b1423e9 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -24,16 +24,29 @@ var layers = new ol.Collection([ new ol.layer.TileLayer({ source: new ol.source.TiledWMS({ url: 'http://wms.geo.admin.ch/?', + attributions: [new ol.Attribution('© Pixelmap 1:1000000 / geo.admin.ch')], + crossOrigin: null, params: {'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale'}, - projection: epsg21781 + projection: epsg21781, + extent: extent + }) + }), + new ol.layer.TileLayer({ + source: new ol.source.TiledWMS({ + url: 'http://wms.geo.admin.ch/?', + attributions: [new ol.Attribution('© National parks / geo.admin.ch')], + crossOrigin: null, + params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, + projection: epsg21781, + extent: extent }) }) ]); var map = new ol.Map({ - center: new ol.Coordinate(600000, 200000), + center: new ol.Coordinate(660000, 190000), projection: epsg21781, layers: layers, target: 'map', - zoom: 8 + zoom: 9 }); From e672083027a1cf41523f3e8e2ceddbfaa80d31e3 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sun, 28 Oct 2012 23:59:36 +0100 Subject: [PATCH 08/12] Indentation and line break fixes --- examples/wms-custom-proj.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 270b1423e9..9c5f8e9351 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -16,15 +16,16 @@ if (goog.DEBUG) { var extent = new ol.Extent(420000, 30000, 900000, 350000); var epsg21781 = new ol.Projection('EPSG:21781', - ol.ProjectionUnits.METERS, - extent -); + ol.ProjectionUnits.METERS, extent); var layers = new ol.Collection([ new ol.layer.TileLayer({ source: new ol.source.TiledWMS({ url: 'http://wms.geo.admin.ch/?', - attributions: [new ol.Attribution('© Pixelmap 1:1000000 / geo.admin.ch')], + attributions: [new ol.Attribution( + '© ' + + '' + + 'Pixelmap 1:1000000 / geo.admin.ch')], crossOrigin: null, params: {'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale'}, projection: epsg21781, @@ -34,7 +35,10 @@ var layers = new ol.Collection([ new ol.layer.TileLayer({ source: new ol.source.TiledWMS({ url: 'http://wms.geo.admin.ch/?', - attributions: [new ol.Attribution('© National parks / geo.admin.ch')], + attributions: [new ol.Attribution( + '© ' + + '' + + 'National parks / geo.admin.ch')], crossOrigin: null, params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, projection: epsg21781, From 0c77aacf33c5b977044da43a28c389e2a4420c4f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 29 Oct 2012 09:33:00 +0100 Subject: [PATCH 09/12] proj4js externs are not necessary --- examples/wms-custom-proj.html | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html index 0638842076..47846882f6 100644 --- a/examples/wms-custom-proj.html +++ b/examples/wms-custom-proj.html @@ -42,7 +42,6 @@
wms, tile, tilelayer, projection
- From b170fa3d16fb5fb6b07f224a96359a42b6c675d8 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 29 Oct 2012 09:34:53 +0100 Subject: [PATCH 10/12] Using DOM renderer; no custom extent for layers The server does not send CORS headers, so we cannot use the WebGL renderer. Since the layers use the projection's extent, it is not necessary to specify the extent. --- examples/wms-custom-proj.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 9c5f8e9351..357235d5c5 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -28,8 +28,7 @@ var layers = new ol.Collection([ 'Pixelmap 1:1000000 / geo.admin.ch')], crossOrigin: null, params: {'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale'}, - projection: epsg21781, - extent: extent + projection: epsg21781 }) }), new ol.layer.TileLayer({ @@ -41,13 +40,13 @@ var layers = new ol.Collection([ 'National parks / geo.admin.ch')], crossOrigin: null, params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, - projection: epsg21781, - extent: extent + projection: epsg21781 }) }) ]); var map = new ol.Map({ + renderer: ol.RendererHint.DOM, center: new ol.Coordinate(660000, 190000), projection: epsg21781, layers: layers, From 393bb367845f71ced899e208fb5af19f25c7efc4 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 29 Oct 2012 09:36:08 +0100 Subject: [PATCH 11/12] Removing standalone example --- examples/standalone/wms-standalone.html | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 examples/standalone/wms-standalone.html diff --git a/examples/standalone/wms-standalone.html b/examples/standalone/wms-standalone.html deleted file mode 100644 index 2544878635..0000000000 --- a/examples/standalone/wms-standalone.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - ol3 full-screen demo - - - -
- - - From e157d17ab70d3a7b58ec523ac780f06540991d76 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 29 Oct 2012 09:44:25 +0100 Subject: [PATCH 12/12] Addressing review comments regarding typeDef --- src/objectliterals.exports | 3 ++- src/ol/source/tiledwmssource.js | 16 ---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/objectliterals.exports b/src/objectliterals.exports index 1117bd1909..d3f7330bb6 100644 --- a/src/objectliterals.exports +++ b/src/objectliterals.exports @@ -61,9 +61,10 @@ @exportObjectLiteralProperty ol.source.BingMapsOptions.style ol.BingMapsStyle @exportObjectLiteral ol.source.TiledWMSOptions +@exportObjectLiteralProperty ol.source.TiledWMSOptions.attributions Array.|undefined @exportObjectLiteralProperty ol.source.TiledWMSOptions.params Object @exportObjectLiteralProperty ol.source.TiledWMSOptions.version string|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.crossOrigin string|undefined +@exportObjectLiteralProperty ol.source.TiledWMSOptions.crossOrigin null|string|undefined @exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined @exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined @exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined diff --git a/src/ol/source/tiledwmssource.js b/src/ol/source/tiledwmssource.js index 327fe92b06..37f9156928 100644 --- a/src/ol/source/tiledwmssource.js +++ b/src/ol/source/tiledwmssource.js @@ -1,7 +1,6 @@ // FIXME add minZoom support goog.provide('ol.source.TiledWMS'); -goog.provide('ol.source.TiledWMSOptions'); goog.require('goog.asserts'); goog.require('goog.object'); @@ -13,21 +12,6 @@ goog.require('ol.source.TileSource'); goog.require('ol.tilegrid.TileGrid'); -/** - * @typedef {{attributions: (Array.|undefined), - * params: Object, - * version: (string|undefined), - * crossOrigin: (null|string|undefined), - * extent: (ol.Extent|undefined), - * tileGrid: (ol.tilegrid.TileGrid|undefined), - * maxZoom: (number|undefined), - * projection: (ol.Projection|undefined), - * url: (string|undefined), - * urls: (Array.|undefined)}} - */ -ol.source.TiledWMSOptions; - - /** * @constructor