UNPKG

rlayers

Version:

React Components for OpenLayers

27 lines 908 B
import TileLayer from 'ol/layer/Tile'; import TileWMS from 'ol/source/TileWMS'; import { default as RLayerRaster } from './RLayerRaster'; /** * Tiled layer using WMS */ export default class RLayerTileWMS extends RLayerRaster { constructor(props) { super(props); this.createSource(); this.ol = new TileLayer({ source: this.source }); this.eventSources = [this.ol, this.source]; } createSource() { const { params, url, projection, attributions } = this.props; const options = { params, url, projection, attributions }; this.source = new TileWMS(options); this.eventSources = [this.ol, this.source]; } refresh(prevProps) { super.refresh(prevProps); this.createSource(); this.ol.setSource(this.source); this.attachOldEventHandlers(this.source); } } //# sourceMappingURL=RLayerTileWMS.js.map