rlayers
Version:
React Components for OpenLayers
27 lines • 898 B
JavaScript
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, context) {
super(props, context);
this.createSource();
this.ol = new TileLayer({ source: this.source });
this.eventSources = [this.ol, this.source];
}
createSource() {
const { params, url, projection } = this.props;
const options = { params, url, projection };
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