Decouple source and rendered tile grid of vector tile sources

This commit is contained in:
Andreas Hocevar
2017-05-08 17:19:55 +02:00
parent 2486b25e5e
commit 785e7135a7
18 changed files with 620 additions and 287 deletions

View File

@@ -1,39 +1,14 @@
goog.provide('ol.test.VectorTile');
goog.require('ol.events');
goog.require('ol.VectorImageTile');
goog.require('ol.VectorTile');
goog.require('ol.Feature');
goog.require('ol.format.GeoJSON');
goog.require('ol.format.TextFeature');
goog.require('ol.proj');
describe('ol.VectorTile.defaultLoadFunction()', function() {
it('sets the loader function on the tile', function() {
var format = new ol.format.GeoJSON();
var tile = new ol.VectorTile([0, 0, 0], null, null, format);
var url = 'https://example.com/';
ol.VectorTile.defaultLoadFunction(tile, url);
var loader = tile.loader_;
expect(typeof loader).to.be('function');
});
it('loader sets features on the tile', function(done) {
var format = new ol.format.GeoJSON();
var tile = new ol.VectorTile([0, 0, 0], null, null, format);
var url = 'spec/ol/data/point.json';
ol.VectorTile.defaultLoadFunction(tile, url);
var loader = tile.loader_;
ol.events.listen(tile, 'change', function(e) {
expect(tile.getFeatures().length).to.be.greaterThan(0);
done();
});
loader.call(tile, [], 1, ol.proj.get('EPSG:3857'));
});
describe('ol.VectorTile', function() {
it('loader sets features on the tile and updates proj units', function(done) {
// mock format that return a tile-pixels feature
@@ -51,7 +26,7 @@ describe('ol.VectorTile.defaultLoadFunction()', function() {
var tile = new ol.VectorTile([0, 0, 0], null, null, format);
var url = 'spec/ol/data/point.json';
ol.VectorTile.defaultLoadFunction(tile, url);
ol.VectorImageTile.defaultLoadFunction(tile, url);
var loader = tile.loader_;
ol.events.listen(tile, 'change', function(e) {
expect(tile.getFeatures().length).to.be.greaterThan(0);