Rename VectorTileSource to VectorTile
This commit is contained in:
@@ -40,7 +40,7 @@ import {assign} from '../obj.js';
|
|||||||
* animations, but slower performance than the other options.
|
* animations, but slower performance than the other options.
|
||||||
*
|
*
|
||||||
* When `declutter` is set to `true`, `'hybrid'` will be used instead of `'image'`.
|
* When `declutter` is set to `true`, `'hybrid'` will be used instead of `'image'`.
|
||||||
* @property {module:ol/source/VectorTile~VectorTileSource} [source] Source.
|
* @property {module:ol/source/VectorTile~VectorTile} [source] Source.
|
||||||
* @property {module:ol/PluggableMap~PluggableMap} [map] Sets the layer as overlay on a map. The map will not manage
|
* @property {module:ol/PluggableMap~PluggableMap} [map] Sets the layer as overlay on a map. The map will not manage
|
||||||
* this layer in its layers collection, and the layer will be rendered on top. This is useful for
|
* this layer in its layers collection, and the layer will be rendered on top. This is useful for
|
||||||
* temporary layers. The standard way to add a layer to a map and have it managed by the map is to
|
* temporary layers. The standard way to add a layer to a map and have it managed by the map is to
|
||||||
@@ -161,9 +161,9 @@ VectorTileLayer.prototype.setUseInterimTilesOnError = function(useInterimTilesOn
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the associated {@link module:ol/source/VectorTile~VectorTileSource vectortilesource} of the layer.
|
* Return the associated {@link module:ol/source/VectorTile~VectorTile vectortilesource} of the layer.
|
||||||
* @function
|
* @function
|
||||||
* @return {module:ol/source/VectorTile~VectorTileSource} Source.
|
* @return {module:ol/source/VectorTile~VectorTile} Source.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
VectorTileLayer.prototype.getSource;
|
VectorTileLayer.prototype.getSource;
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(tile, fram
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = /** @type {module:ol/source/VectorTile~VectorTileSource} */ (layer.getSource());
|
const source = /** @type {module:ol/source/VectorTile~VectorTile} */ (layer.getSource());
|
||||||
const sourceTileGrid = source.getTileGrid();
|
const sourceTileGrid = source.getTileGrid();
|
||||||
const tileGrid = source.getTileGridForProjection(projection);
|
const tileGrid = source.getTileGridForProjection(projection);
|
||||||
const resolution = tileGrid.getResolution(tile.tileCoord[0]);
|
const resolution = tileGrid.getResolution(tile.tileCoord[0]);
|
||||||
@@ -271,7 +271,7 @@ CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(co
|
|||||||
/** @type {Array.<module:ol/VectorImageTile~VectorImageTile>} */
|
/** @type {Array.<module:ol/VectorImageTile~VectorImageTile>} */
|
||||||
const renderedTiles = this.renderedTiles;
|
const renderedTiles = this.renderedTiles;
|
||||||
|
|
||||||
const source = /** @type {module:ol/source/VectorTile~VectorTileSource} */ (layer.getSource());
|
const source = /** @type {module:ol/source/VectorTile~VectorTile} */ (layer.getSource());
|
||||||
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
||||||
let bufferedExtent, found;
|
let bufferedExtent, found;
|
||||||
let i, ii, replayGroup;
|
let i, ii, replayGroup;
|
||||||
@@ -316,7 +316,7 @@ CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(co
|
|||||||
*/
|
*/
|
||||||
CanvasVectorTileLayerRenderer.prototype.getReplayTransform_ = function(tile, frameState) {
|
CanvasVectorTileLayerRenderer.prototype.getReplayTransform_ = function(tile, frameState) {
|
||||||
const layer = this.getLayer();
|
const layer = this.getLayer();
|
||||||
const source = /** @type {module:ol/source/VectorTile~VectorTileSource} */ (layer.getSource());
|
const source = /** @type {module:ol/source/VectorTile~VectorTile} */ (layer.getSource());
|
||||||
const tileGrid = source.getTileGrid();
|
const tileGrid = source.getTileGrid();
|
||||||
const tileCoord = tile.tileCoord;
|
const tileCoord = tile.tileCoord;
|
||||||
const tileResolution = tileGrid.getResolution(tileCoord[0]);
|
const tileResolution = tileGrid.getResolution(tileCoord[0]);
|
||||||
@@ -365,7 +365,7 @@ CanvasVectorTileLayerRenderer.prototype.handleStyleImageChange_ = function(event
|
|||||||
CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameState, layerState) {
|
CanvasVectorTileLayerRenderer.prototype.postCompose = function(context, frameState, layerState) {
|
||||||
const layer = this.getLayer();
|
const layer = this.getLayer();
|
||||||
const declutterReplays = layer.getDeclutter() ? {} : null;
|
const declutterReplays = layer.getDeclutter() ? {} : null;
|
||||||
const source = /** @type {module:ol/source/VectorTile~VectorTileSource} */ (layer.getSource());
|
const source = /** @type {module:ol/source/VectorTile~VectorTile} */ (layer.getSource());
|
||||||
const renderMode = layer.getRenderMode();
|
const renderMode = layer.getRenderMode();
|
||||||
const replayTypes = VECTOR_REPLAYS[renderMode];
|
const replayTypes = VECTOR_REPLAYS[renderMode];
|
||||||
const pixelRatio = frameState.pixelRatio;
|
const pixelRatio = frameState.pixelRatio;
|
||||||
@@ -490,7 +490,7 @@ CanvasVectorTileLayerRenderer.prototype.renderTileImage_ = function(
|
|||||||
const tileCoord = tile.wrappedTileCoord;
|
const tileCoord = tile.wrappedTileCoord;
|
||||||
const z = tileCoord[0];
|
const z = tileCoord[0];
|
||||||
const pixelRatio = frameState.pixelRatio;
|
const pixelRatio = frameState.pixelRatio;
|
||||||
const source = /** @type {module:ol/source/VectorTile~VectorTileSource} */ (layer.getSource());
|
const source = /** @type {module:ol/source/VectorTile~VectorTile} */ (layer.getSource());
|
||||||
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
|
||||||
const resolution = tileGrid.getResolution(z);
|
const resolution = tileGrid.getResolution(z);
|
||||||
const context = tile.getContext(layer);
|
const context = tile.getContext(layer);
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ inherits(VectorSourceEvent, Event);
|
|||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Provides a source of features for vector layers. Vector features provided
|
* Provides a source of features for vector layers. Vector features provided
|
||||||
* by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTileSource} for
|
* by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
|
||||||
* vector data that is optimized for rendering.
|
* vector data that is optimized for rendering.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import TileState from '../TileState.js';
|
import TileState from '../TileState.js';
|
||||||
import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js';
|
import VectorImageTile, {defaultLoadFunction} from '../VectorImageTile.js';
|
||||||
import VectorTile from '../VectorTile.js';
|
import Tile from '../VectorTile.js';
|
||||||
import {toSize} from '../size.js';
|
import {toSize} from '../size.js';
|
||||||
import UrlTile from '../source/UrlTile.js';
|
import UrlTile from '../source/UrlTile.js';
|
||||||
import {getKeyZXY} from '../tilecoord.js';
|
import {getKeyZXY} from '../tilecoord.js';
|
||||||
@@ -70,7 +70,7 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
|
|||||||
* @param {module:ol/source/VectorTile~Options=} options Vector tile options.
|
* @param {module:ol/source/VectorTile~Options=} options Vector tile options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const VectorTileSource = function(options) {
|
const VectorTile = function(options) {
|
||||||
const projection = options.projection || 'EPSG:3857';
|
const projection = options.projection || 'EPSG:3857';
|
||||||
|
|
||||||
const extent = options.extent || extentFromProjection(projection);
|
const extent = options.extent || extentFromProjection(projection);
|
||||||
@@ -121,7 +121,7 @@ const VectorTileSource = function(options) {
|
|||||||
* @type {function(new: module:ol/VectorTile~VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState~TileState, string,
|
* @type {function(new: module:ol/VectorTile~VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState~TileState, string,
|
||||||
* module:ol/format/Feature~FeatureFormat, module:ol/Tile~LoadFunction)}
|
* module:ol/format/Feature~FeatureFormat, module:ol/Tile~LoadFunction)}
|
||||||
*/
|
*/
|
||||||
this.tileClass = options.tileClass ? options.tileClass : VectorTile;
|
this.tileClass = options.tileClass ? options.tileClass : Tile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -131,13 +131,13 @@ const VectorTileSource = function(options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(VectorTileSource, UrlTile);
|
inherits(VectorTile, UrlTile);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean} The source can have overlapping geometries.
|
* @return {boolean} The source can have overlapping geometries.
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.getOverlaps = function() {
|
VectorTile.prototype.getOverlaps = function() {
|
||||||
return this.overlaps_;
|
return this.overlaps_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ VectorTileSource.prototype.getOverlaps = function() {
|
|||||||
* clear {@link module:ol/TileCache~TileCache} and delete all source tiles
|
* clear {@link module:ol/TileCache~TileCache} and delete all source tiles
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.clear = function() {
|
VectorTile.prototype.clear = function() {
|
||||||
this.tileCache.clear();
|
this.tileCache.clear();
|
||||||
this.sourceTiles_ = {};
|
this.sourceTiles_ = {};
|
||||||
};
|
};
|
||||||
@@ -153,7 +153,7 @@ VectorTileSource.prototype.clear = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) {
|
VectorTile.prototype.getTile = function(z, x, y, pixelRatio, projection) {
|
||||||
const tileCoordKey = getKeyZXY(z, x, y);
|
const tileCoordKey = getKeyZXY(z, x, y);
|
||||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||||
return /** @type {!module:ol/Tile~Tile} */ (this.tileCache.get(tileCoordKey));
|
return /** @type {!module:ol/Tile~Tile} */ (this.tileCache.get(tileCoordKey));
|
||||||
@@ -180,7 +180,7 @@ VectorTileSource.prototype.getTile = function(z, x, y, pixelRatio, projection) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.getTileGridForProjection = function(projection) {
|
VectorTile.prototype.getTileGridForProjection = function(projection) {
|
||||||
const code = projection.getCode();
|
const code = projection.getCode();
|
||||||
let tileGrid = this.tileGrids_[code];
|
let tileGrid = this.tileGrids_[code];
|
||||||
if (!tileGrid) {
|
if (!tileGrid) {
|
||||||
@@ -197,7 +197,7 @@ VectorTileSource.prototype.getTileGridForProjection = function(projection) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.getTilePixelRatio = function(pixelRatio) {
|
VectorTile.prototype.getTilePixelRatio = function(pixelRatio) {
|
||||||
return pixelRatio;
|
return pixelRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,9 +205,9 @@ VectorTileSource.prototype.getTilePixelRatio = function(pixelRatio) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
VectorTileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) {
|
VectorTile.prototype.getTilePixelSize = function(z, pixelRatio, projection) {
|
||||||
const tileGrid = this.getTileGridForProjection(projection);
|
const tileGrid = this.getTileGridForProjection(projection);
|
||||||
const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);
|
const tileSize = toSize(tileGrid.getTileSize(z), this.tmpSize);
|
||||||
return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)];
|
return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)];
|
||||||
};
|
};
|
||||||
export default VectorTileSource;
|
export default VectorTile;
|
||||||
|
|||||||
Reference in New Issue
Block a user