UNPKG

rlayers

Version:

React Components for OpenLayers

27 lines 924 B
import ImageLayer from 'ol/layer/Image'; import ImageWMS from 'ol/source/ImageWMS'; import { default as RLayerRaster } from './RLayerRaster'; /** * A layer that renders WMS maps as a single image */ export default class RLayerWMS extends RLayerRaster { constructor(props, context) { super(props, context); this.createSource(); this.ol = new ImageLayer({ source: this.source }); this.eventSources = [this.ol, this.source]; } createSource() { const { params, url, crossOrigin } = this.props; const options = { params, url, crossOrigin }; this.source = new ImageWMS(options); this.eventSources = [this.ol, this.source]; } refresh(prevProps) { super.refresh(prevProps); this.createSource(); this.ol.setSource(this.source); this.attachOldEventHandlers(this.source); } } //# sourceMappingURL=RLayerWMS.js.map