Move default tile load function to tile module

This commit is contained in:
Tim Schaub
2016-11-11 05:04:36 -07:00
parent 64057d7e6b
commit b829471c85
2 changed files with 11 additions and 11 deletions

View File

@@ -5,7 +5,6 @@ goog.require('ol.Tile');
goog.require('ol.VectorTile');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.featureloader');
goog.require('ol.size');
goog.require('ol.source.UrlTile');
@@ -38,7 +37,7 @@ ol.source.VectorTile = function(options) {
state: options.state,
tileGrid: options.tileGrid,
tileLoadFunction: options.tileLoadFunction ?
options.tileLoadFunction : ol.source.VectorTile.defaultTileLoadFunction,
options.tileLoadFunction : ol.VectorTile.defaultLoadFunction,
tileUrlFunction: options.tileUrlFunction,
tilePixelRatio: options.tilePixelRatio,
url: options.url,
@@ -121,12 +120,3 @@ ol.source.VectorTile.prototype.getTilePixelSize = function(z, pixelRatio, projec
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)];
};
/**
* @param {ol.VectorTile} vectorTile Vector tile.
* @param {string} url URL.
*/
ol.source.VectorTile.defaultTileLoadFunction = function(vectorTile, url) {
vectorTile.setLoader(ol.featureloader.tile(url, vectorTile.getFormat()));
};

View File

@@ -3,6 +3,7 @@ goog.provide('ol.VectorTile');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.dom');
goog.require('ol.featureloader');
/**
@@ -186,3 +187,12 @@ ol.VectorTile.prototype.setState = function(tileState) {
ol.VectorTile.prototype.setLoader = function(loader) {
this.loader_ = loader;
};
/**
* @param {ol.VectorTile} tile Vector tile.
* @param {string} url URL.
*/
ol.VectorTile.defaultLoadFunction = function(tile, url) {
tile.setLoader(ol.featureloader.tile(url, tile.getFormat()));
};