1
wangjuncheng
2025-05-23 5ad5f4caf07ec82bc6fb24fc94282e3ad59b3261
1
已修改3个文件
62 ■■■■ 文件已修改
src/components/menu/TimeLine.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/menu/flowRate_waterLevel.vue 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mnfz.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/menu/TimeLine.vue
@@ -517,7 +517,7 @@
    getRainfallData()
    // 根据layer.json去获取时间轴信息
    const { waterTimestamps: timestamps } = await fetchWaterSimulationData(serviceInfo);
    console.log(timestamps,timestamps.length,'ddddddddddddddddddddddddddddddddddddddddddddd');
    // 现在是按照总共有多少个点来渲染时间轴
    if (timestamps) {
      waterTimestamps.value = timestamps;
      updateTimelineRange();
src/components/menu/flowRate_waterLevel.vue
@@ -58,11 +58,10 @@
    };
}
function addPointToViewer(point, index) {
    // 确保 currentTime 有合理值
    const displayTime = currentTime.value || "未设置时间";
    // 添加标签(确保实体创建时包含label属性)
    const entity = viewer.entities.add({
    const labelEntity = viewer.entities.add({
        position: point.cartesian,
        label: {
            text: `测量点 ${index + 1}\n经度: ${point.longitude.toFixed(6)}\n纬度: ${point.latitude.toFixed(6)}\n时间: ${displayTime}`,
@@ -77,42 +76,32 @@
            backgroundPadding: new Cesium.Cartesian2(10, 10),
            showBackground: true,
            scale: 1,
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 距地面5000米内显示
            pixelOffsetScaleByDistance: new Cesium.NearFarScalar(
                100,  // Near 距离 (相机离地100米)
                1.0,  // 在近处,放大倍数为1.0(正常)
                5000, // Far 距离 (相机离地5000米)
                0.3   // 在远处,缩小到0.3倍
            )
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
            pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3)
        }
    });
    // 添加垂直线
    viewer.entities.add({
    const lineEntity = viewer.entities.add({
        polyline: {
            positions: [point.cartesian, Cesium.Cartesian3.fromRadians(point.longitude * Math.PI / 180, point.latitude * Math.PI / 180, 0)],
            width: 2,
            material: new Cesium.PolylineOutlineMaterialProperty({
                outlineWidth: 4,
                outlineColor: Cesium.Color.WHITE
                color: Cesium.Color.RED.withAlpha(0.8),
                outlineColor: Cesium.Color.WHITE,
                outlineWidth: 4
            }),
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 距地面5000米内显示
            pixelOffsetScaleByDistance: new Cesium.NearFarScalar(
                100,  // Near 距离 (相机离地100米)
                1.0,  // 在近处,放大倍数为1.0(正常)
                5000, // Far 距离 (相机离地5000米)
                0.3   // 在远处,缩小到0.3倍
            )
            distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
            pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3)
        }
    });
    // 存储点的信息(包含完整的entity引用)
    // 保存 labelEntity 和 lineEntity
    pickedPoints.value.push({
        entity: entity,
        labelEntity,
        lineEntity,
        longitude: point.longitude,
        latitude: point.latitude,
        latitude: point.latitude
    });
}
@@ -180,8 +169,8 @@
function updateAllLabels() {
    pickedPoints.value.forEach((pointInfo, index) => {
        if (pointInfo.entity && pointInfo.entity.label) {
            pointInfo.entity.label.text =
        if (pointInfo.labelEntity && pointInfo.labelEntity.label) {
            pointInfo.labelEntity.label.text =
                `测量点 ${index + 1}\n经度: ${pointInfo.longitude.toFixed(6)}\n纬度: ${pointInfo.latitude.toFixed(6)}\n时间: ${currentTime.value}`;
        }
    });
@@ -193,10 +182,21 @@
}
function endCalculation() {
    // ElMessage.success('清除所有测量点!');
    // console.log('由本功能创建的所有 label 和 polyline entities:');
    // pickedPoints.value.forEach((pointInfo, index) => {
    //     console.log(`测量点 ${index + 1}:`);
    //     console.log('Label Entity:', pointInfo.labelEntity);
    //     console.log('Polyline Entity:', pointInfo.lineEntity);
    // });
    // console.log('当前 Cesium 中所有实体列表:');
    // viewer.entities.values.forEach((entity, idx) => {
    //     console.log(`实体 #${idx}:`, entity);
    // });
    pickedPoints.value.forEach(pointInfo => {
        if (pointInfo.labelEntity) viewer.entities.remove(pointInfo.labelEntity);
        if (pointInfo.lineEntity) viewer.entities.remove(pointInfo.lineEntity);
    });
    pickedPoints.value = [];
    viewer.entities.removeAll();
    // currentTime.value = 0;
}
defineExpose({
    endCalculation
src/views/mnfz.vue
@@ -543,7 +543,7 @@
  isFinish.value = val;
}
function isColorRender(val){
  console.log('这里打印是否显示水位图例的值:',val);
  // console.log('这里打印是否显示水位图例的值:',val);
  isShowLegend.value = val
}
// 定义全局变量存储当前正在闪动的面片