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

43 lines
920 B
JavaScript

import { videolist } from "../../../../service/station"
import BaseLayer from "../baselayer";
import PicStMarker from "./PicStMarker";
export default class PicStLayer extends BaseLayer {
static LayerName = 'PicStLayer';
constructor(props) {
super(props);
}
getLayerName() {
return PicStLayer.LayerName;
}
onAdd() {
videolist().then((data) => {
const list = data
.filter(o => o.lgtd && o.lttd)//筛选一下,保证数据都是有经纬度的
.map(i=>({
...i,
id:i.id//必须设置id
}));
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 PicStMarker;
}
}