mcfxkh-Web/src/views/Home/MapCtrl/mapstyle/shuichangLayer.js

508 lines
12 KiB
JavaScript
Raw Normal View History

2025-05-28 15:09:02 +08:00
import clone from "clone";
import { PicStPromise, TestPicStPromise } from "../../../../models/_/real";
import { parseGeoJSON } from "../../../../utils/tools";
import { InfoPopNames } from "../../InfoPops";
import BaseLayer from "./baselayer";
const SourceName = '水厂';
const ShapeStyle = {
id: SourceName,
type: 'symbol',
source: SourceName,
layout: {
'icon-allow-overlap': true,
'text-allow-overlap': true,
'icon-image': '水厂',
'icon-size': [
'interpolate', ['linear'], ['zoom'],
10, 0.4,
14, 0.8,
],
'text-allow-overlap': true,
'text-size': [
'interpolate', ['linear'], ['zoom'],
10, 10,
14, 14,
],
'text-font': ['Roboto Black'],
'text-field': [
'step',
['zoom'],
'',
12, ['get', 'stnm']
],
'text-anchor': 'top',
'text-offset': [0, 1],
'visibility': 'none',
},
paint: {
'text-color': '#fff'
}
};
const page1 = [
{
"stcd": "716113001",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点9",
2025-05-28 15:09:02 +08:00
"adcd": "421181113000",
"wscd": null,
"importancy": 0,
"lgtd": 114.805278,
"lttd": 31.206667,
"elev": 0,
"damel": 104.27,
"dsflz": 102.9,
"fsltdz": 102.36,
"ddz": 90.86,
"zcxsw": 102.36,
"drpTm": "2025-04-11T05:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 8.19,
"w": 0,
"a_fsltdz": -94.17,
"rzTm": "2025-04-11T05:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716113001",
"tm": "2023-03-12T07:01:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716113001/20230312150100.jpg"
},
{
"stcd": "716113001",
"tm": "2023-03-12T07:08:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716113002/20230312150800.jpg"
}
],
"aRz": -94.17
},
2025-05-28 17:05:53 +08:00
2025-05-28 15:09:02 +08:00
{
"stcd": "716123001",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点8",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.9175,
"lttd": 31.325556,
"elev": 0,
"damel": 114.75,
"dsflz": 113.39,
"fsltdz": 112.3,
"ddz": 107.9,
"zcxsw": 112.3,
"drpTm": "2025-04-11T05:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 107.53,
"w": 0,
"a_fsltdz": -4.769999999999996,
"rzTm": "2025-04-11T05:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716123001",
"tm": "2023-03-12T07:02:15.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716123001/20230312150215.jpg"
},
{
"stcd": "716123001",
"tm": "2023-03-12T07:04:02.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716123002/20230312150402.jpg"
}
],
"aRz": -4.77
},
{
"stcd": "716122901",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点7",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.905833,
"lttd": 31.339444,
"elev": 0,
"damel": 90.5,
"dsflz": 89.28,
"fsltdz": 88.6,
"ddz": 14.44,
"zcxsw": 88.6,
"drpTm": "2025-04-11T05:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 87.23,
"w": 0.092,
"a_fsltdz": -1.3699999999999903,
"rzTm": "2025-04-11T05:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716122901",
"tm": "2023-03-12T07:03:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716122901/20230312150300.jpg"
},
{
"stcd": "716122901",
"tm": "2023-03-12T07:12:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716122902/20230312151200.jpg"
}
],
"aRz": -1.37
},
{
"stcd": "716123901",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点6",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.903056,
"lttd": 31.285833,
"elev": 0,
"damel": 14.2,
"dsflz": 13.88,
"fsltdz": 93.3,
"ddz": 9.4,
"zcxsw": 93.3,
"drpTm": "2025-04-11T05:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 110.13,
"w": 0,
"a_fsltdz": 16.83,
"rzTm": "2025-04-11T05:00:00.000Z",
"rzWarning": 1,
"rzState": 2,
"pic": [
{
"stcd": "716123901",
"tm": "2023-03-12T08:01:08.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716123901/20230312160108.jpg"
},
{
"stcd": "716123901",
"tm": "2023-03-12T07:03:56.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716123902/20230312150356.jpg"
}
],
"aRz": 16.83
},
{
"stcd": "716115801",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点5",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.014444,
"lttd": 31.355833,
"elev": 0,
"damel": 134.7,
"dsflz": 133.45,
"fsltdz": 132.6,
"ddz": 124.5,
"zcxsw": 132.6,
"drpTm": "2025-04-11T06:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 128.72,
"w": 0.054,
"a_fsltdz": -3.8799999999999955,
"rzTm": "2025-04-11T06:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716115801",
"tm": "2023-03-12T07:03:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716115801/20230312150300.jpg"
},
{
"stcd": "716115801",
"tm": "2023-03-12T07:12:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716115802/20230312151200.jpg"
}
],
"aRz": -3.88
},
{
"stcd": "716120401",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点4",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.954167,
"lttd": 31.311944,
"elev": 0,
"damel": 100,
"dsflz": 98.46,
"fsltdz": 97.4,
"ddz": 93.2,
"zcxsw": 97.4,
"drpTm": "2024-09-03T02:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 96.71,
"w": 0,
"a_fsltdz": -0.6900000000000119,
"rzTm": "2024-09-03T02:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716120401",
"tm": "2023-03-12T08:01:20.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716120401/20230312160120.jpg"
},
{
"stcd": "716120401",
"tm": "2023-03-12T07:04:03.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716120402/20230312150403.jpg"
}
],
"aRz": -0.69
},
{
"stcd": "716116201",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点3",
press: '0.91',
flow: 200,
hg: 90,
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 115.024444,
"lttd": 31.232222,
"elev": 0,
"damel": 140,
"dsflz": 137.65,
"fsltdz": 136.2,
"ddz": 128,
"zcxsw": 136.2,
"drpTm": "2025-04-11T06:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 131.47,
"w": 0.091,
"a_fsltdz": -4.72999999999999,
"rzTm": "2025-04-11T06:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716116201",
"tm": "2023-03-12T07:03:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716116201/20230312150300.jpg"
},
{
"stcd": "716116201",
"tm": "2023-03-12T07:11:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716116202/20230312151100.jpg"
}
],
"aRz": -4.73
},
{
"stcd": "716122701",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
press: '0.52',
flow: 200,
hg: 90,
"stnm": "监测点2",
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.908889,
"lttd": 31.334167,
"elev": 0,
"damel": 114.6,
"dsflz": 112.89,
"fsltdz": 111.6,
"ddz": 101.8,
"zcxsw": 111.6,
"drpTm": "2025-04-11T05:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 103.84,
"w": 0.123,
"a_fsltdz": -7.759999999999991,
"rzTm": "2025-04-11T05:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716122701",
"tm": "2022-02-21T01:05:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2022/0221/716122701/20220221090500.jpg"
},
{
"stcd": "716122701",
"tm": "2022-02-21T01:30:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2022/0221/716122702/20220221093000.jpg"
}
],
"aRz": -7.76
},
{
"stcd": "716122601",
"type": "sk",
"hasRz": true,
2025-05-28 17:05:53 +08:00
"stnm": "监测点1", press: '0.91',
flow: 200,
hg: 90,
2025-05-28 15:09:02 +08:00
"adcd": "421181112000",
"wscd": null,
"importancy": 0,
"lgtd": 114.891667,
"lttd": 31.346944,
"elev": 0,
"damel": 128,
"dsflz": 125.52,
"fsltdz": 124.4,
"ddz": 117.2,
"zcxsw": 124.4,
"drpTm": "2025-04-11T04:00:00.000Z",
"today": 0,
"h1": 0,
"h3": 0,
"h6": 0,
"h12": 0,
"h24": 0,
"h48": 0,
"drpState": 2,
"rz": 121.77,
"w": 0.057,
"a_fsltdz": -2.6300000000000097,
"rzTm": "2025-04-11T04:00:00.000Z",
"rzWarning": 0,
"rzState": 2,
"pic": [
{
"stcd": "716122601",
"tm": "2023-03-12T07:27:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716122601/20230312152700.jpg"
},
{
"stcd": "716122601",
"tm": "2023-03-12T07:39:00.000Z",
"url": "http://223.75.53.106:8891/skjgimages/2023/0312/716122602/20230312153900.jpg"
}
],
"aRz": -2.63
},
]
export default class ShuichangLayer extends BaseLayer {
static LayerName = 'ShuichangLayer';
static SourceName = SourceName;
getStyle() {
const ret = clone(ShapeStyle);
this._setStyleVisibility(ret);
return ret;
}
getName() {
return ShuichangLayer.LayerName;
}
getSubLayers() {
return [ShapeStyle.id];
}
async doRefreshLayer(mapCtrl) {
const ms = mapCtrl.getSource(SourceName);
let data = page1
ms.setData(parseGeoJSON(data));
return true;
}
getFeatureTip(record) {
return '';
}
featureClicked(properties, dispatch) {
2025-05-28 17:05:53 +08:00
dispatch.runtime.setFeaturePop({
type: 'shuichang',
properties,
coordinates: [properties.lgtd, properties.lttd],
offsetPop: true,
});
2025-05-28 15:09:02 +08:00
}
}