Sources may be configured with a projection, tile grids with an extent

An XYZ tile grid is constructed with an extent defining the bounds of the tile grid.
This commit is contained in:
Tim Schaub
2014-08-18 23:26:36 -06:00
parent e97f79b4ab
commit ee487ca308
5 changed files with 25 additions and 22 deletions

View File

@@ -7,6 +7,7 @@ goog.require('ol.TileRange');
goog.require('ol.extent');
goog.require('ol.extent.Corner');
goog.require('ol.proj');
goog.require('ol.proj.EPSG3857');
goog.require('ol.tilecoord');
goog.require('ol.tilegrid.TileGrid');
@@ -23,19 +24,16 @@ goog.require('ol.tilegrid.TileGrid');
* @api
*/
ol.tilegrid.XYZ = function(options) {
var projection = goog.isDef(options.projection) ?
options.projection : 'EPSG:3857';
var extent = ol.tilegrid.extentFromProjection(projection);
// TODO: accept a tileSize option
var tileSize = ol.DEFAULT_TILE_SIZE;
var extent = goog.isDef(options.extent) ?
options.extent : ol.proj.EPSG3857.EXTENT;
var resolutions = ol.tilegrid.resolutionsFromExtent(
extent, options.maxZoom, tileSize);
var origin = ol.extent.getCorner(extent, ol.extent.Corner.TOP_LEFT);
goog.base(this, {
minZoom: options.minZoom,
origin: origin,
origin: ol.extent.getCorner(extent, ol.extent.Corner.TOP_LEFT),
resolutions: resolutions,
tileSize: tileSize
});