| | |
| | | } |
| | | |
| | | // 更新上一个和这一个信息 |
| | | // function updateMapSpotInfo(nowEntity) { |
| | | // const nowData = nowEntity.customInfo; |
| | | // if (!nowEntity) return; |
| | | // if (nowEntity.customInfo.id === lastEntity?.customInfo.id) return; |
| | | // // 设置新的 |
| | | // nowEntity.polygon.material = Cesium.Color.RED.withAlpha(0); |
| | | // nowEntity.polyline.material = Cesium.Color.RED; |
| | | // // 重置上一个 |
| | | // if (lastEntity) { |
| | | // const lastData = lastEntity.customInfo; |
| | | // const originalFillColor = |
| | | // lastData.is_exception === 2 |
| | | // ? Cesium.Color.RED.withAlpha(0.5) |
| | | // : Cesium.Color.YELLOW.withAlpha(0.5); |
| | | // const originalOutlineColor = |
| | | // lastData.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW; |
| | | |
| | | // lastEntity.polygon.material = originalFillColor; |
| | | // lastEntity.polygon.outlineColor = originalOutlineColor; |
| | | // lastEntity.polyline.material = originalOutlineColor; |
| | | // } |
| | | // lastEntity = nowEntity; |
| | | // const numbersWithCommas = nowData.dkfw.match(/\d+(\.\d+)?/g); |
| | | // if (numbersWithCommas) { |
| | | // // 解析经纬度数组 |
| | | // const groupedArr = numbersWithCommas.reduce((acc, val, index, src) => { |
| | | // if (index % 2 === 0) acc.push(src.slice(index, index + 2)); |
| | | // return acc; |
| | | // }, []); |
| | | |
| | | // const polygonCenter = getCenterPoint(groupedArr); |
| | | // // 相机定位 |
| | | // homeViewer.value.scene.camera.setView({ |
| | | // destination: Cesium.Cartesian3.fromDegrees( |
| | | // Number(polygonCenter.lng), |
| | | // Number(polygonCenter.lat), |
| | | // 1500 |
| | | // ), |
| | | |
| | | // }); |
| | | // } |
| | | |
| | | // } |
| | | function updateMapSpotInfo(nowEntity) { |
| | | const nowData = nowEntity.customInfo; |
| | | if (!nowEntity) return; |
| | | if (nowEntity.customInfo.id === lastEntity?.customInfo.id) return; |
| | | // 设置新的 |
| | | nowEntity.polygon.material = Cesium.Color.RED.withAlpha(0); |
| | | nowEntity.polyline.material = Cesium.Color.RED; |
| | | // 重置上一个 |
| | | if (lastEntity) { |
| | | const lastData = lastEntity.customInfo; |
| | | const originalFillColor = |
| | |
| | | : Cesium.Color.YELLOW.withAlpha(0.5); |
| | | const originalOutlineColor = |
| | | lastData.is_exception == 2 ? Cesium.Color.RED : Cesium.Color.YELLOW; |
| | | |
| | | lastEntity.polygon.material = originalFillColor; |
| | | lastEntity.polygon.outlineColor = originalOutlineColor; |
| | | lastEntity.polyline.material = originalOutlineColor; |
| | |
| | | lastEntity = nowEntity; |
| | | const numbersWithCommas = nowData.dkfw.match(/\d+(\.\d+)?/g); |
| | | if (numbersWithCommas) { |
| | | // 解析经纬度数组 |
| | | const groupedArr = numbersWithCommas.reduce((acc, val, index, src) => { |
| | | if (index % 2 === 0) acc.push(src.slice(index, index + 2)); |
| | | return acc; |
| | | }, []); |
| | | const polygonCenter = getCenterPoint(groupedArr); |
| | | // 相机定位 |
| | | homeViewer.value.scene.camera.setView({ |
| | | destination: Cesium.Cartesian3.fromDegrees( |
| | | Number(polygonCenter.lng), |
| | | Number(polygonCenter.lat), |
| | | 1500 |
| | | ), |
| | | |
| | | |
| | | const positionsData = []; |
| | | for (let i = 0; i < numbersWithCommas.length; i += 2) { |
| | | const lon = Number(numbersWithCommas[i]); |
| | | const lat = Number(numbersWithCommas[i + 1]); |
| | | positionsData.push([lon, lat, 10]); |
| | | } |
| | | flyVisual({ |
| | | positionsData: positionsData, |
| | | viewer: homeViewer.value, |
| | | multiple: 15, |
| | | // pitch: -90 |
| | | }); |
| | | } |
| | | |
| | | } |
| | | // 清空选中的数据 |
| | | const clearSelect = () => { |