From 1d2de0f2873c66bf7a9567eb7f2b4bee7330ff6c Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: Fri, 12 Dec 2025 15:16:12 +0800
Subject: [PATCH] 优化禁飞区距离算法
---
ard-work/src/main/java/com/ard/work/component/websocket/handler/NoFlyDistanceManager.java | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/ard-work/src/main/java/com/ard/work/component/websocket/handler/NoFlyDistanceManager.java b/ard-work/src/main/java/com/ard/work/component/websocket/handler/NoFlyDistanceManager.java
index 70aced6..6e89232 100644
--- a/ard-work/src/main/java/com/ard/work/component/websocket/handler/NoFlyDistanceManager.java
+++ b/ard-work/src/main/java/com/ard/work/component/websocket/handler/NoFlyDistanceManager.java
@@ -54,13 +54,10 @@
List<Vertex> polygon = zone.getVertices();
if (polygon == null || polygon.size() < 3) continue;
- double distanceDeg = NoFlyZoneUtils.pointToPolygonDistance(current, polygon);
+ double distance = NoFlyZoneUtils.pointToPolygonDistance(current, polygon);
- // ⭐ 转成米
- double distanceMeter = NoFlyZoneUtils.degDistanceToMeter(distanceDeg, current.y);
-
- if (distanceMeter < minDistance) {
- minDistance = distanceMeter;
+ if (distance < minDistance) {
+ minDistance = distance;
nearestZone = zone;
}
}
--
Gitblit v1.9.3