ss-dp/src/views/Home/MapCtrl/Markers/SLLayer.js

43 lines
906 B
JavaScript

import { sllist } from "../../../../service/station"
import BaseLayer from "../baselayer";
import SLMarker from "./SLMarker"
export default class SLLayer extends BaseLayer {
static LayerName = 'SLLayer';//渗流
constructor(props) {
super(props);
}
getLayerName() {
return SLLayer.LayerName;
}
onAdd() {
sllist().then((data) => {
const list = data
.filter(o => o.lgtd && o.lttd)//筛选一下,保证数据都是有经纬度的
.map((i,index)=>({
...i,
id : i.stationCode,
}))
this._dispatch.runtime.setMarkers({
[this.getLayerName()]: list || []
});
});
}
setSetting(setting) {
const setData = setting[this.getLayerName()]
this._dispatch.map.setMarkerSetting({
[this.getLayerName()]: setData || null,
});
this._setting = setting;
}
getComponentCls() {
return SLMarker;
}
}