From ece872b81a177475642a04059a748397cbfe3757 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 22:23:57 +0100 Subject: [PATCH 01/41] Remove our aliasing of OpenLayers.Util.getElement to window.$. --- lib/OpenLayers/Util.js | 7 ------- tests/Util.html | 5 ----- 2 files changed, 12 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 880e3435ab..9dff44d19f 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -74,13 +74,6 @@ OpenLayers.Util.isArray = function(a) { return (Object.prototype.toString.call(a) === '[object Array]'); }; -/** - * Maintain existing definition of $. - */ -if(typeof window.$ === "undefined") { - window.$ = OpenLayers.Util.getElement; -} - /** * Function: removeItem * Remove an object from an array. Iterates through the array diff --git a/tests/Util.html b/tests/Util.html index 2357b54e2c..73ea006625 100644 --- a/tests/Util.html +++ b/tests/Util.html @@ -77,11 +77,6 @@ t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works"); } - function test_$(t) { - t.plan(1); - t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $."); - } - function test_Util_getImagesLocation (t) { t.plan( 1 ); t.ok( OpenLayers.Util.getImagesLocation(), "../img/", From de2eeaab0b39ef761ab5857b90b08dd7e4ce2531 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 22:26:11 +0100 Subject: [PATCH 02/41] Fix up a test that used our $(). --- tests/Map.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Map.html b/tests/Map.html index ee8b8e7fb2..1daa43a46e 100644 --- a/tests/Map.html +++ b/tests/Map.html @@ -748,7 +748,7 @@ function test_Map_double_addLayer(t) { t.plan(2); - map = new OpenLayers.Map($('map')); + map = new OpenLayers.Map('map'); layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'} From 5c2c39c9dd6c53f856d6453842da9fb2f70d62fd Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Mon, 5 Mar 2012 22:27:43 +0100 Subject: [PATCH 03/41] Fix the examples that used our '$' method. --- examples/editing-methods.js | 2 ++ examples/game-accel-ball.html | 1 + examples/geolocation.js | 2 +- examples/getfeatureinfo-control.html | 2 +- examples/select-feature.html | 3 +++ examples/snap-split.html | 2 ++ examples/snapping.html | 2 ++ examples/strategy-cluster-extended.js | 2 ++ examples/strategy-cluster-threshold.html | 1 + examples/strategy-cluster.html | 2 ++ examples/tilecache.html | 2 +- examples/using-proj4js.js | 2 ++ 12 files changed, 20 insertions(+), 3 deletions(-) diff --git a/examples/editing-methods.js b/examples/editing-methods.js index 6c139a276d..9ed961eaf9 100644 --- a/examples/editing-methods.js +++ b/examples/editing-methods.js @@ -19,6 +19,8 @@ var draw = new OpenLayers.Control.DrawFeature( map.addControl(draw); draw.activate(); +$ = OpenLayers.Util.getElement; + // handle clicks on method links $("insertXY").onclick = function() { var values = parseInput( diff --git a/examples/game-accel-ball.html b/examples/game-accel-ball.html index 40bb02d791..a622768bd2 100644 --- a/examples/game-accel-ball.html +++ b/examples/game-accel-ball.html @@ -33,6 +33,7 @@ vlayer.drawFeature(feature); } function init() { + var $ = OpenLayers.Util.getElement; map = new OpenLayers.Map( 'map', { 'maxExtent': new OpenLayers.Bounds(0, 0, $("map").clientWidth, $("map").clientHeight), diff --git a/examples/geolocation.js b/examples/geolocation.js index 1afc12d997..acde5faae5 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -92,7 +92,7 @@ geolocate.events.register("locationupdated",geolocate,function(e) { geolocate.events.register("locationfailed",this,function() { OpenLayers.Console.log('Location detection failed'); }); - +var $ = OpenLayers.Util.getElement; $('locate').onclick = function() { vector.removeAllFeatures(); geolocate.deactivate(); diff --git a/examples/getfeatureinfo-control.html b/examples/getfeatureinfo-control.html index cb0bec10e4..2dcdf3c58d 100644 --- a/examples/getfeatureinfo-control.html +++ b/examples/getfeatureinfo-control.html @@ -48,7 +48,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/list-tests.html b/tests/list-tests.html index 283bc69eb8..14ccf78ed0 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -231,6 +231,7 @@
  • Kinetic.html
  • Util.html
  • deprecated/Ajax.html
  • +
  • deprecated/Util.html
  • deprecated/BaseTypes/Class.html
  • deprecated/BaseTypes/Element.html
  • deprecated/Control/MouseToolbar.html
  • From 9bbc1d43180d0cd94d1e2daeb8b386f7b3486b2e Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Wed, 25 Apr 2012 09:31:22 +0200 Subject: [PATCH 09/41] Update notes for 2.13 about deprecation of window.$ --- notes/2.13.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/notes/2.13.md b/notes/2.13.md index c8d0938d6c..e5a429912b 100644 --- a/notes/2.13.md +++ b/notes/2.13.md @@ -7,3 +7,21 @@ Previously, objects generated by the library were given id properties with value Corresponding issues/pull requests: * https://github.com/openlayers/openlayers/pull/416 + +# Behavior Changes from Past Releases + +## window.$ is no longer an alias for OpenLayers.Util.getElement + +We do no longer create a global variable '$' when such a symbol isn't already +defined. Previous versions of OpenLayers would define '$' to be an alias for +OpenLayers.Util.getElement. If you application requires window.$ to be defined +in such a way you can either + +* include deprecated.js in your custom build or as additional ressource in your + HTML-file +* or you do the aliasing in your application code yourself: + window.$ = OpenLayers.Util.getElement; + +Corresponding issue/pull requests: + +* https://github.com/openlayers/openlayers/pull/423 \ No newline at end of file From 042ad8d7115687cc286b90985f55785d39b0072b Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Wed, 25 Apr 2012 09:37:37 +0200 Subject: [PATCH 10/41] Minors in the notes file. --- notes/2.13.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notes/2.13.md b/notes/2.13.md index e5a429912b..12fabec635 100644 --- a/notes/2.13.md +++ b/notes/2.13.md @@ -14,12 +14,13 @@ Corresponding issues/pull requests: We do no longer create a global variable '$' when such a symbol isn't already defined. Previous versions of OpenLayers would define '$' to be an alias for -OpenLayers.Util.getElement. If you application requires window.$ to be defined +OpenLayers.Util.getElement. If your application requires window.$ to be defined in such a way you can either * include deprecated.js in your custom build or as additional ressource in your HTML-file * or you do the aliasing in your application code yourself: + window.$ = OpenLayers.Util.getElement; Corresponding issue/pull requests: From 95164d8cc0593a94ffeb10e50d1b5f2ed34d55ee Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Sun, 20 May 2012 13:39:50 +0100 Subject: [PATCH 11/41] Document issues with Google v3 layers --- lib/OpenLayers/Layer/EventPane.js | 9 ++++++++- lib/OpenLayers/Layer/Google.js | 9 +++++++++ lib/OpenLayers/Layer/Google/v3.js | 30 ++++++++++++++++++++++++------ notes/2.12.md | 14 ++++++++++++++ 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/Layer/EventPane.js b/lib/OpenLayers/Layer/EventPane.js index 258f302426..8542b9d765 100644 --- a/lib/OpenLayers/Layer/EventPane.js +++ b/lib/OpenLayers/Layer/EventPane.js @@ -11,7 +11,14 @@ /** * Class: OpenLayers.Layer.EventPane - * Base class for 3rd party layers. Create a new event pane layer with the + * Base class for 3rd party layers, providing a DOM element which isolates + * the 3rd-party layer from mouse events. + * Originally used by Yahoo, Virtual Earth and Google layers, but now + * only used by Google. + * + * Automatically instantiated by the Google constructor, and not usually instantiated directly. + * + * Create a new event pane layer with the * constructor. * * Inherits from: diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js index 075e616a56..c744b11271 100644 --- a/lib/OpenLayers/Layer/Google.js +++ b/lib/OpenLayers/Layer/Google.js @@ -14,6 +14,11 @@ /** * Class: OpenLayers.Layer.Google * + * Provides a wrapper for Google's Maps API + * Normally the Terms of Use for this API do not allow wrapping, but Google + * have provided written consent to OpenLayers for this - see email in + * http://osgeo-org.1560.n6.nabble.com/Google-Maps-API-Terms-of-Use-changes-tp4910013p4911981.html + * * Inherits from: * - * - @@ -462,6 +467,10 @@ OpenLayers.Layer.Google.cache = {}; * Constant: OpenLayers.Layer.Google.v2 * * Mixin providing functionality specific to the Google Maps API v2. + * + * This API has been deprecated by Google. + * Developers are encouraged to migrate to v3 of the API; support for this + * is provided by */ OpenLayers.Layer.Google.v2 = { diff --git a/lib/OpenLayers/Layer/Google/v3.js b/lib/OpenLayers/Layer/Google/v3.js index 777f6e7d67..8c832debab 100644 --- a/lib/OpenLayers/Layer/Google/v3.js +++ b/lib/OpenLayers/Layer/Google/v3.js @@ -11,15 +11,33 @@ /** * Constant: OpenLayers.Layer.Google.v3 * - * 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: + * Mixin providing functionality specific to the Google Maps API v3. + * + * To use this layer, you must include the GMaps v3 API in your html. + * Because OpenLayers needs to control mouse events, it isolates the GMaps mapObject + * (the DOM elements provided by Google) using the EventPane. + * However, because the Terms of Use require some of those elements, + * such as the links to Google's terms, to be clickable, these elements have + * to be moved up to OpenLayers' container div. There is however no easy way + * to identify these, and the logic (see the repositionMapElements function + * in the source) may need to be changed if Google changes them. + * Because of this, a given OpenLayers release can only guarantee support for the current 'frozen' Google release + * (see https://developers.google.com/maps/documentation/javascript/basics#Versioning + * for Google's current release cycle). + * + * For this reason, it's recommended that production code specifically loads + * the current frozen version, for example: * * (code) - * + * * (end) + * + * but that development code should use the latest 'nightly' version, so that any + * problems can be dealt with as soon as they arise, and before they affect the production, 'frozen', code. + * + * 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. */ OpenLayers.Layer.Google.v3 = { diff --git a/notes/2.12.md b/notes/2.12.md index 6a6bdb8fee..61c8b71060 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -219,6 +219,20 @@ Corresponding issues/pull requests: * https://github.com/openlayers/openlayers/pull/101 +## Google v3 Layer + +This release fixes a problem with the clickable elements supplied by Google. `OpenLayers.Layer.Google.v3` is now compatible with the current frozen version of Google's API (3.7) and also with the current release and nightly versions (3.8 and 3.9), but be aware that Google may change these elements in their release and nightly versions at any time, and an interim fix OpenLayers release may be needed. + +It's recommended that production servers always load the frozen version of Google's API, but it would help find potential problems if development pages used the latest nightly version. + +See the class description in the API docs for `OpenLayers.Layer.Google.v3` for more details. + +Good ideas on how to improve this unsatisfactory situation welcome! + +Corresponding issues/pull requests: + + * https://github.com/openlayers/openlayers/pull/472 + ## 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. From 1193e17266cf352d1c44e713fe6df1853d3bd0a0 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Mon, 21 May 2012 10:06:27 +0100 Subject: [PATCH 12/41] Google v3 docs amendment --- lib/OpenLayers/Layer/EventPane.js | 3 +-- lib/OpenLayers/Layer/Google/v3.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Layer/EventPane.js b/lib/OpenLayers/Layer/EventPane.js index 8542b9d765..6df7312116 100644 --- a/lib/OpenLayers/Layer/EventPane.js +++ b/lib/OpenLayers/Layer/EventPane.js @@ -13,8 +13,7 @@ * Class: OpenLayers.Layer.EventPane * Base class for 3rd party layers, providing a DOM element which isolates * the 3rd-party layer from mouse events. - * Originally used by Yahoo, Virtual Earth and Google layers, but now - * only used by Google. + * Only used by Google layers. * * Automatically instantiated by the Google constructor, and not usually instantiated directly. * diff --git a/lib/OpenLayers/Layer/Google/v3.js b/lib/OpenLayers/Layer/Google/v3.js index 8c832debab..db98c8ee66 100644 --- a/lib/OpenLayers/Layer/Google/v3.js +++ b/lib/OpenLayers/Layer/Google/v3.js @@ -14,6 +14,7 @@ * Mixin providing functionality specific to the Google Maps API v3. * * To use this layer, you must include the GMaps v3 API in your html. + * * Because OpenLayers needs to control mouse events, it isolates the GMaps mapObject * (the DOM elements provided by Google) using the EventPane. * However, because the Terms of Use require some of those elements, @@ -21,9 +22,11 @@ * to be moved up to OpenLayers' container div. There is however no easy way * to identify these, and the logic (see the repositionMapElements function * in the source) may need to be changed if Google changes them. - * Because of this, a given OpenLayers release can only guarantee support for the current 'frozen' Google release - * (see https://developers.google.com/maps/documentation/javascript/basics#Versioning - * for Google's current release cycle). + * These elements are not part of the published API and can be changed at any time, + * so a given OpenLayers release can only guarantee support for the 'frozen' + * Google release at the time of the OpenLayers release. See + * https://developers.google.com/maps/documentation/javascript/basics#Versioning + * for Google's current release cycle. * * For this reason, it's recommended that production code specifically loads * the current frozen version, for example: @@ -35,6 +38,12 @@ * but that development code should use the latest 'nightly' version, so that any * problems can be dealt with as soon as they arise, and before they affect the production, 'frozen', code. * + * Note, however, that frozen versions are retired as part of Google's release + * cycle, and once this happens, you will get the next version, in the example above, 3.8 once 3.7 is retired. + * + * This version supports 3.7. + * + * * 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. From 7bc54e15175a68c1d51caa97bf0ef76786a1a86e Mon Sep 17 00:00:00 2001 From: Gregers Gram Rygg Date: Mon, 21 May 2012 15:08:31 +0200 Subject: [PATCH 13/41] Don't round wheel change zoom for maps with fractional zoom --- lib/OpenLayers/Control/Navigation.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Control/Navigation.js b/lib/OpenLayers/Control/Navigation.js index 11f1a05845..17d2bf0aaa 100644 --- a/lib/OpenLayers/Control/Navigation.js +++ b/lib/OpenLayers/Control/Navigation.js @@ -261,8 +261,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { * deltaZ - {Integer} */ wheelChange: function(evt, deltaZ) { + if (!this.map.fractionalZoom) { + deltaZ = Math.round(deltaZ); + } var currentZoom = this.map.getZoom(); - var newZoom = this.map.getZoom() + Math.round(deltaZ); + var newZoom = this.map.getZoom() + deltaZ; newZoom = Math.max(newZoom, 0); newZoom = Math.min(newZoom, this.map.getNumZoomLevels()); if (newZoom === currentZoom) { From 95bc51ce3d8d39d83ae3ee9fd5eadb5e5c3acf8f Mon Sep 17 00:00:00 2001 From: Gregers Gram Rygg Date: Mon, 21 May 2012 15:11:05 +0200 Subject: [PATCH 14/41] Make analog mouse wheel adjustments configurable and reduce sensitivity --- lib/OpenLayers/Handler/MouseWheel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Handler/MouseWheel.js b/lib/OpenLayers/Handler/MouseWheel.js index e75ce0a415..0228c0b74c 100644 --- a/lib/OpenLayers/Handler/MouseWheel.js +++ b/lib/OpenLayers/Handler/MouseWheel.js @@ -54,6 +54,12 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, { * negative) */ cumulative: true, + + /** + * Property: analogWheelPrecision + * {Integer} Adjust to get analog scroll wheel to feel right + */ + analogWheelPrecision: 360, /** * Constructor: OpenLayers.Handler.MouseWheel @@ -170,7 +176,7 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, { e = window.event; } if (e.wheelDelta) { - delta = e.wheelDelta/120; + delta = e.wheelDelta/this.analogWheelPrecision; if (window.opera && window.opera.version() < 9.2) { delta = -delta; } From 2cd979d34c5d57eca0ab55059ca5030e9d332e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 22 May 2012 10:07:18 +0200 Subject: [PATCH 15/41] use the nightly version of Google Maps API in the examples, and provide some information about Google Maps API versioning in the google-v3 example --- examples/all-overlays-google.html | 2 +- examples/google-v3-alloverlays.html | 2 +- examples/google-v3.html | 13 ++++++++++++- examples/osm-google.html | 2 +- examples/spherical-mercator.html | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/all-overlays-google.html b/examples/all-overlays-google.html index 9df8cff1d3..3b7790eea9 100644 --- a/examples/all-overlays-google.html +++ b/examples/all-overlays-google.html @@ -8,7 +8,7 @@ - + diff --git a/examples/google-v3-alloverlays.html b/examples/google-v3-alloverlays.html index d4b368b171..d940266d7a 100644 --- a/examples/google-v3-alloverlays.html +++ b/examples/google-v3-alloverlays.html @@ -8,7 +8,7 @@ - + diff --git a/examples/google-v3.html b/examples/google-v3.html index 8b4a348b9b..4365dafbf8 100644 --- a/examples/google-v3.html +++ b/examples/google-v3.html @@ -8,7 +8,7 @@ - + @@ -35,6 +35,17 @@ location, you must include the extra theme/default/google.css stylesheet.

    +

    + Note on Google Maps API versioning: + This example uses the "nightly" version of Google Maps + API. This is specified by using v=3 in the + the Google Maps API URL. Production applications should use the + "release" or "frozen" versions of Google Maps + API. See the OpenLayers.Layer.Google.v3 API + docs, and the + Versioning Section + of the Google Maps API docs, for more details. +

    diff --git a/examples/osm-google.html b/examples/osm-google.html index a09cba59dd..066dadc61e 100644 --- a/examples/osm-google.html +++ b/examples/osm-google.html @@ -8,7 +8,7 @@ - + diff --git a/examples/spherical-mercator.html b/examples/spherical-mercator.html index fc1bf681a5..b2835701d8 100644 --- a/examples/spherical-mercator.html +++ b/examples/spherical-mercator.html @@ -22,7 +22,7 @@ } - + From f377d0387f12b4a485a44ae411f339486f2ccc36 Mon Sep 17 00:00:00 2001 From: Gregers Gram Rygg Date: Tue, 22 May 2012 17:29:12 +0200 Subject: [PATCH 16/41] Adjusted delta in MouseWheel test --- tests/Handler/MouseWheel.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Handler/MouseWheel.html b/tests/Handler/MouseWheel.html index d41c2cd18c..1d2a6b7eb5 100644 --- a/tests/Handler/MouseWheel.html +++ b/tests/Handler/MouseWheel.html @@ -107,7 +107,7 @@ var activated = handler.activate(); - var delta = 120; + var delta = 360; if (window.opera && window.opera.version() < 9.2) delta = -delta; handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta}); handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta}); From 12931612eabb56ab76dd63c8c7cb5a9584bb38cc Mon Sep 17 00:00:00 2001 From: Gregers Gram Rygg Date: Tue, 22 May 2012 17:43:52 +0200 Subject: [PATCH 17/41] Don't affect digital mouse wheels (a.k.a. step-scroll) --- lib/OpenLayers/Handler/MouseWheel.js | 7 ++++++- tests/Handler/MouseWheel.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Handler/MouseWheel.js b/lib/OpenLayers/Handler/MouseWheel.js index 0228c0b74c..7cfc40cfce 100644 --- a/lib/OpenLayers/Handler/MouseWheel.js +++ b/lib/OpenLayers/Handler/MouseWheel.js @@ -176,7 +176,12 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, { e = window.event; } if (e.wheelDelta) { - delta = e.wheelDelta/this.analogWheelPrecision; + delta = e.wheelDelta; + if (delta % 120 === 0) { + delta = delta / 120; + } else { + delta = delta / this.analogWheelPrecision; + } if (window.opera && window.opera.version() < 9.2) { delta = -delta; } diff --git a/tests/Handler/MouseWheel.html b/tests/Handler/MouseWheel.html index 1d2a6b7eb5..d41c2cd18c 100644 --- a/tests/Handler/MouseWheel.html +++ b/tests/Handler/MouseWheel.html @@ -107,7 +107,7 @@ var activated = handler.activate(); - var delta = 360; + var delta = 120; if (window.opera && window.opera.version() < 9.2) delta = -delta; handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta}); handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta}); From d289aa327ea17299d393fbf6d31243632ce0ebc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 24 May 2012 22:55:43 +0200 Subject: [PATCH 18/41] Grid.removeExcessTiles removes more tiles than it should, refs #481 --- lib/OpenLayers/Layer/Grid.js | 7 ++-- tests/Layer/Grid.html | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index ab83779334..b1d45eebd8 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -1302,19 +1302,20 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { * columns - {Integer} Maximum number of columns we want our grid to have. */ removeExcessTiles: function(rows, columns) { + var i, l; // remove extra rows while (this.grid.length > rows) { var row = this.grid.pop(); - for (var i=0, l=row.length; i columns) { - for (var i=0, l=this.grid.length; i columns) { var row = this.grid[i]; var tile = row.pop(); this.destroyTile(tile); diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index bb632d1ea5..981ccb4e83 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -1523,6 +1523,70 @@ map.destroy(); } + + function test_removeExcessTiles(t) { + t.plan(15); + + /* + * Set up + */ + + var map = new OpenLayers.Map('map'); + var layer = new OpenLayers.Layer.Grid('name', '/url', + {}, {isBaseLayer: true}); + map.addLayer(layer); + + function newTile(id) { + var t = new OpenLayers.Tile(layer, + new OpenLayers.Pixel(1, 1), + new OpenLayers.Bounds(1, 1, 1, 1)); + t._id = id; + return t; + } + + layer.grid = [ + [newTile(1), newTile(2), newTile(3)], + [newTile(4), newTile(5)], + [newTile(6), newTile(7), newTile(8)] + ]; + + // create a clone to be able to test whether + // tiles have been destroyed or not + var grid = [ + layer.grid[0].slice(), + layer.grid[1].slice(), + layer.grid[2].slice() + ]; + + /* + * Test + */ + + layer.removeExcessTiles(2, 2); + + t.eq(layer.grid.length, 2, 'grid has two rows'); + t.eq(layer.grid[0].length, 2, 'row #1 has two columns'); + t.eq(layer.grid[0][0]._id, 1, 'row #1 col #1 includes expected tile'); + t.eq(layer.grid[0][1]._id, 2, 'row #1 col #2 includes expected tile'); + t.eq(layer.grid[1].length, 2, 'row #2 has two columns'); + t.eq(layer.grid[1][0]._id, 4, 'row #2 col #1 includes expected tile'); + t.eq(layer.grid[1][1]._id, 5, 'row #2 col #2 includes expected tile'); + + t.ok(grid[0][0].events != null, 'tile 0,0 not destroyed'); + t.ok(grid[0][1].events != null, 'tile 0,1 not destroyed'); + t.ok(grid[0][2].events == null, 'tile 0,2 destroyed'); + t.ok(grid[1][0].events != null, 'tile 1,0 not destroyed'); + t.ok(grid[1][1].events != null, 'tile 1,1 not destroyed'); + t.ok(grid[2][0].events == null, 'tile 2,0 destroyed'); + t.ok(grid[2][1].events == null, 'tile 2,1 destroyed'); + t.ok(grid[2][2].events == null, 'tile 2,2 destroyed'); + + /* + * Tear down + */ + + map.destroy(); + } From f5c43d6506127ca80e8f860631527a3cad0df599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 25 May 2012 14:55:14 +0200 Subject: [PATCH 19/41] set VERSION_NUMBER to Release 2.12-rc5 --- lib/OpenLayers.js | 2 +- lib/OpenLayers/SingleFile.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index b38c036bf6..d00fc976cb 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -414,4 +414,4 @@ /** * Constant: VERSION_NUMBER */ -OpenLayers.VERSION_NUMBER="Release 2.12-rc4"; +OpenLayers.VERSION_NUMBER="Release 2.12-rc5"; diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index d3f7179301..53fa0ceb8d 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -7,7 +7,7 @@ var OpenLayers = { /** * Constant: VERSION_NUMBER */ - VERSION_NUMBER: "Release 2.12-rc4", + VERSION_NUMBER: "Release 2.12-rc5", /** * Constant: singleFile From 440b9fb6d32002a113308fa123826d5cc8e817fc Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 25 May 2012 17:29:21 +0200 Subject: [PATCH 20/41] Using updated URLs. --- examples/mobile-wmts-vienna.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/mobile-wmts-vienna.js b/examples/mobile-wmts-vienna.js index 8c118d6f6e..ede3e67b53 100644 --- a/examples/mobile-wmts-vienna.js +++ b/examples/mobile-wmts-vienna.js @@ -184,21 +184,21 @@ var map; attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' }; fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ - url: "http://www.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", + url: "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", layer: "fmzk", style: "pastell", transitionEffect: "resize" }, defaults)); aerial = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ - url: "http://www.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", + url: "http://maps.wien.gv.at/wmts/lb/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", layer: "lb", style: "farbe", transitionEffect: "resize" }, defaults)); labels = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ - url: "http://www.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png", + url: "http://maps.wien.gv.at/wmts/beschriftung/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png", layer: "beschriftung", style: "normal", transitionEffect: null, From 88fd8038c8dc5c41ddcfe6ceeb32d350bbd0f541 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 25 May 2012 18:37:12 +0200 Subject: [PATCH 21/41] Simplifying configuration. --- examples/mobile-wmts-vienna.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/mobile-wmts-vienna.js b/examples/mobile-wmts-vienna.js index ede3e67b53..91d3a7105d 100644 --- a/examples/mobile-wmts-vienna.js +++ b/examples/mobile-wmts-vienna.js @@ -163,8 +163,8 @@ var map; {layer:"lb", requestEncoding:"REST", transitionEffect:"resize"}, defaults )); labels = format.createLayer(caps, OpenLayers.Util.applyDefaults( - {layer:"beschriftung", requestEncoding:"REST", isBaseLayer: false}, - OpenLayers.Util.extend({className: "nofade"}, defaults) + {layer:"beschriftung", requestEncoding:"REST", className:"nofade", isBaseLayer: false}, + defaults )); map.addLayers([fmzk, aerial, labels]); zoomToInitialExtent(); From 9a7b4bd06e60a0675171ee1b75cb5d3cbf9ac1cf Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Sat, 26 May 2012 16:30:10 +0100 Subject: [PATCH 22/41] Format/KML: correct parseStyles docs --- lib/OpenLayers/Format/KML.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js index 8553fd1910..b90fd20740 100644 --- a/lib/OpenLayers/Format/KML.js +++ b/lib/OpenLayers/Format/KML.js @@ -311,8 +311,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, { /** * Method: parseStyles - * Looks for