253 lines
5.7 KiB
JavaScript
253 lines
5.7 KiB
JavaScript
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-05-01 21:00:00",
|
|
"comments": "漳河遥测",
|
|
"src": "zhzj",
|
|
"esstym": "",
|
|
"mvalue": {
|
|
"slmmmt": null,
|
|
"slm60": 0,
|
|
"exkey": "@",
|
|
"slm80": 0,
|
|
"hitrsn": null,
|
|
"crpty": null,
|
|
"crpgrwprd": null,
|
|
"srlslm": null,
|
|
"stcd": "ZH201417",
|
|
"slm10": 24,
|
|
"slm20": 5.3,
|
|
"slm30": 44.3,
|
|
"slm40": 44.3,
|
|
"tm": "2024-08-03 05:00",
|
|
"slm100": 0,
|
|
"vtavslm": null,
|
|
"slmAvg": 24.5
|
|
},
|
|
"lttd": 30.8456,
|
|
"sttp": "SS",
|
|
"irrCode": "D00000010",
|
|
"sort": 9999,
|
|
"hasImg": false,
|
|
"stlc": "荆门市",
|
|
"dtmel": 0,
|
|
"stcd": "ZH201417",
|
|
"stnm": "马山二组(墒情)",
|
|
"addvcd_dictText": "荆门市",
|
|
"lgtd": 112.2321,
|
|
"irrCode_dictText": "漳河实验站",
|
|
"bsnm": "漳河流域"
|
|
},
|
|
{
|
|
"addvcd": "420800000000000",
|
|
"moditime": "2022-05-01 21:00:00",
|
|
"comments": "漳河遥测",
|
|
"src": "zhzj",
|
|
"esstym": "",
|
|
"mvalue": {
|
|
"slmmmt": null,
|
|
"slm60": 0,
|
|
"exkey": "@",
|
|
"slm80": 0,
|
|
"hitrsn": null,
|
|
"crpty": null,
|
|
"crpgrwprd": null,
|
|
"srlslm": null,
|
|
"stcd": "ZH201421",
|
|
"slm10": 12.1,
|
|
"slm20": 16.2,
|
|
"slm30": 12.8,
|
|
"slm40": 12.8,
|
|
"tm": "2024-08-15 08:00",
|
|
"slm100": 0,
|
|
"vtavslm": null,
|
|
"slmAvg": 13.7
|
|
},
|
|
"lttd": 30.8446,
|
|
"sttp": "SS",
|
|
"irrCode": "D00000010",
|
|
"sort": 9999,
|
|
"hasImg": false,
|
|
"stlc": "荆门市",
|
|
"dtmel": 0,
|
|
"stcd": "ZH201421",
|
|
"stnm": "槐桥四组(墒情)",
|
|
"addvcd_dictText": "荆门市",
|
|
"lgtd": 112.203,
|
|
"irrCode_dictText": "漳河实验站",
|
|
"bsnm": "漳河流域"
|
|
},
|
|
{
|
|
"addvcd": "420800000000000",
|
|
"moditime": "2022-05-01 21:00:00",
|
|
"src": "zhzj",
|
|
"esstym": "",
|
|
"mvalue": {
|
|
"slmmmt": null,
|
|
"slm60": 0,
|
|
"exkey": "@",
|
|
"slm80": 0,
|
|
"hitrsn": null,
|
|
"crpty": null,
|
|
"crpgrwprd": null,
|
|
"srlslm": null,
|
|
"stcd": "ZH201418",
|
|
"slm10": 16.5,
|
|
"slm20": 12.5,
|
|
"slm30": 0,
|
|
"slm40": 0,
|
|
"tm": "2024-09-19 11:00",
|
|
"slm100": 0,
|
|
"vtavslm": null,
|
|
"slmAvg": 14.5
|
|
},
|
|
"lttd": 30.8866,
|
|
"sttp": "SS",
|
|
"irrCode": "D00000010",
|
|
"sort": 9999,
|
|
"hasImg": false,
|
|
"stlc": "荆门市",
|
|
"dtmel": 0,
|
|
"stcd": "ZH201418",
|
|
"stnm": "双碑一组(墒情)",
|
|
"addvcd_dictText": "荆门市",
|
|
"lgtd": 112.2006,
|
|
"irrCode_dictText": "漳河实验站",
|
|
"bsnm": "漳河流域"
|
|
},
|
|
{
|
|
"addvcd": "420800000000000",
|
|
"moditime": "2022-05-01 21:00:00",
|
|
"comments": "水资源多孔闸门控制系统",
|
|
"src": "zhzj",
|
|
"esstym": "",
|
|
"mvalue": {
|
|
"slmmmt": null,
|
|
"slm60": null,
|
|
"exkey": "@",
|
|
"slm80": null,
|
|
"hitrsn": null,
|
|
"crpty": null,
|
|
"crpgrwprd": null,
|
|
"srlslm": null,
|
|
"stcd": "4211221031",
|
|
"slm10": 31,
|
|
"slm20": 42.6,
|
|
"slm30": null,
|
|
"slm40": 26.6,
|
|
"tm": "2025-05-26 09:00",
|
|
"slm100": null,
|
|
"vtavslm": null,
|
|
"slmAvg": 33.4
|
|
},
|
|
"lttd": 30.904191,
|
|
"sttp": "SS",
|
|
"irrCode": "D00000010",
|
|
"sort": 9999,
|
|
"hasImg": false,
|
|
"stlc": "荆门市",
|
|
"stcd": "4211221031",
|
|
"stnm": "试验站墒情",
|
|
"addvcd_dictText": "荆门市",
|
|
"lgtd": 112.087806,
|
|
"irrCode_dictText": "漳河实验站",
|
|
"bsnm": "漳河流域"
|
|
}
|
|
]
|
|
|
|
export default class TrsqLayer extends BaseLayer {
|
|
|
|
static LayerName = 'TrsqLayer';
|
|
|
|
static SourceName = SourceName;
|
|
|
|
getStyle() {
|
|
|
|
const ret = clone(ShapeStyle);
|
|
this._setStyleVisibility(ret);
|
|
return ret;
|
|
|
|
}
|
|
|
|
getName() {
|
|
return TrsqLayer.LayerName;
|
|
}
|
|
|
|
getSubLayers() {
|
|
return [ShapeStyle.id];
|
|
}
|
|
|
|
async doRefreshLayer(mapCtrl) {
|
|
const ms = mapCtrl.getSource(SourceName);
|
|
|
|
let data =
|
|
// await PicStPromise.get();
|
|
[...page1].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: InfoPopNames.PicStPop,
|
|
properties,
|
|
coordinates: [properties.lgtd, properties.lttd],
|
|
offsetPop: true,
|
|
});
|
|
}
|
|
}
|