From 89380e6260a75d1d3b94de687ebcc2f50d50659d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 03 Feb 2026 15:44:33 +0800
Subject: [PATCH] feat:环境变量配置调整
---
applications/drone-command/src/utils/cesium/shapeTools/draw/DrawBufferCircleTool.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/applications/drone-command/src/utils/cesium/shapeTools/draw/DrawBufferCircleTool.js b/applications/drone-command/src/utils/cesium/shapeTools/draw/DrawBufferCircleTool.js
index 71e04c8..0198cf6 100644
--- a/applications/drone-command/src/utils/cesium/shapeTools/draw/DrawBufferCircleTool.js
+++ b/applications/drone-command/src/utils/cesium/shapeTools/draw/DrawBufferCircleTool.js
@@ -1,7 +1,12 @@
import * as Cesium from 'cesium'
import { MapTooltip } from '@ztzf/utils'
import { ToolBase } from '../ToolBase'
-import { buildEllipsePositions } from '../shapeUtils'
+import {
+ buildEllipsePositions,
+ formatBufferRadius,
+ getBufferRadiusLabelStyle,
+ getBufferRadiusPoint,
+} from '../shapeUtils'
export class DrawBufferCircleTool extends ToolBase {
constructor(viewer) {
@@ -21,6 +26,9 @@
this.radiusPoint1 = null
this.radiusPoint2 = null
this.radiusPoint3 = null
+ this.radiusLevel1LabelEntity = null
+ this.radiusLevel2LabelEntity = null
+ this.radiusLevel3LabelEntity = null
this.isDrawing = false
this.drawStep = 0
this.isCompleted = false
@@ -34,7 +42,7 @@
this.handler.setInputAction(movement => this.handleMouseMove(movement), Cesium.ScreenSpaceEventType.MOUSE_MOVE)
this.drawStep = 0
this.isCompleted = false
- this.tooltip.show('单击设置中心点', { x: 0, y: 0 })
+ this.tooltip.hide()
}
handleLeftClick(click) {
@@ -100,7 +108,19 @@
handleMouseMove(movement) {
if (this.isCompleted) return
- this.tooltip.move(movement.endPosition)
+ const tipText = this.drawStep === 0
+ ? '单击设置中心点'
+ : this.drawStep === 1
+ ? '单击设置一级缓冲圆'
+ : this.drawStep === 2
+ ? '单击设置二级缓冲圆'
+ : '单击设置三级缓冲圆'
+ if (!this.tooltip?.isVisible) {
+ this.tooltip.show(tipText, movement.endPosition)
+ } else {
+ this.tooltip.show(tipText)
+ this.tooltip.move(movement.endPosition)
+ }
if (!this.isDrawing) return
const position = this.getPositionFromScreen(movement.endPosition)
if (!position) return
@@ -193,6 +213,10 @@
material: Cesium.Color.fromBytes(0, 251, 255, 255),
},
})
+
+ this.radiusLevel1LabelEntity = this.createRadiusLabelEntity(() => this.radiusLevel1)
+ this.radiusLevel2LabelEntity = this.createRadiusLabelEntity(() => this.radiusLevel2)
+ this.radiusLevel3LabelEntity = this.createRadiusLabelEntity(() => this.radiusLevel3)
}
clearPreviewEntities() {
@@ -204,6 +228,9 @@
this.circleLevel1OutlineEntity = null
this.circleLevel2OutlineEntity = null
this.circleLevel3OutlineEntity = null
+ this.radiusLevel1LabelEntity = null
+ this.radiusLevel2LabelEntity = null
+ this.radiusLevel3LabelEntity = null
}
getSurfaceDistance(startCartesian, endCartesian) {
@@ -218,6 +245,23 @@
const cartesian = scene.pickPosition(screenPosition)
if (cartesian) return cartesian
return scene.camera.pickEllipsoid(screenPosition, scene.globe.ellipsoid)
+ }
+
+ getRadiusPoint(radius) {
+ return getBufferRadiusPoint(this.centerCartesian, radius)
+ }
+
+ createRadiusLabelEntity(getRadius) {
+ return this.dataSource.entities.add({
+ position: new Cesium.CallbackProperty(
+ () => getBufferRadiusPoint(this.centerCartesian, getRadius()),
+ false
+ ),
+ label: {
+ ...getBufferRadiusLabelStyle(),
+ text: new Cesium.CallbackProperty(() => formatBufferRadius(getRadius()), false),
+ },
+ })
}
destroy() {
@@ -241,6 +285,9 @@
this.radiusPoint1 = null
this.radiusPoint2 = null
this.radiusPoint3 = null
+ this.radiusLevel1LabelEntity = null
+ this.radiusLevel2LabelEntity = null
+ this.radiusLevel3LabelEntity = null
this.isDrawing = false
this.drawStep = 0
this.isCompleted = false
--
Gitblit v1.9.3