61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
import POILayer2D from "./POILayer2D";
|
|
import Style from 'ol/style/Style';
|
|
import StrokeStyle from 'ol/style/Stroke';
|
|
import { zindex2d } from "../../zindex";
|
|
import {config} from "../../../../../config";
|
|
|
|
export default class BouaInLayer2D extends POILayer2D {
|
|
static LayerName = 'BouaInLayer';
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this._style1 = new Style({
|
|
stroke: new StrokeStyle({
|
|
color: 'rgb(161,166,211)',
|
|
width: 7,
|
|
}),
|
|
zIndex: zindex2d.sx,
|
|
});
|
|
this._style2 = new Style({
|
|
stroke: new StrokeStyle({
|
|
color: 'rgb(137,137,137)',
|
|
width: 1.5,
|
|
lineDash: [15,5,3,5],
|
|
}),
|
|
zIndex: zindex2d.sx,
|
|
});
|
|
}
|
|
|
|
getLayerName() {
|
|
return BouaInLayer2D.LayerName;
|
|
}
|
|
|
|
async dataPromise() {
|
|
const hlData = await fetch(`${process.env.PUBLIC_URL}/data/geojson/xianfeng/boua_In.geojson`)
|
|
.then(resp => resp.json())
|
|
.then(data => data.features)
|
|
.then(features => features
|
|
// .filter(o => o.geometry.coordinates.length > 1)
|
|
.map(({ properties, geometry }) => ({
|
|
...properties,
|
|
geometry,
|
|
name: properties.name || properties.Name,
|
|
pname: properties.projName,
|
|
id: properties.FID,
|
|
})))
|
|
.catch(() => []);
|
|
return hlData;
|
|
}
|
|
|
|
styleFunc = () => {
|
|
if (!this.isVisible()) {
|
|
return null;
|
|
}
|
|
return [
|
|
this._style1,
|
|
this._style2]
|
|
;
|
|
}
|
|
}
|