Replace ol.tilegrid.XYZ with an ol.tilegrid.createXYZ function

This commit is contained in:
Andreas Hocevar
2015-04-28 23:26:35 +02:00
parent a116878a57
commit b05193fa45
16 changed files with 79 additions and 353 deletions
+7 -6
View File
@@ -12,7 +12,6 @@ goog.require('ol.proj');
goog.require('ol.source.State');
goog.require('ol.source.TileImage');
goog.require('ol.tilecoord');
goog.require('ol.tilegrid.XYZ');
@@ -103,18 +102,20 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
var sourceProjection = this.getProjection();
var tileGrid = new ol.tilegrid.XYZ({
extent: ol.tilegrid.extentFromProjection(sourceProjection),
var extent = ol.tilegrid.extentFromProjection(sourceProjection);
var tileSize = resource.imageWidth == resource.imageHeight ?
resource.imageWidth : [resource.imageWidth, resource.imageHeight];
var tileGrid = ol.tilegrid.createXYZ({
extent: extent,
minZoom: resource.zoomMin,
maxZoom: maxZoom,
tileSize: resource.imageWidth == resource.imageHeight ?
resource.imageWidth : [resource.imageWidth, resource.imageHeight]
tileSize: tileSize
});
this.tileGrid = tileGrid;
var culture = this.culture_;
this.tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
tileGrid.createTileCoordTransform(),
ol.tilegrid.createOriginTopLeftTileCoordTransform(tileGrid),
ol.TileUrlFunction.createFromTileUrlFunctions(
goog.array.map(
resource.imageUrlSubdomains,
+1 -2
View File
@@ -17,7 +17,6 @@ goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.source.State');
goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.XYZ');
@@ -69,7 +68,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
}
var minZoom = tileJSON.minzoom || 0;
var maxZoom = tileJSON.maxzoom || 22;
var tileGrid = new ol.tilegrid.XYZ({
var tileGrid = ol.tilegrid.createXYZ({
extent: ol.tilegrid.extentFromProjection(sourceProjection),
maxZoom: maxZoom,
minZoom: minZoom
+1 -2
View File
@@ -13,7 +13,6 @@ goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.source.State');
goog.require('ol.source.Tile');
goog.require('ol.tilegrid.XYZ');
@@ -122,7 +121,7 @@ ol.source.TileUTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
}
var minZoom = tileJSON.minzoom || 0;
var maxZoom = tileJSON.maxzoom || 22;
var tileGrid = new ol.tilegrid.XYZ({
var tileGrid = ol.tilegrid.createXYZ({
extent: ol.tilegrid.extentFromProjection(sourceProjection),
maxZoom: maxZoom,
minZoom: minZoom
+3 -3
View File
@@ -3,7 +3,6 @@ goog.provide('ol.source.XYZ');
goog.require('ol.Attribution');
goog.require('ol.TileUrlFunction');
goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.XYZ');
@@ -20,7 +19,7 @@ ol.source.XYZ = function(options) {
var projection = goog.isDef(options.projection) ?
options.projection : 'EPSG:3857';
var tileGrid = new ol.tilegrid.XYZ({
var tileGrid = ol.tilegrid.createXYZ({
extent: ol.tilegrid.extentFromProjection(projection),
maxZoom: options.maxZoom,
tileSize: options.tileSize
@@ -42,7 +41,8 @@ ol.source.XYZ = function(options) {
* @private
* @type {ol.TileCoordTransformType}
*/
this.tileCoordTransform_ = tileGrid.createTileCoordTransform();
this.tileCoordTransform_ =
ol.tilegrid.createOriginTopLeftTileCoordTransform(tileGrid);
if (goog.isDef(options.tileUrlFunction)) {
this.setTileUrlFunction(options.tileUrlFunction);