From aa584e17e9b24ad1bd1a95bc1fe5529296a830f5 Mon Sep 17 00:00:00 2001 From: Mike Adair Date: Wed, 20 Jun 2012 09:02:20 -0400 Subject: [PATCH 1/4] center returned in user projection --- src/ol/Map.js | 9 ++++++++- test/index.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ol/Map.js b/src/ol/Map.js index 3242bf5fd5..052f0ca334 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -91,6 +91,8 @@ ol.Map.DEFAULT_TILE_SIZE = 256; * @return {ol.Loc} Location. */ ol.Map.prototype.getCenter = function() { + var proj = this.getUserProjection(); + this.center_ = this.center_.transform(proj); return this.center_; }; @@ -201,7 +203,12 @@ ol.Map.prototype.getResolutionForZoom = function(zoom) { * @param {ol.Loc} center Center. */ ol.Map.prototype.setCenter = function(center) { - this.center_ = center; + var proj = center.getProjection(); + if (goog.isNull(proj)) { + proj = this.getUserProjection(); + center.setProjection(proj); + } + this.center_ = center.transform(this.getProjection()); }; diff --git a/test/index.html b/test/index.html index b271f302c1..3e57ae944b 100644 --- a/test/index.html +++ b/test/index.html @@ -9,7 +9,7 @@ - + From e61769c6dce9006bfe22b78bd73373122e0fa1b8 Mon Sep 17 00:00:00 2001 From: Mike Adair Date: Wed, 20 Jun 2012 09:04:51 -0400 Subject: [PATCH 2/4] put back to SIMPLE mode --- test/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.html b/test/index.html index 3e57ae944b..b271f302c1 100644 --- a/test/index.html +++ b/test/index.html @@ -9,7 +9,7 @@ - + From e989c61e63275007f3d08559130c8ad391dc4c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 20 Jun 2012 15:09:30 +0200 Subject: [PATCH 3/4] make the tests run in Closure RAW mode, but leave the SIMPLE mode script tag to still catch compilation errors/warnings while running tests --- test/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/test/index.html b/test/index.html index b271f302c1..0083c74e0e 100644 --- a/test/index.html +++ b/test/index.html @@ -10,6 +10,7 @@ + From 2890a55ee73c38a3cf02defd2e91e8f01fb9f1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 20 Jun 2012 15:13:22 +0200 Subject: [PATCH 4/4] [ol.layer.XYZ] a tiling fix --- src/ol/layer/XYZ.js | 20 ++++++++------------ test/spec/ol/layer/XYZ.test.js | 3 +-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/ol/layer/XYZ.js b/src/ol/layer/XYZ.js index 60dc65d660..d9ff88ef89 100644 --- a/src/ol/layer/XYZ.js +++ b/src/ol/layer/XYZ.js @@ -130,26 +130,22 @@ ol.layer.XYZ.prototype.getData = function(bounds, resolution) { offsetY = Math.floor( (tileOriginY - boundsMaxY) / tileHeightGeo), - gridWidth = Math.ceil( - (boundsMaxX - boundsMinX) / tileWidthGeo), - gridHeight = Math.ceil( - (boundsMaxY - boundsMinY) / tileHeightGeo); + gridLeft = tileOriginX + tileWidthGeo * offsetX, + gridTop = tileOriginY - tileHeightGeo * offsetY; - var tiles = [], - tile, - url, - i, ii, - j, jj; - - for (i=0, ii=gridWidth; i boundsMinY) { tiles[i] = []; - for (j=0, jj=gridHeight; j