Source updates for new extent structure

This commit is contained in:
Tim Schaub
2013-09-03 17:50:33 -06:00
parent a670b7979c
commit 75cb19d7e1
9 changed files with 21 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ ol.source.ImageStatic = function(options) {
var imageExtent = options.imageExtent;
var imageSize = options.imageSize;
var imageResolution = (imageExtent[3] - imageExtent[2]) / imageSize[1];
var imageResolution = (imageExtent[1][1] - imageExtent[0][1]) / imageSize[1];
var projection = ol.proj.get(options.projection);
goog.base(this, {

View File

@@ -89,8 +89,8 @@ ol.source.ImageWMS.prototype.getImage =
extent = extent.slice();
ol.extent.scaleFromCenter(extent, this.ratio_);
var width = (extent[1] - extent[0]) / resolution;
var height = (extent[3] - extent[2]) / resolution;
var width = (extent[1][0] - extent[0][0]) / resolution;
var height = (extent[1][1] - extent[0][1]) / resolution;
var size = [width, height];
this.image_ = this.createImage(extent, resolution, size, projection);

View File

@@ -69,15 +69,15 @@ goog.inherits(ol.source.TileJSON, ol.source.TileImage);
* @protected
*/
ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
var tileJSON = ol.tilejson.grids_.pop();
var epsg4326Projection = ol.proj.get('EPSG:4326');
var extent;
if (goog.isDef(tileJSON.bounds)) {
var bounds = tileJSON.bounds;
var epsg4326Extent = [bounds[0], bounds[2], bounds[1], bounds[3]];
var epsg4326Extent = [
tileJSON.bounds.slice(0, 2), tileJSON.bounds.slice(2)
];
var transform = ol.proj.getTransformFromProjections(
epsg4326Projection, this.getProjection());
extent = ol.extent.transform(epsg4326Extent, transform);

View File

@@ -75,10 +75,11 @@ ol.source.TileWMS = function(options) {
extent = goog.isDef(extent) ? extent : projectionExtent;
if (!goog.isNull(extent) && projection.isGlobal() &&
extent[0] === projectionExtent[0] &&
extent[1] === projectionExtent[1]) {
extent[0][0] === projectionExtent[0][0] &&
extent[1][0] === projectionExtent[1][0]) {
var numCols = Math.ceil(
(extent[1] - extent[0]) / (tileExtent[1] - tileExtent[0]));
(extent[1][0] - extent[0][0]) /
(tileExtent[1][0] - tileExtent[0][0]));
x = goog.math.modulo(x, numCols);
tileExtent = tileGrid.getTileCoordExtent(
new ol.TileCoord(tileCoord.z, x, tileCoord.y));

View File

@@ -54,8 +54,8 @@ ol.source.wms.getUrl =
var axisOrientation = projection.getAxisOrientation();
var bboxValues = (wms13 && axisOrientation.substr(0, 2) == 'ne') ?
[extent[2], extent[0], extent[3], extent[1]] :
[extent[0], extent[2], extent[1], extent[3]];
[extent[0][1], extent[0][0], extent[1][1], extent[1][0]] :
[extent[0][0], extent[0][1], extent[1][0], extent[1][1]];
baseParams['BBOX'] = bboxValues.join(',');
return goog.uri.utils.appendParamsFromMap(baseUrl, baseParams);

View File

@@ -154,10 +154,11 @@ ol.source.WMTS = function(options) {
options.extent : projectionExtent;
if (!goog.isNull(extent) && projection.isGlobal() &&
extent[0] === projectionExtent[0] &&
extent[1] === projectionExtent[1]) {
extent[0][0] === projectionExtent[0][0] &&
extent[1][0] === projectionExtent[1][0]) {
var numCols = Math.ceil(
(extent[1] - extent[0]) / (tileExtent[1] - tileExtent[0]));
(extent[1][0] - extent[0][0]) /
(tileExtent[1][0] - tileExtent[0][0]));
x = goog.math.modulo(x, numCols);
tmpTileCoord.z = tileCoord.z;
tmpTileCoord.x = x;