Redefine ol.Size to be Array.<number>

This commit is contained in:
Frederic Junod
2013-05-31 16:24:47 +02:00
parent 1d7ca27e61
commit a1a7e21f92
33 changed files with 139 additions and 157 deletions

View File

@@ -5,7 +5,6 @@ goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.net.Jsonp');
goog.require('ol.Attribution');
goog.require('ol.Size');
goog.require('ol.TileRange');
goog.require('ol.TileUrlFunction');
goog.require('ol.extent');
@@ -70,11 +69,10 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
goog.asserts.assert(resourceSet.resources.length == 1);
var resource = resourceSet.resources[0];
var tileSize = new ol.Size(resource.imageWidth, resource.imageHeight);
var tileGrid = new ol.tilegrid.XYZ({
minZoom: resource.zoomMin,
maxZoom: resource.zoomMax,
tileSize: tileSize
tileSize: [resource.imageWidth, resource.imageHeight]
});
this.tileGrid = tileGrid;

View File

@@ -58,20 +58,20 @@ ol.DebugTile_.prototype.getImage = function(opt_context) {
var canvas = /** @type {HTMLCanvasElement} */
(goog.dom.createElement(goog.dom.TagName.CANVAS));
canvas.width = tileSize.width;
canvas.height = tileSize.height;
canvas.width = tileSize[0];
canvas.height = tileSize[1];
var context = canvas.getContext('2d');
context.strokeStyle = 'black';
context.strokeRect(0.5, 0.5, tileSize.width + 0.5, tileSize.height + 0.5);
context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
context.fillStyle = 'black';
context.textAlign = 'center';
context.textBaseline = 'middle';
context.font = '24px sans-serif';
context.fillText(
this.tileCoord_.toString(), tileSize.width / 2, tileSize.height / 2);
this.tileCoord_.toString(), tileSize[0] / 2, tileSize[1] / 2);
this.canvasByContext_[key] = canvas;
return canvas;

View File

@@ -2,7 +2,6 @@ goog.provide('ol.source.SingleImageWMS');
goog.require('ol.Image');
goog.require('ol.ImageUrlFunction');
goog.require('ol.Size');
goog.require('ol.extent');
goog.require('ol.source.ImageSource');
goog.require('ol.source.wms');
@@ -64,7 +63,7 @@ ol.source.SingleImageWMS.prototype.getImage =
ol.extent.scaleFromCenter(extent, this.ratio_);
var width = (extent[1] - extent[0]) / resolution;
var height = (extent[3] - extent[2]) / resolution;
var size = new ol.Size(width, height);
var size = [width, height];
this.image_ = this.createImage(extent, resolution, size, projection);
return this.image_;

View File

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

View File

@@ -20,8 +20,8 @@ ol.source.wms.getUrl =
'REQUEST': 'GetMap',
'FORMAT': 'image/png',
'TRANSPARENT': true,
'WIDTH': Math.round(size.width),
'HEIGHT': Math.round(size.height)
'WIDTH': Math.round(size[0]),
'HEIGHT': Math.round(size[1])
};
goog.object.extend(baseParams, params);