| | |
| | | color: Cesium.Color.RED, |
| | | outlineColor: Cesium.Color.YELLOW, |
| | | outlineWidth: 2, |
| | | pixelSize: 8 // 圆点半径大小 |
| | | pixelSize: 8,// 圆点半径大小 |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), |
| | | |
| | | } |
| | | }); |
| | | pickedEntitiesIds.value.push(entity.id); // 记录实体ID |
| | |
| | | positions: [startPoint.cartesian, endPoint.cartesian], |
| | | material: Cesium.Color.YELLOW, |
| | | heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), |
| | | |
| | | } |
| | | }); |
| | | pickedEntitiesIds.value.push(entity.id); // 记录实体ID |
| | |
| | | |
| | | // 新增:绘制模拟点(圆柱 + label) |
| | | function drawSimulationPoint(start, end) { |
| | | // 计算中点(经纬度平均值) |
| | | const midLon = (start.longitude + end.longitude) / 2; |
| | | const midLat = (start.latitude + end.latitude) / 2; |
| | | const terrainHeight = viewer.scene.globe.getHeight( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat) |
| | | ); |
| | | // 计算中点(经纬度平均值) |
| | | const midLon = (start.longitude + end.longitude) / 2; |
| | | const midLat = (start.latitude + end.latitude) / 2; |
| | | const terrainHeight = viewer.scene.globe.getHeight( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat) |
| | | ); |
| | | |
| | | const cylinderBottomHeight = 0; |
| | | const cylinderTopHeight = terrainHeight + 190; |
| | | const cartesianBottom = viewer.scene.globe.ellipsoid.cartographicToCartesian( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat, cylinderBottomHeight) |
| | | ); |
| | | const CrosscylinderEntity = viewer.entities.add({ |
| | | position: cartesianBottom, |
| | | cylinder: { |
| | | length: 190.0, |
| | | topRadius: 1.0, |
| | | bottomRadius: 1.0, |
| | | material: Cesium.Color.YELLOW, |
| | | outline: true, |
| | | outlineColor: Cesium.Color.YELLOW, |
| | | slices: 64, |
| | | heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000) |
| | | } |
| | | }); |
| | | const labelHeight = cylinderTopHeight + 10; |
| | | const cartesianLabel = viewer.scene.globe.ellipsoid.cartographicToCartesian( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat, labelHeight) |
| | | ); |
| | | const cylinderBottomHeight = 0; |
| | | const cylinderTopHeight = terrainHeight + 190; |
| | | const cartesianBottom = viewer.scene.globe.ellipsoid.cartographicToCartesian( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat, cylinderBottomHeight) |
| | | ); |
| | | const CrosscylinderEntity = viewer.entities.add({ |
| | | position: cartesianBottom, |
| | | cylinder: { |
| | | length: 190.0, |
| | | topRadius: 1.0, |
| | | bottomRadius: 1.0, |
| | | material: Cesium.Color.YELLOW, |
| | | outline: true, |
| | | outlineColor: Cesium.Color.YELLOW, |
| | | slices: 64, |
| | | heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000) |
| | | } |
| | | }); |
| | | const labelHeight = cylinderTopHeight + 10; |
| | | const cartesianLabel = viewer.scene.globe.ellipsoid.cartographicToCartesian( |
| | | Cesium.Cartographic.fromDegrees(midLon, midLat, labelHeight) |
| | | ); |
| | | |
| | | const CrosslabelEntity = viewer.entities.add({ |
| | | position: cartesianLabel, |
| | | label: { |
| | | text: '断面截面模拟点', |
| | | font: 'bold 14pt monospace', |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | fillColor: Cesium.Color.YELLOW, |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | verticalOrigin: Cesium.VerticalOrigin.CENTER, |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | backgroundColor: Cesium.Color.fromCssColorString('rgba(0,0,0,0.7)'), |
| | | backgroundPadding: new Cesium.Cartesian2(10, 10), |
| | | showBackground: true, |
| | | scale: 1, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), |
| | | pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3), |
| | | heightReference: Cesium.HeightReference.NONE // 使用绝对高度 |
| | | } |
| | | }); |
| | | pickedEntitiesIds.value.push(CrosscylinderEntity.id); |
| | | pickedEntitiesIds.value.push(CrosslabelEntity.id); |
| | | const CrosslabelEntity = viewer.entities.add({ |
| | | position: cartesianLabel, |
| | | label: { |
| | | text: '断面截面模拟点', |
| | | font: 'bold 14pt monospace', |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | fillColor: Cesium.Color.YELLOW, |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | verticalOrigin: Cesium.VerticalOrigin.CENTER, |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | backgroundColor: Cesium.Color.fromCssColorString('rgba(0,0,0,0.7)'), |
| | | backgroundPadding: new Cesium.Cartesian2(10, 10), |
| | | showBackground: true, |
| | | scale: 1, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), |
| | | pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3), |
| | | heightReference: Cesium.HeightReference.NONE // 使用绝对高度 |
| | | } |
| | | }); |
| | | pickedEntitiesIds.value.push(CrosscylinderEntity.id); |
| | | pickedEntitiesIds.value.push(CrosslabelEntity.id); |
| | | } |
| | | function clearPoints() { |
| | | for (const id of pickedEntitiesIds.value) { |
| | |
| | | } |
| | | isPicking.value = false; |
| | | // isUploaded.value = false; |
| | | |
| | | |
| | | ElMessage.info('已关闭--断面截面--拾取点坐标功能!'); |
| | | return; |
| | | } |
| | |
| | | cartesian: point2.cartesian |
| | | }); |
| | | |
| | | isUploaded.value = true; |
| | | isUploaded.value = true; |
| | | ElMessage.success('正在进行--断面截面--数据分析上传,请稍等...'); |
| | | } |
| | | |