From 20af1273bd4ae8ae061a92768e14f95d52721e6c Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 28 Jan 2026 18:46:28 +0800
Subject: [PATCH] feat:绘制区域颜色处理

---
 applications/drone-command/src/views/areaManage/partition/shapeTools/edit/EditEllipseTool.js |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/applications/drone-command/src/views/areaManage/partition/shapeTools/edit/EditEllipseTool.js b/applications/drone-command/src/views/areaManage/partition/shapeTools/edit/EditEllipseTool.js
index 8e26834..c3b2904 100644
--- a/applications/drone-command/src/views/areaManage/partition/shapeTools/edit/EditEllipseTool.js
+++ b/applications/drone-command/src/views/areaManage/partition/shapeTools/edit/EditEllipseTool.js
@@ -9,6 +9,15 @@
 	cartesianToLocal,
 } from '../shapeUtils'
 
+const DEFAULT_STYLE = {
+	fill: Cesium.Color.fromBytes(45, 140, 240, 99),
+	outline: Cesium.Color.fromBytes(45, 140, 240, 255),
+}
+const resolveStyle = style => ({
+	fill: style?.fill || DEFAULT_STYLE.fill,
+	outline: style?.outline || DEFAULT_STYLE.outline,
+})
+
 const normalizePoints = points =>
 	(points || []).map(point => ({
 		lng: point.lng ?? point.longitude,
@@ -16,7 +25,7 @@
 	}))
 
 export class EditEllipseTool extends ToolBase {
-	constructor(viewer) {
+	constructor(viewer, options = {}) {
 		super(viewer)
 		this.tooltip = new MapTooltip(viewer)
 		this.dataSource = null
@@ -28,6 +37,7 @@
 		this.majorEntity = null
 		this.minorEntity = null
 		this.ellipseEntity = null
+		this.style = resolveStyle(options?.style)
 	}
 
 	start(points = []) {
@@ -112,9 +122,9 @@
 			ellipse: {
 				semiMajorAxis: new Cesium.CallbackProperty(() => this.semiMajor, false),
 				semiMinorAxis: new Cesium.CallbackProperty(() => this.semiMinor, false),
-				material: Cesium.Color.fromBytes(45, 140, 240, 99),
+				material: this.style.fill,
 				outline: true,
-				outlineColor: Cesium.Color.fromBytes(45, 140, 240, 255),
+				outlineColor: this.style.outline,
 				outlineWidth: 2,
 				heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
 			},
@@ -178,6 +188,14 @@
 		return scene.camera.pickEllipsoid(screenPosition, scene.globe.ellipsoid)
 	}
 
+	setStyle(style) {
+		this.style = resolveStyle(style)
+		if (this.ellipseEntity?.ellipse) {
+			this.ellipseEntity.ellipse.material = this.style.fill
+			this.ellipseEntity.ellipse.outlineColor = this.style.outline
+		}
+	}
+
 	disableMapControl() {
 		const controller = this.viewer.scene.screenSpaceCameraController
 		controller.enableRotate = false

--
Gitblit v1.9.3