tsg-web/src/views/Home/MapCtrl/Markers/PicStLayer.js

48 lines
1018 B
JavaScript
Raw Normal View History

2024-09-20 15:02:50 +08:00
// import clone from "clone";
import { PicStMapDataPromise } from "../../../../models/_/real";
import BaseLayer from "../baselayer";
import PicStMarker from "./PicStMarker";
export default class PicStLayer extends BaseLayer {
static LayerName = 'PicStLayer';
constructor(props) {
super(props);
this.highlights = {};
}
getLayerName() {
return PicStLayer.LayerName;
}
onAdd() {
PicStMapDataPromise().then((data) => {
this._dispatch.runtime.setMarkers({
[this.getLayerName()]: data || []
});
});
}
setSetting(setting) {
const highlights = setting?.highlight?.PicStLayer;
if (highlights !== this._setting?.highlight?.PicStLayer) {
const setting = {};
if (highlights) {
for (const h of highlights) {
setting[h] = true
}
}
this._dispatch.map.setMarkerSetting({
[this.getLayerName()]: setting,
});
}
this._setting = setting;
}
getComponentCls() {
return PicStMarker;
}
}