| | |
| | | ? mergedPageData |
| | | : mergedPageData.filter((device) => device.deviceName.includes("孙胡沟")); |
| | | |
| | | // 孙胡沟设备经纬度映射 |
| | | const deviceMapping = { |
| | | 怀柔区琉璃庙镇孙胡沟椴树底下东沟泥位计5007: { |
| | | lon: 116.598891, |
| | | lat: 40.554979, |
| | | }, |
| | | 怀柔区琉璃庙镇孙胡沟村上台子河东南沟泥位计5006: { |
| | | lon: 116.593215, |
| | | lat: 40.554399, |
| | | }, |
| | | }; |
| | | |
| | | let displayedData = filteredPageData; |
| | | |
| | | if (!areaName.includes("区")) { |
| | | // 添加 lon 和 lan 字段 |
| | | displayedData = filteredPageData.map((device) => { |
| | | const mapping = deviceMapping[device.deviceName]; |
| | | return { |
| | | ...device, |
| | | ...(mapping && { lon: mapping.lon, lat: mapping.lat }), // 如果 mapping 存在,才添加 |
| | | }; |
| | | }); |
| | | |
| | | // 添加额外的两个点位 |
| | | const extraPoint1 = { |
| | | deviceName: "弯沟1", |
| | | longitude: 116.597836, |
| | | latitude: 40.564962, |
| | | // height: 530.14, |
| | | type: "泥位计", |
| | | lon: 116.597836, |
| | | lat: 40.564962, |
| | | dictDeviceType: "1437295811", |
| | | deviceId: "custom_extraPoint1", // 手动加一个唯一 ID |
| | | }; |
| | | |
| | | const extraPoint2 = { |
| | | deviceName: "弯沟2", |
| | | longitude: 116.591571, |
| | | latitude: 40.573093, |
| | | // height: 483.89, |
| | | type: "泥位计", |
| | | lon: 116.591571, |
| | | lat: 40.573093, |
| | | dictDeviceType: "1437295811", |
| | | deviceId: "custom_extraPoint2", // 手动加一个唯一 ID |
| | | }; |
| | | |
| | | displayedData = [...displayedData, extraPoint1, extraPoint2]; |
| | | // displayedData = [...displayedData, extraPoint1]; |
| | | } |
| | | |
| | | console.log( |
| | | filteredPageData, |
| | | areaName.includes("区") ? "全部泥位计设备列表" : "孙胡沟泥位计设备列表" |
| | | displayedData, |
| | | areaName.includes("区") |
| | | ? "全部泥位计设备列表" |
| | | : "孙胡沟泥位计 + 额外点位列表" |
| | | ); |
| | | |
| | | // 7. 创建点 |
| | | filteredPageData.forEach((item) => { |
| | | displayedData.forEach((item) => { |
| | | // 根据需求可增删 |
| | | item.type = getDictName(deviceDictList, item.dictDeviceType); |
| | | item.name = item.deviceName; |
| | |
| | | <div class="panel-content"> |
| | | <!-- 开挖深度设置 --> |
| | | <el-form :model="form" label-width="80px"> |
| | | <el-form-item label="请注意:"> |
| | | <p>1、右击结束最后一个点 2、请按照同向顺序开挖</p> |
| | | </el-form-item> |
| | | <el-form-item label="开挖深度"> |
| | | <el-input v-model="form.digDepth" placeholder="请输入开挖深度(m)" /> |
| | | </el-form-item> |
| | |
| | | |
| | | // 开始监听点击事件 |
| | | clickHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); |
| | | |
| | | // 左击添加点 |
| | | clickHandler.setInputAction((movement) => { |
| | | const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid); |
| | | if (cartesian) { |
| | | currentPoints.push(cartesian.clone()); |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | // 右击结束绘制并保存最后一个点 |
| | | clickHandler.setInputAction((movement) => { |
| | | const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid); |
| | | if (cartesian) { |
| | | currentPoints.push(cartesian.clone()); // 添加最后一个右击点 |
| | | } |
| | | handleConfirm(); // 自动调用确认 |
| | | }, Cesium.ScreenSpaceEventType.RIGHT_CLICK); |
| | | }; |
| | | |
| | | const createExcavation = () => { |
| | |
| | | ); |
| | | // 点击确认按钮(打印当前坐标点集合和深度) |
| | | const handleConfirm = () => { |
| | | if (currentPoints.length === 0) { |
| | | ElMessage.warning('请选取开沟有效的坐标点!'); |
| | | if (currentPoints.length < 3) { |
| | | ElMessage.warning('请至少选择三个坐标点以构成多边形!'); |
| | | return; |
| | | } |
| | | |
| | | const depth = parseFloat(form.digDepth); |
| | | // 转换为普通对象数组 |
| | | const plainPoints = currentPoints.map(point => ({ |
| | | x: point.x, |
| | | y: point.y, |
| | | z: point.z |
| | | })); |
| | | |
| | | // 第一步:将笛卡尔坐标转为 [经度, 纬度] 数组 |
| | | let coords = currentPoints.map(point => { |
| | | const cartographic = Cesium.Cartographic.fromCartesian(point); |
| | | const lon = Cesium.Math.toDegrees(cartographic.longitude).toFixed(6); // 经度 |
| | | const lat = Cesium.Math.toDegrees(cartographic.latitude).toFixed(6); // 纬度 |
| | | return [parseFloat(lon), parseFloat(lat)]; |
| | | }); |
| | | |
| | | // 第二步:闭合多边形(如果首尾点不一致) |
| | | if (coords.length > 0 && (coords[0][0] !== coords[coords.length - 1][0] || coords[0][1] !== coords[coords.length - 1][1])) { |
| | | coords.push([...coords[0]]); // 添加第一个点到末尾 |
| | | } |
| | | |
| | | // 第三步:构造 WKT POLYGON 格式 |
| | | const pointsStr = coords.map(p => p.join(' ')).join(', '); |
| | | const wkt = `POLYGON ((${pointsStr}))`; |
| | | |
| | | // console.log(wkt); |
| | | |
| | | // 第四步:构建返回结果 |
| | | const result = { |
| | | points: plainPoints, |
| | | geom: wkt, |
| | | depth: depth |
| | | }; |
| | | console.log(result,'确认时,产生的地形修改数据'); |
| | | |
| | | emit('update-excavation-data', result); |
| | | ElMessage.success('实现开挖功能!'); |
| | | |
| | | }; |
| | | const handleClear = () => { |
| | | isDrawing.value = false; |
| | |
| | | "geom", |
| | | "id", |
| | | "serviceName", |
| | | "updateTime", |
| | | // "updateTime", |
| | | "updateUser", |
| | | "createUser", |
| | | "bak", |
| | |
| | | |
| | | if (key === "createTime" && typeof value === "number") { |
| | | formattedData.push({ name: "创建时间:", value: formatDate(value) }); |
| | | continue; |
| | | } |
| | | |
| | | if (key === "updateTime" && typeof value === "number") { |
| | | formattedData.push({ name: "结束时间:", value: formatDate(value) }); |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | addField("total", "降雨总量(mm)"); |
| | | addField("duration", "降雨时长(h)"); |
| | | addField("intensity", "降雨强度(mm/小时)"); |
| | | addField("intensity", "降雨强度(mm/h"); |
| | | addField("prediction", "降雨场次"); |
| | | addField("model", "降雨模式"); |
| | | addField("history", "历史降雨"); |
| | |
| | | mode: forms.mode, |
| | | gauges: forms.gauges, |
| | | rainfalls: forms.rainFallList, |
| | | // intensityUnit: forms.intensityUnit |
| | | intensityUnit: forms.intensityUnit || 'mm/15min' |
| | | }) |
| | | } |
| | |
| | | if (entity && entity.attrs && !simStore.openDia && entity.attrs.type && entity.attrs.type == '泥位计') { |
| | | let obj = { |
| | | deviceName: entity.attrs.deviceName, |
| | | latitude: entity.attrs.latitude, |
| | | longitude: entity.attrs.longitude |
| | | latitude: entity.attrs.lat, |
| | | longitude: entity.attrs.lon |
| | | } |
| | | simStore.selectNWJ = obj |
| | | showDeviceDetail.value = false; |