From 913a3b7409e08fd239a65ff7afabefe95b51865a Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期五, 26 十二月 2025 19:44:23 +0800
Subject: [PATCH] 优化了异形有障碍物算法
---
src/zhuye/MapRenderer.java | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/zhuye/MapRenderer.java b/src/zhuye/MapRenderer.java
index 9d63270..2d77ce3 100644
--- a/src/zhuye/MapRenderer.java
+++ b/src/zhuye/MapRenderer.java
@@ -1403,7 +1403,8 @@
// 灏嗕笘鐣屽潗鏍囪浆鎹负灞忓箷鍧愭爣锛堢敤浜庢枃瀛楁樉绀猴級
Point2D.Double worldMid = new Point2D.Double(midX, midY);
- Point2D.Double screenMid = worldToScreen(worldMid);
+ Point2D.Double screenMid = new Point2D.Double();
+ originalTransform.transform(worldMid, screenMid);
// 鎭㈠鍘熷鍙樻崲浠ョ粯鍒舵枃瀛楋紙鍥哄畾澶у皬锛屼笉闅忕缉鏀惧彉鍖栵級
g2d.setTransform(new AffineTransform());
@@ -1958,6 +1959,7 @@
.append(',')
.append(formatCoordinate(point.y));
if (i < boundary.size() - 1) {
+
builder.append(';');
}
}
@@ -3516,4 +3518,17 @@
this.boundaryPreviewUpdateCallback = callback;
}
+ /**
+ * 灏嗚鍥句腑蹇冨鍑嗗綋鍓嶈竟鐣岀殑鍑犱綍涓績
+ */
+ public void centerViewOnBoundary() {
+ if (currentBoundary == null || currentBoundary.isEmpty()) {
+ return;
+ }
+
+ Rectangle2D.Double bounds = computeBounds(currentBoundary);
+ if (bounds != null) {
+ fitBoundsToView(bounds);
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.10.0