UNPKG

rlayers

Version:

React Components for OpenLayers

33 lines 1.25 kB
import { Heatmap as LayerHeatmap } from 'ol/layer'; import { Vector as SourceVector } from 'ol/source'; import { default as RLayerBaseVector } from './RLayerBaseVector'; /** A vector layer that renders its RFeatures as a heatmap * * Compatible with RLayerVector * * Requires an `RMap` context * * Provides a vector layer for JSX-declared RFeatures */ export default class RLayerHeatmap extends RLayerBaseVector { createSource(props) { this.source = new SourceVector({ features: this.props.features, url: this.props.url, format: this.props.format, loader: this.props.loader, wrapX: this.props.wrapX, strategy: this.props.strategy }); this.ol = new LayerHeatmap(Object.assign(Object.assign({}, props), { source: this.source })); return [this.ol, this.source]; } refresh(prev) { super.refresh(prev); if ((prev === null || prev === void 0 ? void 0 : prev.blur) !== this.props.blur) this.ol.setBlur(this.props.blur); if ((prev === null || prev === void 0 ? void 0 : prev.radius) !== this.props.radius) this.ol.setRadius(this.props.radius); } } //# sourceMappingURL=RLayerHeatmap.js.map