|
|
|
@ -481,8 +481,8 @@ export default { |
|
|
|
platformCustomStyles: {}, |
|
|
|
// 默认样式 |
|
|
|
defaultStyles: { |
|
|
|
point: { color: '#FF0000', size: 12 }, |
|
|
|
line: { color: '#00FF00', width: 3 }, |
|
|
|
point: { color: '#808080', size: 8 }, |
|
|
|
line: { color: '#000000', width: 1 }, |
|
|
|
polygon: { color: '#0000FF', opacity: 0, width: 4 }, |
|
|
|
rectangle: { color: '#FFA500', opacity: 0, width: 4 }, |
|
|
|
circle: { color: '#800080', opacity: 0, width: 4 }, |
|
|
|
@ -4187,7 +4187,7 @@ export default { |
|
|
|
// 测距模式:使用千米,简化格式 |
|
|
|
this.hoverTooltip = { |
|
|
|
visible: true, |
|
|
|
content: `${(cumulativeLength / 1000).toFixed(1)}km ,${bearingType === 'magnetic' ? '磁' : '真'}:${bearing.toFixed(1)}°`, |
|
|
|
content: `${(cumulativeLength / 1000).toFixed(1)}km ,${bearing.toFixed(1)}°`, |
|
|
|
position: { |
|
|
|
x: movement.endPosition.x + 10, |
|
|
|
y: movement.endPosition.y - 10 |
|
|
|
@ -4533,7 +4533,7 @@ export default { |
|
|
|
// 测距模式:使用千米,简化格式 |
|
|
|
this.hoverTooltip = { |
|
|
|
visible: true, |
|
|
|
content: `${(length / 1000).toFixed(1)}km ,真:${bearing.toFixed(1)}°`, |
|
|
|
content: `${(length / 1000).toFixed(1)}km ,${bearing.toFixed(1)}°`, |
|
|
|
position: { |
|
|
|
x: movement.endPosition.x + 10, |
|
|
|
y: movement.endPosition.y - 10 |
|
|
|
@ -4561,9 +4561,16 @@ export default { |
|
|
|
const position = this.getClickPosition(click.position); |
|
|
|
if (position) { |
|
|
|
this.drawingPoints.push(position); |
|
|
|
// 计算从起点到当前点的累计距离 |
|
|
|
let cumulativeDistance = 0; |
|
|
|
if (this.drawingPoints.length > 1) { |
|
|
|
cumulativeDistance = this.calculateLineLength(this.drawingPoints); |
|
|
|
} |
|
|
|
// 创建点实体并添加到场景中 |
|
|
|
this.entityCounter++; |
|
|
|
const pointId = `point_${this.entityCounter}`; |
|
|
|
// 判断是否是起点 |
|
|
|
const isStartPoint = this.drawingPoints.length === 1; |
|
|
|
const pointEntity = this.viewer.entities.add({ |
|
|
|
id: pointId, |
|
|
|
position: position, |
|
|
|
@ -4572,6 +4579,17 @@ export default { |
|
|
|
color: Cesium.Color.fromCssColorString(this.defaultStyles.point.color), |
|
|
|
outlineColor: Cesium.Color.WHITE, |
|
|
|
outlineWidth: 2 |
|
|
|
}, |
|
|
|
label: { |
|
|
|
text: isStartPoint ? '起点' : `${(cumulativeDistance / 1000).toFixed(2)}km`, |
|
|
|
font: '14px Microsoft YaHei, sans-serif', |
|
|
|
fillColor: Cesium.Color.BLACK, |
|
|
|
backgroundColor: Cesium.Color.WHITE.withAlpha(0.8), |
|
|
|
showBackground: true, |
|
|
|
horizontalOrigin: Cesium.HorizontalOrigin.LEFT, |
|
|
|
verticalOrigin: Cesium.VerticalOrigin.CENTER, |
|
|
|
pixelOffset: new Cesium.Cartesian2(15, 0), |
|
|
|
disableDepthTestDistance: Number.POSITIVE_INFINITY |
|
|
|
} |
|
|
|
}); |
|
|
|
this.drawingPointEntities.push(pointEntity); |
|
|
|
@ -4646,6 +4664,14 @@ export default { |
|
|
|
this.viewer.entities.remove(this.tempPreviewEntity); |
|
|
|
this.tempPreviewEntity = null; |
|
|
|
} |
|
|
|
// 修改最后一个点的标签,在距离前面加上"共"字 |
|
|
|
if (this.drawingPointEntities.length > 0) { |
|
|
|
const lastPointEntity = this.drawingPointEntities[this.drawingPointEntities.length - 1]; |
|
|
|
const length = this.calculateLineLength([...this.drawingPoints]); |
|
|
|
if (lastPointEntity.label) { |
|
|
|
lastPointEntity.label.text = `共${(length / 1000).toFixed(2)}km`; |
|
|
|
} |
|
|
|
} |
|
|
|
// 创建最终的实线实体 |
|
|
|
const entity = this.addLineEntity([...this.drawingPoints], [...this.drawingPointEntities]); |
|
|
|
// 计算长度 |
|
|
|
|