window.urlParameterLayer = null; window.divIcon = null; const urlParameter = { state: { urlParameterData: {}, // urlParameterLayer: null // 自定义标签图层 }, actions: { addurlParameterLayerIcon({ state, commit, dispatch }, val) { const list = val.list; if (val.clear) { // window.urlParameterLayer.remove(); window.urlParameterLayererLayer.clear(); } for (const i in list) { const billboard = new global.DC.Billboard( new global.DC.Position(Number(list[i].jd), Number(list[i].wd), 0), "/changjing/img/icon/m-t.png" ); const label = new global.DC.Label( new global.DC.Position(Number(list[i].jd), Number(list[i].wd), 0), list[i].name ); label.setStyle({ fillColor: global.DC.Color.RED, style: global.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE, outlineColor: global.DC.Color.WHITE, // 边框颜色 outlineWidth: 8, // 边框大小, font: "12px sans-serif", pixelOffset: { x: 0, y: -24 }, }); billboard.on(global.DC.MouseEventType.CLICK, (e) => { if (state.pinchFlag == true) { return; } const lntLat = [+list[i].jd, +list[i].wd]; const d = { position: {}, lntLat: lntLat, query: { introduce: "自定义标签", address: "", ...(list[i] || {}), lntLat: lntLat, }, useJWD: true, // 仅使用经纬度 }; dispatch("setMobileWindows", d); }); label.on(global.DC.MouseEventType.CLICK, (e) => { if (state.pinchFlag == true) { return; } const lntLat = [+list[i].jd, +list[i].wd]; const d = { position: {}, lntLat: lntLat, query: { introduce: "自定义标签", address: "", ...(list[i] || {}), lntLat: lntLat, }, useJWD: true, // 仅使用经纬度 }; dispatch("setMobileWindows", d); }); window.urlParameterLayer.addOverlay(billboard); // 加入图标 window.urlParameterLayer.addOverlay(label); } }, }, mutations: { initurlParameterLayer(state, val) { if (!window.urlParameterLayer) { window.urlParameterLayer = new global.DC.VectorLayer( "urlParameterLayer" ); global.viewer.addLayer(window.urlParameterLayer); } }, set_urlParameterData(state, val) { state.urlParameterData = val; }, clearurlParameterLayerIcon(state, val) { if (window.urlParameterLayer) { window.urlParameterLayer.clear(); } }, }, }; export default urlParameter;