From 13d032241e1a2938a8be4f64c9171e1240e9ea1e Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期一, 22 十二月 2025 18:50:42 +0800
Subject: [PATCH] 新增了边界管理页面和首页边界虚线功能
---
src/zhuye/Shouye.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 95 insertions(+), 8 deletions(-)
diff --git a/src/zhuye/Shouye.java b/src/zhuye/Shouye.java
index 97dddac..10832fe 100644
--- a/src/zhuye/Shouye.java
+++ b/src/zhuye/Shouye.java
@@ -35,6 +35,7 @@
import java.awt.geom.Point2D;
import publicway.Gpstoxuzuobiao;
+import publicway.Fanhuibutton;
/**
* 棣栭〉鐣岄潰 - 閫傞厤6.5瀵哥珫灞忥紝浣跨敤鐙珛鐨凪apRenderer杩涜缁樺埗
@@ -561,7 +562,7 @@
private void showSettingsReturnButton() {
ensureFloatingButtonInfrastructure();
if (settingsReturnButton == null) {
- settingsReturnButton = createFloatingTextButton("杩斿洖");
+ settingsReturnButton = Fanhuibutton.createReturnButton(null);
settingsReturnButton.setToolTipText("杩斿洖绯荤粺璁剧疆");
settingsReturnButton.addActionListener(e -> {
// 鍏抽棴鎵�鏈夌浉鍏虫ā寮�
@@ -1411,6 +1412,8 @@
remoteBtn.addActionListener(e -> showRemoteControlDialog());
areaSelectBtn.addActionListener(e -> {
// 鐐瑰嚮鈥滃湴鍧椻�濈洿鎺ユ墦寮�鍦板潡绠$悊瀵硅瘽妗嗭紙鑻ラ渶瑕佸彲浼犲叆鐗瑰畾鍦板潡缂栧彿锛�
+// Dikuaiguanli.showDikuaiManagement(this, null);
+ // 鐩存帴杩涘叆鍦板潡绠$悊鐣岄潰
Dikuaiguanli.showDikuaiManagement(this, null);
});
baseStationBtn.addActionListener(e -> showBaseStationDialog());
@@ -3115,15 +3118,16 @@
enterDrawingControlMode();
// 闅愯棌杩斿洖璁剧疆鎸夐挳锛堝鏋滄樉绀虹粯鍒舵寜閽紝鍒欎笉搴旇鏄剧ず杩斿洖鎸夐挳锛�
- if (settingsReturnButton != null) {
- settingsReturnButton.setVisible(false);
- }
+// if (settingsReturnButton != null) {
+// settingsReturnButton.setVisible(false);
+// }
// 鏄剧ず"姝e湪缁樺埗杈圭晫"鎻愮ず
if (drawingBoundaryLabel != null) {
// 濡傛灉鏄線杩旇矾寰勭粯鍒讹紝涓嶆樉绀烘鏍囩锛堢姸鎬佹爮宸叉樉绀�"姝e湪缁樺埗寰�杩旇矾寰�"锛�
- boolean isReturnPathDrawing = returnPathDrawer != null && returnPathDrawer.isActive();
- drawingBoundaryLabel.setVisible(!isReturnPathDrawing);
+// boolean isReturnPathDrawing = returnPathDrawer != null && returnPathDrawer.isActive();
+// drawingBoundaryLabel.setVisible(!isReturnPathDrawing);
+ drawingBoundaryLabel.setVisible(true);
}
boolean enableCircleGuidance = drawingShape != null
@@ -3840,9 +3844,8 @@
endDrawingButton.setVisible(false);
}
if (pathPreviewReturnButton == null) {
- pathPreviewReturnButton = createFloatingTextButton("杩斿洖");
+ pathPreviewReturnButton = Fanhuibutton.createReturnButton(e -> handlePathPreviewReturn());
pathPreviewReturnButton.setToolTipText("杩斿洖鏂板鍦板潡姝ラ");
- pathPreviewReturnButton.addActionListener(e -> handlePathPreviewReturn());
}
pathPreviewReturnButton.setVisible(true);
if (floatingButtonPanel != null) {
@@ -4293,6 +4296,90 @@
pathPreviewReturnAction.run();
}
}
+
+ /**
+ * 鏄剧ず杈圭晫棰勮锛堝師濮嬭竟鐣�-绱壊锛屼紭鍖栧悗杈圭晫-缁胯壊锛�
+ * @param dikuai 鍦板潡瀵硅薄
+ * @param optimizedBoundary 浼樺寲鍚庣殑杈圭晫鍧愭爣瀛楃涓�
+ * @param returnCallback 杩斿洖鍥炶皟
+ */
+ public static void showBoundaryPreview(dikuai.Dikuai dikuai, String optimizedBoundary, Runnable returnCallback) {
+ Shouye shouye = getInstance();
+ if (shouye == null || shouye.mapRenderer == null || dikuai == null) {
+ return;
+ }
+
+ // 鑾峰彇鍘熷杈圭晫XY鍧愭爣
+ String originalBoundaryXY = dikuai.getBoundaryOriginalXY();
+
+ // 璁剧疆杈圭晫棰勮
+ shouye.mapRenderer.setBoundaryPreview(originalBoundaryXY, optimizedBoundary);
+
+ // 璁剧疆杩斿洖鍥炶皟
+ shouye.pathPreviewReturnAction = returnCallback;
+ shouye.pathPreviewActive = true;
+
+ // 纭繚鎮诞鎸夐挳鍩虹璁炬柦宸插垱寤�
+ shouye.ensureFloatingButtonInfrastructure();
+
+ // 鍒涘缓鎴栨樉绀鸿繑鍥炴寜閽�
+ if (shouye.pathPreviewReturnButton == null) {
+ shouye.pathPreviewReturnButton = publicway.Fanhuibutton.createReturnButton(e -> shouye.handleBoundaryPreviewReturn());
+ shouye.pathPreviewReturnButton.setToolTipText("杩斿洖杈圭晫缂栬緫椤甸潰");
+ }
+
+ // 闅愯棌鍏朵粬鎮诞鎸夐挳
+ shouye.hideFloatingDrawingControls();
+
+ // 鏄剧ず杩斿洖鎸夐挳
+ shouye.pathPreviewReturnButton.setVisible(true);
+ if (shouye.floatingButtonPanel != null) {
+ shouye.floatingButtonPanel.setVisible(true);
+ if (shouye.floatingButtonPanel.getParent() != shouye.visualizationPanel) {
+ shouye.visualizationPanel.add(shouye.floatingButtonPanel, BorderLayout.SOUTH);
+ }
+ }
+ shouye.rebuildFloatingButtonColumn();
+
+ shouye.visualizationPanel.revalidate();
+ shouye.visualizationPanel.repaint();
+ }
+
+ /**
+ * 澶勭悊杈圭晫棰勮杩斿洖
+ */
+ private void handleBoundaryPreviewReturn() {
+ Runnable callback = pathPreviewReturnAction;
+ exitBoundaryPreview();
+ if (callback != null) {
+ callback.run();
+ }
+ }
+
+ /**
+ * 閫�鍑鸿竟鐣岄瑙�
+ */
+ private void exitBoundaryPreview() {
+ pathPreviewActive = false;
+
+ // 娓呴櫎杈圭晫棰勮
+ if (mapRenderer != null) {
+ mapRenderer.clearBoundaryPreview();
+ }
+
+ // 闅愯棌杩斿洖鎸夐挳
+ if (pathPreviewReturnButton != null) {
+ pathPreviewReturnButton.setVisible(false);
+ }
+
+ // 闅愯棌鎮诞闈㈡澘
+ if (floatingButtonPanel != null) {
+ floatingButtonPanel.setVisible(false);
+ }
+
+ visualizationPanel.revalidate();
+ visualizationPanel.repaint();
+ }
// 娴嬭瘯鏂规硶
public static void main(String[] args) {
--
Gitblit v1.10.0