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 = [ { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.298", "vol": 1072, "formatAccq": null, "stcd": "42080204", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.298, "fr": 0, "chan": "1", "accq": 87999472 }, "lttd": 31.021727, "sttp": "PQ", "irrCode": "D00001300", "sort": 3001, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "工业", "stcd": "42080204", "stnm": "荆门热电厂", "addvcd_dictText": "荆门市", "lgtd": 112.099215, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "esstym": " ", "mvalue": { "formatTm": null, "formatHq": "0.217", "vol": 782, "formatAccq": null, "stcd": "42000003", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.217, "fr": 0, "chan": "1", "accq": 33193457 }, "lttd": 30.953887, "sttp": "PQ", "irrCode": "D00000020", "sort": 3002, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "工业", "usfl": "1", "stcd": "42000003", "stnm": "格林美", "addvcd_dictText": "荆门市", "lgtd": 112.190551, "irrCode_dictText": "三干渠", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.009", "vol": 31, "formatAccq": null, "stcd": "42000005", "rz": null, "tm": "2025-05-26 06:00", "hq": 0.009, "fr": null, "chan": "1", "accq": 1541415 }, "lttd": 30.93926, "sttp": "PQ", "irrCode": "D00000020", "sort": 3003, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "工业", "stcd": "42000005", "stnm": "福耀玻璃", "addvcd_dictText": "荆门市", "lgtd": 112.191703, "irrCode_dictText": "三干渠", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.065", "vol": 235, "formatAccq": null, "stcd": "42000011", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.065, "fr": null, "chan": "1", "accq": 8643445 }, "lttd": 30.923904, "sttp": "PQ", "irrCode": "D00000020", "sort": 3004, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "工业", "stcd": "42000011", "stnm": "绿动集团取水点", "addvcd_dictText": "荆门市", "lgtd": 112.19131, "irrCode_dictText": "三干渠", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "chidCount": 1, "mvalue": { "formatTm": null, "formatHq": "0.482", "vol": 1734, "formatAccq": null, "stcd": "42080202", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.482, "fr": 0, "chan": "1", "accq": 120347052 }, "lttd": 31.020675, "sttp": "PQ", "irrCode": "D00001300", "sort": 3005, "hasImg": true, "stlc": "荆门市", "flowType_dictText": "工业", "usfl": "1", "stcd": "42080202", "stnm": "荆门石化总厂", "addvcd_dictText": "荆门市", "lgtd": 112.096162, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.264", "vol": 947, "formatAccq": null, "stcd": "42000010", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.264, "fr": 0, "chan": "1", "accq": 11497137 }, "lttd": 31.074535, "sttp": "PQ", "irrCode": "D00000310", "sort": 3006, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "工业", "usfl": "1", "stcd": "42000010", "stnm": "华能热电", "addvcd_dictText": "荆门市", "lgtd": 112.199915, "irrCode_dictText": "四干渠", "bsnm": "漳河流域", "flowType": "3" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水,2024年1月12号变更rtu编码 4208020800", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.370", "vol": 1332, "formatAccq": null, "stcd": "42080208", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.37, "fr": 0, "chan": "1", "accq": 45187209 }, "lttd": 31.033908, "sttp": "PQ", "irrCode": "D00000310", "sort": 3007, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "生活", "stcd": "42080208", "stnm": "荆门一水厂", "addvcd_dictText": "荆门市", "lgtd": 112.189707, "irrCode_dictText": "四干渠", "bsnm": "漳河流域", "flowType": "1" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.048", "vol": 1564, "formatAccq": null, "stcd": "42080201", "rz": null, "tm": "2025-05-26 16:00", "hq": 0.048, "fr": null, "chan": "1", "accq": 59409048 }, "lttd": 31.014198, "sttp": "PQ", "irrCode": "D00001300", "sort": 3008, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "生活", "stcd": "42080201", "stnm": "荆门二水厂", "addvcd_dictText": "荆门市", "lgtd": 112.059217, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "1" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "42080401", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": 0, "chan": "1", "accq": 41103262 }, "lttd": 30.972017, "sttp": "PQ", "irrCode": "D00000290", "sort": 3009, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "生活", "stcd": "42080401", "stnm": "荆门三水厂", "addvcd_dictText": "荆门市", "lgtd": 112.184665, "irrCode_dictText": "总干渠", "bsnm": "漳河流域", "flowType": "1" }, { "addvcd": "420800000000000", "moditime": "2022-12-01 19:30:00", "comments": "漳河水库供水", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.090", "vol": 3213, "formatAccq": null, "stcd": "42080207", "rz": null, "tm": "2025-05-26 16:00", "hq": 0.09, "fr": null, "chan": "1", "accq": 262192755 }, "lttd": 31.013848, "sttp": "PQ", "irrCode": "D00001300", "sort": 3010, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "生活", "stcd": "42080207", "stnm": "三水厂备用水源", "addvcd_dictText": "荆门市", "lgtd": 112.059227, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "1" }, { "addvcd": "420800000000000", "moditime": "2023-04-14 10:25:52", "comments": "水资源多孔闸门控制系统", "src": "zhzj", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 18, "formatAccq": null, "stcd": "0020230414", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": 0, "chan": "1", "accq": 372776 }, "lttd": 30.971243, "sttp": "PQ", "irrCode": "D00000290", "sort": 3012, "hasImg": false, "stlc": "荆门市", "flowType_dictText": "农业", "stcd": "0020230414", "stnm": "杨家冲秀江南取水点", "addvcd_dictText": "荆门市", "lgtd": 112.154102, "irrCode_dictText": "总干渠", "bsnm": "漳河流域", "flowType": "4" }, { "comments": "大表系统", "src": "other", "mvalue": { "formatTm": null, "formatHq": "0.439", "vol": 1579, "formatAccq": null, "stcd": "42999999", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.439, "fr": null, "chan": "1", "accq": 31584428 }, "lttd": 31.006966, "sttp": "PQ", "irrCode": "D00001300", "sort": 3013, "hasImg": false, "stlc": "宜昌市当阳市育溪镇", "flowType_dictText": "工业生活", "stcd": "42999999", "stnm": "引漳入城站", "lgtd": 111.982362, "irrCode_dictText": "水库枢纽", "flowType": "5" }, { "addvcd": "420800000000000", "moditime": "2022-05-31 21:00:00", "comments": "漳河遥测", "src": "zhzj", "chidCount": 2, "mvalue": { "formatTm": null, "formatHq": "3.208", "vol": 10373, "formatAccq": null, "stcd": "0000000185", "rz": null, "tm": "2025-05-26 16:00", "hq": 3.208, "fr": 0, "chan": "1", "accq": 164381452 }, "lttd": 31.0656, "sttp": "PQ", "irrCode": "D00001300", "sort": 3014, "hasImg": true, "stlc": "荆门市", "flowType_dictText": "发电", "stcd": "0000000185", "stnm": "电站八百车间", "addvcd_dictText": "荆门市", "lgtd": 111.931, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "2" }, { "addvcd": "420800000000000", "moditime": "2022-05-31 21:00:00", "comments": "漳河遥测", "src": "zhzj", "chidCount": 1, "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "0000000186", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": 0, "chan": "1", "accq": 82137899 }, "lttd": 31.0617, "sttp": "PQ", "irrCode": "D00001300", "sort": 3015, "hasImg": true, "stlc": "荆门市", "flowType_dictText": "发电", "stcd": "0000000186", "stnm": "电站三千车间", "addvcd_dictText": "荆门市", "lgtd": 111.9308, "irrCode_dictText": "水库枢纽", "bsnm": "漳河流域", "flowType": "2" }, { "moditime": "2023-09-07 09:17:13", "comments": "16+500", "src": "zhzj", "esstym": "202309", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "2023090001", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": null, "chan": "1", "accq": 36120 }, "lttd": 30.973775, "sttp": "PQ", "irrCode": "D00000290", "sort": 3016, "hasImg": false, "stcd": "2023090001", "stnm": "汉通闸流量站", "lgtd": 112.17597, "irrCode_dictText": "总干渠" } ] const page2 = [ { "moditime": "2023-11-17 09:38:47", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.004", "vol": 15, "formatAccq": null, "stcd": "2023111501", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.004, "fr": 0, "chan": "1", "accq": 61933 }, "lttd": 30.972626, "sttp": "PQ", "irrCode": "D00000290", "sort": 9999, "hasImg": false, "stcd": "2023111501", "stnm": "可可取水点", "lgtd": 112.126579, "irrCode_dictText": "总干渠" }, { "moditime": "2024-03-19 15:36:57", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "2024031901", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": null, "chan": "1", "accq": 91497 }, "lttd": 31.027036, "sttp": "PQ", "irrCode": "D00000310", "sort": 9999, "hasImg": false, "stcd": "2024031901", "stnm": "团结水库取水口", "lgtd": 112.187742, "irrCode_dictText": "四干渠" }, { "moditime": "2024-03-19 16:24:14", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "2024031902", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": null, "chan": "1", "accq": 14580 }, "lttd": 31.031071, "sttp": "PQ", "irrCode": "D00000310", "sort": 9999, "hasImg": false, "stcd": "2024031902", "stnm": "文明湖取水口", "lgtd": 112.189671, "irrCode_dictText": "四干渠" }, { "moditime": "2024-04-26 14:17:34", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.016", "vol": 17, "formatAccq": null, "stcd": "7724042601", "rz": null, "tm": "2025-05-26 16:00", "hq": 0.016, "fr": null, "chan": "1", "accq": 102474 }, "lttd": 31.040052, "sttp": "PQ", "irrCode": "D00000310", "sort": 9999, "hasImg": false, "stcd": "7724042601", "stnm": "西山林语取水口(四干渠管道)", "lgtd": 112.191118, "irrCode_dictText": "四干渠" }, { "moditime": "2024-07-26 11:37:05", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.255", "vol": 919, "formatAccq": null, "stcd": "4208020669", "rz": null, "tm": "2025-05-26 15:00", "hq": 0.255, "fr": null, "chan": "1", "accq": 6684229 }, "lttd": 30.886438, "sttp": "PQ", "irrCode": "D00000290", "sort": 9999, "hasImg": false, "stcd": "4208020669", "stnm": "岳飞城", "lgtd": 112.209508, "irrCode_dictText": "总干渠" }, { "moditime": "2024-07-27 08:09:52", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 30, "formatAccq": null, "stcd": "7720240725", "rz": null, "tm": "2025-05-26 15:00", "hq": 0, "fr": 0, "chan": "1", "accq": 1187333 }, "lttd": 33.33333, "sttp": "PQ", "irrCode": "D00000290", "sort": 9999, "hasImg": false, "stcd": "7720240725", "stnm": "象山大道桥取水点(掇刀)", "lgtd": 111.111111, "irrCode_dictText": "总干渠" }, { "moditime": "2024-11-27 15:20:43", "src": "zhzj", "esstym": "", "mvalue": { "formatTm": null, "formatHq": "0.000", "vol": 0, "formatAccq": null, "stcd": "2024112701", "rz": null, "tm": "2025-05-06 18:00", "hq": 0, "fr": null, "chan": "1", "accq": 103355 }, "lttd": 30.952161, "sttp": "PQ", "irrCode": "D00000290", "sort": 9999, "hasImg": false, "stcd": "2024112701", "stnm": "总干渠夹园闸管道流量", "lgtd": 112.081919, "irrCode_dictText": "总干渠" } ] export default class SbLayer extends BaseLayer { static LayerName = 'SbLayer'; static SourceName = SourceName; getStyle() { const ret = clone(ShapeStyle); this._setStyleVisibility(ret); return ret; } getName() { return SbLayer.LayerName; } getSubLayers() { return [ShapeStyle.id]; } async doRefreshLayer(mapCtrl) { const ms = mapCtrl.getSource(SourceName); let data = // await PicStPromise.get(); [...page1,...page2].map((item)=>{ const obj = {...item} obj.lgtd = item.lgtd + 2.9619 obj.lttd = item.lttd + 0.2002 return obj }) ms.setData(parseGeoJSON(data)); return true; } getFeatureTip(record) { return record.stnm; } featureClicked(properties, dispatch) { dispatch.runtime.setFeaturePop({ type: '流量水表站', properties, coordinates: [properties.lgtd, properties.lttd], offsetPop: true, }); } }