From 43ef0920c2d9bf006cd1d769d2391b9b75a92cf8 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Sun, 20 Nov 2011 23:47:37 -0500 Subject: [PATCH 001/112] Removing camelize method. --- lib/OpenLayers/BaseTypes.js | 22 ---------------------- lib/OpenLayers/BaseTypes/Element.js | 4 ++-- lib/OpenLayers/Control/OverviewMap.js | 6 +++--- lib/OpenLayers/Handler/Box.js | 8 ++++---- lib/OpenLayers/Popup.js | 8 ++++---- tests/BaseTypes.html | 27 --------------------------- tests/Handler/Box.html | 2 +- 7 files changed, 14 insertions(+), 63 deletions(-) diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js index 05b06b8d3d..f19a70d223 100644 --- a/lib/OpenLayers/BaseTypes.js +++ b/lib/OpenLayers/BaseTypes.js @@ -60,28 +60,6 @@ OpenLayers.String = { return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); }, - /** - * APIFunction: camelize - * Camel-case a hyphenated string. - * Ex. "chicken-head" becomes "chickenHead", and - * "-chicken-head" becomes "ChickenHead". - * - * Parameters: - * str - {String} The string to be camelized. The original is not modified. - * - * Returns: - * {String} The string, camelized - */ - camelize: function(str) { - var oStringList = str.split('-'); - var camelizedString = oStringList[0]; - for (var i=1, len=oStringList.length; i Date: Mon, 21 Nov 2011 15:42:46 -0500 Subject: [PATCH 002/112] Moving camelize and its tests to deprecated --- lib/deprecated.js | 24 ++++++++++++++++ tests/deprecated/BaseTypes.html | 40 ++++++++++++++++++++++++++ tests/deprecated/BaseTypes/String.html | 40 ++++++++++++++++++++++++++ tests/list-tests.html | 1 + 4 files changed, 105 insertions(+) create mode 100644 tests/deprecated/BaseTypes.html create mode 100644 tests/deprecated/BaseTypes/String.html diff --git a/lib/deprecated.js b/lib/deprecated.js index 23f0d976b8..ebe9725b30 100644 --- a/lib/deprecated.js +++ b/lib/deprecated.js @@ -85,6 +85,30 @@ OpenLayers.Util.clearArray = function(array) { array.length = 0; }; + +/** + * APIFunction: camelize + * Camel-case a hyphenated string. + * Ex. "chicken-head" becomes "chickenHead", and + * "-chicken-head" becomes "ChickenHead". + * + * Parameters: + * str - {String} The string to be camelized. The original is not modified. + * + * Returns: + * {String} The string, camelized + */ + +OpenLayers.String.camelize = function(str) { + var oStringList = str.split('-'); + var camelizedString = oStringList[0]; + for (var i=1, len=oStringList.length; i + + + + + + + + + + diff --git a/tests/deprecated/BaseTypes/String.html b/tests/deprecated/BaseTypes/String.html new file mode 100644 index 0000000000..b8a66b8574 --- /dev/null +++ b/tests/deprecated/BaseTypes/String.html @@ -0,0 +1,40 @@ + + + + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index adc9580f73..af7b6b29d6 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -226,6 +226,7 @@
  • deprecated/Ajax.html
  • deprecated/BaseTypes/Class.html
  • deprecated/BaseTypes/Element.html
  • +
  • deprecated/BaseTypes/String.html
  • deprecated/Control/MouseToolbar.html
  • deprecated/Layer/MapServer/Untiled.html
  • deprecated/Layer/MultiMap.html
  • From 1a1cb9fe4e1b70b3a09faa936122dc7d0d85697c Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 25 Jan 2012 16:25:36 +0100 Subject: [PATCH 003/112] Add OpenLayers/Spherical.js --- lib/OpenLayers/Spherical.js | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 lib/OpenLayers/Spherical.js diff --git a/lib/OpenLayers/Spherical.js b/lib/OpenLayers/Spherical.js new file mode 100644 index 0000000000..ed64c844f8 --- /dev/null +++ b/lib/OpenLayers/Spherical.js @@ -0,0 +1,59 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @see http://www.movable-type.co.uk/scripts/latlong.html + * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical + */ + + +/** + * Namespace: Spherical + */ +OpenLayers.Spherical = OpenLayers.Spherical || {}; + + +OpenLayers.Spherical.DEFAULT_RADIUS = 6378137; + + +/** + * APIFunction: computeDistanceBetween + * Computes the distance between two LonLats. + * + * Parameters: + * from - {} + * to - {} + * radius - {Float} + * + * Returns: + * {Float} The distance in meters. + */ +OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) { + var R = radius || OpenLayers.Spherical.DEFAULT_RADIUS; + var sinHalfDeltaLon = Math.sin(Math.PI * (to.lon - from.lon) / 360); + var sinHalfDeltaLat = Math.sin(Math.PI * (to.lat - from.lat) / 360); + var a = sinHalfDeltaLat * sinHalfDeltaLat + + sinHalfDeltaLon * sinHalfDeltaLon * Math.cos(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180); + return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); +}; + + +/** + * APIFunction: computeHeading + * Computes the heading from one LonLat to another LonLat. + * + * Parameters: + * from - {} + * to - {} + * + * Returns: + * {Float} The heading in degrees. + */ +OpenLayers.Spherical.computeHeading = function(from, to) { + var y = Math.sin(Math.PI * (from.lon - to.lon) / 180) * Math.cos(Math.PI * to.lat / 180); + var x = Math.cos(Math.PI * from.lat / 180) * Math.sin(Math.PI * to.lat / 180) - + Math.sin(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180) * Math.cos(Math.PI * (from.lon - to.lon) / 180); + return 180 * Math.atan2(y, x) / Math.PI; +}; From ef85f43d21e58f7a8d840e091097b0e10dffa82c Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 26 Jan 2012 01:24:11 +0100 Subject: [PATCH 004/112] A tile queue that can be aborted. This saves server requests, and because we use OpenLayers.Animation, setting img.src on a tile should not freeze iOS any more, so we can hopefully get rid of scheduleMoveGriddedTiles. --- examples/mobile-wmts-vienna.html | 3 +- examples/mobile-wmts-vienna.js | 2 - lib/OpenLayers/Layer/Grid.js | 274 ++++++++---------- tests/Layer/ArcGIS93Rest.html | 5 + tests/Layer/Grid.html | 19 +- tests/Layer/MapServer.html | 5 + tests/Layer/WMS.html | 5 + tests/Layer/WrapDateLine.html | 5 + tests/deprecated/Layer/MapServer/Untiled.html | 5 + 9 files changed, 165 insertions(+), 158 deletions(-) diff --git a/examples/mobile-wmts-vienna.html b/examples/mobile-wmts-vienna.html index 280f66ce74..11e1ee995e 100644 --- a/examples/mobile-wmts-vienna.html +++ b/examples/mobile-wmts-vienna.html @@ -6,8 +6,8 @@ + -

    City of Vienna WMTS for Desktop and Mobile Devices

    @@ -22,6 +22,7 @@ functionality and uses the Geolocate control.

    + diff --git a/examples/mobile-wmts-vienna.js b/examples/mobile-wmts-vienna.js index 692b86afe2..4257f7429b 100644 --- a/examples/mobile-wmts-vienna.js +++ b/examples/mobile-wmts-vienna.js @@ -152,7 +152,6 @@ var map; var defaults = { requestEncoding: "REST", matrixSet: "google3857", - buffer: 4, attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' }; var doc = request.responseText, @@ -182,7 +181,6 @@ var map; requestEncoding: "REST", matrixSet: "google3857", tileFullExtent: extent, - buffer: 4, attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' }; fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 0a1c2d8220..1e5b0c9d89 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -97,13 +97,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { */ numLoadingTiles: 0, - /** - * APIProperty: tileLoadingDelay - * {Integer} - Number of milliseconds before we shift and load - * tiles. Default is 100. - */ - tileLoadingDelay: 100, - /** * Property: serverResolutions * {Array(Number}} This property is documented in subclasses as @@ -112,10 +105,16 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { serverResolutions: null, /** - * Property: timerId - * {Number} - The id of the tileLoadingDelay timer. + * Property: tileLoopId + * {Number} - The id of the animation. */ - timerId: null, + tileLoopId: null, + + /** + * Property: tileOperations + * {Array(Object)} Pending tile operations. + */ + tileOperations: null, /** * Property: backBuffer @@ -152,7 +151,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * flash effects caused by tile animation. */ backBufferTimerId: null, - + /** * Register a listener for a particular event with the following syntax: * (code) @@ -187,10 +186,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this, arguments); this.grid = []; - - this._moveGriddedTiles = OpenLayers.Function.bind( - this.moveGriddedTiles, this - ); + this.tileOperations = []; }, /** @@ -201,10 +197,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * map - {} The map. */ removeMap: function(map) { - if(this.timerId != null) { - window.clearTimeout(this.timerId); - this.timerId = null; - } + this.abortTileOperations(); if(this.backBufferTimerId !== null) { window.clearTimeout(this.backBufferTimerId); this.backBufferTimerId = null; @@ -230,20 +223,20 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * destroy() on each of them to kill circular references */ clearGrid:function() { + this.abortTileOperations(); if (this.grid) { for(var iRow=0, len=this.grid.length; iRow} + */ + destroyTile: function(tile) { + for (var i=this.tileOperations.length-1; i>=0; --i) { + if (this.tileOperations[i].scope === tile) { + this.tileOperations.splice(i, 1); + } + } + this.removeTileMonitoringHooks(tile); + tile.destroy(); + }, /** * Method: getServerResolution @@ -565,24 +619,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { */ moveByPx: function(dx, dy) { if (!this.singleTile) { - this.scheduleMoveGriddedTiles(); + this.moveGriddedTiles(); } }, - /** - * Method: scheduleMoveGriddedTiles - * Schedule the move of tiles. - */ - scheduleMoveGriddedTiles: function() { - if (this.timerId != null) { - window.clearTimeout(this.timerId); - } - this.timerId = window.setTimeout( - this._moveGriddedTiles, - this.tileLoadingDelay - ); - }, - /** * APIMethod: setTileSize * Check if we are in singleTile mode and if so, set the size as a ratio @@ -776,7 +816,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { var layerContainerDivLeft = parseInt(this.map.layerContainerDiv.style.left); var layerContainerDivTop = parseInt(this.map.layerContainerDiv.style.top); - + var tileData = [], center = this.map.getCenter(); do { var row = this.grid[rowidx++]; if (!row) { @@ -810,6 +850,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { } else { tile.moveTo(tileBounds, px, false); } + var tileCenter = tileBounds.getCenterLonLat(); + tileData.push({ + tile: tile, + distance: Math.pow(tileCenter.lon - center.lon, 2) + + Math.pow(tileCenter.lat - center.lat, 2) + }); tileoffsetlon += tilelon; tileoffsetx += this.tileSize.w; @@ -828,7 +874,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { this.gridResolution = this.getServerResolution(); //now actually draw the tiles - this.spiralTileLoad(); + tileData.sort(function(a, b) { + return a.distance - b.distance; + }); + for (var i=0, ii=tileData.length; i= 0) && - (testCell < this.grid[0].length) && (testCell >= 0)) { - tile = this.grid[testRow][testCell]; - } - - if ((tile != null) && (!tile.queued)) { - //add tile to beginning of queue, mark it as queued. - tileQueue.unshift(tile); - tile.queued = true; - - //restart the directions counter and take on the new coords - directionsTried = 0; - iRow = testRow; - iCell = testCell; - } else { - //need to try to load a tile in a different direction - direction = (direction + 1) % 4; - directionsTried++; - } - } - - // now we go through and draw the tiles in forward order - for(var i=0, len=tileQueue.length; i} The added OpenLayers.Tile */ addTile: function(bounds, position) { + var that = this; + var options = OpenLayers.Util.extend({ + draw: function() { + // clear immediately + this.clear(); + // draw in an animation frame - can be aborted + that.addTileOperation(that.tileClass.prototype.draw, this); + } + }, this.tileOptions); return new this.tileClass(this, position, bounds, null, - this.tileSize, this.tileOptions); + this.tileSize, options); }, /** @@ -993,37 +980,32 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * Method: moveGriddedTiles */ moveGriddedTiles: function() { - var shifted = true; var buffer = this.buffer || 1; var scale = this.getResolutionScale(); - var tlLayer = this.grid[0][0].position.clone(); - tlLayer.x *= scale; - tlLayer.y *= scale; - tlLayer = tlLayer.add(parseInt(this.div.style.left, 10), - parseInt(this.div.style.top, 10)); - var offsetX = parseInt(this.map.layerContainerDiv.style.left); - var offsetY = parseInt(this.map.layerContainerDiv.style.top); - var tlViewPort = tlLayer.add(offsetX, offsetY); - var tileSize = { - w: this.tileSize.w * scale, - h: this.tileSize.h * scale - }; - if (tlViewPort.x > -tileSize.w * (buffer - 1)) { - this.shiftColumn(true); - } else if (tlViewPort.x < -tileSize.w * buffer) { - this.shiftColumn(false); - } else if (tlViewPort.y > -tileSize.h * (buffer - 1)) { - this.shiftRow(true); - } else if (tlViewPort.y < -tileSize.h * buffer) { - this.shiftRow(false); - } else { - shifted = false; - } - if (shifted) { - // we may have other row or columns to shift, schedule it - // with a setTimeout, to give the user a chance to sneak - // in moveTo's - this.timerId = window.setTimeout(this._moveGriddedTiles, 0); + while(true) { + var tlLayer = this.grid[0][0].position.clone(); + tlLayer.x *= scale; + tlLayer.y *= scale; + tlLayer = tlLayer.add(parseInt(this.div.style.left, 10), + parseInt(this.div.style.top, 10)); + var offsetX = parseInt(this.map.layerContainerDiv.style.left); + var offsetY = parseInt(this.map.layerContainerDiv.style.top); + var tlViewPort = tlLayer.add(offsetX, offsetY); + var tileSize = { + w: this.tileSize.w * scale, + h: this.tileSize.h * scale + }; + if (tlViewPort.x > -tileSize.w * (buffer - 1)) { + this.shiftColumn(true); + } else if (tlViewPort.x < -tileSize.w * buffer) { + this.shiftColumn(false); + } else if (tlViewPort.y > -tileSize.h * (buffer - 1)) { + this.shiftRow(true); + } else if (tlViewPort.y < -tileSize.h * buffer) { + this.shiftRow(false); + } else { + break; + } } }, @@ -1113,8 +1095,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { var row = this.grid.pop(); for (var i=0, l=row.length; iwindow.alert = oldAlert; From 14624cb8150005815924fae8aedb6b2d520d05e2 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 18 Jan 2012 14:03:25 +0100 Subject: [PATCH 016/112] New OpenLayers.CANVAS_SUPPORTED constant --- lib/OpenLayers/Renderer/Canvas.js | 3 +-- lib/OpenLayers/Util.js | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index 4edaf92a7b..daf9e19e35 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -110,8 +110,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { * {Boolean} Whether or not the browser supports the renderer class */ supported: function() { - var canvas = document.createElement("canvas"); - return !!canvas.getContext; + return OpenLayers.CANVAS_SUPPORTED; }, /** diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 2458a54b67..5ca8c35201 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -1435,6 +1435,15 @@ OpenLayers.IS_GECKO = (function() { return ua.indexOf("webkit") == -1 && ua.indexOf("gecko") != -1; })(); +/** + * Constant: CANVAS_SUPPORTED + * {Boolean} True if canvas 2d is supported. + */ +OpenLayers.CANVAS_SUPPORTED = (function() { + var elem = document.createElement('canvas'); + return !!(elem.getContext && elem.getContext('2d')); +})(); + /** * Constant: BROWSER_NAME * {String} From 57ae02f3812280d25f521f4f4ba9dc1e358e4a79 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 18 Jan 2012 14:06:01 +0100 Subject: [PATCH 017/112] Set image.crossOrigin attribute in OpenLayers.Tile.Image --- lib/OpenLayers/Tile/Image.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 23a7c9668a..28dab38773 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -297,6 +297,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { } else { OpenLayers.Event.observe(img, "load", load); OpenLayers.Event.observe(img, "error", load); + img.crossOrigin = null; img.src = this.blankImageUrl; } } @@ -314,6 +315,8 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { img.style.visibility = 'hidden'; img.style.opacity = 0; if (url) { + // don't set crossOrigin if the url is a data URL + img.crossOrigin = url.indexOf('data:') === 0 ? null : ''; img.src = url; } }, From b4ac0af5d86e51f9c317e7546a0e3865b1f06417 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 18 Jan 2012 14:06:22 +0100 Subject: [PATCH 018/112] New OpenLayers.Tile.Image.getCanvasContext function --- lib/OpenLayers/Tile/Image.js | 32 ++++++++++++++++++++++++++++++++ tests/Tile/Image.html | 25 +++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 28dab38773..7baf8bf98e 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -81,6 +81,13 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { */ maxGetUrlLength: null, + /** + * Property: canvasContext + * {CanvasRenderingContext2D} A canvas context associated with + * the tile image. + */ + canvasContext: null, + /** TBD 3.0 - reorder the parameters to the init function to remove * URL. the getUrl() function on the layer gets called on * each draw(), so no need to specify it here. @@ -216,6 +223,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { } OpenLayers.Element.removeClass(img, "olImageLoadError"); } + this.canvasContext = null; }, /** @@ -369,6 +377,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { img.style.opacity = this.layer.opacity; this.isLoading = false; + this.canvasContext = null; this.events.triggerEvent("loadend"); // IE<7 needs a reflow when the tiles are loaded because of the @@ -409,6 +418,29 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { } }, + /** + * APIMethod: getCanvasContext + * Returns a canvas context associated with the tile image (with + * the image drawn on it). + * Returns undefined if the browser does not support canvas, if + * the tile has no image or if it's currently loading. + * + * Returns: + * {Boolean} + */ + getCanvasContext: function() { + if (OpenLayers.CANVAS_SUPPORTED && this.imgDiv && !this.isLoading) { + if (!this.canvasContext) { + var canvas = document.createElement("canvas"); + canvas.width = this.size.w; + canvas.height = this.size.h; + this.canvasContext = canvas.getContext("2d"); + this.canvasContext.drawImage(this.imgDiv, 0, 0); + } + return this.canvasContext; + } + }, + CLASS_NAME: "OpenLayers.Tile.Image" }); diff --git a/tests/Tile/Image.html b/tests/Tile/Image.html index 0b42064265..f202f6dfe1 100644 --- a/tests/Tile/Image.html +++ b/tests/Tile/Image.html @@ -399,6 +399,31 @@ map.destroy(); }); } + + function test_getCanvasContext(t) { + if (!OpenLayers.CANVAS_SUPPORTED) { + t.plan(0); + } else { + t.plan(1); + + var map = new OpenLayers.Map('map'); + var layer = new OpenLayers.Layer.WMS("OpenLayers WMS", + "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}); + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(0, 0), 5); + + t.delay_call(5, function() { + var tile = layer.grid[0][0]; + if (tile.isLoading) { + t.ok(false, "test_getCanvasContext timeout"); + } else { + t.ok(tile.getCanvasContext() instanceof CanvasRenderingContext2D, + "getCanvasContext() returns CanvasRenderingContext2D instance"); + } + map.destroy(); + }); + } + } From e9097ce066b920269645b01e04708ad6092da813 Mon Sep 17 00:00:00 2001 From: fredj Date: Thu, 19 Jan 2012 16:12:52 +0100 Subject: [PATCH 019/112] More APIdoc for OpenLayers.Tile.Image.getCanvasContext --- lib/OpenLayers/Tile/Image.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 7baf8bf98e..690e494ed4 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -425,6 +425,15 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { * Returns undefined if the browser does not support canvas, if * the tile has no image or if it's currently loading. * + * The function returns a canvas context instance but the + * underlying canvas is still available in the 'canvas' property: + * (code) + * var context = tile.getCanvasContext(); + * if (context) { + * var data = context.canvas.toDataURL('image/jpeg'); + * } + * (end) + * * Returns: * {Boolean} */ From b34f272fa702ee4028fbd6e102973609e4a0bea7 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 20 Jan 2012 12:00:20 +0100 Subject: [PATCH 020/112] Optimize the string test --- lib/OpenLayers/Tile/Image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 690e494ed4..d9ee4e76e9 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -324,7 +324,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { img.style.opacity = 0; if (url) { // don't set crossOrigin if the url is a data URL - img.crossOrigin = url.indexOf('data:') === 0 ? null : ''; + img.crossOrigin = url.substr(0, 5) === 'data:' ? null : ''; img.src = url; } }, From b1cc0c1b9dd6df83569b6d2b6a26386cf76b185c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 9 Feb 2012 16:58:36 +0100 Subject: [PATCH 021/112] make OpenLayers.js auto-load Spherical.js --- lib/OpenLayers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 3ffa1b6a84..78b35da424 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -348,7 +348,8 @@ "OpenLayers/Symbolizer/Text.js", "OpenLayers/Symbolizer/Raster.js", "OpenLayers/Lang.js", - "OpenLayers/Lang/en.js" + "OpenLayers/Lang/en.js", + "OpenLayers/Spherical.js" ]; // etc. } From 4cc1bf18993486d0bde9a6849994b639c064bd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 9 Feb 2012 16:59:02 +0100 Subject: [PATCH 022/112] better docs for the Spherical namespace --- lib/OpenLayers/Spherical.js | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/OpenLayers/Spherical.js b/lib/OpenLayers/Spherical.js index ed64c844f8..b19edc8939 100644 --- a/lib/OpenLayers/Spherical.js +++ b/lib/OpenLayers/Spherical.js @@ -3,29 +3,32 @@ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the * full text of the license. */ -/** - * @see http://www.movable-type.co.uk/scripts/latlong.html - * @see http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical - */ - - /** * Namespace: Spherical + * The OpenLayers.Spherical namespace includes utility functions for + * calculations on the basis of a spherical earth (ignoring ellipsoidal + * effects), which is accurate enough for most purposes. + * + * Relevant links: + * * http://www.movable-type.co.uk/scripts/latlong.html + * * http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical */ + OpenLayers.Spherical = OpenLayers.Spherical || {}; - OpenLayers.Spherical.DEFAULT_RADIUS = 6378137; - /** * APIFunction: computeDistanceBetween * Computes the distance between two LonLats. * * Parameters: - * from - {} - * to - {} - * radius - {Float} + * from - {} or {Object} Starting point. A LonLat or + * a JavaScript litteral with lon lat properties. + * to - {} or {Object} Ending point. A LonLat or a + * JavaScript litteral with lon lat properties. + * radius - {Float} The radius. Optional. Defaults to the earth's + * radius, i.e. 6378137 meters. * * Returns: * {Float} The distance in meters. @@ -45,8 +48,10 @@ OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) { * Computes the heading from one LonLat to another LonLat. * * Parameters: - * from - {} - * to - {} + * from - {} or {Object} Starting point. A LonLat or + * a JavaScript litteral with lon lat properties. + * to - {} or {Object} Ending point. A LonLat or a + * JavaScript litteral with lon lat properties. * * Returns: * {Float} The heading in degrees. From 50629f3e50793233419c25cf4695751621151d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 9 Feb 2012 16:59:20 +0100 Subject: [PATCH 023/112] add Spherical to the API doc menu --- doc_config/Menu.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc_config/Menu.txt b/doc_config/Menu.txt index 7d685cb73c..1a941749ae 100644 --- a/doc_config/Menu.txt +++ b/doc_config/Menu.txt @@ -458,6 +458,7 @@ Group: OpenLayers { File: Tween (no auto-title, OpenLayers/Tween.js) File: Util (no auto-title, OpenLayers/Util.js) + File: Spherical (no auto-title, OpenLayers/Spherical.js) File: Deprecated (no auto-title, deprecated.js) } # Group: OpenLayers From 3c3092985808aca0b27ed20246b6aeced68bcd6f Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 10 Feb 2012 09:42:08 +0100 Subject: [PATCH 024/112] Correct spelling --- lib/OpenLayers/Spherical.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Spherical.js b/lib/OpenLayers/Spherical.js index b19edc8939..2fcaf44756 100644 --- a/lib/OpenLayers/Spherical.js +++ b/lib/OpenLayers/Spherical.js @@ -24,9 +24,9 @@ OpenLayers.Spherical.DEFAULT_RADIUS = 6378137; * * Parameters: * from - {} or {Object} Starting point. A LonLat or - * a JavaScript litteral with lon lat properties. + * a JavaScript literal with lon lat properties. * to - {} or {Object} Ending point. A LonLat or a - * JavaScript litteral with lon lat properties. + * JavaScript literal with lon lat properties. * radius - {Float} The radius. Optional. Defaults to the earth's * radius, i.e. 6378137 meters. * @@ -49,9 +49,9 @@ OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) { * * Parameters: * from - {} or {Object} Starting point. A LonLat or - * a JavaScript litteral with lon lat properties. + * a JavaScript literal with lon lat properties. * to - {} or {Object} Ending point. A LonLat or a - * JavaScript litteral with lon lat properties. + * JavaScript literal with lon lat properties. * * Returns: * {Float} The heading in degrees. From 8d6c9ef1eee650149e0b764fab140c752cb29d9a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 10 Feb 2012 09:42:52 +0100 Subject: [PATCH 025/112] Correct documentation --- lib/OpenLayers/Spherical.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/OpenLayers/Spherical.js b/lib/OpenLayers/Spherical.js index 2fcaf44756..4a8956a5b7 100644 --- a/lib/OpenLayers/Spherical.js +++ b/lib/OpenLayers/Spherical.js @@ -27,8 +27,7 @@ OpenLayers.Spherical.DEFAULT_RADIUS = 6378137; * a JavaScript literal with lon lat properties. * to - {} or {Object} Ending point. A LonLat or a * JavaScript literal with lon lat properties. - * radius - {Float} The radius. Optional. Defaults to the earth's - * radius, i.e. 6378137 meters. + * radius - {Float} The radius. Optional. Defaults to 6378137 meters. * * Returns: * {Float} The distance in meters. From 342d624616efd12e67d42cf52ad24ee00a853d7f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 10 Feb 2012 12:50:13 +0100 Subject: [PATCH 026/112] New crossOriginKeyword property. Set to 'anonymous' for Layer.OSM and Layer.Bing, and not used by default for other layers. --- lib/OpenLayers/Layer/Bing.js | 3 +++ lib/OpenLayers/Layer/OSM.js | 6 ++++++ lib/OpenLayers/Tile/Image.js | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index a33202a724..703c2b5e43 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -107,6 +107,9 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { var newArgs = [name, null, options]; OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs); + this.tileOptions = OpenLayers.Util.extend({ + crossOriginKeyword: 'anonymous' + }, this.options.tileOptions); this.loadMetadata(); }, diff --git a/lib/OpenLayers/Layer/OSM.js b/lib/OpenLayers/Layer/OSM.js index 320c4540ef..69f411756b 100644 --- a/lib/OpenLayers/Layer/OSM.js +++ b/lib/OpenLayers/Layer/OSM.js @@ -73,6 +73,12 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { * layer option can be set in this object (e.g. * ). */ + initialize: function(name, url, options) { + OpenLayers.Layer.XYZ.prototype.initialize.apply(this, arguments); + this.tileOptions = OpenLayers.Util.extend({ + crossOriginKeyword: 'anonymous' + }, this.options && this.options.tileOptions); + }, /** * Method: clone diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index d9ee4e76e9..309976a22f 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -87,6 +87,16 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { * the tile image. */ canvasContext: null, + + /** + * APIProperty: crossOriginKeyword + * The value of the crossorigin keyword to use when loading images. This is + * only relevant when using for tiles from remote + * origins and should be set to either 'anonymous' or 'use-credentials' + * for servers that send Access-Control-Allow-Origin headers with their + * tiles. + */ + crossOriginKeyword: null, /** TBD 3.0 - reorder the parameters to the init function to remove * URL. the getUrl() function on the layer gets called on @@ -305,7 +315,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { } else { OpenLayers.Event.observe(img, "load", load); OpenLayers.Event.observe(img, "error", load); - img.crossOrigin = null; + delete img.crossOrigin; img.src = this.blankImageUrl; } } @@ -324,7 +334,9 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { img.style.opacity = 0; if (url) { // don't set crossOrigin if the url is a data URL - img.crossOrigin = url.substr(0, 5) === 'data:' ? null : ''; + if (this.crossOriginKeyword && url.substr(0, 5 !== 'data:')) { + img.crossOrigin = this.crossOriginKeyword; + } img.src = url; } }, From cebc7e60de1a13cde910c7648d707c926c38d6fe Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 10 Feb 2012 13:03:18 +0100 Subject: [PATCH 027/112] Don't displayOutsideMaxExtent when wrapDateLine is set. p=scaddenp, r=me (closes http://trac.osgeo.org/openlayers/ticket/3616) --- lib/OpenLayers/Layer.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 54c97f0d13..f7614db4bc 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -361,10 +361,6 @@ OpenLayers.Layer = OpenLayers.Class({ } } - - if (this.wrapDateLine) { - this.displayOutsideMaxExtent = true; - } }, /** From f8099e9ab10e60209f4bb739f25c204c10374947 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 10 Feb 2012 13:46:13 +0100 Subject: [PATCH 028/112] Unset crossOrigin when setting blankImageUrl to the image. Tested with FF 10, Chrome 16 and 18. --- lib/OpenLayers/Tile/Image.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 309976a22f..dfbf1bda43 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -315,7 +315,9 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { } else { OpenLayers.Event.observe(img, "load", load); OpenLayers.Event.observe(img, "error", load); - delete img.crossOrigin; + if (img.crossOrigin) { + img.crossOrigin = null; + } img.src = this.blankImageUrl; } } From 334f83ff850da0bf47aa6b66c7e1ee8ce9d43801 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 10 Feb 2012 14:15:26 +0100 Subject: [PATCH 029/112] Updated tests for cebc7e60de1a13cde910c7648d707c926c38d6fe. See http://trac.osgeo.org/openlayers/ticket/3616. --- tests/Layer/WrapDateLine.html | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/Layer/WrapDateLine.html b/tests/Layer/WrapDateLine.html index 15e9d5771a..ca993b9011 100644 --- a/tests/Layer/WrapDateLine.html +++ b/tests/Layer/WrapDateLine.html @@ -127,7 +127,7 @@ } function test_Layer_WrapDateLine_WMS (t) { - t.plan( 3 ); + t.plan( 4 ); var url = "http://octo.metacarta.com/cgi-bin/mapserv"; layer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true,encodeBBOX:true, buffer: 2}); @@ -135,13 +135,14 @@ m.addLayer(layer); m.zoomToMaxExtent(); t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world."); - t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat"); - t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all."); + t.eq(layer.grid[3][1].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180%2C-90%2C0%2C90&WIDTH=256&HEIGHT=256", "cell [3][1] is wrapped around the world."); + t.eq(layer.grid[3][2].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][2] is not wrapped at all."); + t.ok(layer.grid[0][2].url == null, "no latitudinal wrapping - tile not loaded if outside maxExtent"); m.destroy(); } function test_Layer_WrapDateLine_KaMap (t) { - t.plan( 3 ); + t.plan( 4 ); var layer = new OpenLayers.Layer.KaMap( "Blue Marble NG", "http://www.openlayers.org/world/index.php", @@ -150,13 +151,14 @@ var m = new OpenLayers.Map('map', {adjustZoom: function(z) {return z;}}); m.addLayer(layer); m.zoomToMaxExtent(); - t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=221471921.25", "grid[0][0] kamap is okay"); - t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=221471921.25", "grid[0][3] kamap is okay"); - t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=221471921.25", "grid[3][0] is okay"); + t.eq(layer.grid[5][7].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][7] kamap is okay"); + t.eq(layer.grid[5][6].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=0&s=221471921.25", "grid[5][6] kamap is okay"); + t.eq(layer.grid[5][5].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=0&l=-256&s=221471921.25", "grid[5][5] is okay"); + t.ok(layer.grid[7][6].url == null, "no latitudinal wrapping - tile not loaded if outside maxExtent"); m.destroy(); } function test_Layer_WrapDateLine_WMS_Overlay (t) { - t.plan( 3 ); + t.plan( 4 ); var url = "http://octo.metacarta.com/cgi-bin/mapserv"; baselayer = new OpenLayers.Layer.WMS(name, url, params, {'wrapDateLine':true, buffer: 2}); var layer = new OpenLayers.Layer.WMS( "DM Solutions Demo", @@ -168,9 +170,10 @@ var m = new OpenLayers.Map('map', {adjustZoom: function(z) {return z;}}); m.addLayers([baselayer,layer]); m.zoomToMaxExtent(); - t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay"); - t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay"); - t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay"); + t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay"); + t.eq(layer.grid[3][1].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-180%2C-90%2C0%2C90&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay"); + t.eq(layer.grid[3][2].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay"); + t.ok(layer.grid[0][2].url == null, "no latitudinal wrapping - tile not loaded if outside maxExtent"); m.destroy(); } From b17c7b69f25ce0ddbaf720f91b7d48328b005831 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 10 Feb 2012 15:46:45 +0100 Subject: [PATCH 030/112] Adding comment about GMaps API version. Closes http://trac.osgeo.org/openlayers/ticket/2984. --- lib/OpenLayers/Layer/Google/v3.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/Google/v3.js b/lib/OpenLayers/Layer/Google/v3.js index bf8618130a..b99d93bffc 100644 --- a/lib/OpenLayers/Layer/Google/v3.js +++ b/lib/OpenLayers/Layer/Google/v3.js @@ -11,10 +11,15 @@ /** * Constant: OpenLayers.Layer.Google.v3 * - * Mixin providing functionality specific to the Google Maps API v3. Note that - * this layer configures the google.maps.map object with the "disableDefaultUI" - * option set to true. Using UI controls that the Google Maps API provides is - * not supported by the OpenLayers API. + * Mixin providing functionality specific to the Google Maps API v3 <= v3.6. + * Note that this layer configures the google.maps.map object with the + * "disableDefaultUI" option set to true. Using UI controls that the Google + * Maps API provides is not supported by the OpenLayers API. To use this layer, + * you must include the GMaps API (<= v3.6) in your html: + * + * (code) + * + * (end) */ OpenLayers.Layer.Google.v3 = { From 68a6c62f0b9880b98e54e09cf0daa99d6c42f2d5 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 10 Feb 2012 18:03:22 +0100 Subject: [PATCH 031/112] Documenting tileOptions defaults. --- lib/OpenLayers/Layer/Bing.js | 10 ++++++++++ lib/OpenLayers/Layer/OSM.js | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index 703c2b5e43..f593551ef7 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -74,6 +74,16 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { */ metadataParams: null, + /** APIProperty: tileOptions + * {Object} optional configuration options for instances + * created by this Layer. Default is + * + * (code) + * {crossOriginKeyword: 'anonymous'} + * (end) + */ + tileOptions: null, + /** * Constructor: OpenLayers.Layer.Bing * Create a new Bing layer. diff --git a/lib/OpenLayers/Layer/OSM.js b/lib/OpenLayers/Layer/OSM.js index 69f411756b..04e7b04454 100644 --- a/lib/OpenLayers/Layer/OSM.js +++ b/lib/OpenLayers/Layer/OSM.js @@ -63,6 +63,25 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { */ wrapDateLine: true, + /** APIProperty: tileOptions + * {Object} optional configuration options for instances + * created by this Layer. Default is + * + * (code) + * {crossOriginKeyword: 'anonymous'} + * (end) + * + * When using OSM tilesets other than the default ones, it may be + * necessary to set this to + * + * (code) + * {crossOriginKeyword: null} + * (end) + * + * if the server does not send Access-Control-Allow-Origin headers. + */ + tileOptions: null, + /** * Constructor: OpenLayers.Layer.OSM * From c6312b613ba3e4ce6fe18d1fa9c516eb55e812fc Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Fri, 10 Feb 2012 23:55:51 +0100 Subject: [PATCH 032/112] correct a typo in release notes CSS example --- notes/2.12.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notes/2.12.md b/notes/2.12.md index 2182009676..d312132ec6 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -62,7 +62,7 @@ We are deprecating the Rico classes/objects in OpenLayers. This has the followin The `roundedCorner` option of `Control.LayerSwitcher` is deprecated, and it now defaults to `false`. Setting it to true results in deprecation messages being output on the console. If you still want to set `roundedCorner` to `true` (you should not!) you need to make sure that the Rico/Corner.js and Rico/Color.js scripts are loaded in the page. This can be ensured by adding Rico/Corner.js in the build profile. The controls.html example demonstrates how to use `border-radius` to round corners of a layer switcher: - olControlLayerSwitcher .layersDiv { + .olControlLayerSwitcher .layersDiv { border-radius: 10px 0 0 10px; } From ca2c3526b3f593646b74db442a6b4af7e618e6db Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 11 Feb 2012 11:16:21 +0100 Subject: [PATCH 033/112] Adding notes about the crossOriginKeyword tile option for Layer.OSM and Layer.Bing. --- notes/2.12.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notes/2.12.md b/notes/2.12.md index d312132ec6..3aa2db8eda 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -76,10 +76,14 @@ The base `OpenLayers.Geometry` class no longer depends on `OpenLayers.Format.WKT Without the WKT format included (by default), the `OpenLayers.Geometry::toString` method now returns "[object Object]." Previously, it returned the Well-Known Text representation of the geometry. To maintain the previous behavior, include the OpenLayers/Format/WKT.js file in your build. -## OSM Layer +## OSM and Bing Layers `Layer.OSM` is now defined in its own script file, namely `OpenLayers/Layer/OSM.js`. So people using `Layer.OSM` should now include `OpenLayers/Layer/OSM.js`, as opposed to `OpenLayers/Layer/XYZ.js`, in their OpenLayers builds. (See https://github.com/openlayers/openlayers/issues/138) +The `OpenLayers.Tile.Image` class now has a method to get a canvas context for processing tiles. Since both OSM and Bing set Access-Control-Allow-Origin headers for their tiles, it is possible to manipulate a canvas that these tiles were rendered to even if the tiles come from a remote origin. Especially when working with custom OSM tilesets from servers that do not send Access-Control-Allow-Origin headers, it is now necessary to configure the layer with + + tileOptions: {crossOriginKeyword: null} + ## Projection & SphericalMercator In previous releases, coordinate transforms between EPSG:4326 and EPSG:900913 were defined in the SphericalMercator.js script. In 2.12, these default transforms are included in the Projection.js script. The Projection.js script is included as a dependency in builds with any layer types, so no special build configuration is necessary to get the web mercator transforms. From 6385be7ffe56abd3b9722e4c1407ddac3174b941 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 11 Feb 2012 12:34:40 +0100 Subject: [PATCH 034/112] Template for the Attribution control. This allows to add map specific copyright, or copyright required for tools like geocoders that are used in the context of the map. --- lib/OpenLayers/Control/Attribution.js | 12 +++++++++++- tests/Control/Attribution.html | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Control/Attribution.js b/lib/OpenLayers/Control/Attribution.js index 621f6be77d..25aa069280 100644 --- a/lib/OpenLayers/Control/Attribution.js +++ b/lib/OpenLayers/Control/Attribution.js @@ -24,6 +24,14 @@ OpenLayers.Control.Attribution = */ separator: ", ", + /** + * APIProperty: template + * {String} Template for the attribution. This has to include the substring + * "${layers}", which will be replaced by the layer specific + * attributions, separated by . The default is "${layers}". + */ + template: "${layers}", + /** * Constructor: OpenLayers.Control.Attribution * @@ -86,7 +94,9 @@ OpenLayers.Control.Attribution = } } } - this.div.innerHTML = attributions.join(this.separator); + this.div.innerHTML = OpenLayers.String.format(this.template, { + layers: attributions.join(this.separator) + }); } }, diff --git a/tests/Control/Attribution.html b/tests/Control/Attribution.html index c1c1ef228b..04b85cfdb3 100644 --- a/tests/Control/Attribution.html +++ b/tests/Control/Attribution.html @@ -30,8 +30,9 @@ map.addLayer(new OpenLayers.Layer("name", {'attribution':'My layer 2!'})); t.eq(control.div.innerHTML, 'My layer!, My layer 2!', "Attribution correct with two layers."); control.separator = '|'; + control.template = "Map Copyright (c) 2012 by Foo Bar; ${layers}"; map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 3!'})); - t.eq(control.div.innerHTML, 'My layer!|My layer 2!|My layer 3!', "Attribution correct with three layers and diff seperator."); + t.eq(control.div.innerHTML, 'Map Copyright (c) 2012 by Foo Bar; My layer!|My layer 2!|My layer 3!', "Attribution correct with three layers and diff seperator."); } From 718679a025b7cb0f1022d4ca9f29d35ea6ce9b01 Mon Sep 17 00:00:00 2001 From: oleg-poligon Date: Sun, 12 Feb 2012 02:04:03 +0400 Subject: [PATCH 035/112] set GMaps API version to 3.6 in allOverlays Layer Example --- examples/google-v3-alloverlays.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/google-v3-alloverlays.html b/examples/google-v3-alloverlays.html index 10dcde4364..dac1d15f13 100644 --- a/examples/google-v3-alloverlays.html +++ b/examples/google-v3-alloverlays.html @@ -8,7 +8,7 @@ - + From 134f24480a9e6ebf0c71891e52a6b1d456ad1996 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Sun, 12 Feb 2012 21:56:41 +0100 Subject: [PATCH 036/112] Move the popup close box sizing to CSS --- lib/OpenLayers/Popup.js | 6 ++---- notes/2.12.md | 3 +++ theme/default/style.css | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Popup.js b/lib/OpenLayers/Popup.js index 36f666e73f..f6f6e65871 100644 --- a/lib/OpenLayers/Popup.js +++ b/lib/OpenLayers/Popup.js @@ -872,13 +872,11 @@ OpenLayers.Popup = OpenLayers.Class({ */ addCloseBox: function(callback) { - this.closeDiv = OpenLayers.Util.createDiv( - this.id + "_close", null, {w: 17, h: 17} - ); + this.closeDiv = OpenLayers.Util.createDiv(this.id + "_close"); this.closeDiv.className = "olPopupCloseBox"; // use the content div's css padding to determine if we should - // padd the close div + // pad the close div var contentDivPadding = this.getContentDivPadding(); this.closeDiv.style.right = contentDivPadding.right + "px"; diff --git a/notes/2.12.md b/notes/2.12.md index 3aa2db8eda..52a122b765 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -145,3 +145,6 @@ In addition, OpenLayers no longer modifies any native prototypes or objects by d * Function.prototype.bindAsEventListener * Event.stop +## Popup close box size + +The size of the close box is now configurable in CSS instead of the fixed 17x17px (`.olPopupCloseBox`) diff --git a/theme/default/style.css b/theme/default/style.css index c695689ff7..703eb961c2 100644 --- a/theme/default/style.css +++ b/theme/default/style.css @@ -259,6 +259,8 @@ div.olControlSaveFeaturesItemInactive { .olPopupCloseBox { background: url("img/close.gif") no-repeat; + width: 17px; + height: 17px; cursor: pointer; } From 1f539470bbba6b617139205ad7ae27faefe427d2 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 13 Feb 2012 09:42:09 +0100 Subject: [PATCH 037/112] add box drawing to draw-feature control example so it is easier to find for people --- examples/draw-feature.html | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/examples/draw-feature.html b/examples/draw-feature.html index d292794f63..f70e9eabf3 100644 --- a/examples/draw-feature.html +++ b/examples/draw-feature.html @@ -33,18 +33,27 @@ var pointLayer = new OpenLayers.Layer.Vector("Point Layer"); var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer"); + var boxLayer = new OpenLayers.Layer.Vector("Box layer"); - map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]); + map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer, boxLayer]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition()); drawControls = { point: new OpenLayers.Control.DrawFeature(pointLayer, - OpenLayers.Handler.Point), + OpenLayers.Handler.Point), line: new OpenLayers.Control.DrawFeature(lineLayer, - OpenLayers.Handler.Path), + OpenLayers.Handler.Path), polygon: new OpenLayers.Control.DrawFeature(polygonLayer, - OpenLayers.Handler.Polygon) + OpenLayers.Handler.Polygon), + box: new OpenLayers.Control.DrawFeature(boxLayer, + OpenLayers.Handler.RegularPolygon, { + handlerOptions: { + sides: 4, + irregular: true + } + } + ) }; for(var key in drawControls) { @@ -80,11 +89,11 @@

    OpenLayers Draw Feature Example

    - point, line, linestring, polygon, digitizing, geometry, draw, drag + point, line, linestring, polygon, box, digitizing, geometry, draw, drag

    - Demonstrate on-screen digitizing tools for point, line, and polygon creation. + Demonstrate on-screen digitizing tools for point, line, polygon and box creation.

    @@ -107,6 +116,10 @@ +
  • + + +
  • @@ -119,6 +132,8 @@ Double-click to finish drawing.

    With the polygon drawing control active, click on the map to add the points that make up your polygon. Double-click to finish drawing.

    +

    With the box drawing control active, click in the map and drag the mouse to get a rectangle. Release + the mouse to finish.

    With any drawing control active, paning the map can still be achieved. Drag the map as usual for that.

    Hold down the shift key while drawing to activate freehand mode. While drawing lines or polygons From 2dabac734ce3e12c5b923695b3fd30377d488a92 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 13 Feb 2012 19:59:59 +0100 Subject: [PATCH 038/112] Revert "Move the popup close box sizing to CSS" Moving the box size to CSS broke `Popup.setSize()`; the function expects a width for the padding computation. Because this function is called before the div is added to the DOM, the size can't be computed. This reverts commit 134f24480a9e6ebf0c71891e52a6b1d456ad1996. --- lib/OpenLayers/Popup.js | 6 ++++-- notes/2.12.md | 3 --- theme/default/style.css | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Popup.js b/lib/OpenLayers/Popup.js index f6f6e65871..36f666e73f 100644 --- a/lib/OpenLayers/Popup.js +++ b/lib/OpenLayers/Popup.js @@ -872,11 +872,13 @@ OpenLayers.Popup = OpenLayers.Class({ */ addCloseBox: function(callback) { - this.closeDiv = OpenLayers.Util.createDiv(this.id + "_close"); + this.closeDiv = OpenLayers.Util.createDiv( + this.id + "_close", null, {w: 17, h: 17} + ); this.closeDiv.className = "olPopupCloseBox"; // use the content div's css padding to determine if we should - // pad the close div + // padd the close div var contentDivPadding = this.getContentDivPadding(); this.closeDiv.style.right = contentDivPadding.right + "px"; diff --git a/notes/2.12.md b/notes/2.12.md index 52a122b765..3aa2db8eda 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -145,6 +145,3 @@ In addition, OpenLayers no longer modifies any native prototypes or objects by d * Function.prototype.bindAsEventListener * Event.stop -## Popup close box size - -The size of the close box is now configurable in CSS instead of the fixed 17x17px (`.olPopupCloseBox`) diff --git a/theme/default/style.css b/theme/default/style.css index 703eb961c2..c695689ff7 100644 --- a/theme/default/style.css +++ b/theme/default/style.css @@ -259,8 +259,6 @@ div.olControlSaveFeaturesItemInactive { .olPopupCloseBox { background: url("img/close.gif") no-repeat; - width: 17px; - height: 17px; cursor: pointer; } From ce71a5a3fd5ec78f8a4ea5c68cf6e7eeb4876224 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 Feb 2012 00:07:57 +0100 Subject: [PATCH 039/112] Google Static Maps API. Simple and limited to 1000 views. --- examples/google-static.html | 33 +++++++++++++++++++++++++ examples/google-static.js | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 examples/google-static.html create mode 100644 examples/google-static.js diff --git a/examples/google-static.html b/examples/google-static.html new file mode 100644 index 0000000000..e7e7885397 --- /dev/null +++ b/examples/google-static.html @@ -0,0 +1,33 @@ + + + + + + + OpenLayers Google (Static Maps API) Grid Layer Example + + + + +

    Google (Static Maps API) Grid Layer Example

    +
    + Google, grid, static, GMaps +
    +

    + Using the Google Static Maps API with a Grid Layer. +

    +
    +
    +

    + A Grid layer with a custom getURL method can be + used to request static maps for a specific extent and zoom + level. The Google Static Maps API is the most reliable way to + get Google base maps in OpenLayers. Note, however, that this is + limited to 1000 page views per viewer. Every map center or zoom + level change increases the page view counter by 1. +

    +
    + + + + diff --git a/examples/google-static.js b/examples/google-static.js new file mode 100644 index 0000000000..dde0903ea8 --- /dev/null +++ b/examples/google-static.js @@ -0,0 +1,48 @@ +var options = { + singleTile: true, + ratio: 1, + isBaseLayer: true, + wrapDateLine: true, + getURL: function() { + var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"), + size = this.map.getSize(); + return [ + this.url, "¢er=", center.lat, ",", center.lon, + "&zoom=", this.map.getZoom(), "&size=", size.w, "x", size.h + ].join(""); + } +}; + +var map = new OpenLayers.Map({ + div: "map", + maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], + maxResolution: 156543.03390625, + units: "m", + projection: "EPSG:3857", + numZoomLevels: 22, + layers: [ + new OpenLayers.Layer.Grid( + "Google Physical", + "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=terrain", + null, options + ), + new OpenLayers.Layer.Grid( + "Google Streets", + "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=roadmap", + null, options + ), + new OpenLayers.Layer.Grid( + "Google Hybrid", + "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=hybrid", + null, options + ), + new OpenLayers.Layer.Grid( + "Google Satellite", + "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite", + null, options + ) + ], + center: new OpenLayers.LonLat(10.2, 48.9).transform("EPSG:4326", "EPSG:3857"), + zoom: 5 +}); +map.addControl(new OpenLayers.Control.LayerSwitcher()); From fe0bc333ca8bfe22a099e7a237df72a23d6b1dfc Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 Feb 2012 00:14:15 +0100 Subject: [PATCH 040/112] Improving example documentation. --- examples/google-static.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/google-static.html b/examples/google-static.html index e7e7885397..ab7d788dd8 100644 --- a/examples/google-static.html +++ b/examples/google-static.html @@ -18,14 +18,16 @@

    -

    - A Grid layer with a custom getURL method can be +

    A Grid layer with a custom getURL method can be used to request static maps for a specific extent and zoom level. The Google Static Maps API is the most reliable way to get Google base maps in OpenLayers. Note, however, that this is - limited to 1000 page views per viewer. Every map center or zoom - level change increases the page view counter by 1. + limited to 1000 page views per viewer per day. Every map center + or zoom level change increases the page view counter by 1.

    +

    Look at the + google-static.js + source to see how this is done.

    From d387add3e2b2adace3e82ef5c6380cdecb1bafa1 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 Feb 2012 12:28:29 +0100 Subject: [PATCH 041/112] Note about size limitations. --- examples/google-static.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/google-static.html b/examples/google-static.html index ab7d788dd8..96847cb83b 100644 --- a/examples/google-static.html +++ b/examples/google-static.html @@ -21,13 +21,17 @@

    A Grid layer with a custom getURL method can be used to request static maps for a specific extent and zoom level. The Google Static Maps API is the most reliable way to - get Google base maps in OpenLayers. Note, however, that this is - limited to 1000 page views per viewer per day. Every map center + get Google base maps in OpenLayers. Note, however, that the + free version of this is limited to a map size of 640x640 pixels + (1280x1280 if the scale=2 url parameter is used) + and 1000 page views per viewer per day. Every map center or zoom level change increases the page view counter by 1.

    Look at the google-static.js - source to see how this is done. + source to see how this is done. See the + Static Maps API V2 Developer Guide + for details on the API. From 692fe2dd1286f2f6bebfa1fca30e7d6e1de75353 Mon Sep 17 00:00:00 2001 From: fredj Date: Tue, 14 Feb 2012 14:32:15 +0100 Subject: [PATCH 042/112] Bounds.fromSize: size can be a simple object, update doc. --- lib/OpenLayers/BaseTypes/Bounds.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index 5a527ca02a..5dd6d2c906 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -716,7 +716,8 @@ OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) { * from a size * * Parameters: - * size - {} + * size - {|Object} OpenLayers.Size or an object with + * a 'w' and 'h' properties. * * Returns: * {} New bounds object built from the passed-in size. From add094b28438d4364fcd9f4c461a5421248b6892 Mon Sep 17 00:00:00 2001 From: fredj Date: Tue, 14 Feb 2012 14:46:47 +0100 Subject: [PATCH 043/112] tileSize property already defined in parent class (Layer.Grid) --- lib/OpenLayers/Layer/ArcIMS.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/OpenLayers/Layer/ArcIMS.js b/lib/OpenLayers/Layer/ArcIMS.js index eb7dbc983c..bfe01811fa 100644 --- a/lib/OpenLayers/Layer/ArcIMS.js +++ b/lib/OpenLayers/Layer/ArcIMS.js @@ -29,12 +29,6 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, { ServiceName: '' }, - /** - * APIProperty: tileSize - * {} Size for tiles. Default is 512x512. - */ - tileSize: null, - /** * APIProperty: featureCoordSys * {String} Code for feature coordinate system. Default is "4326". From cd8fa55b0ede4488a622b243c9f7793facfcd6eb Mon Sep 17 00:00:00 2001 From: Xavier Mamano Date: Tue, 14 Feb 2012 16:44:36 +0100 Subject: [PATCH 044/112] Build: ignore trailing space in @requires dependencies --- tools/mergejs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mergejs.py b/tools/mergejs.py index 5a8ec42b4e..a0b7566af0 100755 --- a/tools/mergejs.py +++ b/tools/mergejs.py @@ -43,7 +43,7 @@ import sys SUFFIX_JAVASCRIPT = ".js" -RE_REQUIRE = "@requires?:? (.*)\n" # TODO: Ensure in comment? +RE_REQUIRE = "@requires?:?\s+(\S*)\s*\n" # TODO: Ensure in comment? class MissingImport(Exception): """Exception raised when a listed import is not found in the lib.""" From fe8a00d5c9a815e1e3acdb8035ba0acb7ff9ce15 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 Feb 2012 17:23:01 +0100 Subject: [PATCH 045/112] Support the culture attribute in the Bing Layer. p=dcabasson, r=me (closes http://trac.osgeo.org/openlayers/ticket/3598) --- lib/OpenLayers/Layer/Bing.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index f593551ef7..68ea9efd3a 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -67,6 +67,13 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { */ type: "Road", + /** + * APIProperty: culture + * {String} The culture identifier. See http://msdn.microsoft.com/en-us/library/ff701709.aspx + * for the definition and the possible values. Default is "en-US". + */ + culture: "en-US", + /** * APIProperty: metadataParams * {Object} Optional url parameters for the Get Imagery Metadata request @@ -155,6 +162,7 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { initLayer: function() { var res = this.metadata.resourceSets[0].resources[0]; var url = res.imageUrl.replace("{quadkey}", "${quadkey}"); + url = url.replace("{culture}", this.culture); this.url = []; for (var i=0; i Date: Tue, 14 Feb 2012 18:56:46 +0100 Subject: [PATCH 046/112] A configuration file based on a directive `[exclude]` is a anti-pattern, so is proposed to remove `library.cfg`. --- build/library.cfg | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 build/library.cfg diff --git a/build/library.cfg b/build/library.cfg deleted file mode 100644 index f4d66faffe..0000000000 --- a/build/library.cfg +++ /dev/null @@ -1,45 +0,0 @@ -# This file includes the OpenLayers code to create a build for everything that -# does not require vector support. - -[first] - -[last] - -[include] - -[exclude] -Firebug -OpenLayers.js -OpenLayers/Format/GeoRSS.js -OpenLayers/Format/GML.js -OpenLayers/Format/WKT.js -OpenLayers/Format/KML.js -OpenLayers/Format/WFS.js -OpenLayers/Format.js -OpenLayers/Handler/Path.js -OpenLayers/Handler/Point.js -OpenLayers/Handler/Polygon.js -OpenLayers/Handler/Select.js -OpenLayers/Geometry/Collection.js -OpenLayers/Geometry/Curve.js -OpenLayers/Geometry/LinearRing.js -OpenLayers/Geometry/LineString.js -OpenLayers/Geometry/MultiLineString.js -OpenLayers/Geometry/MultiPoint.js -OpenLayers/Geometry/MultiPolygon.js -OpenLayers/Geometry/Point.js -OpenLayers/Geometry/Polygon.js -OpenLayers/Geometry.js -OpenLayers/Layer/Vector.js -OpenLayers/Control/DrawFeature.js -OpenLayers/Control/EditingToolbar.js -OpenLayers/Control/SelectFeature.js -OpenLayers/Feature/Vector.js -OpenLayers/Renderer -OpenLayers/Renderer/Elements.js -OpenLayers/Renderer/SVG.js -OpenLayers/Renderer/VML.js -OpenLayers/Renderer.js -OpenLayers/Lang - - From da3dc76a6d34c7fc1790b67b4f296b00151bb49b Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 14 Feb 2012 20:06:52 +0100 Subject: [PATCH 047/112] Making the delay for removing the backbuffer configurable. This helps users who want to avoid having old and new tiles on the screen for transparent single tile layers. r=@elemoine (closes #216) --- lib/OpenLayers/Layer/Grid.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 86bf9488a5..a58c7e7ce2 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -173,7 +173,15 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * flash effects caused by tile animation. */ backBufferTimerId: null, - + + /** + * APIProperty: removeBackBufferDelay + * {Number} Delay for removing the backbuffer when all tiles have finished + * loading. Can be set to 0 when no css opacity transitions for the + * olTileImage class are used. Default is 2500. + */ + removeBackBufferDelay: 2500, + /** * Register a listener for a particular event with the following syntax: * (code) @@ -972,7 +980,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { // effects due to the animation of tile displaying this.backBufferTimerId = window.setTimeout( OpenLayers.Function.bind(this.removeBackBuffer, this), - 2500 + this.removeBackBufferDelay ); } } From 52931daf32f0580119aabb5f0c36dcafe62c1a50 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Wed, 15 Feb 2012 09:14:31 +0100 Subject: [PATCH 048/112] Fix spelling in test-function. No functional change. --- tests/Control/Measure.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Control/Measure.html b/tests/Control/Measure.html index 045f807d36..4d060ea97d 100644 --- a/tests/Control/Measure.html +++ b/tests/Control/Measure.html @@ -3,7 +3,7 @@ From cfaaa352f8b109bdba05ae7a5adce888ba955f79 Mon Sep 17 00:00:00 2001 From: Pierre GIRAUD Date: Wed, 15 Feb 2012 12:17:39 +0100 Subject: [PATCH 052/112] Update lib/OpenLayers/Format/GPX.js --- lib/OpenLayers/Format/GPX.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/GPX.js b/lib/OpenLayers/Format/GPX.js index e322e4f0e4..8da76193d2 100644 --- a/lib/OpenLayers/Format/GPX.js +++ b/lib/OpenLayers/Format/GPX.js @@ -73,7 +73,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, { schemaLocation: "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd", /** - * Property: creator + * APIProperty: creator * {String} The creator attribute to be added to the written GPX files. * Defaults to "OpenLayers" */ From a40ae7ef11a4690085082ec9a2e300b9edd98c8d Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 15 Feb 2012 12:30:05 +0100 Subject: [PATCH 053/112] If sphericalMercator, use default values from Projection.defaults --- lib/OpenLayers/Layer/XYZ.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/OpenLayers/Layer/XYZ.js b/lib/OpenLayers/Layer/XYZ.js index 7977a3255f..4c2bfc051d 100644 --- a/lib/OpenLayers/Layer/XYZ.js +++ b/lib/OpenLayers/Layer/XYZ.js @@ -70,19 +70,10 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, { * options - {Object} Hashtable of extra options to tag onto the layer */ initialize: function(name, url, options) { - if (options && options.sphericalMercator || this.sphericalMercator) { - options = OpenLayers.Util.extend({ - maxExtent: new OpenLayers.Bounds( - -128 * 156543.03390625, - -128 * 156543.03390625, - 128 * 156543.03390625, - 128 * 156543.03390625 - ), - maxResolution: 156543.03390625, - numZoomLevels: 19, - units: "m", - projection: "EPSG:900913" - }, options); + options = options || {}; + if (options.sphericalMercator || this.sphericalMercator) { + options.projection = new OpenLayers.Projection('EPSG:900913'); + options.numZoomLevels = 19; } url = url || this.url; name = name || this.name; From cd3ffa205841e329b2d92196c151bed65f2ae1f7 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 15 Feb 2012 12:32:25 +0100 Subject: [PATCH 054/112] Simplify parent call (don't use intermediate array) --- lib/OpenLayers/Layer/XYZ.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/XYZ.js b/lib/OpenLayers/Layer/XYZ.js index 4c2bfc051d..cc52d97fc6 100644 --- a/lib/OpenLayers/Layer/XYZ.js +++ b/lib/OpenLayers/Layer/XYZ.js @@ -75,10 +75,9 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, { options.projection = new OpenLayers.Projection('EPSG:900913'); options.numZoomLevels = 19; } - url = url || this.url; - name = name || this.name; - var newArguments = [name, url, {}, options]; - OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); + OpenLayers.Layer.Grid.prototype.initialize.apply(this, [ + name || this.name, url || this.url, {}, options + ]); }, /** From 147b32b7e34f18996f79437f7b80f512aba46515 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 15 Feb 2012 12:33:14 +0100 Subject: [PATCH 055/112] Don't compute limit if it's not needed --- lib/OpenLayers/Layer/XYZ.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/XYZ.js b/lib/OpenLayers/Layer/XYZ.js index cc52d97fc6..43535dff79 100644 --- a/lib/OpenLayers/Layer/XYZ.js +++ b/lib/OpenLayers/Layer/XYZ.js @@ -147,10 +147,9 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, { OpenLayers.Util.indexOf(resolutions, res) : this.getServerZoom() + this.zoomOffset; - var limit = Math.pow(2, z); - if (this.wrapDateLine) - { - x = ((x % limit) + limit) % limit; + if (this.wrapDateLine) { + var limit = Math.pow(2, z); + x = ((x % limit) + limit) % limit; } return {'x': x, 'y': y, 'z': z}; From 2e423df3d238a4dca6a7c4c1d6bda981aa57257e Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 15 Feb 2012 13:41:25 +0100 Subject: [PATCH 056/112] Use the layer's projection. In setMap, the layer gets the map's projection if it doesn't have its own. And since a layer can have a different SRS code than the map (but a compatible one, i.e. with OpenLayers.Projection.transforms[mapProj][layerProj] being OpenLayer.Projection.nullTransform), the axis order can be different. --- lib/OpenLayers/Layer/WMS.js | 2 +- tests/Control/WMSGetFeatureInfo.html | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Layer/WMS.js b/lib/OpenLayers/Layer/WMS.js index 6a283b2a61..2de8a95966 100644 --- a/lib/OpenLayers/Layer/WMS.js +++ b/lib/OpenLayers/Layer/WMS.js @@ -175,7 +175,7 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, { * {Boolean} true if the axis order is reversed, false otherwise. */ reverseAxisOrder: function() { - var projCode = this.map.getProjectionObject().getCode(); + var projCode = this.projection.getCode(); return parseFloat(this.params.VERSION) >= 1.3 && !!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx); }, diff --git a/tests/Control/WMSGetFeatureInfo.html b/tests/Control/WMSGetFeatureInfo.html index 7bdbc05625..5e7801b036 100644 --- a/tests/Control/WMSGetFeatureInfo.html +++ b/tests/Control/WMSGetFeatureInfo.html @@ -290,19 +290,19 @@ function test_mixedParams(t) { t.plan(5); var map = new OpenLayers.Map("map", { - getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}, - getProjectionObject: function() {return new OpenLayers.Projection("EPSG:4326");} + getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));} }); + var geographic = new OpenLayers.Projection("EPSG:4326"); var a = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", { layers: "a,b,c,d", styles: "a,b,c,d" - }, {map: map}); + }, {projection: geographic}); var b = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", { layers: ["a","b","c","d"], styles: ["a","b","c","d"] - }, {map: map}); + }, {projection: geographic}); var c = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", { layers: ["a","b","c","d"] @@ -310,13 +310,13 @@ var d = new OpenLayers.Layer.WMS("dummy","http://localhost/wms", { layers: "a,b,c,d" - }, {map: map}); + }, {projection: geographic}); var click = new OpenLayers.Control.WMSGetFeatureInfo({ featureType: 'type', featureNS: 'ns', layers: [a, b, c, d] - }, {map: map}); + }, {projection: geographic}); map.addControl(click); From e15dde05614d62807a05a732f728c14594efc67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 24 Jan 2012 13:58:44 +0100 Subject: [PATCH 057/112] make the keyboard handler work on the map div as opposed to the document --- lib/OpenLayers/Handler/Keyboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Handler/Keyboard.js b/lib/OpenLayers/Handler/Keyboard.js index 0372564299..c446cb0988 100644 --- a/lib/OpenLayers/Handler/Keyboard.js +++ b/lib/OpenLayers/Handler/Keyboard.js @@ -73,7 +73,7 @@ OpenLayers.Handler.Keyboard = OpenLayers.Class(OpenLayers.Handler, { if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) { for (var i=0, len=this.KEY_EVENTS.length; i Date: Tue, 24 Jan 2012 13:59:00 +0100 Subject: [PATCH 058/112] improve the accessible.html example --- examples/accessible.html | 57 ++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/examples/accessible.html b/examples/accessible.html index d9b8a777b3..fcde73ebdb 100644 --- a/examples/accessible.html +++ b/examples/accessible.html @@ -31,6 +31,15 @@ font-size:1em; text-decoration:underline; } + a.accesskey { + color: white; + } + a.accesskey:focus { + color: #436976; + } + a.zoom { + padding-right: 20px; + } - + From 0727f5558ac26e0571500f604e7222760ac70be4 Mon Sep 17 00:00:00 2001 From: fredj Date: Thu, 16 Feb 2012 13:55:53 +0100 Subject: [PATCH 067/112] Remove maxExtent, maxResolution and units options. See #219 --- examples/google-static.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/google-static.js b/examples/google-static.js index af6f1cc688..bc97e4c0bb 100644 --- a/examples/google-static.js +++ b/examples/google-static.js @@ -15,9 +15,6 @@ var options = { var map = new OpenLayers.Map({ div: "map", - maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], - maxResolution: 156543.03390625, - units: "m", projection: "EPSG:3857", numZoomLevels: 22, layers: [ From 584d33eaa33ac914d9fbf8bc9b36e76bd9b00b2c Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Thu, 16 Feb 2012 13:32:10 +0000 Subject: [PATCH 068/112] GPX read should allow for blank attribute nodes --- lib/OpenLayers/Format/GPX.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/GPX.js b/lib/OpenLayers/Format/GPX.js index 8da76193d2..2b71d3b27d 100644 --- a/lib/OpenLayers/Format/GPX.js +++ b/lib/OpenLayers/Format/GPX.js @@ -197,7 +197,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, { var attributes = {}; var attrNode = node.firstChild, value, name; while(attrNode) { - if(attrNode.nodeType == 1) { + if(attrNode.nodeType == 1 && attrNode.firstChild) { value = attrNode.firstChild; if(value.nodeType == 3 || value.nodeType == 4) { name = (attrNode.prefix) ? From 17f96f68a208cc2941a197e0d80dc0f1ba9f4b06 Mon Sep 17 00:00:00 2001 From: fredj Date: Thu, 16 Feb 2012 15:09:11 +0100 Subject: [PATCH 069/112] Preserve numZoomLevels from options. r=@tonio (see #219) --- lib/OpenLayers/Layer/XYZ.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/XYZ.js b/lib/OpenLayers/Layer/XYZ.js index 43535dff79..b2cdefd3d2 100644 --- a/lib/OpenLayers/Layer/XYZ.js +++ b/lib/OpenLayers/Layer/XYZ.js @@ -70,10 +70,11 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, { * options - {Object} Hashtable of extra options to tag onto the layer */ initialize: function(name, url, options) { - options = options || {}; - if (options.sphericalMercator || this.sphericalMercator) { - options.projection = new OpenLayers.Projection('EPSG:900913'); - options.numZoomLevels = 19; + if (options && options.sphericalMercator || this.sphericalMercator) { + options = OpenLayers.Util.extend({ + projection: "EPSG:900913", + numZoomLevels: 19 + }, options); } OpenLayers.Layer.Grid.prototype.initialize.apply(this, [ name || this.name, url || this.url, {}, options From 93e4d0b94c57cf8a2d32f25570f38be9d973c820 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 16 Feb 2012 16:29:06 +0100 Subject: [PATCH 070/112] Making loaded tile available to tileloaded listeners. --- lib/OpenLayers/Layer/Grid.js | 6 ++++-- tests/Layer/Grid.html | 15 ++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index a58c7e7ce2..1e767f75dd 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -199,7 +199,9 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * tileloaded - Triggered when each new tile is * loaded, as a means of progress update to listeners. * listeners can access 'numLoadingTiles' if they wish to keep - * track of the loading progress. + * track of the loading progress. Listeners are called with an object + * with a tile property as first argument, making the loded tile + * available to the listener. */ /** @@ -971,7 +973,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { tile.onLoadEnd = function() { this.numLoadingTiles--; - this.events.triggerEvent("tileloaded"); + this.events.triggerEvent("tileloaded", {tile: tile}); //if that was the last tile, then trigger a 'loadend' on the layer if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) { this.events.triggerEvent("loadend"); diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index 34478df73d..366627caa3 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -505,12 +505,12 @@ } function test_Layer_Grid_addTileMonitoringHooks(t) { - t.plan(14); + t.plan(15); layer = new OpenLayers.Layer.Grid(); layer.events = { - 'triggerEvent': function(str) { - g_events.push(str); + 'triggerEvent': function(str, evt) { + g_events.push([str, evt]); } } @@ -536,7 +536,7 @@ g_events = []; tile.onLoadStart.apply(layer); - t.eq(g_events[0], "loadstart", "loadstart event triggered when numLoadingTiles is 0"); + t.eq(g_events[0][0], "loadstart", "loadstart event triggered when numLoadingTiles is 0"); t.eq(layer.numLoadingTiles, 1, "numLoadingTiles incremented"); g_events = []; @@ -553,7 +553,8 @@ layer.numLoadingTiles = 2; g_events = []; tile.onLoadEnd.apply(layer); - t.eq(g_events[0], "tileloaded", "tileloaded triggered when numLoadingTiles is > 0"); + t.eq(g_events[0][0], "tileloaded", "tileloaded triggered when numLoadingTiles is > 0"); + t.ok(g_events[0][1].tile === tile, "tile passed as tile property to event object"); t.eq(g_events.length, 1, "loadend event not triggered when numLoadingTiles is > 0"); t.eq(layer.numLoadingTiles, 1, "numLoadingTiles decremented"); @@ -561,8 +562,8 @@ g_events = []; layer.grid = [[{}]]; // to prevent error in updateBackBuffer tile.onLoadEnd.apply(layer); - t.eq(g_events[0], "tileloaded", "tileloaded triggered when numLoadingTiles is 0"); - t.eq(g_events[1], "loadend", "loadend event triggered when numLoadingTiles is 0"); + t.eq(g_events[0][0], "tileloaded", "tileloaded triggered when numLoadingTiles is 0"); + t.eq(g_events[1][0], "loadend", "loadend event triggered when numLoadingTiles is 0"); t.eq(layer.numLoadingTiles, 0, "numLoadingTiles decremented"); } From 2b5ade2dde3089addb8ba6a48226f76aef3a5ce4 Mon Sep 17 00:00:00 2001 From: tschaub Date: Thu, 16 Feb 2012 10:36:34 -0700 Subject: [PATCH 071/112] Adding back events documentation. When the list of event types became unconstrained in 501b42228ab12d50f06d8f000dac5078aaca9509, we lost the documentation for events that are triggered. This change adds the list of events triggered to the API docs for events properties. --- lib/OpenLayers/Control.js | 6 +- lib/OpenLayers/Control/DrawFeature.js | 13 +++- lib/OpenLayers/Control/Geolocate.js | 27 +++++--- lib/OpenLayers/Control/GetFeature.js | 13 +++- lib/OpenLayers/Control/Measure.js | 11 ++-- lib/OpenLayers/Control/SLDSelect.js | 12 ++-- lib/OpenLayers/Control/SelectFeature.js | 23 +++++-- lib/OpenLayers/Control/Snapping.js | 11 ++-- lib/OpenLayers/Control/Split.js | 11 ++-- lib/OpenLayers/Control/TransformFeature.js | 63 ++++++++++-------- lib/OpenLayers/Control/WMSGetFeatureInfo.js | 13 +++- lib/OpenLayers/Control/WMTSGetFeatureInfo.js | 13 +++- lib/OpenLayers/Layer.js | 31 +++++---- lib/OpenLayers/Layer/Vector.js | 5 +- lib/OpenLayers/Map.js | 68 ++++++++++---------- lib/OpenLayers/Strategy/Save.js | 12 ++-- lib/OpenLayers/Tile.js | 29 +++++---- 17 files changed, 218 insertions(+), 143 deletions(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index a91887f869..ac867fc288 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -139,10 +139,7 @@ OpenLayers.Control = OpenLayers.Class({ * APIProperty: events * {} Events instance for listeners and triggering * control specific events. - */ - events: null, - - /** + * * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); @@ -161,6 +158,7 @@ OpenLayers.Control = OpenLayers.Class({ * activate - Triggered when activated. * deactivate - Triggered when deactivated. */ + events: null, /** * Constructor: OpenLayers.Control diff --git a/lib/OpenLayers/Control/DrawFeature.js b/lib/OpenLayers/Control/DrawFeature.js index e8e2e139ee..d53f7a47f6 100644 --- a/lib/OpenLayers/Control/DrawFeature.js +++ b/lib/OpenLayers/Control/DrawFeature.js @@ -31,8 +31,17 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, { */ callbacks: null, - /** - * Supported event types: + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): * featureadded - Triggered when a feature is added */ diff --git a/lib/OpenLayers/Control/Geolocate.js b/lib/OpenLayers/Control/Geolocate.js index 28b93bb062..aa19c8a9ae 100644 --- a/lib/OpenLayers/Control/Geolocate.js +++ b/lib/OpenLayers/Control/Geolocate.js @@ -22,15 +22,24 @@ */ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, { - /** - * Supported event types: - * - *locationupdated* Triggered when browser return a new position. Listeners will - * receive an object with a 'position' property which is the browser.geolocation.position - * native object, as well as a 'point' property which is the location transformed in the - * current map projection. - * - *locationfailed* Triggered when geolocation has failed - * - *locationuncapable* Triggered when control is activated on a browser - * which doesn't support geolocation + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): + * locationupdated - Triggered when browser return a new position. Listeners will + * receive an object with a 'position' property which is the browser.geolocation.position + * native object, as well as a 'point' property which is the location transformed in the + * current map projection. + * locationfailed - Triggered when geolocation has failed + * locationuncapable - Triggered when control is activated on a browser + * which doesn't support geolocation */ /** diff --git a/lib/OpenLayers/Control/GetFeature.js b/lib/OpenLayers/Control/GetFeature.js index 98ac1cfdc8..c037f87d15 100644 --- a/lib/OpenLayers/Control/GetFeature.js +++ b/lib/OpenLayers/Control/GetFeature.js @@ -169,8 +169,17 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, { */ filterType: OpenLayers.Filter.Spatial.BBOX, - /** - * Supported event types: + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): * beforefeatureselected - Triggered when is true before a * feature is selected. The event object has a feature property with * the feature about to select diff --git a/lib/OpenLayers/Control/Measure.js b/lib/OpenLayers/Control/Measure.js index 59aec5370c..7eb05a02c2 100644 --- a/lib/OpenLayers/Control/Measure.js +++ b/lib/OpenLayers/Control/Measure.js @@ -17,16 +17,17 @@ */ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { - /** + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): + * Supported event types (in addition to those from ): * measure - Triggered when a measurement sketch is complete. Listeners * will receive an event with measure, units, order, and geometry * properties. diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js index c192344a15..52f0798ae9 100644 --- a/lib/OpenLayers/Control/SLDSelect.js +++ b/lib/OpenLayers/Control/SLDSelect.js @@ -23,17 +23,17 @@ */ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, { - /** + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from - * ): + * Supported event types (in addition to those from ): * selected - Triggered when a selection occurs. Listeners receive an * event with *filters* and *layer* properties. Filters will be an * array of OpenLayers.Filter objects created in order to perform diff --git a/lib/OpenLayers/Control/SelectFeature.js b/lib/OpenLayers/Control/SelectFeature.js index ab6ac484ab..4753b154d6 100644 --- a/lib/OpenLayers/Control/SelectFeature.js +++ b/lib/OpenLayers/Control/SelectFeature.js @@ -21,13 +21,22 @@ */ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, { - /** - * Supported event types: - * - *beforefeaturehighlighted* Triggered before a feature is highlighted - * - *featurehighlighted* Triggered when a feature is highlighted - * - *featureunhighlighted* Triggered when a feature is unhighlighted - * - *boxselectionstart* Triggered before box selection starts - * - *boxselectionend* Triggered after box selection ends + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): + * beforefeaturehighlighted - Triggered before a feature is highlighted + * featurehighlighted - Triggered when a feature is highlighted + * featureunhighlighted - Triggered when a feature is unhighlighted + * boxselectionstart - Triggered before box selection starts + * boxselectionend - Triggered after box selection ends */ /** diff --git a/lib/OpenLayers/Control/Snapping.js b/lib/OpenLayers/Control/Snapping.js index 792f0183a4..a883ee0495 100644 --- a/lib/OpenLayers/Control/Snapping.js +++ b/lib/OpenLayers/Control/Snapping.js @@ -17,16 +17,17 @@ */ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, { - /** + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): + * Supported event types (in addition to those from ): * beforesnap - Triggered before a snap occurs. Listeners receive an * event object with *point*, *x*, *y*, *distance*, *layer*, and * *snapType* properties. The point property will be original point diff --git a/lib/OpenLayers/Control/Split.js b/lib/OpenLayers/Control/Split.js index 8439078d60..3aa56fb599 100644 --- a/lib/OpenLayers/Control/Split.js +++ b/lib/OpenLayers/Control/Split.js @@ -18,16 +18,17 @@ */ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, { - /** + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * * Register a listener for a particular event with the following syntax: * (code) * control.events.register(type, obj, listener); * (end) * - * Listeners will be called with a reference to an event object. The - * properties of this event depends on exactly what happened. - * - * Supported control event types (in addition to those from ): + * Supported event types (in addition to those from ): * beforesplit - Triggered before a split occurs. Listeners receive an * event object with *source* and *target* properties. * split - Triggered when a split occurs. Listeners receive an event with diff --git a/lib/OpenLayers/Control/TransformFeature.js b/lib/OpenLayers/Control/TransformFeature.js index 2b719a4450..5b84a10ee7 100644 --- a/lib/OpenLayers/Control/TransformFeature.js +++ b/lib/OpenLayers/Control/TransformFeature.js @@ -21,33 +21,42 @@ */ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, { - /** - * Supported event types: - * - *beforesetfeature* Triggered before a feature is set for - * tranformation. The feature will not be set if a listener returns - * false. Listeners receive a *feature* property, with the feature - * that will be set for transformation. Listeners are allowed to - * set the control's *scale*, *ratio* and *rotation* properties, - * which will set the initial scale, ratio and rotation of the - * feature, like the method's initialParams argument. - * - *setfeature* Triggered when a feature is set for tranformation. - * Listeners receive a *feature* property, with the feature that - * is now set for transformation. - * - *beforetransform* Triggered while dragging, before a feature is - * transformed. The feature will not be transformed if a listener - * returns false (but the box still will). Listeners receive one or - * more of *center*, *scale*, *ratio* and *rotation*. The *center* - * property is an object with the new - * center of the transformed feature, the others are Floats with the - * scale, ratio or rotation change since the last transformation. - * - *transform* Triggered while dragging, when a feature is transformed. - * Listeners receive an event object with one or more of *center*, - * *scale*, *ratio* and *rotation*. The *center* property is an - * object with the new center of the - * transformed feature, the others are Floats with the scale, ratio - * or rotation change of the feature since the last transformation. - * - *transformcomplete* Triggered after dragging. Listeners receive - * an event object with the transformed *feature*. + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): + * beforesetfeature - Triggered before a feature is set for + * tranformation. The feature will not be set if a listener returns + * false. Listeners receive a *feature* property, with the feature + * that will be set for transformation. Listeners are allowed to + * set the control's *scale*, *ratio* and *rotation* properties, + * which will set the initial scale, ratio and rotation of the + * feature, like the method's initialParams argument. + * setfeature - Triggered when a feature is set for tranformation. + * Listeners receive a *feature* property, with the feature that + * is now set for transformation. + * beforetransform - Triggered while dragging, before a feature is + * transformed. The feature will not be transformed if a listener + * returns false (but the box still will). Listeners receive one or + * more of *center*, *scale*, *ratio* and *rotation*. The *center* + * property is an object with the new + * center of the transformed feature, the others are Floats with the + * scale, ratio or rotation change since the last transformation. + * transform - Triggered while dragging, when a feature is transformed. + * Listeners receive an event object with one or more of *center*, + * scale*, *ratio* and *rotation*. The *center* property is an + * object with the new center of the + * transformed feature, the others are Floats with the scale, ratio + * or rotation change of the feature since the last transformation. + * transformcomplete - Triggered after dragging. Listeners receive + * an event object with the transformed *feature*. */ /** diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js index 6aac4b01a8..9348a9d542 100644 --- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js @@ -154,8 +154,17 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { */ hoverRequest: null, - /** - * Supported event types (in addition to those from ): + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): * beforegetfeatureinfo - Triggered before the request is sent. * The event object has an *xy* property with the position of the * mouse click or hover event that triggers the request. diff --git a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js index e2004318f7..1622abebab 100644 --- a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js @@ -135,8 +135,17 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { */ hoverRequest: null, - /** - * Supported event types (in addition to those from ): + /** + * APIProperty: events + * {} Events instance for listeners and triggering + * control specific events. + * + * Register a listener for a particular event with the following syntax: + * (code) + * control.events.register(type, obj, listener); + * (end) + * + * Supported event types (in addition to those from ): * beforegetfeatureinfo - Triggered before each request is sent. * The event object has an *xy* property with the position of the * mouse click or hover event that triggers the request and a *layer* diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 6b702a2104..d543f66e90 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -58,6 +58,21 @@ OpenLayers.Layer = OpenLayers.Class({ alwaysInRange: null, /** + * Constant: RESOLUTION_PROPERTIES + * {Array} The properties that are used for calculating resolutions + * information. + */ + RESOLUTION_PROPERTIES: [ + 'scales', 'resolutions', + 'maxScale', 'minScale', + 'maxResolution', 'minResolution', + 'numZoomLevels', 'maxZoomLevel' + ], + + /** + * APIProperty: events + * {} + * * Register a listener for a particular event with the following syntax: * (code) * layer.events.register(type, obj, listener); @@ -87,22 +102,6 @@ OpenLayers.Layer = OpenLayers.Class({ * will receive an object with a *map* property referencing the map and * a *layer* property referencing the layer. */ - - /** - * Constant: RESOLUTION_PROPERTIES - * {Array} The properties that are used for calculating resolutions - * information. - */ - RESOLUTION_PROPERTIES: [ - 'scales', 'resolutions', - 'maxScale', 'minScale', - 'maxResolution', 'minResolution', - 'numZoomLevels', 'maxZoomLevel' - ], - - /** - * APIProperty: events - * {} */ events: null, diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js index baefdad89e..2857a82d7b 100644 --- a/lib/OpenLayers/Layer/Vector.js +++ b/lib/OpenLayers/Layer/Vector.js @@ -24,6 +24,9 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { /** + * APIProperty: events + * {} + * * Register a listener for a particular event with the following syntax: * (code) * layer.events.register(type, obj, listener); @@ -36,7 +39,7 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, { * object - {Object} A reference to layer.events.object. * element - {DOMElement} A reference to layer.events.element. * - * Supported map event types (in addition to those from ): + * Supported map event types (in addition to those from ): * beforefeatureadded - Triggered before a feature is added. Listeners * will receive an object with a *feature* property referencing the * feature to be added. To stop the feature from being added, a diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 24ecd23a1a..393e8129ba 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -35,6 +35,9 @@ OpenLayers.Map = OpenLayers.Class({ }, /** + * APIProperty: events + * {} + * * Register a listener for a particular event with the following syntax: * (code) * map.events.register(type, obj, listener); @@ -44,43 +47,42 @@ OpenLayers.Map = OpenLayers.Class({ * properties of this event depends on exactly what happened. * * All event objects have at least the following properties: - * - *object* {Object} A reference to map.events.object. - * - *element* {DOMElement} A reference to map.events.element. + * object - {Object} A reference to map.events.object. + * element - {DOMElement} A reference to map.events.element. * * Browser events have the following additional properties: - * - *xy* {} The pixel location of the event (relative - * to the the map viewport). - * - other properties that come with browser events + * xy - {} The pixel location of the event (relative + * to the the map viewport). * * Supported map event types: - * - *preaddlayer* triggered before a layer has been added. The event - * object will include a *layer* property that references the layer - * to be added. When a listener returns "false" the adding will be - * aborted. - * - *addlayer* triggered after a layer has been added. The event object - * will include a *layer* property that references the added layer. - * - *preremovelayer* triggered before a layer has been removed. The event - * object will include a *layer* property that references the layer - * to be removed. When a listener returns "false" the removal will be - * aborted. - * - *removelayer* triggered after a layer has been removed. The event - * object will include a *layer* property that references the removed - * layer. - * - *changelayer* triggered after a layer name change, order change, - * opacity change, params change, visibility change (due to resolution - * thresholds) or attribution change (due to extent change). Listeners - * will receive an event object with *layer* and *property* properties. - * The *layer* property will be a reference to the changed layer. The - * *property* property will be a key to the changed property (name, - * order, opacity, params, visibility or attribution). - * - *movestart* triggered after the start of a drag, pan, or zoom - * - *move* triggered after each drag, pan, or zoom - * - *moveend* triggered after a drag, pan, or zoom completes - * - *zoomend* triggered after a zoom completes - * - *mouseover* triggered after mouseover the map - * - *mouseout* triggered after mouseout the map - * - *mousemove* triggered after mousemove the map - * - *changebaselayer* triggered after the base layer changes + * preaddlayer - triggered before a layer has been added. The event + * object will include a *layer* property that references the layer + * to be added. When a listener returns "false" the adding will be + * aborted. + * addlayer - triggered after a layer has been added. The event object + * will include a *layer* property that references the added layer. + * preremovelayer - triggered before a layer has been removed. The event + * object will include a *layer* property that references the layer + * to be removed. When a listener returns "false" the removal will be + * aborted. + * removelayer - triggered after a layer has been removed. The event + * object will include a *layer* property that references the removed + * layer. + * changelayer* triggered after a layer name change, order change, + * opacity change, params change, visibility change (due to resolution + * thresholds) or attribution change (due to extent change). Listeners + * will receive an event object with *layer* and *property* properties. + * The *layer* property will be a reference to the changed layer. The + * *property* property will be a key to the changed property (name, + * order, opacity, params, visibility or attribution). + * movestart* triggered after the start of a drag, pan, or zoom + * move - triggered after each drag, pan, or zoom + * moveend - triggered after a drag, pan, or zoom completes + * zoomend - triggered after a zoom completes + * mouseover - triggered after mouseover the map + * mouseout - triggered after mouseout the map + * mousemove - triggered after mousemove the map + * changebaselayer - triggered after the base layer changes */ /** diff --git a/lib/OpenLayers/Strategy/Save.js b/lib/OpenLayers/Strategy/Save.js index c928eebdad..baa4b14777 100644 --- a/lib/OpenLayers/Strategy/Save.js +++ b/lib/OpenLayers/Strategy/Save.js @@ -20,16 +20,20 @@ OpenLayers.Strategy.Save = OpenLayers.Class(OpenLayers.Strategy, { /** + * APIProperty: events + * {} An events object that handles all + * events on the strategy object. + * * Register a listener for a particular event with the following syntax: * (code) * strategy.events.register(type, obj, listener); * (end) * * Supported event types: - * - *start* Triggered before saving - * - *success* Triggered after a successful transaction - * - *fail* Triggered after a failed transaction - * + * start - Triggered before saving + * success - Triggered after a successful transaction + * fail - Triggered after a failed transaction + * */ /** diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index 7251381406..d1d11eef8f 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -23,22 +23,25 @@ */ OpenLayers.Tile = OpenLayers.Class({ - /** - * Supported event types: - * - *beforedraw* Triggered before the tile is drawn. Used to defer - * drawing to an animation queue. To defer drawing, listeners need - * to return false, which will abort drawing. The queue handler needs - * to call (true) to actually draw the tile. - * - *loadstart* Triggered when tile loading starts. - * - *loadend* Triggered when tile loading ends. - * - *reload* Triggered when an already loading tile is reloaded. - * - *unload* Triggered before a tile is unloaded. - */ - /** * APIProperty: events * {} An events object that handles all - * events on the tile. + * events on the tile. + * + * Register a listener for a particular event with the following syntax: + * (code) + * tile.events.register(type, obj, listener); + * (end) + * + * Supported event types: + * beforedraw - Triggered before the tile is drawn. Used to defer + * drawing to an animation queue. To defer drawing, listeners need + * to return false, which will abort drawing. The queue handler needs + * to call (true) to actually draw the tile. + * loadstart - Triggered when tile loading starts. + * loadend - Triggered when tile loading ends. + * reload - Triggered when an already loading tile is reloaded. + * unload - Triggered before a tile is unloaded. */ events: null, From 977c334fa3f44beea4bc12a9d32cc789cc19f8b9 Mon Sep 17 00:00:00 2001 From: tschaub Date: Thu, 16 Feb 2012 10:41:05 -0700 Subject: [PATCH 072/112] Doc cleanup. --- lib/OpenLayers/Map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 393e8129ba..0a8f7bde0a 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -68,14 +68,14 @@ OpenLayers.Map = OpenLayers.Class({ * removelayer - triggered after a layer has been removed. The event * object will include a *layer* property that references the removed * layer. - * changelayer* triggered after a layer name change, order change, + * changelayer - triggered after a layer name change, order change, * opacity change, params change, visibility change (due to resolution * thresholds) or attribution change (due to extent change). Listeners * will receive an event object with *layer* and *property* properties. * The *layer* property will be a reference to the changed layer. The * *property* property will be a key to the changed property (name, * order, opacity, params, visibility or attribution). - * movestart* triggered after the start of a drag, pan, or zoom + * movestart - triggered after the start of a drag, pan, or zoom * move - triggered after each drag, pan, or zoom * moveend - triggered after a drag, pan, or zoom completes * zoomend - triggered after a zoom completes From 03ba4dac88af917501d04b4f7d1aab780e446cb0 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Thu, 16 Feb 2012 21:43:36 +0100 Subject: [PATCH 073/112] Remove superfluous comment closing (*/), thanks @mprins. --- lib/OpenLayers/Layer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index d543f66e90..687627e2f7 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -102,7 +102,6 @@ OpenLayers.Layer = OpenLayers.Class({ * will receive an object with a *map* property referencing the map and * a *layer* property referencing the layer. */ - */ events: null, /** From 3fefe91580aeab40323979691d62b0b9601c75b8 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 17 Feb 2012 09:12:59 +0100 Subject: [PATCH 074/112] Remove tabs --- lib/OpenLayers/Layer/MapGuide.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Layer/MapGuide.js b/lib/OpenLayers/Layer/MapGuide.js index 762df37a5e..680b8472c2 100644 --- a/lib/OpenLayers/Layer/MapGuide.js +++ b/lib/OpenLayers/Layer/MapGuide.js @@ -27,10 +27,10 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { /** * APIProperty: useHttpTile * {Boolean} use a tile cache exposed directly via a webserver rather than the - * via mapguide server. This does require extra configuration on the Mapguide Server, - * and will only work when singleTile is false. The url for the layer must be set to the - * webserver path rather than the Mapguide mapagent. - * See http://trac.osgeo.org/mapguide/wiki/CodeSamples/Tiles/ServingTilesViaHttp + * via mapguide server. This does require extra configuration on the Mapguide Server, + * and will only work when singleTile is false. The url for the layer must be set to the + * webserver path rather than the Mapguide mapagent. + * See http://trac.osgeo.org/mapguide/wiki/CodeSamples/Tiles/ServingTilesViaHttp **/ useHttpTile: false, From 221d7caf70ace66041c41fc8c62412932e367f4e Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 20 Feb 2012 12:01:56 +0100 Subject: [PATCH 075/112] Using a blankImgUrl that works for IFrames in IE9. See http://trac.osgeo.org/openlayers/ticket/3624. --- lib/OpenLayers/Tile/Image/IFrame.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Tile/Image/IFrame.js b/lib/OpenLayers/Tile/Image/IFrame.js index eefa7bbe91..b29798cccc 100644 --- a/lib/OpenLayers/Tile/Image/IFrame.js +++ b/lib/OpenLayers/Tile/Image/IFrame.js @@ -65,7 +65,11 @@ OpenLayers.Tile.Image.IFrame = { // And if we had an iframe we also remove the event pane. if(fromIFrame) { + this.blankImageUrl = this._blankImageUrl; this.frame.removeChild(this.frame.firstChild); + } else { + this._blankImageUrl = this.blankImageUrl; + this.blankImageUrl = "about:blank"; } } } @@ -85,7 +89,7 @@ OpenLayers.Tile.Image.IFrame = { style.width = "100%"; style.height = "100%"; style.zIndex = 1; - style.backgroundImage = "url(" + this.blankImageUrl + ")"; + style.backgroundImage = "url(" + this._blankImageUrl + ")"; this.frame.appendChild(eventPane); } @@ -133,7 +137,7 @@ OpenLayers.Tile.Image.IFrame = { return OpenLayers.Tile.Image.prototype.getImage.apply(this, arguments); } }, - + /** * Method: createRequestForm * Create the html

    element with width, height, bbox and all From 79b539c1f9049ded835b1ae8fdc6eef72c5c88cd Mon Sep 17 00:00:00 2001 From: fredj Date: Mon, 20 Feb 2012 13:54:08 +0100 Subject: [PATCH 076/112] Simplify parent call (don't use intermediate array) --- lib/OpenLayers/Layer/Zoomify.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Layer/Zoomify.js b/lib/OpenLayers/Layer/Zoomify.js index 82e3838365..65fefac858 100644 --- a/lib/OpenLayers/Layer/Zoomify.js +++ b/lib/OpenLayers/Layer/Zoomify.js @@ -87,12 +87,11 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, { initialize: function(name, url, size, options) { // initilize the Zoomify pyramid for given size - this.initializeZoomify( size ); + this.initializeZoomify(size); - var newArguments = []; - newArguments.push(name, url, size, {}, options); - - OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); + OpenLayers.Layer.Grid.prototype.initialize.apply(this, [ + name, url, size, {}, options + ]); }, /** From 815cafd9008f5f7d0a26ac59562b9b67fa70f3d8 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Tue, 21 Feb 2012 07:53:43 +0100 Subject: [PATCH 077/112] add an option to OpenLayers.Strategy.BBOX to allow not aborting previous requests --- lib/OpenLayers/Strategy/BBOX.js | 11 +++++++---- tests/Strategy/BBOX.html | 14 +++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Strategy/BBOX.js b/lib/OpenLayers/Strategy/BBOX.js index b6307876fb..2f7ff50631 100644 --- a/lib/OpenLayers/Strategy/BBOX.js +++ b/lib/OpenLayers/Strategy/BBOX.js @@ -124,9 +124,12 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { * Callback function called on "moveend" or "refresh" layer events. * * Parameters: - * options - {Object} An object with a property named "force", this - * property references a boolean value indicating if new data - * must be incondtionally read. + * options - {Object} Optional object whose properties will determine + * the behaviour of this Strategy + * + * Valid options include: + * force - {Boolean} if true, new data must be unconditionally read. + * noAbort - {Boolean} if true, do not abort previous requests. */ update: function(options) { var mapBounds = this.getMapBounds(); @@ -218,7 +221,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { * returned by the layer protocol. */ triggerRead: function(options) { - if (this.response) { + if (this.response && options.noAbort !== true) { this.layer.protocol.abort(this.response); this.layer.events.triggerEvent("loadend"); } diff --git a/tests/Strategy/BBOX.html b/tests/Strategy/BBOX.html index c0ff4ff401..aa66c65321 100644 --- a/tests/Strategy/BBOX.html +++ b/tests/Strategy/BBOX.html @@ -33,7 +33,7 @@ } function test_update(t) { - t.plan(5); + t.plan(7); // Create a dummy layer that can act as the map base layer. // This will be unnecessary if #1921 is addressed (allowing @@ -43,9 +43,10 @@ var strategy = new OpenLayers.Strategy.BBOX({ ratio: 1 // makes for easier comparison to map bounds }); + var log = []; var layer = new OpenLayers.Layer.Vector(null, { isBaseLayer: true, - protocol: new OpenLayers.Protocol(), + protocol: new OpenLayers.Protocol({abort: function(response) { log.push(response); }}), strategies: [strategy] }); @@ -61,7 +62,14 @@ * should be removed when the issue(s) described in #1835 are addressed. */ strategy.update({force: true}); - + strategy.response = {}; + strategy.update({force: true}); + t.eq(log.length, 1, "Response aborted"); + log = []; + strategy.update({force: true}); + strategy.update({force: true, noAbort: true}); + t.eq(log.length, 0, "Response not aborted when noAbort is true"); + // test that the strategy bounds were set t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent"); From 990a33662eeeedb9b98c83e2ac55e7c6a604fa3f Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Tue, 21 Feb 2012 12:09:19 +0100 Subject: [PATCH 078/112] incorporate @ahocevar's review --- lib/OpenLayers/Strategy/BBOX.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Strategy/BBOX.js b/lib/OpenLayers/Strategy/BBOX.js index 2f7ff50631..6d59e4c2ab 100644 --- a/lib/OpenLayers/Strategy/BBOX.js +++ b/lib/OpenLayers/Strategy/BBOX.js @@ -221,7 +221,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { * returned by the layer protocol. */ triggerRead: function(options) { - if (this.response && options.noAbort !== true) { + if (this.response && !(options && options.noAbort === true)) { this.layer.protocol.abort(this.response); this.layer.events.triggerEvent("loadend"); } From 85498cb23fe87bee23947f0b625082cc23b189ca Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 21 Feb 2012 15:06:32 +0100 Subject: [PATCH 079/112] Removing imageOffset and using getImageSize. This fixes a regression that was introduced with the Tile.Image overhaul. See http://trac.osgeo.org/openlayers/ticket/3625. --- examples/gutter.html | 2 +- lib/OpenLayers/Layer.js | 11 +---------- lib/OpenLayers/Tile/Image.js | 12 ++++-------- tests/Layer.html | 5 +---- tests/Tile/Image.html | 11 ++++++----- 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/examples/gutter.html b/examples/gutter.html index 1d16e504c0..3dd4dbf082 100644 --- a/examples/gutter.html +++ b/examples/gutter.html @@ -45,7 +45,7 @@ "http://demo.opengeo.org/geoserver/wms", {layers: 'topp:states'}, {gutter: 15}); - var states = new OpenLayers.Layer.WMS( "Roads (no gutter)", + var states = new OpenLayers.Layer.WMS( "States (no gutter)", "http://demo.opengeo.org/geoserver/wms", {layers: 'topp:states'}); map.addLayers([states, states15]); diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 687627e2f7..1a2a1999e4 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -159,13 +159,6 @@ OpenLayers.Layer = OpenLayers.Class({ */ imageSize: null, - /** - * Property: imageOffset - * {} For layers with a gutter, the image offset - * represents displacement due to the gutter. - */ - imageOffset: null, - // OPTIONS /** @@ -693,7 +686,7 @@ OpenLayers.Layer = OpenLayers.Class({ /** * APIMethod: setTileSize * Set the tile size based on the map size. This also sets layer.imageSize - * and layer.imageOffset for use by Tile.Image. + * or use by Tile.Image. * * Parameters: * size - {} @@ -710,8 +703,6 @@ OpenLayers.Layer = OpenLayers.Class({ // this.name + ": layers with " + // "gutters need non-null tile sizes"); //} - this.imageOffset = new OpenLayers.Pixel(-this.gutter, - -this.gutter); this.imageSize = new OpenLayers.Size(tileSize.w + (2*this.gutter), tileSize.h + (2*this.gutter)); } diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 5332c1581d..aef46ff49e 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -208,11 +208,12 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { * code. */ positionTile: function() { - var style = this.getTile().style; + var style = this.getTile().style, + size = this.layer.getImageSize(this.bounds); style.left = this.position.x + "%"; style.top = this.position.y + "%"; - style.width = this.size.w + "%"; - style.height = this.size.h + "%"; + style.width = size.w + "%"; + style.height = size.h + "%"; }, /** @@ -256,11 +257,6 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { var top = this.layer.gutter / this.layer.tileSize.h * 100; style.left = -left + "%"; style.top = -top + "%"; - style.width = (2 * left + 100) + "%"; - style.height = (2 * top + 100) + "%"; - } else { - style.width = "100%"; - style.height = "100%"; } style.visibility = "hidden"; style.opacity = 0; diff --git a/tests/Layer.html b/tests/Layer.html index 6f571f5600..eb2c9270f7 100644 --- a/tests/Layer.html +++ b/tests/Layer.html @@ -764,7 +764,7 @@ } function test_layer_setTileSize(t) { - t.plan(6); + t.plan(4); layer = new OpenLayers.Layer(); @@ -784,7 +784,6 @@ var size = new OpenLayers.Size(2,2); layer.setTileSize(size); t.ok(layer.tileSize.equals(size), "size paramater set correctly to layer's tile size"); - t.ok(layer.imageOffset == null, "imageOffset and imageSize null when no gutters") //set on layer layer.tileSize = layerTileSize; @@ -803,10 +802,8 @@ size = new OpenLayers.Size(10,100); layer.setTileSize(size); - var desiredImageOffset = new OpenLayers.Pixel(-15, -15); var desiredImageSize = new OpenLayers.Size(40, 130); - t.ok(layer.imageOffset.equals(desiredImageOffset), "image offset correctly calculated"); t.ok(layer.imageSize.equals(desiredImageSize), "image size correctly calculated"); } diff --git a/tests/Tile/Image.html b/tests/Tile/Image.html index ca0b42e14d..029e2d221e 100644 --- a/tests/Tile/Image.html +++ b/tests/Tile/Image.html @@ -295,9 +295,6 @@ t.ok(tile.layer.imageSize == null, "zero size gutter doesn't set image size"); - t.ok(tile.layer.imageOffset == null, - "zero size gutter doesn't set image offset"); - var zero_gutter_bounds = tile.bounds; map.destroy(); @@ -312,8 +309,12 @@ tile.size.h + (2 * gutter))), "gutter properly changes image size"); - t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(-gutter, -gutter)), - "gutter properly sets image offset"); + var offsetLeft = -(gutter / layer.tileSize.w * 100) | 0; + var offsetTop = -(gutter / layer.tileSize.h * 100) | 0; + t.eq(parseInt(tile.imgDiv.style.left, 10), offsetLeft, + "gutter properly sets image left style"); + t.eq(parseInt(tile.imgDiv.style.top, 10), offsetTop, + "gutter properly sets image top style"); t.ok(tile.bounds.equals(zero_gutter_bounds), "gutter doesn't affect tile bounds"); From 050f72b44378bc2a13aec9033b00c86cec863c99 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 09:55:45 +0100 Subject: [PATCH 080/112] start on a GeoServer profile for SLD --- lib/OpenLayers.js | 1 + lib/OpenLayers/Format/SLD.js | 9 ++ lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js | 142 ++++++++++++++++++ tests/Format/SLD/v1_0_0_GeoServer.html | 88 +++++++++++ tests/list-tests.html | 1 + 5 files changed, 241 insertions(+) create mode 100644 lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js create mode 100644 tests/Format/SLD/v1_0_0_GeoServer.html diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 78b35da424..360c7868d1 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -287,6 +287,7 @@ "OpenLayers/Format/SLD.js", "OpenLayers/Format/SLD/v1.js", "OpenLayers/Format/SLD/v1_0_0.js", + "OpenLayers/Format/SLD/v1_0_0_GeoServer.js", "OpenLayers/Format/OWSCommon.js", "OpenLayers/Format/OWSCommon/v1.js", "OpenLayers/Format/OWSCommon/v1_0_0.js", diff --git a/lib/OpenLayers/Format/SLD.js b/lib/OpenLayers/Format/SLD.js index 20e8abf79f..2149b0a516 100644 --- a/lib/OpenLayers/Format/SLD.js +++ b/lib/OpenLayers/Format/SLD.js @@ -23,6 +23,15 @@ */ OpenLayers.Format.SLD = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, { + /** + * APIProperty: profile + * {String} If provided, use a custom profile. + * + * Currently supported profiles: + * - GeoServer - parses GeoServer vendor specific capabilities for SLD. + */ + profile: null, + /** * APIProperty: defaultVersion * {String} Version number to assume if none found. Default is "1.0.0". diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js new file mode 100644 index 0000000000..663db29d37 --- /dev/null +++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js @@ -0,0 +1,142 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Format/SLD/v1_0_0.js + */ + +/** + * Class: OpenLayers.Format.SLD/v1_0_0_GeoServer + * Read SLD version 1.0.0 with GeoServer-specific enhanced options. + * See http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd + * + * Inherits from: + * - + */ +OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( + OpenLayers.Format.SLD.v1_0_0, { + + /** + * Property: version + * {String} The specific parser version. + */ + version: "1.0.0", + + /** + * Property: profile + * {String} The specific profile + */ + profile: "GeoServer", + + /** + * Constructor: OpenLayers.Format.SLD.v1_0_0_GeoServer + * Create a new parser for GeoServer-enhanced SLD version 1.0.0. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + + /** + * Property: readers + * Contains public functions, grouped by namespace prefix, that will + * be applied when a namespaced node is found matching the function + * name. The function will be applied in the scope of this parser + * with two arguments: the node being read and a context object passed + * from the parent. + */ + readers: { + "sld": OpenLayers.Util.applyDefaults({ + "Priority": function(node, obj) { + var value = this.readers.ogc._expression.call(this, node); + if (value) { + obj.priority = value; + } + }, + "VendorOption": function(node, obj) { + if (!obj.vendorOptions) { + obj.vendorOptions = []; + } + obj.vendorOptions.push({ + name: node.getAttribute("name"), + value: this.getChildValue(node) + }); + } + }, OpenLayers.Format.SLD.v1_0_0.prototype.readers["sld"]), + "ogc": OpenLayers.Format.SLD.v1_0_0.prototype.readers["ogc"] + }, + + /** + * Property: writers + * As a compliment to the readers property, this structure contains public + * writing functions grouped by namespace alias and named like the + * node names they produce. + */ + writers: { + "sld": OpenLayers.Util.applyDefaults({ + "Priority": function(priority) { + return this.writers.sld._OGCExpression.call( + this, "sld:Priority", priority + ); + }, + "VendorOption": function(option) { + return this.createElementNSPlus("sld:VendorOption", { + attributes: {name: option.name}, + value: option.value + }); + }, + "TextSymbolizer": function(symbolizer) { + var node = OpenLayers.Format.SLD.v1_0_0.prototype.writers["sld"]["TextSymbolizer"].apply(this, arguments); + if (symbolizer.externalGraphic || symbolizer.graphicName) { + this.writeNode("Graphic", symbolizer, node); + } + if ("priority" in symbolizer) { + this.writeNode("Priority", symbolizer.priority, node); + } + var options = symbolizer.vendorOptions; + if (options) { + for (var i=0, ii=options.length; i + + + + + +
    + + diff --git a/tests/list-tests.html b/tests/list-tests.html index 1421c2b6dc..92ebdec19a 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -73,6 +73,7 @@
  • Format/Text.html
  • Format/SLD.html
  • Format/SLD/v1_0_0.html
  • +
  • Format/SLD/v1_0_0_GeoServer.html
  • Format/Filter.html
  • Format/Filter/v1.html
  • Format/Filter/v1_0_0.html
  • From b2f95bd537dca45e52eb0cb6135474eaa01809cc Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 11:03:48 +0100 Subject: [PATCH 081/112] TextSymbolizer->Fill->CssParameter['fill'] should map to fontColor instead --- lib/OpenLayers/Format/SLD/v1.js | 17 +++++++++++++---- tests/Format/SLD/v1_0_0.html | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index be1ce6effd..0780c8d163 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -338,6 +338,10 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { "CssParameter": function(node, symbolizer) { var cssProperty = node.getAttribute("name"); var symProperty = this.cssMap[cssProperty]; + // for labels, fill should map to the fontColor + if (symbolizer.label && cssProperty === 'fill') { + symProperty = "fontColor"; + } if(symProperty) { // Limited support for parsing of OGC expressions var value = this.readers.ogc._expression.call(this, node); @@ -862,10 +866,15 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { return node; }, "CssParameter": function(obj) { + var name = this.getCssProperty(obj.key); + var value = obj.symbolizer[obj.key]; + if (obj.symbolizer.label && name === 'fill') { + value = obj.symbolizer.fontColor; + } // not handling ogc:expressions for now return this.createElementNSPlus("sld:CssParameter", { - attributes: {name: this.getCssProperty(obj.key)}, - value: obj.symbolizer[obj.key] + attributes: {name: name}, + value: value }); }, "TextSymbolizer": function(symbolizer) { @@ -888,7 +897,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { this.writeNode("Halo", symbolizer, node); } // add in optional Fill - if(symbolizer.fillColor != null || + if(symbolizer.fontColor != null || symbolizer.fillOpacity != null) { this.writeNode("Fill", symbolizer, node); } @@ -1004,7 +1013,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { // GraphicFill here // add in CssParameters - if(symbolizer.fillColor) { + if(symbolizer.fillColor || (symbolizer.label && symbolizer.fontColor)) { this.writeNode( "CssParameter", {symbolizer: symbolizer, key: "fillColor"}, diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index a31ba6a5f3..98f4cd161b 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -177,7 +177,7 @@ t.eq(text.label, "A ${FOO} label", "(AAA161) first rule has proper text label"); t.eq(layer.userStyles[0].propertyStyles["label"], true, "label added to propertyStyles"); t.eq(text.fontFamily, "Arial", "(AAA161) first rule has proper font family"); - t.eq(text.fillColor, "#000000", "(AAA161) first rule has proper text fill"); + t.eq(text.fontColor, "#000000", "(AAA161) first rule has proper text fill"); t.eq(text.haloRadius, "3", "(AAA161) first rule has proper halo radius"); t.eq(text.haloColor, "#ffffff", "(AAA161) first rule has proper halo color"); @@ -347,7 +347,7 @@ "label": "This is the ${city} in ${state}.", "fontFamily": "Arial", "fontSize": 10, - "fillColor": "blue", + "fontColor": "blue", "fontWeight": "bold", "fontStyle": "normal", "haloRadius": 2, From 82a8602b45f9b033e6458b029b1b5aa8630c5b6e Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 11:50:37 +0100 Subject: [PATCH 082/112] use a more clean way to achieve the same --- lib/OpenLayers/Format/SLD/v1.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 0780c8d163..e23a14d995 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -866,15 +866,10 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { return node; }, "CssParameter": function(obj) { - var name = this.getCssProperty(obj.key); - var value = obj.symbolizer[obj.key]; - if (obj.symbolizer.label && name === 'fill') { - value = obj.symbolizer.fontColor; - } // not handling ogc:expressions for now return this.createElementNSPlus("sld:CssParameter", { - attributes: {name: name}, - value: value + attributes: {name: this.getCssProperty(obj.key)}, + value: obj.symbolizer[obj.key] }); }, "TextSymbolizer": function(symbolizer) { @@ -899,7 +894,9 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { // add in optional Fill if(symbolizer.fontColor != null || symbolizer.fillOpacity != null) { - this.writeNode("Fill", symbolizer, node); + this.writeNode("Fill", { + fillColor: symbolizer.fontColor + }, node); } return node; }, @@ -1013,7 +1010,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { // GraphicFill here // add in CssParameters - if(symbolizer.fillColor || (symbolizer.label && symbolizer.fontColor)) { + if(symbolizer.fillColor) { this.writeNode( "CssParameter", {symbolizer: symbolizer, key: "fillColor"}, From f0cb98a9bf969007018c0c81820e48e6d967cd26 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 11:57:42 +0100 Subject: [PATCH 083/112] a bit of restructuring, also making sure that a Graphic in a TextSymbolizer can be read and written (this is a GeoServer extension to produce e.g. highway shields) --- lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js | 65 ++++++++++--------- tests/Format/SLD/v1_0_0_GeoServer.html | 12 ++++ 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js index 663db29d37..dc77fc5387 100644 --- a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js +++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js @@ -88,55 +88,56 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( }); }, "TextSymbolizer": function(symbolizer) { - var node = OpenLayers.Format.SLD.v1_0_0.prototype.writers["sld"]["TextSymbolizer"].apply(this, arguments); + var writers = OpenLayers.Format.SLD.v1_0_0.prototype.writers; + var node = writers["sld"]["TextSymbolizer"].apply(this, arguments); if (symbolizer.externalGraphic || symbolizer.graphicName) { this.writeNode("Graphic", symbolizer, node); } if ("priority" in symbolizer) { this.writeNode("Priority", symbolizer.priority, node); } - var options = symbolizer.vendorOptions; - if (options) { - for (var i=0, ii=options.length; i #000000 + + + square + + #59BF34 + + + #2D6917 + + + 24 + population From d4e0947f1a299c8a727a70da2ef05b298038ad16 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 12:18:56 +0100 Subject: [PATCH 084/112] even though the parsing and writing is the same for all VendorOption tags, add a more complete list in the test SLD --- tests/Format/SLD/v1_0_0_GeoServer.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Format/SLD/v1_0_0_GeoServer.html b/tests/Format/SLD/v1_0_0_GeoServer.html index 94defbfe93..c396ec61ce 100644 --- a/tests/Format/SLD/v1_0_0_GeoServer.html +++ b/tests/Format/SLD/v1_0_0_GeoServer.html @@ -88,7 +88,19 @@ population 60 + true + 300 150 + false + 3 + stretch + yes + 10 + true + 15 + false + 0.3 + mbr From 941f3c0913b44701822bd0271cc70c61f453b9ea Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 12:23:20 +0100 Subject: [PATCH 085/112] change comment to highlight it's both read and write --- lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js index dc77fc5387..50275e5d32 100644 --- a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js +++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js @@ -9,9 +9,10 @@ /** * Class: OpenLayers.Format.SLD/v1_0_0_GeoServer - * Read SLD version 1.0.0 with GeoServer-specific enhanced options. + * Read and write SLD version 1.0.0 with GeoServer-specific enhanced options. * See http://svn.osgeo.org/geotools/trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd - * + * for more information. + * * Inherits from: * - */ From d6e28e5ab94fb44a51438ae325813ee89f87fbc3 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Wed, 22 Feb 2012 15:26:21 +0100 Subject: [PATCH 086/112] Added support for named graphics to Canvas renderer --- lib/OpenLayers/Renderer/Canvas.js | 153 ++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index daf9e19e35..da82e1d7f9 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -51,6 +51,12 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { */ pendingRedraw: false, + /** + * Property: cachedSymbolBounds + * {Object} Internal cache of calculated symbol extents. + */ + cachedSymbolBounds: {}, + /** * Constructor: OpenLayers.Renderer.Canvas * @@ -283,6 +289,151 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { img.src = style.externalGraphic; }, + /** + * Method: drawNamedSymbol + * Called to draw Well Known Graphic Symbol Name. + * This method is only called by the renderer itself. + * + * Parameters: + * geometry - {} + * style - {Object} + * featureId - {String} + */ + drawNamedSymbol: function(geometry, style, featureId) { + var x, y, cx, cy, i, symbolBounds, scaling, angle; + var unscaledStrokeWidth; + var deg2rad = Math.PI / 180.0; + + var symbol = OpenLayers.Renderer.symbol[style.graphicName]; + + if (!symbol) { + throw new Error(style.graphicName + ' is not a valid symbol name'); + } + + if (!symbol.length || symbol.length < 2) return; + + var pt = this.getLocalXY(geometry); + var p0 = pt[0]; + var p1 = pt[1]; + + if (isNaN(p0) || isNaN(p1)) return; + + // Use rounded line caps + this.canvas.lineCap = "round"; + this.canvas.lineJoin = "round"; + + // Scale and rotate symbols, using precalculated bounds whenever possible. + if (style.graphicName in this.cachedSymbolBounds) { + symbolBounds = this.cachedSymbolBounds[style.graphicName]; + } else { + symbolBounds = new OpenLayers.Bounds(); + for(i = 0; i < symbol.length; i+=2) { + symbolBounds.extend(new OpenLayers.LonLat(symbol[i], symbol[i+1])); + } + this.cachedSymbolBounds[style.graphicName] = symbolBounds; + } + + // Push symbol scaling, translation and rotation onto the transformation stack in reverse order. + // Don't forget to apply all canvas transformations to the hitContext canvas as well(!) + this.canvas.save(); + if (this.hitDetection) this.hitContext.save(); + + // Step 3: place symbol at the desired location + this.canvas.translate(p0,p1); + if (this.hitDetection) this.hitContext.translate(p0,p1); + + // Step 2a. rotate the symbol if necessary + angle = deg2rad * style.rotation; // will be NaN when style.rotation is undefined. + if (!isNaN(angle)) { + this.canvas.rotate(angle); + if (this.hitDetection) this.hitContext.rotate(angle); + } + + // // Step 2: scale symbol such that pointRadius equals half the maximum symbol dimension. + scaling = 2.0 * style.pointRadius / Math.max(symbolBounds.getWidth(), symbolBounds.getHeight()); + this.canvas.scale(scaling,scaling); + if (this.hitDetection) this.hitContext.scale(scaling,scaling); + + // Step 1: center the symbol at the origin + cx = symbolBounds.getCenterLonLat().lon; + cy = symbolBounds.getCenterLonLat().lat; + this.canvas.translate(-cx,-cy); + if (this.hitDetection) this.hitContext.translate(-cx,-cy); + + // Don't forget to scale stroke widths, because they are affected by canvas scale transformations as well(!) + // Alternative: scale symbol coordinates manually, so stroke width scaling is not needed anymore. + unscaledStrokeWidth = style.strokeWidth; + style.strokeWidth = unscaledStrokeWidth / scaling; + + if (style.fill !== false) { + this.setCanvasStyle("fill", style); + this.canvas.beginPath(); + for (i=0; i Date: Wed, 22 Feb 2012 15:39:31 +0100 Subject: [PATCH 087/112] Small fix for hit detection on a canvas layer as an illegal feature id might result at a location where the edge of one feature intersects the interior of another. This is due to antialiasing on the hit context canvas which can't be turned off, unfortunately. --- .gitignore | 2 ++ examples/graphic-name.js | 4 ++-- lib/OpenLayers/Renderer/Canvas.js | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 42b60260f3..0f81cf6d15 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /doc/apidocs/ /examples/example-list.js /examples/example-list.xml +/examples/graphic-name.js +/examples/graphic-name.html diff --git a/examples/graphic-name.js b/examples/graphic-name.js index 654a4c997d..267ae071dc 100644 --- a/examples/graphic-name.js +++ b/examples/graphic-name.js @@ -34,14 +34,14 @@ function init(){ var styles = new OpenLayers.StyleMap({ "default": { graphicName: "${type}", - pointRadius: 10, + pointRadius: 40, strokeColor: "fuchsia", strokeWidth: 2, fillColor: "lime", fillOpacity: 0.6 }, "select": { - pointRadius: 20, + pointRadius: 50, fillOpacity: 1, rotation: 45 } diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index da82e1d7f9..e180ef7288 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -786,7 +786,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { * layer. */ getFeatureIdFromEvent: function(evt) { - var feature; + var featureId, feature; if (this.hitDetection) { // this dragging check should go in the feature handler if (!this.map.dragging) { @@ -797,7 +797,14 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { if (data[3] === 255) { // antialiased var id = data[2] + (256 * (data[1] + (256 * data[0]))); if (id) { - feature = this.features["OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow)][0]; + featureId = "OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow); + try { + feature = this.features["OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow)][0]; + } catch(err) { + // Because of antialiasing on the canvas, when the hit location is at a point where the edge of + // one symbol intersects the interior of another symbol, a wrong hit color (and therefore id) results. + // todo: set Antialiasing = 'off' on the hitContext as soon as browsers allow it. + } } } } From 65aeaec284f66b76073672f066b6932d666eb709 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Wed, 22 Feb 2012 15:52:01 +0100 Subject: [PATCH 088/112] returned graphic-name.js to its original state --- .gitignore | 2 -- examples/graphic-name.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0f81cf6d15..42b60260f3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,3 @@ /doc/apidocs/ /examples/example-list.js /examples/example-list.xml -/examples/graphic-name.js -/examples/graphic-name.html diff --git a/examples/graphic-name.js b/examples/graphic-name.js index 267ae071dc..654a4c997d 100644 --- a/examples/graphic-name.js +++ b/examples/graphic-name.js @@ -34,14 +34,14 @@ function init(){ var styles = new OpenLayers.StyleMap({ "default": { graphicName: "${type}", - pointRadius: 40, + pointRadius: 10, strokeColor: "fuchsia", strokeWidth: 2, fillColor: "lime", fillOpacity: 0.6 }, "select": { - pointRadius: 50, + pointRadius: 20, fillOpacity: 1, rotation: 45 } From bb3ae997135d3c3f16c85bd12a5cf1390d4d7995 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Wed, 22 Feb 2012 15:57:54 +0100 Subject: [PATCH 089/112] forgot to actually used featureId in getFeatureIdFromEvent --- lib/OpenLayers/Renderer/Canvas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index e180ef7288..eb2b7fcc54 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -799,7 +799,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { if (id) { featureId = "OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow); try { - feature = this.features["OpenLayers.Feature.Vector_" + (id - 1 + this.hitOverflow)][0]; + feature = this.features[featureId][0]; } catch(err) { // Because of antialiasing on the canvas, when the hit location is at a point where the edge of // one symbol intersects the interior of another symbol, a wrong hit color (and therefore id) results. From 7fb62b69333c0cf748d562d8f42340389d48c564 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Wed, 22 Feb 2012 16:18:41 +0100 Subject: [PATCH 090/112] more complete inheritance of readers and writers --- lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js index 50275e5d32..49596be1c4 100644 --- a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js +++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js @@ -48,7 +48,7 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( * with two arguments: the node being read and a context object passed * from the parent. */ - readers: { + readers: OpenLayers.Util.applyDefaults({ "sld": OpenLayers.Util.applyDefaults({ "Priority": function(node, obj) { var value = this.readers.ogc._expression.call(this, node); @@ -65,9 +65,8 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( value: this.getChildValue(node) }); } - }, OpenLayers.Format.SLD.v1_0_0.prototype.readers["sld"]), - "ogc": OpenLayers.Format.SLD.v1_0_0.prototype.readers["ogc"] - }, + }, OpenLayers.Format.SLD.v1_0_0.prototype.readers["sld"]) + }, OpenLayers.Format.SLD.v1_0_0.prototype.readers), /** * Property: writers @@ -75,7 +74,7 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( * writing functions grouped by namespace alias and named like the * node names they produce. */ - writers: { + writers: OpenLayers.Util.applyDefaults({ "sld": OpenLayers.Util.applyDefaults({ "Priority": function(priority) { return this.writers.sld._OGCExpression.call( @@ -114,9 +113,8 @@ OpenLayers.Format.SLD.v1_0_0_GeoServer = OpenLayers.Class( var node = writers["sld"]["PolygonSymbolizer"].apply(this, arguments); return this.addVendorOptions(node, symbolizer); } - }, OpenLayers.Format.SLD.v1_0_0.prototype.writers["sld"]), - "ogc": OpenLayers.Format.SLD.v1_0_0.prototype.writers["ogc"] - }, + }, OpenLayers.Format.SLD.v1_0_0.prototype.writers["sld"]) + }, OpenLayers.Format.SLD.v1_0_0.prototype.writers), /** * Method: addVendorOptions From 69660e3530b9c04b1b96aa7b86d250ff1f06dc72 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 22 Feb 2012 17:22:30 +0100 Subject: [PATCH 091/112] Minor coding style improvements. --- lib/OpenLayers/Renderer/Canvas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index eb2b7fcc54..35939afdd2 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -336,29 +336,29 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { // Push symbol scaling, translation and rotation onto the transformation stack in reverse order. // Don't forget to apply all canvas transformations to the hitContext canvas as well(!) this.canvas.save(); - if (this.hitDetection) this.hitContext.save(); + if (this.hitDetection) { this.hitContext.save(); } // Step 3: place symbol at the desired location this.canvas.translate(p0,p1); - if (this.hitDetection) this.hitContext.translate(p0,p1); + if (this.hitDetection) { this.hitContext.translate(p0,p1); } // Step 2a. rotate the symbol if necessary angle = deg2rad * style.rotation; // will be NaN when style.rotation is undefined. if (!isNaN(angle)) { this.canvas.rotate(angle); - if (this.hitDetection) this.hitContext.rotate(angle); + if (this.hitDetection) { this.hitContext.rotate(angle); } } // // Step 2: scale symbol such that pointRadius equals half the maximum symbol dimension. scaling = 2.0 * style.pointRadius / Math.max(symbolBounds.getWidth(), symbolBounds.getHeight()); this.canvas.scale(scaling,scaling); - if (this.hitDetection) this.hitContext.scale(scaling,scaling); + if (this.hitDetection) { this.hitContext.scale(scaling,scaling); } // Step 1: center the symbol at the origin cx = symbolBounds.getCenterLonLat().lon; cy = symbolBounds.getCenterLonLat().lat; this.canvas.translate(-cx,-cy); - if (this.hitDetection) this.hitContext.translate(-cx,-cy); + if (this.hitDetection) { this.hitContext.translate(-cx,-cy); } // Don't forget to scale stroke widths, because they are affected by canvas scale transformations as well(!) // Alternative: scale symbol coordinates manually, so stroke width scaling is not needed anymore. @@ -408,7 +408,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { style.strokeWidth = unscaledStrokeWidth; this.canvas.restore(); - if (this.hitDetection) this.hitContext.restore(); + if (this.hitDetection) { this.hitContext.restore(); } this.setCanvasStyle("reset"); }, From 2e69d681022a86cf7733ff4697ee2a24fbf18266 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Thu, 23 Feb 2012 15:55:40 +0100 Subject: [PATCH 092/112] map fill-opacity in TextSymbolizer to fontOpacity --- lib/OpenLayers/Format/SLD/v1.js | 16 +++++++++++----- tests/Format/SLD/v1_0_0_GeoServer.html | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index e23a14d995..a6fe969c4a 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -338,9 +338,14 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { "CssParameter": function(node, symbolizer) { var cssProperty = node.getAttribute("name"); var symProperty = this.cssMap[cssProperty]; - // for labels, fill should map to the fontColor - if (symbolizer.label && cssProperty === 'fill') { - symProperty = "fontColor"; + // for labels, fill should map to fontColor and fill-opacity + // to fontOpacity + if (symbolizer.label) { + if (cssProperty === 'fill') { + symProperty = "fontColor"; + } else if (cssProperty === 'fill-opacity') { + symProperty = "fontOpacity"; + } } if(symProperty) { // Limited support for parsing of OGC expressions @@ -893,9 +898,10 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { } // add in optional Fill if(symbolizer.fontColor != null || - symbolizer.fillOpacity != null) { + symbolizer.fontOpacity != null) { this.writeNode("Fill", { - fillColor: symbolizer.fontColor + fillColor: symbolizer.fontColor, + fillOpacity: symbolizer.fontOpacity }, node); } return node; diff --git a/tests/Format/SLD/v1_0_0_GeoServer.html b/tests/Format/SLD/v1_0_0_GeoServer.html index c396ec61ce..bfe9b3ec4a 100644 --- a/tests/Format/SLD/v1_0_0_GeoServer.html +++ b/tests/Format/SLD/v1_0_0_GeoServer.html @@ -71,12 +71,14 @@ #000000 + 0.5 square - #59BF34 + #59BF34 + 0.8 #2D6917 From 6411a6c0efd2f232b57bad5ddabbf2c56eda6162 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 14:58:36 +0100 Subject: [PATCH 093/112] implement TextSymbolizer->PointPlacement --- lib/OpenLayers/Feature/.Vector.js.swp | Bin 0 -> 16384 bytes lib/OpenLayers/Format/SLD/v1.js | 126 ++++++++++++++++++++++++++ tests/Format/SLD/v1_0_0.html | 13 +++ 3 files changed, 139 insertions(+) create mode 100644 lib/OpenLayers/Feature/.Vector.js.swp diff --git a/lib/OpenLayers/Feature/.Vector.js.swp b/lib/OpenLayers/Feature/.Vector.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..264aae31ffdf200292c7a018095878b91b52334f GIT binary patch literal 16384 zcmeHNO>87b6)t|V5R&kdAR$0Pg;!*3WA}J%SkP=R%-UYouxnfEnJh>fK}~m!yX>Cs zp}TsV*^L)P;*u2-KPMy({N<1XC>KC*iv&4ucy{gwW)mwOU{WATSw?uHglaSr7FKs^chkue6-b_f3rE(N-RdeE{ z+RcwxJRk6Qo{QZW_iTQ^{9cmm%@5PWixQtjnWWxscA_$_(lOu|IEH}-$kO7O1yy-^>Vx#52fN3#bH$DU z$ADwNG2j?*3^)cH1C9a5!0V9#IXp$ajDfw;4DP_(-*D*unz?*ae)CZMe@*?qDS!D; z{eMjTiYfn`>A?2$Z&SZz>c4%c{!OO*L397xp?Xv7ZjJ%RfMdWh;23ZWI0hU8jseGj zW56-s7;p?6!2k;gSw#7HwE=+N|Lyz#kKaK^1Uw9!0`39+@peLP1HS`)27Dj*DzFbo zAOjNM5-$$23!JGfsX8l{a0_@6=mTBgGVlm+4p;)-54`wRj34+4kOM;?1U>`28@M0%`&$V4D{vcl9vA@) z;La&Ro(8S~4*}2LL&$X?12}LE_#|)^m;t7MKjKWrcYtpJw}2;s5NHD*0X__T0C*4Z zD{PoN0n7upVcQphUjsh{eggauxCuN4bOB}mHt_#nR9&-li=}M9CC+iQh$*u7l@up9 zIAwICPjJwFaiGJaWrHNnWSXnv9W7d&{P4`l53e}+p<6d+XDO_RYmfw@FL=e*bqscuRxnyo%e`$@oUXSOzEBVMvwJ+C=el!YSRp^?}tY*#wq)sV-avTkP@vWyN` zz^#KQ8O9-Nn$0N#YmYE0SWS+n!Wyqdmp6O6@O1k~ImRQ0*6t%_5F3TR7OL$F8Pdzj zzsDv7<_f1wv|!_^5l&a>LEDZ@?Onc;QJldV@>GtM&$0;N7{L5GDg)Z%@Bj|SR~!m? zcfeGSdo}l(h#hSo5UE{?ioVv?s@0x|GMM9Vm}E5Rm*HG9g7S6*ft6Et=#?avX%cx8 zBrVU;{ZRO!>L623QfrfvfO2%b@ks$Prvq?56;i^3dSk1Cl4+a;9-@ZH$8?{AzQTNg zM_2MR<*`J3>1m|SypB3Wz7=<)aFheuj;S%8HofY`hK?p@Vl2wOwHQeHR$O~)eajfS zRr0ATF>C6({s;8}p039jnna8SywCDTPT47>oI!7FW5$ek4lv892efpvQ7PiQTERd>C%vu4Dxc*!-OKIRz`}M*b zOBYZvpga%(zAvH({!b;_gJ==MgPD)0k7do~6Rbk(awz&kCdUy!W+0_`bxX{C6QcB! z#S*9&HH^CWmPxFZ$BDEyu_7zF^gKadty2UzvT`m^Qzr1KQgmQ~ey9D-eVVLwd;BzOPB5njyXo!feZ#N-l#0ssEI8Ez(cfrCYf=S zVj*I*p_OVVT?|9Uu``pg@;YJGuGCk|!H#VhCV^z)L9D~Ev-CAwy!tOA@G}tIs zrS*;NwJRMoU5^ne(v)^LKD)7bbpyrScrQ-&V^glCQ#~7I$~$U)v#n-U_|^^5Y|_q^ z_Vz{ExwyVfl;(ZBL{P~emns=iR=}G9j>;0ui(~6vlI}E- zK*xKvv+Pa#w1hyNVXHjG^b!foljy})NsM|YNz!b_qg#0oH6fe_6Bu$rrNm0aSxV1u zuU6_%kVsdO;TSI&p`_FP3|(AUI6J?%aAr|W-_>~0s_KAFXBYuPo{!!&n za11yG90QI4$ADwNG2j?*3^)cH1FusC4$i4pd7}QAABgZN5ZMrK%-C^`lb9F32sQK; zE^pW$f)3{JE^e-f^?0?}k&@Ly_EWV?&4*(2m4Tj7on{ ztLfvt*gkc7L0`36>~3dTpeS~ZYE{Doo5Va_8>wwgNF9kxV9Rccsp6p4Fifz0x}{oo zW1)80KXhc}6&8pbg3g%DcWAA 1/3 && x < 2/3) { + labelAlign = 'c'; + } else if (x >= 2/3) { + labelAlign = 'r'; + } + if (y <= 1/3) { + labelAlign += 'b'; + } else if (y > 1/3 && y < 2/3) { + labelAlign += 'm'; + } else if (x >= 2/3) { + labelAlign += 't'; + } + symbolizer.labelAlign = labelAlign; + }, + "AnchorPoint": function(node, symbolizer) { + this.readChildNodes(node, symbolizer); + }, + "AnchorPointX": function(node, symbolizer) { + var labelAnchorPointX = this.readers.ogc._expression.call(this, node); + // always string, could be empty string + if(labelAnchorPointX) { + symbolizer.labelAnchorPointX = labelAnchorPointX; + } + }, + "AnchorPointY": function(node, symbolizer) { + var labelAnchorPointY = this.readers.ogc._expression.call(this, node); + // always string, could be empty string + if(labelAnchorPointY) { + symbolizer.labelAnchorPointY = labelAnchorPointY; + } + }, + "Displacement": function(node, symbolizer) { + this.readChildNodes(node, symbolizer); + }, + "DisplacementX": function(node, symbolizer) { + var labelXOffset = this.readers.ogc._expression.call(this, node); + // always string, could be empty string + if(labelXOffset) { + symbolizer.labelXOffset = labelXOffset; + } + }, + "DisplacementY": function(node, symbolizer) { + var labelYOffset = this.readers.ogc._expression.call(this, node); + // always string, could be empty string + if(labelYOffset) { + symbolizer.labelYOffset = labelYOffset; + } + }, "Label": function(node, symbolizer) { var value = this.readers.ogc._expression.call(this, node); if (value) { @@ -881,6 +939,11 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { symbolizer.fontStyle != null) { this.writeNode("Font", symbolizer, node); } + // add in optional LabelPlacement + if (symbolizer.labelAnchorPointX != null || + symbolizer.labelAnchorPointY != null) { + this.writeNode("LabelPlacement", symbolizer, node); + } // add in optional Halo if(symbolizer.haloRadius != null || symbolizer.haloColor != null || @@ -894,6 +957,69 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { } return node; }, + "LabelPlacement": function(symbolizer) { + var node = this.createElementNSPlus("sld:LabelPlacement"); + if (symbolizer.labelAnchorPointX != null || + symbolizer.labelAnchorPointY != null) { + this.writeNode("PointPlacement", symbolizer, node); + } + return node; + }, + "PointPlacement": function(symbolizer) { + var node = this.createElementNSPlus("sld:PointPlacement"); + if (symbolizer.labelAnchorPointX != null || + symbolizer.labelAnchorPointY != null) { + this.writeNode("AnchorPoint", symbolizer, node); + } + if (symbolizer.labelXOffset != null || + symbolizer.labelYOffset != null) { + this.writeNode("Displacement", symbolizer, node); + } + if (symbolizer.rotation != null) { + this.writeNode("Rotation", symbolizer.rotation, node); + } + return node; + }, + "AnchorPoint": function(symbolizer) { + var node = this.createElementNSPlus("sld:AnchorPoint"); + if (symbolizer.labelAnchorPointX != null) { + this.writeNode("AnchorPointX", symbolizer.labelAnchorPointX, node); + } + if (symbolizer.labelAnchorPointY != null) { + this.writeNode("AnchorPointY", symbolizer.labelAnchorPointY, node); + } + return node; + }, + "AnchorPointX": function(value) { + return this.createElementNSPlus("sld:AnchorPointX", { + value: value + }); + }, + "AnchorPointY": function(value) { + return this.createElementNSPlus("sld:AnchorPointY", { + value: value + }); + }, + "Displacement": function(symbolizer) { + var node = this.createElementNSPlus("sld:Displacement"); + if (symbolizer.labelXOffset != null) { + this.writeNode("DisplacementX", symbolizer.labelXOffset, node); + } + if (symbolizer.labelYOffset != null) { + this.writeNode("DisplacementY", symbolizer.labelYOffset, node); + } + return node; + }, + "DisplacementX": function(value) { + return this.createElementNSPlus("sld:DisplacementX", { + value: value + }); + }, + "DisplacementY": function(value) { + return this.createElementNSPlus("sld:DisplacementY", { + value: value + }); + }, "Font": function(symbolizer) { var node = this.createElementNSPlus("sld:Font"); // add in CssParameters diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index a31ba6a5f3..37e9e1558a 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -47,6 +47,19 @@ 'bold' + 'normal' + '' + + '' + + '' + + '' + + '0.5' + + '0.5' + + '' + + '' + + '5' + + '5' + + '' + + '45' + + '' + + '' + '' + '3' + '' + From f05564cdb3fcb4b071daf01b7cca26396ebea581 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 15:42:49 +0100 Subject: [PATCH 094/112] add support for LinePlacement --- lib/OpenLayers/Format/SLD/v1.js | 28 ++++++++++++++++-- tests/Format/SLD/v1_0_0.html | 51 +++++++++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index ef8dda0ce3..49592aef71 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -278,6 +278,16 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { symbolizer.labelYOffset = labelYOffset; } }, + "LinePlacement": function(node, symbolizer) { + this.readChildNodes(node, symbolizer); + }, + "PerpendicularOffset": function(node, symbolizer) { + var labelPerpendicularOffset = this.readers.ogc._expression.call(this, node); + // always string, could be empty string + if(labelPerpendicularOffset) { + symbolizer.labelPerpendicularOffset = labelPerpendicularOffset; + } + }, "Label": function(node, symbolizer) { var value = this.readers.ogc._expression.call(this, node); if (value) { @@ -940,8 +950,9 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { this.writeNode("Font", symbolizer, node); } // add in optional LabelPlacement - if (symbolizer.labelAnchorPointX != null || - symbolizer.labelAnchorPointY != null) { + if ((symbolizer.labelAnchorPointX != null || + symbolizer.labelAnchorPointY != null) || + symbolizer.labelPerpendicularOffset != null) { this.writeNode("LabelPlacement", symbolizer, node); } // add in optional Halo @@ -963,8 +974,21 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { symbolizer.labelAnchorPointY != null) { this.writeNode("PointPlacement", symbolizer, node); } + if (symbolizer.labelPerpendicularOffset != null) { + this.writeNode("LinePlacement", symbolizer, node); + } return node; }, + "LinePlacement": function(symbolizer) { + var node = this.createElementNSPlus("sld:LinePlacement"); + this.writeNode("PerpendicularOffset", symbolizer.labelPerpendicularOffset, node); + return node; + }, + "PerpendicularOffset": function(value) { + return this.createElementNSPlus("sld:PerpendicularOffset", { + value: value + }); + }, "PointPlacement": function(symbolizer) { var node = this.createElementNSPlus("sld:PointPlacement"); if (symbolizer.labelAnchorPointX != null || diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index 37e9e1558a..7b3c50acf2 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -522,7 +522,33 @@ t.xml_eq(got, exp, "duplicated rules to write zIndex as FeatureTypeStyle elements"); } - + + function test_label_LinePlacement(t) { + t.plan(1); + var format = new OpenLayers.Format.SLD.v1_0_0({ + multipleSymbolizers: true + }); + var style = new OpenLayers.Style2({ + rules: [ + new OpenLayers.Rule({ + symbolizers: [ + new OpenLayers.Symbolizer.Line({ + strokeColor: "red", + strokeWidth: 3 + }), + new OpenLayers.Symbolizer.Text({ + label: "${FOO}", + labelPerpendicularOffset: 10 + }) + ] + }) + ] + }); + var got = format.writeNode("sld:UserStyle", style); + var exp = readXML("label_lineplacement_test.sld").documentElement; + t.xml_eq(got, exp, "LinePlacement written out correctly"); + } + function test_read_FeatureTypeStyles(t) { t.plan(13); @@ -598,7 +624,6 @@ doc = readXML("polygon_labelhalo.sld"); out = format.write(format.read(doc)); t.xml_eq(out, doc.documentElement, "round-tripped polygon_labelhalo.sld"); - } @@ -880,5 +905,27 @@ --> +
    From c7a631c2e5b43616e0ae494855c466c69a068021 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 15:59:14 +0100 Subject: [PATCH 095/112] correct typo --- lib/OpenLayers/Format/SLD/v1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 49592aef71..8244c09909 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -239,7 +239,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { labelAlign += 'b'; } else if (y > 1/3 && y < 2/3) { labelAlign += 'm'; - } else if (x >= 2/3) { + } else if (y >= 2/3) { labelAlign += 't'; } symbolizer.labelAlign = labelAlign; From 094bedda9a39b6d82657064b5b7f7c2397c84848 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 24 Feb 2012 16:04:07 +0100 Subject: [PATCH 096/112] If maxResolution is not set, we want the serverResolution. After 2fe882f4d83728814c8ec387b13c0f89e8e74986, no default maxResolution is set. To make the Math.min not return 0, we need a fallback if no maxResolution was configured. --- lib/OpenLayers/Layer/Bing.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index 68ea9efd3a..b03b7e6815 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -169,7 +169,8 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { } this.addOptions({ maxResolution: Math.min( - this.serverResolutions[res.zoomMin], this.maxResolution + this.serverResolutions[res.zoomMin], + this.maxResolution || Number.POSITIVE_INFINITY ), numZoomLevels: Math.min( res.zoomMax + 1 - res.zoomMin, this.numZoomLevels From 66d3b8192910ec9b5b9b5e3a0bd98d3ea65e2f4c Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 17:03:49 +0100 Subject: [PATCH 097/112] remove accidentally commited swap file --- lib/OpenLayers/Feature/.Vector.js.swp | Bin 16384 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 lib/OpenLayers/Feature/.Vector.js.swp diff --git a/lib/OpenLayers/Feature/.Vector.js.swp b/lib/OpenLayers/Feature/.Vector.js.swp deleted file mode 100644 index 264aae31ffdf200292c7a018095878b91b52334f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNO>87b6)t|V5R&kdAR$0Pg;!*3WA}J%SkP=R%-UYouxnfEnJh>fK}~m!yX>Cs zp}TsV*^L)P;*u2-KPMy({N<1XC>KC*iv&4ucy{gwW)mwOU{WATSw?uHglaSr7FKs^chkue6-b_f3rE(N-RdeE{ z+RcwxJRk6Qo{QZW_iTQ^{9cmm%@5PWixQtjnWWxscA_$_(lOu|IEH}-$kO7O1yy-^>Vx#52fN3#bH$DU z$ADwNG2j?*3^)cH1C9a5!0V9#IXp$ajDfw;4DP_(-*D*unz?*ae)CZMe@*?qDS!D; z{eMjTiYfn`>A?2$Z&SZz>c4%c{!OO*L397xp?Xv7ZjJ%RfMdWh;23ZWI0hU8jseGj zW56-s7;p?6!2k;gSw#7HwE=+N|Lyz#kKaK^1Uw9!0`39+@peLP1HS`)27Dj*DzFbo zAOjNM5-$$23!JGfsX8l{a0_@6=mTBgGVlm+4p;)-54`wRj34+4kOM;?1U>`28@M0%`&$V4D{vcl9vA@) z;La&Ro(8S~4*}2LL&$X?12}LE_#|)^m;t7MKjKWrcYtpJw}2;s5NHD*0X__T0C*4Z zD{PoN0n7upVcQphUjsh{eggauxCuN4bOB}mHt_#nR9&-li=}M9CC+iQh$*u7l@up9 zIAwICPjJwFaiGJaWrHNnWSXnv9W7d&{P4`l53e}+p<6d+XDO_RYmfw@FL=e*bqscuRxnyo%e`$@oUXSOzEBVMvwJ+C=el!YSRp^?}tY*#wq)sV-avTkP@vWyN` zz^#KQ8O9-Nn$0N#YmYE0SWS+n!Wyqdmp6O6@O1k~ImRQ0*6t%_5F3TR7OL$F8Pdzj zzsDv7<_f1wv|!_^5l&a>LEDZ@?Onc;QJldV@>GtM&$0;N7{L5GDg)Z%@Bj|SR~!m? zcfeGSdo}l(h#hSo5UE{?ioVv?s@0x|GMM9Vm}E5Rm*HG9g7S6*ft6Et=#?avX%cx8 zBrVU;{ZRO!>L623QfrfvfO2%b@ks$Prvq?56;i^3dSk1Cl4+a;9-@ZH$8?{AzQTNg zM_2MR<*`J3>1m|SypB3Wz7=<)aFheuj;S%8HofY`hK?p@Vl2wOwHQeHR$O~)eajfS zRr0ATF>C6({s;8}p039jnna8SywCDTPT47>oI!7FW5$ek4lv892efpvQ7PiQTERd>C%vu4Dxc*!-OKIRz`}M*b zOBYZvpga%(zAvH({!b;_gJ==MgPD)0k7do~6Rbk(awz&kCdUy!W+0_`bxX{C6QcB! z#S*9&HH^CWmPxFZ$BDEyu_7zF^gKadty2UzvT`m^Qzr1KQgmQ~ey9D-eVVLwd;BzOPB5njyXo!feZ#N-l#0ssEI8Ez(cfrCYf=S zVj*I*p_OVVT?|9Uu``pg@;YJGuGCk|!H#VhCV^z)L9D~Ev-CAwy!tOA@G}tIs zrS*;NwJRMoU5^ne(v)^LKD)7bbpyrScrQ-&V^glCQ#~7I$~$U)v#n-U_|^^5Y|_q^ z_Vz{ExwyVfl;(ZBL{P~emns=iR=}G9j>;0ui(~6vlI}E- zK*xKvv+Pa#w1hyNVXHjG^b!foljy})NsM|YNz!b_qg#0oH6fe_6Bu$rrNm0aSxV1u zuU6_%kVsdO;TSI&p`_FP3|(AUI6J?%aAr|W-_>~0s_KAFXBYuPo{!!&n za11yG90QI4$ADwNG2j?*3^)cH1FusC4$i4pd7}QAABgZN5ZMrK%-C^`lb9F32sQK; zE^pW$f)3{JE^e-f^?0?}k&@Ly_EWV?&4*(2m4Tj7on{ ztLfvt*gkc7L0`36>~3dTpeS~ZYE{Doo5Va_8>wwgNF9kxV9Rccsp6p4Fifz0x}{oo zW1)80KXhc}6&8pbg3g%DcWAA Date: Fri, 24 Feb 2012 17:48:35 +0100 Subject: [PATCH 098/112] do not use rotation but use labelRotation instead (thanks @ahocevar for the catch) --- lib/OpenLayers/Format/SLD/v1.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 8244c09909..3d5bc87c9a 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -224,7 +224,10 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { this.readChildNodes(node, symbolizer); }, "PointPlacement": function(node, symbolizer) { - this.readChildNodes(node, symbolizer); + var config = {}; + this.readChildNodes(node, config); + config.labelRotation = config.rotation; + delete config.rotation; var labelAlign, x = symbolizer.labelAnchorPointX, y = symbolizer.labelAnchorPointY; @@ -242,7 +245,8 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { } else if (y >= 2/3) { labelAlign += 't'; } - symbolizer.labelAlign = labelAlign; + config.labelAlign = labelAlign; + OpenLayers.Util.applyDefaults(symbolizer, config); }, "AnchorPoint": function(node, symbolizer) { this.readChildNodes(node, symbolizer); @@ -999,8 +1003,8 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { symbolizer.labelYOffset != null) { this.writeNode("Displacement", symbolizer, node); } - if (symbolizer.rotation != null) { - this.writeNode("Rotation", symbolizer.rotation, node); + if (symbolizer.labelRotation != null) { + this.writeNode("Rotation", symbolizer.labelRotation, node); } return node; }, From 617ba736a29a47e6d218ad9f40b808ab36824494 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 18:20:41 +0100 Subject: [PATCH 099/112] if labelAlign is set, translate to AnchorPointX and AnchorPointY --- lib/OpenLayers/Format/SLD/v1.js | 65 ++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js index 3d5bc87c9a..cfd67fa3f7 100644 --- a/lib/OpenLayers/Format/SLD/v1.js +++ b/lib/OpenLayers/Format/SLD/v1.js @@ -948,22 +948,26 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { } // add in optional Font if(symbolizer.fontFamily != null || - symbolizer.fontSize != null || - symbolizer.fontWeight != null || - symbolizer.fontStyle != null) { - this.writeNode("Font", symbolizer, node); + symbolizer.fontSize != null || + symbolizer.fontWeight != null || + symbolizer.fontStyle != null) { + this.writeNode("Font", symbolizer, node); } // add in optional LabelPlacement - if ((symbolizer.labelAnchorPointX != null || - symbolizer.labelAnchorPointY != null) || + if (symbolizer.labelAnchorPointX != null || + symbolizer.labelAnchorPointY != null || + symbolizer.labelAlign != null || + symbolizer.labelXOffset != null || + symbolizer.labelYOffset != null || + symbolizer.labelRotation != null || symbolizer.labelPerpendicularOffset != null) { - this.writeNode("LabelPlacement", symbolizer, node); + this.writeNode("LabelPlacement", symbolizer, node); } // add in optional Halo if(symbolizer.haloRadius != null || - symbolizer.haloColor != null || - symbolizer.haloOpacity != null) { - this.writeNode("Halo", symbolizer, node); + symbolizer.haloColor != null || + symbolizer.haloOpacity != null) { + this.writeNode("Halo", symbolizer, node); } // add in optional Fill if(symbolizer.fillColor != null || @@ -975,8 +979,12 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { "LabelPlacement": function(symbolizer) { var node = this.createElementNSPlus("sld:LabelPlacement"); if (symbolizer.labelAnchorPointX != null || - symbolizer.labelAnchorPointY != null) { - this.writeNode("PointPlacement", symbolizer, node); + symbolizer.labelAnchorPointY != null || + symbolizer.labelAlign != null || + symbolizer.labelXOffset != null || + symbolizer.labelYOffset != null || + symbolizer.labelRotation != null) { + this.writeNode("PointPlacement", symbolizer, node); } if (symbolizer.labelPerpendicularOffset != null) { this.writeNode("LinePlacement", symbolizer, node); @@ -996,7 +1004,8 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { "PointPlacement": function(symbolizer) { var node = this.createElementNSPlus("sld:PointPlacement"); if (symbolizer.labelAnchorPointX != null || - symbolizer.labelAnchorPointY != null) { + symbolizer.labelAnchorPointY != null || + symbolizer.labelAlign != null) { this.writeNode("AnchorPoint", symbolizer, node); } if (symbolizer.labelXOffset != null || @@ -1010,11 +1019,33 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, { }, "AnchorPoint": function(symbolizer) { var node = this.createElementNSPlus("sld:AnchorPoint"); - if (symbolizer.labelAnchorPointX != null) { - this.writeNode("AnchorPointX", symbolizer.labelAnchorPointX, node); + var x = symbolizer.labelAnchorPointX, + y = symbolizer.labelAnchorPointY; + if (x != null) { + this.writeNode("AnchorPointX", x, node); } - if (symbolizer.labelAnchorPointY != null) { - this.writeNode("AnchorPointY", symbolizer.labelAnchorPointY, node); + if (y != null) { + this.writeNode("AnchorPointY", y, node); + } + if (x == null && y == null) { + var xAlign = symbolizer.labelAlign.substr(0, 1), + yAlign = symbolizer.labelAlign.substr(1, 1); + if (xAlign === "l") { + x = 0; + } else if (xAlign === "c") { + x = 0.5; + } else if (xAlign === "r") { + x = 1; + } + if (yAlign === "b") { + y = 0; + } else if (yAlign === "m") { + y = 0.5; + } else if (yAlign === "t") { + y = 1; + } + this.writeNode("AnchorPointX", x, node); + this.writeNode("AnchorPointY", y, node); } return node; }, From 12d8220992ba5a6bebb6ac0e9b5989c867729024 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Fri, 24 Feb 2012 18:35:20 +0100 Subject: [PATCH 100/112] add a testcase for the labelAlign to AnchorPoint translation --- tests/Format/SLD/v1_0_0.html | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/Format/SLD/v1_0_0.html b/tests/Format/SLD/v1_0_0.html index 7b3c50acf2..6fdcd2bf7e 100644 --- a/tests/Format/SLD/v1_0_0.html +++ b/tests/Format/SLD/v1_0_0.html @@ -549,6 +549,28 @@ t.xml_eq(got, exp, "LinePlacement written out correctly"); } + function test_labelAlignToAnchorPosition(t) { + t.plan(1); + var format = new OpenLayers.Format.SLD.v1_0_0({ + multipleSymbolizers: true + }); + var style = new OpenLayers.Style2({ + rules: [ + new OpenLayers.Rule({ + symbolizers: [ + new OpenLayers.Symbolizer.Text({ + label: "${FOO}", + labelAlign: "rb" + }) + ] + }) + ] + }); + var got = format.writeNode("sld:UserStyle", style); + var exp = readXML("label_pointplacement_test.sld").documentElement; + t.xml_eq(got, exp, "PointPlacement with labelAlign written out correctly"); + } + function test_read_FeatureTypeStyles(t) { t.plan(13); @@ -927,5 +949,24 @@ --> +
    From 27e5aaf8f0ff2b7c0d0d908ebaedae0b01e3d035 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Sat, 25 Feb 2012 17:06:30 +0000 Subject: [PATCH 101/112] Map: check default controls are in build --- lib/OpenLayers/Map.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 0a8f7bde0a..15b3bb03dd 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -577,14 +577,20 @@ OpenLayers.Map = OpenLayers.Class({ } if (this.controls == null) { + this.controls = []; if (OpenLayers.Control != null) { // running full or lite? - this.controls = [ new OpenLayers.Control.Navigation(), - new OpenLayers.Control.PanZoom(), - new OpenLayers.Control.ArgParser(), - new OpenLayers.Control.Attribution() - ]; - } else { - this.controls = []; + if (OpenLayers.Control.Navigation) { + this.controls.push(new OpenLayers.Control.Navigation()) + } + if (OpenLayers.Control.PanZoom) { + this.controls.push(new OpenLayers.Control.PanZoom()) + } + if (OpenLayers.Control.ArgParser) { + this.controls.push(new OpenLayers.Control.ArgParser()) + } + if (OpenLayers.Control.Attribution) { + this.controls.push(new OpenLayers.Control.Attribution()) + } } } From 5444fbcfc8adaa28ad0f05caaf0d1545deb6c05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 28 Feb 2012 09:06:47 +0100 Subject: [PATCH 102/112] make the Google Closure compiler happier, no functional change --- lib/OpenLayers/Kinetic.js | 5 +++-- lib/OpenLayers/Tween.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Kinetic.js b/lib/OpenLayers/Kinetic.js index 451a66ef7d..b744e24653 100644 --- a/lib/OpenLayers/Kinetic.js +++ b/lib/OpenLayers/Kinetic.js @@ -1,8 +1,9 @@ /* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. - * + * full text of the license. */ + +/** * @requires OpenLayers/BaseTypes/Class.js * @requires OpenLayers/Animation.js */ diff --git a/lib/OpenLayers/Tween.js b/lib/OpenLayers/Tween.js index e30d5d607b..85718c0953 100644 --- a/lib/OpenLayers/Tween.js +++ b/lib/OpenLayers/Tween.js @@ -1,8 +1,9 @@ /* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. - * + * full text of the license. */ + +/** * @requires OpenLayers/BaseTypes/Class.js * @requires OpenLayers/Animation.js */ From acf6a8a97d7f9d67b8bc4bbd38e866f3c542bc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 28 Feb 2012 09:53:10 +0100 Subject: [PATCH 103/112] indicate that String.camelize is deprecated in the 2.12 release notes, refs #64, no functional change --- notes/2.12.md | 1 + 1 file changed, 1 insertion(+) diff --git a/notes/2.12.md b/notes/2.12.md index 3aa2db8eda..759cbf83d2 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -109,6 +109,7 @@ A number of properties, methods, and constructors have been marked as deprecated * OpenLayers.Util.setOpacity * OpenLayers.Util.safeStopPropagation * OpenLayers.Util.getArgs + * OpenLayers.Sring.camelize * OpenLayers.nullHandler * OpenLayers.loadURL * OpenLayers.parseXMLString From 4efa03eb59a43bde442bac2ea6360a2d7a987595 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Wed, 22 Feb 2012 17:39:11 +0100 Subject: [PATCH 104/112] Fix for being able to select a feature from an invisible layer that uses the Canvas renderer --- lib/OpenLayers/Renderer/Canvas.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index 35939afdd2..199ca8f10d 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -787,6 +787,10 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { */ getFeatureIdFromEvent: function(evt) { var featureId, feature; + + // if the drawing canvas isn't visible, return undefined. + if (this.root.style.display === "none") return feature; + if (this.hitDetection) { // this dragging check should go in the feature handler if (!this.map.dragging) { From bf834e6b8ef97f06904ea18b94d0fb92315a4737 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Wed, 22 Feb 2012 17:44:31 +0100 Subject: [PATCH 105/112] being a good coder and adding braces around if statement body --- lib/OpenLayers/Renderer/Canvas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index 199ca8f10d..30ab7a6d99 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -789,7 +789,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { var featureId, feature; // if the drawing canvas isn't visible, return undefined. - if (this.root.style.display === "none") return feature; + if (this.root.style.display === "none") { return feature; } if (this.hitDetection) { // this dragging check should go in the feature handler From f8189f2862b2010f149d1f135879496ab0e9dce9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Feb 2012 10:23:23 +0100 Subject: [PATCH 106/112] Added unit tests for hit detection on invisible canvas layer --- tests/Renderer/Canvas.html | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/tests/Renderer/Canvas.html b/tests/Renderer/Canvas.html index bdec99948c..a19aa1f56f 100644 --- a/tests/Renderer/Canvas.html +++ b/tests/Renderer/Canvas.html @@ -348,6 +348,92 @@ } + // Extra test: hit detection on an invisible canvas should return undefined + function test_hitDetectionOnInvisibleLayer(t) { + if (!supported) { + t.plan(0); + return; + } + + var layer = new OpenLayers.Layer.Vector(null, { + isBaseLayer: true, + resolutions: [1], + styleMap: new OpenLayers.StyleMap({ + pointRadius: 5, + strokeWidth: 3, + fillColor: "red", + fillOpacity: 0.5, + strokeColor: "blue", + strokeOpacity: 0.75 + }), + renderers: ["Canvas"] + }); + + var map = new OpenLayers.Map({ + div: "map", + controls: [], + layers: [layer], + center: new OpenLayers.LonLat(0, 0), + zoom: 0 + }); + + layer.addFeatures([ + new OpenLayers.Feature.Vector( + new OpenLayers.Geometry.Point(-100, 0) + ), + new OpenLayers.Feature.Vector( + OpenLayers.Geometry.fromWKT("LINESTRING(-50 0, 50 0)") + ), + new OpenLayers.Feature.Vector( + OpenLayers.Geometry.fromWKT("POLYGON((100 -25, 150 -25, 150 25, 100 25, 100 -25), (120 -5, 130 -5, 130 5, 120 5, 120 -5))") + ) + ]); + + var cases = [{ + msg: "center of invisible point", x: -100, y: 0, id: layer.features[0].id + }, { + msg: "edge of invisible point", x: -103, y: 3, id: layer.features[0].id + }, { + msg: "outside invisible point", x: -110, y: 3, id: null + }, { + msg: "center of invisible line", x: 0, y: 0, id: layer.features[1].id + }, { + msg: "edge of invisible line", x: 0, y: 1, id: layer.features[1].id + }, { + msg: "outside invisible line", x: 0, y: 5, id: null + }, { + msg: "inside invisible polygon", x: 110, y: 0, id: layer.features[2].id + }, { + msg: "edge of invisible polygon", x: 99, y: 0, id: layer.features[2].id + }, { + msg: "inside invisible polygon hole", x: 125, y: 0, id: null + }, { + msg: "outside invisible polygon", x: 155, y: 0, id: null + }]; + + function px(x, y) { + return map.getPixelFromLonLat( + new OpenLayers.LonLat(x, y) + ); + } + + var num = cases.length; + t.plan(num); + var c, feature; + + // Hit detection on an invisible canvas layer should always return undefined + layer.setVisibility(false); + + for (var i=0; i Date: Tue, 28 Feb 2012 10:15:55 +0100 Subject: [PATCH 107/112] simplified unit test for hit detection on invisible canvas --- tests/Renderer/Canvas.html | 94 +++----------------------------------- 1 file changed, 7 insertions(+), 87 deletions(-) diff --git a/tests/Renderer/Canvas.html b/tests/Renderer/Canvas.html index a19aa1f56f..303b56732d 100644 --- a/tests/Renderer/Canvas.html +++ b/tests/Renderer/Canvas.html @@ -336,104 +336,24 @@ } var num = cases.length; - t.plan(num); + t.plan(2 * num); var c, feature; for (var i=0; i Date: Tue, 28 Feb 2012 10:45:18 +0100 Subject: [PATCH 108/112] Simplifying logic that returns undefined when root is invisible. --- lib/OpenLayers/Renderer/Canvas.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/OpenLayers/Renderer/Canvas.js b/lib/OpenLayers/Renderer/Canvas.js index 30ab7a6d99..ee90db4e38 100644 --- a/lib/OpenLayers/Renderer/Canvas.js +++ b/lib/OpenLayers/Renderer/Canvas.js @@ -788,10 +788,7 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { getFeatureIdFromEvent: function(evt) { var featureId, feature; - // if the drawing canvas isn't visible, return undefined. - if (this.root.style.display === "none") { return feature; } - - if (this.hitDetection) { + if (this.hitDetection && this.root.style.display !== "none") { // this dragging check should go in the feature handler if (!this.map.dragging) { var xy = evt.xy; From eb700d98e14ffab037d66149a0c88e3154f16d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 28 Feb 2012 10:46:49 +0100 Subject: [PATCH 109/112] add an example for an accessible click control implementation --- examples/click-keyboard.html | 69 ++++++++++++ examples/click-keyboard.js | 199 +++++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 examples/click-keyboard.html create mode 100644 examples/click-keyboard.js diff --git a/examples/click-keyboard.html b/examples/click-keyboard.html new file mode 100644 index 0000000000..c81917cef2 --- /dev/null +++ b/examples/click-keyboard.html @@ -0,0 +1,69 @@ + + + + + + + Accessible Custom Click Control + + + + + + + + + +

    An accessible click control implementation

    + +
    + click, control, accessibility +
    + + + Jump to map + + +
    + +

    + Demonstrate the KeyboardDefaults control as well as a control that + allows clicking on the map using the keyboard. + First focus the map (using tab key or mouse), then press the 'i' + key to activate the query control. You can then move the point + using arrow keys. Press 'RETURN' to get the coordinate. Press 'i' + again to deactivate the control. +

    + + + diff --git a/examples/click-keyboard.js b/examples/click-keyboard.js new file mode 100644 index 0000000000..328e0da768 --- /dev/null +++ b/examples/click-keyboard.js @@ -0,0 +1,199 @@ +var map, navigationControl, queryControl; + +function init(){ + map = new OpenLayers.Map('map', {controls: []}); + var layer = new OpenLayers.Layer.WMS( + "OpenLayers WMS", + "http://vmap0.tiles.osgeo.org/wms/vmap0", + {layers: 'basic'} + ); + map.addLayers([layer]); + + navigationControl = new OpenLayers.Control.KeyboardDefaults({ + observeElement: 'map' + }); + map.addControl(navigationControl); + + queryControl = new OpenLayers.Control.KeyboardClick({ + observeElement: 'map' + }); + map.addControl(queryControl); + + map.zoomToMaxExtent(); +} + +/** + * Class: OpenLayers.Control.KeyboardClick + * + * A custom control that (a) adds a vector point that can be moved using the + * arrow keys of the keyboard, and (b) displays a browser alert window when the + * RETURN key is pressed. The control can be activated/deactivated using the + * "i" key. When activated the control deactivates any KeyboardDefaults control + * in the map so that the map is not moved when the arrow keys are pressed. + * + * This control relies on the OpenLayers.Handler.KeyboardPoint custom handler. + */ +OpenLayers.Control.KeyboardClick = OpenLayers.Class(OpenLayers.Control, { + initialize: function(options) { + OpenLayers.Control.prototype.initialize.apply(this, [options]); + var observeElement = this.observeElement || document; + this.handler = new OpenLayers.Handler.KeyboardPoint(this, { + done: this.onClick, + cancel: this.deactivate + }, { + observeElement: observeElement + }); + OpenLayers.Event.observe( + observeElement, + "keydown", + OpenLayers.Function.bindAsEventListener( + function(evt) { + if (evt.keyCode == 73) { // "i" + if (this.active) { + this.deactivate(); + } else { + this.activate(); + } + } + }, + this + ) + ); + }, + + onClick: function(geometry) { + alert("You clicked near " + geometry.x + " N, " + + geometry.y + " E"); + }, + + activate: function() { + if(!OpenLayers.Control.prototype.activate.apply(this, arguments)) { + return false; + } + // deactivate any KeyboardDefaults control + var keyboardDefaults = this.map.getControlsByClass( + 'OpenLayers.Control.KeyboardDefaults')[0]; + if (keyboardDefaults) { + keyboardDefaults.deactivate(); + } + return true; + }, + + deactivate: function() { + if(!OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { + return false; + } + // reactivate any KeyboardDefaults control + var keyboardDefaults = this.map.getControlsByClass( + 'OpenLayers.Control.KeyboardDefaults')[0]; + if (keyboardDefaults) { + keyboardDefaults.activate(); + } + return true; + } +}); + +/** + * Class: OpenLayers.Handler.KeyboardPoint + * + * A custom handler that displays a vector point that can be moved + * using the arrow keys of the keyboard. + */ +OpenLayers.Handler.KeyboardPoint = OpenLayers.Class(OpenLayers.Handler, { + + KEY_EVENTS: ["keydown"], + + + initialize: function(control, callbacks, options) { + OpenLayers.Handler.prototype.initialize.apply(this, arguments); + // cache the bound event listener method so it can be unobserved later + this.eventListener = OpenLayers.Function.bindAsEventListener( + this.handleKeyEvent, this + ); + }, + + activate: function() { + if(!OpenLayers.Handler.prototype.activate.apply(this, arguments)) { + return false; + } + this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME); + this.map.addLayer(this.layer); + this.observeElement = this.observeElement || document; + for (var i=0, len=this.KEY_EVENTS.length; i Date: Tue, 28 Feb 2012 10:48:50 +0100 Subject: [PATCH 110/112] click-keyboard example renamed to accessible-click-control --- examples/{click-keyboard.html => accessible-click-control.html} | 2 +- examples/{click-keyboard.js => accessible-click-control.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename examples/{click-keyboard.html => accessible-click-control.html} (97%) rename examples/{click-keyboard.js => accessible-click-control.js} (100%) diff --git a/examples/click-keyboard.html b/examples/accessible-click-control.html similarity index 97% rename from examples/click-keyboard.html rename to examples/accessible-click-control.html index c81917cef2..c8d97cde88 100644 --- a/examples/click-keyboard.html +++ b/examples/accessible-click-control.html @@ -38,7 +38,7 @@ - +

    An accessible click control implementation

    diff --git a/examples/click-keyboard.js b/examples/accessible-click-control.js similarity index 100% rename from examples/click-keyboard.js rename to examples/accessible-click-control.js From 1c6d44e5d5f1dce796ecb6ad6d59560bd8257bf2 Mon Sep 17 00:00:00 2001 From: Arjen Kopinga Date: Tue, 28 Feb 2012 11:17:46 +0100 Subject: [PATCH 111/112] Moved symbol definitions to Renderer.js --- lib/OpenLayers/Renderer.js | 15 +++++++++++++++ lib/OpenLayers/Renderer/Elements.js | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/OpenLayers/Renderer.js b/lib/OpenLayers/Renderer.js index 45de3a6f3f..3d7ffa1596 100644 --- a/lib/OpenLayers/Renderer.js +++ b/lib/OpenLayers/Renderer.js @@ -415,3 +415,18 @@ OpenLayers.Renderer.defaultSymbolizer = { labelAlign: 'cm' }; + + +/** + * Constant: OpenLayers.Renderer.symbol + * Coordinate arrays for well known (named) symbols. + */ +OpenLayers.Renderer.symbol = { + "star": [350,75, 379,161, 469,161, 397,215, 423,301, 350,250, 277,301, + 303,215, 231,161, 321,161, 350,75], + "cross": [4,0, 6,0, 6,4, 10,4, 10,6, 6,6, 6,10, 4,10, 4,6, 0,6, 0,4, 4,4, + 4,0], + "x": [0,0, 25,0, 50,35, 75,0, 100,0, 65,50, 100,100, 75,100, 50,65, 25,100, 0,100, 35,50, 0,0], + "square": [0,0, 0,1, 1,1, 1,0, 0,0], + "triangle": [0,10, 10,10, 5,0, 0,10] +}; \ No newline at end of file diff --git a/lib/OpenLayers/Renderer/Elements.js b/lib/OpenLayers/Renderer/Elements.js index 7e1d89e5b1..11735f4eeb 100644 --- a/lib/OpenLayers/Renderer/Elements.js +++ b/lib/OpenLayers/Renderer/Elements.js @@ -1051,17 +1051,3 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, { CLASS_NAME: "OpenLayers.Renderer.Elements" }); - -/** - * Constant: OpenLayers.Renderer.symbol - * Coordinate arrays for well known (named) symbols. - */ -OpenLayers.Renderer.symbol = { - "star": [350,75, 379,161, 469,161, 397,215, 423,301, 350,250, 277,301, - 303,215, 231,161, 321,161, 350,75], - "cross": [4,0, 6,0, 6,4, 10,4, 10,6, 6,6, 6,10, 4,10, 4,6, 0,6, 0,4, 4,4, - 4,0], - "x": [0,0, 25,0, 50,35, 75,0, 100,0, 65,50, 100,100, 75,100, 50,65, 25,100, 0,100, 35,50, 0,0], - "square": [0,0, 0,1, 1,1, 1,0, 0,0], - "triangle": [0,10, 10,10, 5,0, 0,10] -}; From 94e8fff9e6ce8c9457ce1b09f7adf6099130ad8f Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 28 Feb 2012 12:04:38 +0100 Subject: [PATCH 112/112] Fixing test (see #249) --- tests/Layer/Grid.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index 366627caa3..9cd87a705c 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -226,9 +226,10 @@ map.setCenter([-10, 0], 5); var log = []; + var origDeferMoveGriddedTiles = layer.deferMoveGriddedTiles; layer.deferMoveGriddedTiles = function() { log.push("deferMoveGriddedTiles"); - OpenLayers.Layer.WMS.prototype.deferMoveGriddedTiles.apply(this, arguments); + origDeferMoveGriddedTiles.apply(this, arguments); } layer.moveGriddedTiles = function() { log.push("moveGriddedTiles");