Remove extent default so we catch errors when extent is not set
This commit is contained in:
@@ -4,13 +4,6 @@
|
|||||||
import Tile from './Tile.js';
|
import Tile from './Tile.js';
|
||||||
import TileState from './TileState.js';
|
import TileState from './TileState.js';
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {import("./extent.js").Extent}
|
|
||||||
*/
|
|
||||||
const DEFAULT_EXTENT = [0, 0, 4096, 4096];
|
|
||||||
|
|
||||||
|
|
||||||
class VectorTile extends Tile {
|
class VectorTile extends Tile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +82,7 @@ class VectorTile extends Tile {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
getExtent() {
|
getExtent() {
|
||||||
return this.extent_ || DEFAULT_EXTENT;
|
return this.extent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +159,7 @@ class VectorTile extends Tile {
|
|||||||
* calculated by multiplying the tile size with the tile pixel ratio. For
|
* calculated by multiplying the tile size with the tile pixel ratio. For
|
||||||
* sources using {@link module:ol/format/MVT~MVT} as feature format, the
|
* sources using {@link module:ol/format/MVT~MVT} as feature format, the
|
||||||
* {@link module:ol/format/MVT~MVT#getLastExtent} method will return the correct
|
* {@link module:ol/format/MVT~MVT#getLastExtent} method will return the correct
|
||||||
* extent. The default is `[0, 0, 4096, 4096]`.
|
* extent.
|
||||||
* @param {import("./extent.js").Extent} extent The extent.
|
* @param {import("./extent.js").Extent} extent The extent.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,12 +42,11 @@ import {equals} from '../array.js';
|
|||||||
* var data = // ... fetch data
|
* var data = // ... fetch data
|
||||||
* var format = tile.getFormat();
|
* var format = tile.getFormat();
|
||||||
* tile.setProjection(format.readProjection(data));
|
* tile.setProjection(format.readProjection(data));
|
||||||
|
* tile.setExtent(format.getLastExtent()); // line only required for ol/format/MVT
|
||||||
* tile.setFeatures(format.readFeatures(data, {
|
* tile.setFeatures(format.readFeatures(data, {
|
||||||
* // featureProjection is not required for ol/format/MVT
|
* // featureProjection is not required for ol/format/MVT
|
||||||
* featureProjection: map.getView().getProjection()
|
* featureProjection: map.getView().getProjection()
|
||||||
* }));
|
* }));
|
||||||
* // the line below is only required for ol/format/MVT
|
|
||||||
* tile.setExtent(format.getLastExtent());
|
|
||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
|||||||
let tile;
|
let tile;
|
||||||
tileCallback = function(t) {
|
tileCallback = function(t) {
|
||||||
t.setProjection(proj);
|
t.setProjection(proj);
|
||||||
|
t.setExtent([0, 0, 4096, 4096]);
|
||||||
tile = t;
|
tile = t;
|
||||||
};
|
};
|
||||||
map.renderSync();
|
map.renderSync();
|
||||||
|
|||||||
Reference in New Issue
Block a user