UNPKG

rlayers

Version:

React Components for OpenLayers

27 lines 912 B
import { Tile as LayerTile } from 'ol/layer'; import { TileJSON } from 'ol/source'; import { default as RLayerRaster } from './RLayerRaster'; /** * A layer with data from TileJSON tiles * * Requires an `RMap` context */ export default class RLayerTileJSON extends RLayerRaster { constructor(props, context) { super(props, context); this.source = new TileJSON({ url: this.props.url, tileSize: this.props.tileSize }); this.ol = new LayerTile({ source: this.source }); this.eventSources = [this.ol, this.source]; } refresh(prevProps) { super.refresh(prevProps); if (this.props.url && (prevProps === null || prevProps === void 0 ? void 0 : prevProps.url) !== this.props.url) { this.source.setUrl(this.props.url); this.source.refresh(); } } } //# sourceMappingURL=RLayerTileJSON.js.map