Named export for VectorImageTile
This commit is contained in:
@@ -285,14 +285,14 @@ VectorImageTile.prototype.finishLoading_ = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default VectorImageTile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the loader for a tile.
|
* Sets the loader for a tile.
|
||||||
* @param {ol.VectorTile} tile Vector tile.
|
* @param {ol.VectorTile} tile Vector tile.
|
||||||
* @param {string} url URL.
|
* @param {string} url URL.
|
||||||
*/
|
*/
|
||||||
VectorImageTile.defaultLoadFunction = function(tile, url) {
|
export function defaultLoadFunction(tile, url) {
|
||||||
var loader = loadFeaturesXhr(url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
|
var loader = loadFeaturesXhr(url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
|
||||||
tile.setLoader(loader);
|
tile.setLoader(loader);
|
||||||
};
|
}
|
||||||
export default VectorImageTile;
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import TileState from '../TileState.js';
|
import TileState from '../TileState.js';
|
||||||
import VectorImageTile from '../VectorImageTile.js';
|
import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js';
|
||||||
import VectorTile from '../VectorTile.js';
|
import VectorTile from '../VectorTile.js';
|
||||||
import _ol_size_ from '../size.js';
|
import _ol_size_ from '../size.js';
|
||||||
import _ol_source_UrlTile_ from '../source/UrlTile.js';
|
import _ol_source_UrlTile_ from '../source/UrlTile.js';
|
||||||
@@ -46,8 +46,7 @@ var _ol_source_VectorTile_ = function(options) {
|
|||||||
projection: projection,
|
projection: projection,
|
||||||
state: options.state,
|
state: options.state,
|
||||||
tileGrid: tileGrid,
|
tileGrid: tileGrid,
|
||||||
tileLoadFunction: options.tileLoadFunction ?
|
tileLoadFunction: options.tileLoadFunction ? options.tileLoadFunction : defaultLoadFunction,
|
||||||
options.tileLoadFunction : VectorImageTile.defaultLoadFunction,
|
|
||||||
tileUrlFunction: options.tileUrlFunction,
|
tileUrlFunction: options.tileUrlFunction,
|
||||||
url: options.url,
|
url: options.url,
|
||||||
urls: options.urls,
|
urls: options.urls,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import TileState from '../../../src/ol/TileState.js';
|
import TileState from '../../../src/ol/TileState.js';
|
||||||
import VectorImageTile from '../../../src/ol/VectorImageTile.js';
|
import VectorImageTile, {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
|
||||||
import VectorTile from '../../../src/ol/VectorTile.js';
|
import VectorTile from '../../../src/ol/VectorTile.js';
|
||||||
import _ol_events_ from '../../../src/ol/events.js';
|
import _ol_events_ from '../../../src/ol/events.js';
|
||||||
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
|
||||||
@@ -14,7 +14,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var format = new GeoJSON();
|
var format = new GeoJSON();
|
||||||
var url = 'spec/ol/data/point.json';
|
var url = 'spec/ol/data/point.json';
|
||||||
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {
|
defaultLoadFunction, [0, 0, -1], function() {
|
||||||
return url;
|
return url;
|
||||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||||
@@ -37,7 +37,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
||||||
function(tile, url) {
|
function(tile, url) {
|
||||||
sourceTile = tile;
|
sourceTile = tile;
|
||||||
VectorImageTile.defaultLoadFunction(tile, url);
|
defaultLoadFunction(tile, url);
|
||||||
}, [0, 0, -1], function() {
|
}, [0, 0, -1], function() {
|
||||||
return url;
|
return url;
|
||||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||||
@@ -62,7 +62,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var format = new GeoJSON();
|
var format = new GeoJSON();
|
||||||
var url = 'spec/ol/data/unavailable.json';
|
var url = 'spec/ol/data/unavailable.json';
|
||||||
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {
|
defaultLoadFunction, [0, 0, -1], function() {
|
||||||
return url;
|
return url;
|
||||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||||
@@ -79,7 +79,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var format = new GeoJSON();
|
var format = new GeoJSON();
|
||||||
var url = '';
|
var url = '';
|
||||||
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {},
|
defaultLoadFunction, [0, 0, -1], function() {},
|
||||||
_ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
_ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
});
|
});
|
||||||
var sourceTiles = {};
|
var sourceTiles = {};
|
||||||
var tile = new VectorImageTile([1, 0, -1], 0, url, format,
|
var tile = new VectorImageTile([1, 0, -1], 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [1, 0, -1], function(zxy) {
|
defaultLoadFunction, [1, 0, -1], function(zxy) {
|
||||||
return url;
|
return url;
|
||||||
}, tileGrid,
|
}, tileGrid,
|
||||||
_ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
_ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
||||||
@@ -115,7 +115,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var format = new GeoJSON();
|
var format = new GeoJSON();
|
||||||
var url = 'spec/ol/data/point.json';
|
var url = 'spec/ol/data/point.json';
|
||||||
var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
var tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {
|
defaultLoadFunction, [0, 0, -1], function() {
|
||||||
return url;
|
return url;
|
||||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||||
@@ -135,7 +135,7 @@ describe('ol.VectorImageTile', function() {
|
|||||||
var format = new GeoJSON();
|
var format = new GeoJSON();
|
||||||
var url = 'spec/ol/data/point.json';
|
var url = 'spec/ol/data/point.json';
|
||||||
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
var tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||||
VectorImageTile.defaultLoadFunction, [0, 0, -1], function() {
|
defaultLoadFunction, [0, 0, -1], function() {
|
||||||
return url;
|
return url;
|
||||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||||
import VectorImageTile from '../../../src/ol/VectorImageTile.js';
|
import {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
|
||||||
import VectorTile from '../../../src/ol/VectorTile.js';
|
import VectorTile from '../../../src/ol/VectorTile.js';
|
||||||
import _ol_events_ from '../../../src/ol/events.js';
|
import _ol_events_ from '../../../src/ol/events.js';
|
||||||
import TextFeature from '../../../src/ol/format/TextFeature.js';
|
import TextFeature from '../../../src/ol/format/TextFeature.js';
|
||||||
@@ -25,7 +25,7 @@ describe('ol.VectorTile', function() {
|
|||||||
var tile = new VectorTile([0, 0, 0], null, null, format);
|
var tile = new VectorTile([0, 0, 0], null, null, format);
|
||||||
var url = 'spec/ol/data/point.json';
|
var url = 'spec/ol/data/point.json';
|
||||||
|
|
||||||
VectorImageTile.defaultLoadFunction(tile, url);
|
defaultLoadFunction(tile, url);
|
||||||
var loader = tile.loader_;
|
var loader = tile.loader_;
|
||||||
_ol_events_.listen(tile, 'change', function(e) {
|
_ol_events_.listen(tile, 'change', function(e) {
|
||||||
expect(tile.getFeatures().length).to.be.greaterThan(0);
|
expect(tile.getFeatures().length).to.be.greaterThan(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user