Move default tile load function to tile module
This commit is contained in:
@@ -5,7 +5,6 @@ goog.require('ol.Tile');
|
|||||||
goog.require('ol.VectorTile');
|
goog.require('ol.VectorTile');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.featureloader');
|
|
||||||
goog.require('ol.size');
|
goog.require('ol.size');
|
||||||
goog.require('ol.source.UrlTile');
|
goog.require('ol.source.UrlTile');
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ ol.source.VectorTile = function(options) {
|
|||||||
state: options.state,
|
state: options.state,
|
||||||
tileGrid: options.tileGrid,
|
tileGrid: options.tileGrid,
|
||||||
tileLoadFunction: options.tileLoadFunction ?
|
tileLoadFunction: options.tileLoadFunction ?
|
||||||
options.tileLoadFunction : ol.source.VectorTile.defaultTileLoadFunction,
|
options.tileLoadFunction : ol.VectorTile.defaultLoadFunction,
|
||||||
tileUrlFunction: options.tileUrlFunction,
|
tileUrlFunction: options.tileUrlFunction,
|
||||||
tilePixelRatio: options.tilePixelRatio,
|
tilePixelRatio: options.tilePixelRatio,
|
||||||
url: options.url,
|
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));
|
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
|
||||||
return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)];
|
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()));
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ goog.provide('ol.VectorTile');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
|
goog.require('ol.featureloader');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,3 +187,12 @@ ol.VectorTile.prototype.setState = function(tileState) {
|
|||||||
ol.VectorTile.prototype.setLoader = function(loader) {
|
ol.VectorTile.prototype.setLoader = function(loader) {
|
||||||
this.loader_ = 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()));
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user