修改范围圈实体的填充颜色 30km和50km分别填充不同颜色
This commit is contained in:
parent
a8eb98bb65
commit
63cda7b29e
@ -5,7 +5,7 @@
|
|||||||
<!-- 触发器 -->
|
<!-- 触发器 -->
|
||||||
<div class="dropdown-trigger" @click="toggleDropdown">
|
<div class="dropdown-trigger" @click="toggleDropdown">
|
||||||
<span class="trigger-text"
|
<span class="trigger-text"
|
||||||
>距离灾害点{{ forcePreset.searchRadius - 20 }}km范围内</span
|
>距离灾害点{{ forcePreset.searchRadius }}km范围内</span
|
||||||
>
|
>
|
||||||
<div class="trigger-icon" :class="{ 'is-open': isDropdownOpen }">
|
<div class="trigger-icon" :class="{ 'is-open': isDropdownOpen }">
|
||||||
<img
|
<img
|
||||||
@ -156,8 +156,8 @@ const isDropdownOpen = ref(false);
|
|||||||
// 距离选项
|
// 距离选项
|
||||||
const distanceOptions = [
|
const distanceOptions = [
|
||||||
// { value: 10, label: "距离灾害点10km范围内" },
|
// { value: 10, label: "距离灾害点10km范围内" },
|
||||||
{ value: 30, label: "距离灾害点10km范围内" },
|
{ value: 30, label: "距离灾害点30km范围内" },
|
||||||
{ value: 50, label: "距离灾害点30km范围内" },
|
{ value: 50, label: "距离灾害点50km范围内" },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -59,28 +59,47 @@ export function useRangeCircle() {
|
|||||||
Cesium.Cartesian3.multiplyByScalar(offsetDirection, - radiusMeters * 0.2, offsetDirection) // 向下偏移 20%
|
Cesium.Cartesian3.multiplyByScalar(offsetDirection, - radiusMeters * 0.2, offsetDirection) // 向下偏移 20%
|
||||||
Cesium.Cartesian3.add(labelPositionCartesian, offsetDirection, labelPositionCartesian)
|
Cesium.Cartesian3.add(labelPositionCartesian, offsetDirection, labelPositionCartesian)
|
||||||
|
|
||||||
|
let fillColor
|
||||||
|
let fillAlpha
|
||||||
|
let outlineColor
|
||||||
|
if (radiusKm === 30) {
|
||||||
|
fillColor = '#3E9EF0' // 蓝色,30km范围圈
|
||||||
|
fillAlpha = 0.4
|
||||||
|
outlineColor = '#49CDD2'
|
||||||
|
} else if (radiusKm === 50) {
|
||||||
|
fillColor = '#10FF67' // 绿色,50km范围圈
|
||||||
|
fillAlpha = 0.2
|
||||||
|
outlineColor = '#51BCAF'
|
||||||
|
} else {
|
||||||
|
fillColor = style.fillColor // 默认颜色
|
||||||
|
fillAlpha = style.fillAlpha
|
||||||
|
outlineColor = style.outlineColor
|
||||||
|
}
|
||||||
|
|
||||||
// 创建范围圈实体并添加到数组
|
// 创建范围圈实体并添加到数组
|
||||||
const circleEntity = viewer.entities.add({
|
const circleEntity = viewer.entities.add({
|
||||||
position: centerCartesian,
|
position: centerCartesian,
|
||||||
ellipse: {
|
ellipse: {
|
||||||
semiMinorAxis: radiusMeters,
|
semiMinorAxis: radiusMeters,
|
||||||
semiMajorAxis: radiusMeters,
|
semiMajorAxis: radiusMeters,
|
||||||
material: Cesium.Color.fromCssColorString(style.fillColor).withAlpha(style.fillAlpha),
|
material: Cesium.Color.fromCssColorString(fillColor).withAlpha(fillAlpha),
|
||||||
outline: true,
|
outline: true,
|
||||||
outlineColor: Cesium.Color.fromCssColorString(style.outlineColor).withAlpha(style.outlineAlpha),
|
outlineColor: Cesium.Color.fromCssColorString(outlineColor),
|
||||||
outlineWidth: style.outlineWidth,
|
outlineWidth: 1,
|
||||||
|
// height: 1,
|
||||||
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
||||||
},
|
},
|
||||||
allowPicking: false
|
allowPicking: false
|
||||||
})
|
})
|
||||||
rangeCircleEntities.value.push(circleEntity)
|
rangeCircleEntities.value.push(circleEntity)
|
||||||
|
|
||||||
|
|
||||||
// 创建半径线实体并添加到数组
|
// 创建半径线实体并添加到数组
|
||||||
const lineEntity = viewer.entities.add({
|
const lineEntity = viewer.entities.add({
|
||||||
polyline: {
|
polyline: {
|
||||||
positions: [centerCartesian, radiusEndCartesian],
|
positions: [centerCartesian, radiusEndCartesian],
|
||||||
width: 2,
|
width: 2,
|
||||||
material: Cesium.Color.fromCssColorString(style.outlineColor).withAlpha(0.8),
|
material: Cesium.Color.fromCssColorString(outlineColor),
|
||||||
},
|
},
|
||||||
allowPicking: false
|
allowPicking: false
|
||||||
})
|
})
|
||||||
@ -90,7 +109,7 @@ export function useRangeCircle() {
|
|||||||
const currentLabelEntity = viewer.entities.add({
|
const currentLabelEntity = viewer.entities.add({
|
||||||
position: labelPositionCartesian,
|
position: labelPositionCartesian,
|
||||||
label: {
|
label: {
|
||||||
text: `${radiusKm - 20} km`,
|
text: `${radiusKm} km`,
|
||||||
font: 'bold 16px sans-serif',
|
font: 'bold 16px sans-serif',
|
||||||
fillColor: Cesium.Color.WHITE,
|
fillColor: Cesium.Color.WHITE,
|
||||||
outlineColor: Cesium.Color.BLACK,
|
outlineColor: Cesium.Color.BLACK,
|
||||||
|
|||||||
@ -53,12 +53,11 @@ export const DEFAULT_CAMERA_VIEW = {
|
|||||||
export const DEFAULT_SEARCH_RADIUS = 10
|
export const DEFAULT_SEARCH_RADIUS = 10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 范围圈样式配置
|
* 范围圈样式默认配置
|
||||||
*/
|
*/
|
||||||
export const RANGE_CIRCLE_STYLE = {
|
export const RANGE_CIRCLE_STYLE = {
|
||||||
fillColor: '#1CA1FF',
|
fillColor: '#1CA1FF',
|
||||||
fillAlpha: 0.2,
|
fillAlpha: 0.2,
|
||||||
outlineColor: '#1CA1FF',
|
outlineColor: '#1CA1FF',
|
||||||
outlineAlpha: 0.8,
|
outlineAlpha: 1,
|
||||||
outlineWidth: 2,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user