From 32524195d474b74e48916867b2a6c2f022a40d98 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期二, 09 十二月 2025 19:36:32 +0800
Subject: [PATCH] 20251209

---
 src/dikuai/Dikuaiguanli.java | 1245 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 1,200 insertions(+), 45 deletions(-)

diff --git a/src/dikuai/Dikuaiguanli.java b/src/dikuai/Dikuaiguanli.java
index 94a3d1c..a5e31b6 100644
--- a/src/dikuai/Dikuaiguanli.java
+++ b/src/dikuai/Dikuaiguanli.java
@@ -6,7 +6,11 @@
 import java.awt.datatransfer.*;
 import java.awt.datatransfer.StringSelection;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import ui.UIConfig;
 import ui.UIUtils;
 import java.text.SimpleDateFormat;
@@ -15,7 +19,11 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Properties;
 
+import lujing.Lunjingguihua;
 import zhangaiwu.AddDikuai;
 import zhangaiwu.Obstacledge;
 import zhuye.MapRenderer;
@@ -55,12 +63,15 @@
 	private JButton addLandBtn;
 
 	private static String currentWorkLandNumber;
+	private static final String WORK_LAND_KEY = "currentWorkLandNumber";
+	private static final String PROPERTIES_FILE = "set.properties";
 	private static final Map<String, Boolean> boundaryPointVisibility = new HashMap<>();
 	private ImageIcon workSelectedIcon;
 	private ImageIcon workUnselectedIcon;
 	private ImageIcon boundaryVisibleIcon;
 	private ImageIcon boundaryHiddenIcon;
 	private static final int BOUNDARY_TOGGLE_ICON_SIZE = 48;
+	private Map<String, ObstacleSummary> obstacleSummaryCache = Collections.emptyMap();
 
 	public Dikuaiguanli(String landNumber) {
 		latestInstance = this;
@@ -136,13 +147,15 @@
 		cardsPanel.removeAll();
 		
 		Map<String, Dikuai> allDikuai = Dikuai.getAllDikuai();
-		
+	
 		if (allDikuai.isEmpty()) {
+			obstacleSummaryCache = Collections.emptyMap();
 			// 鏄剧ず绌虹姸鎬�
 			JPanel emptyPanel = createEmptyStatePanel();
 			cardsPanel.add(emptyPanel);
 			setCurrentWorkLand(null, null);
 		} else {
+			obstacleSummaryCache = loadObstacleSummaries();
 			if (allDikuai.size() == 1) {
 				Dikuai onlyDikuai = allDikuai.values().iterator().next();
 				setCurrentWorklandIfNeeded(onlyDikuai);
@@ -238,15 +251,18 @@
 		JPanel boundaryPanel = createBoundaryInfoItem(dikuai,
 			getTruncatedValue(dikuai.getBoundaryCoordinates(), 12, "鏈缃�"));
 		setInfoItemTooltip(boundaryPanel, dikuai.getBoundaryCoordinates());
+		configureInteractiveLabel(getInfoItemTitleLabel(boundaryPanel),
+			() -> editBoundaryCoordinates(dikuai),
+			"鐐瑰嚮鏌ョ湅/缂栬緫鍦板潡杈圭晫鍧愭爣");
 		contentPanel.add(boundaryPanel);
 	contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 		
-		// 闅滅鐗╁潗鏍囷紙甯︽柊澧炲拰鏌ョ湅鎸夐挳锛�
-		JPanel obstaclePanel = createCardInfoItemWithButton("闅滅鐗╁潗鏍�:",
-			getTruncatedValue(dikuai.getObstacleCoordinates(), 12, "鏈缃�"),
+		ObstacleSummary obstacleSummary = getObstacleSummaryFromCache(dikuai.getLandNumber());
+		JPanel obstaclePanel = createCardInfoItemWithButton("闅滅鐗�:",
+			obstacleSummary.buildDisplayValue(),
 			"鏂板",
 			e -> addNewObstacle(dikuai));
-		setInfoItemTooltip(obstaclePanel, dikuai.getObstacleCoordinates());
+		setInfoItemTooltip(obstaclePanel, obstacleSummary.buildTooltip());
 		contentPanel.add(obstaclePanel);
 	contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
@@ -255,6 +271,9 @@
 			getTruncatedValue(dikuai.getPlannedPath(), 12, "鏈缃�"), 
 			"澶嶅埗", e -> copyCoordinatesAction("璺緞鍧愭爣", dikuai.getPlannedPath()));
 		setInfoItemTooltip(pathPanel, dikuai.getPlannedPath());
+		configureInteractiveLabel(getInfoItemTitleLabel(pathPanel),
+			() -> editPlannedPath(dikuai),
+			"鐐瑰嚮鏌ョ湅/缂栬緫璺緞鍧愭爣");
 		contentPanel.add(pathPanel);
 	contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
@@ -262,6 +281,9 @@
 			getTruncatedValue(dikuai.getBaseStationCoordinates(), 12, "鏈缃�"),
 			"澶嶅埗", e -> copyCoordinatesAction("鍩虹珯鍧愭爣", dikuai.getBaseStationCoordinates()));
 		setInfoItemTooltip(baseStationPanel, dikuai.getBaseStationCoordinates());
+		configureInteractiveLabel(getInfoItemTitleLabel(baseStationPanel),
+			() -> editBaseStationCoordinates(dikuai),
+			"鐐瑰嚮鏌ョ湅/缂栬緫鍩虹珯鍧愭爣");
 		contentPanel.add(baseStationPanel);
 	contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
@@ -269,6 +291,9 @@
 			getTruncatedValue(dikuai.getBoundaryOriginalCoordinates(), 12, "鏈缃�"),
 			"澶嶅埗", e -> copyCoordinatesAction("杈圭晫鍘熷鍧愭爣", dikuai.getBoundaryOriginalCoordinates()));
 		setInfoItemTooltip(boundaryOriginalPanel, dikuai.getBoundaryOriginalCoordinates());
+		configureInteractiveLabel(getInfoItemTitleLabel(boundaryOriginalPanel),
+			() -> editBoundaryOriginalCoordinates(dikuai),
+			"鐐瑰嚮鏌ョ湅/缂栬緫杈圭晫鍘熷鍧愭爣");
 		contentPanel.add(boundaryOriginalPanel);
 		contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
@@ -276,6 +301,9 @@
 			getTruncatedValue(dikuai.getMowingPattern(), 12, "鏈缃�"),
 			"澶嶅埗", e -> copyCoordinatesAction("鍓茶崏妯″紡", dikuai.getMowingPattern()));
 		setInfoItemTooltip(mowingPatternPanel, dikuai.getMowingPattern());
+		configureInteractiveLabel(getInfoItemTitleLabel(mowingPatternPanel),
+			() -> editMowingPattern(dikuai),
+			"鐐瑰嚮鏌ョ湅/缂栬緫鍓茶崏妯″紡");
 		contentPanel.add(mowingPatternPanel);
 		contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
 
@@ -290,15 +318,30 @@
 			"缂栬緫", e -> editMowingWidth(dikuai));
 		setInfoItemTooltip(mowingWidthPanel, widthSource);
 		contentPanel.add(mowingWidthPanel);
+		contentPanel.add(Box.createRigidArea(new Dimension(0, 20)));
+
+		JPanel completedTrackPanel = createCardInfoItemWithButton("宸插畬鎴愬壊鑽夎矾寰�:",
+			getTruncatedValue(dikuai.getMowingTrack(), 12, "鏈褰�"),
+			"鏌ョ湅", e -> showCompletedMowingTrackDialog(dikuai));
+		setInfoItemTooltip(completedTrackPanel, dikuai.getMowingTrack());
+		configureInteractiveLabel(getInfoItemTitleLabel(completedTrackPanel),
+			() -> showCompletedMowingTrackDialog(dikuai),
+			"鐐瑰嚮鏌ョ湅瀹屾垚鐨勫壊鑽夎矾寰勮褰�");
+		contentPanel.add(completedTrackPanel);
 
 		card.add(contentPanel, BorderLayout.CENTER);
 
 		JButton deleteBtn = createDeleteButton();
 		deleteBtn.addActionListener(e -> deleteDikuai(dikuai));
 
+		JButton generatePathBtn = createPrimaryFooterButton("鐢熸垚鍓茶崏璺緞");
+		generatePathBtn.addActionListener(e -> generateMowingPath(dikuai));
+
 		JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
 		footerPanel.setBackground(CARD_BACKGROUND);
 		footerPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
+		footerPanel.add(generatePathBtn);
+		footerPanel.add(Box.createHorizontalStrut(12));
 		footerPanel.add(deleteBtn);
 		card.add(footerPanel, BorderLayout.SOUTH);
 
@@ -349,6 +392,7 @@
 		itemPanel.add(labelComp, BorderLayout.WEST);
 		itemPanel.add(rightPanel, BorderLayout.CENTER);
 		itemPanel.putClientProperty("valueLabel", valueComp);
+		itemPanel.putClientProperty("titleLabel", labelComp);
 		
 		return itemPanel;
 	}
@@ -383,6 +427,7 @@
 			itemPanel.add(labelComp, BorderLayout.WEST);
 			itemPanel.add(rightPanel, BorderLayout.CENTER);
 			itemPanel.putClientProperty("valueLabel", valueComp);
+			itemPanel.putClientProperty("titleLabel", labelComp);
 
 			return itemPanel;
 		}
@@ -466,6 +511,7 @@
 					boolean isCurrent = currentWorkLandNumber != null && currentWorkLandNumber.equals(landNumber);
 					if (isCurrent) {
 						renderer.setBoundaryPointsVisible(desiredState);
+						renderer.setBoundaryPointSizeScale(desiredState ? 0.5d : 1.0d);
 					}
 				}
 			}
@@ -481,6 +527,811 @@
 		}
 	}
 
+	private JLabel getInfoItemTitleLabel(JPanel itemPanel) {
+		if (itemPanel == null) {
+			return null;
+		}
+		Object titleComp = itemPanel.getClientProperty("titleLabel");
+		return titleComp instanceof JLabel ? (JLabel) titleComp : null;
+	}
+
+	private void configureInteractiveLabel(JLabel label, Runnable onClick, String tooltip) {
+		if (label == null || onClick == null) {
+			return;
+		}
+		Color originalColor = label.getForeground();
+		label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+		if (tooltip != null && !tooltip.trim().isEmpty()) {
+			label.setToolTipText(tooltip);
+		}
+		label.addMouseListener(new MouseAdapter() {
+			public void mouseClicked(MouseEvent e) {
+				if (SwingUtilities.isLeftMouseButton(e)) {
+					onClick.run();
+				}
+			}
+
+			public void mouseEntered(MouseEvent e) {
+				label.setForeground(PRIMARY_COLOR);
+			}
+
+			public void mouseExited(MouseEvent e) {
+				label.setForeground(originalColor);
+			}
+		});
+	}
+
+	private String prepareCoordinateForEditor(String value) {
+		if (value == null) {
+			return "";
+		}
+		String trimmed = value.trim();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return "";
+		}
+		return trimmed;
+	}
+
+	private String normalizeCoordinateInput(String input) {
+		if (input == null) {
+			return "-1";
+		}
+		String trimmed = input.trim();
+		return trimmed.isEmpty() ? "-1" : trimmed;
+	}
+
+	private String promptCoordinateEditing(String title, String initialValue) {
+		JTextArea textArea = new JTextArea(prepareCoordinateForEditor(initialValue));
+		textArea.setLineWrap(true);
+		textArea.setWrapStyleWord(true);
+		textArea.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 13));
+		textArea.setCaretPosition(0);
+		textArea.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+
+		JScrollPane scrollPane = new JScrollPane(textArea);
+		scrollPane.setPreferredSize(new Dimension(360, 240));
+
+		Window owner = SwingUtilities.getWindowAncestor(this);
+		JDialog dialog;
+		if (owner instanceof Frame) {
+			dialog = new JDialog((Frame) owner, title, true);
+		} else if (owner instanceof Dialog) {
+			dialog = new JDialog((Dialog) owner, title, true);
+		} else {
+			dialog = new JDialog((Frame) null, title, true);
+		}
+		dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+		JPanel contentPanel = new JPanel(new BorderLayout());
+		contentPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+		contentPanel.add(scrollPane, BorderLayout.CENTER);
+
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		JButton okButton = new JButton("纭畾");
+		JButton cancelButton = new JButton("鍙栨秷");
+		JButton copyButton = new JButton("澶嶅埗");
+
+		final boolean[] confirmed = new boolean[] {false};
+		final String[] resultHolder = new String[1];
+
+		okButton.addActionListener(e -> {
+			resultHolder[0] = textArea.getText();
+			confirmed[0] = true;
+			dialog.dispose();
+		});
+
+		cancelButton.addActionListener(e -> dialog.dispose());
+
+		copyButton.addActionListener(e -> {
+			String text = textArea.getText();
+			if (text == null) {
+				text = "";
+			}
+			String trimmed = text.trim();
+			if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+				JOptionPane.showMessageDialog(dialog, title + " 鏈缃�", "鎻愮ず", JOptionPane.INFORMATION_MESSAGE);
+				return;
+			}
+			try {
+				StringSelection selection = new StringSelection(text);
+				Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+				clipboard.setContents(selection, selection);
+				JOptionPane.showMessageDialog(dialog, title + " 宸插鍒跺埌鍓创鏉�", "鎻愮ず", JOptionPane.INFORMATION_MESSAGE);
+			} catch (Exception ex) {
+				JOptionPane.showMessageDialog(dialog, "澶嶅埗澶辫触: " + ex.getMessage(), "閿欒", JOptionPane.ERROR_MESSAGE);
+			}
+		});
+
+		buttonPanel.add(okButton);
+		buttonPanel.add(cancelButton);
+		buttonPanel.add(copyButton);
+
+		contentPanel.add(buttonPanel, BorderLayout.SOUTH);
+		dialog.setContentPane(contentPanel);
+		dialog.getRootPane().setDefaultButton(okButton);
+		dialog.pack();
+		dialog.setLocationRelativeTo(this);
+		dialog.setVisible(true);
+
+		return confirmed[0] ? resultHolder[0] : null;
+	}
+
+	private boolean saveFieldAndRefresh(Dikuai dikuai, String fieldName, String value) {
+		if (dikuai == null || fieldName == null || dikuai.getLandNumber() == null) {
+			return false;
+		}
+		if (!Dikuai.updateField(dikuai.getLandNumber(), fieldName, value)) {
+			return false;
+		}
+		Dikuai.updateField(dikuai.getLandNumber(), "updateTime", getCurrentTime());
+		Dikuai.saveToProperties();
+		boolean isCurrent = dikuai.getLandNumber().equals(currentWorkLandNumber);
+		loadDikuaiData();
+		if (isCurrent) {
+			setCurrentWorkLand(dikuai.getLandNumber(), dikuai.getLandName());
+		}
+		return true;
+	}
+
+	private void editBoundaryCoordinates(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String edited = promptCoordinateEditing("鏌ョ湅 / 缂栬緫鍦板潡杈圭晫鍧愭爣", dikuai.getBoundaryCoordinates());
+		if (edited == null) {
+			return;
+		}
+		String normalized = normalizeCoordinateInput(edited);
+		if (!saveFieldAndRefresh(dikuai, "boundaryCoordinates", normalized)) {
+			JOptionPane.showMessageDialog(this, "鏃犳硶鏇存柊鍦板潡杈圭晫鍧愭爣", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+		String message = "-1".equals(normalized) ? "鍦板潡杈圭晫鍧愭爣宸叉竻绌�" : "鍦板潡杈圭晫鍧愭爣宸叉洿鏂�";
+		JOptionPane.showMessageDialog(this, message, "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private void editPlannedPath(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String edited = promptCoordinateEditing("鏌ョ湅 / 缂栬緫璺緞鍧愭爣", dikuai.getPlannedPath());
+		if (edited == null) {
+			return;
+		}
+		String normalized = normalizeCoordinateInput(edited);
+		if (!saveFieldAndRefresh(dikuai, "plannedPath", normalized)) {
+			JOptionPane.showMessageDialog(this, "鏃犳硶鏇存柊璺緞鍧愭爣", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+		String message = "-1".equals(normalized) ? "璺緞鍧愭爣宸叉竻绌�" : "璺緞鍧愭爣宸叉洿鏂�";
+		JOptionPane.showMessageDialog(this, message, "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private void editBaseStationCoordinates(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String edited = promptCoordinateEditing("鏌ョ湅 / 缂栬緫鍩虹珯鍧愭爣", dikuai.getBaseStationCoordinates());
+		if (edited == null) {
+			return;
+		}
+		String normalized = normalizeCoordinateInput(edited);
+		if (!saveFieldAndRefresh(dikuai, "baseStationCoordinates", normalized)) {
+			JOptionPane.showMessageDialog(this, "鏃犳硶鏇存柊鍩虹珯鍧愭爣", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+		String message = "-1".equals(normalized) ? "鍩虹珯鍧愭爣宸叉竻绌�" : "鍩虹珯鍧愭爣宸叉洿鏂�";
+		JOptionPane.showMessageDialog(this, message, "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private void editBoundaryOriginalCoordinates(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String edited = promptCoordinateEditing("鏌ョ湅 / 缂栬緫杈圭晫鍘熷鍧愭爣", dikuai.getBoundaryOriginalCoordinates());
+		if (edited == null) {
+			return;
+		}
+		String normalized = normalizeCoordinateInput(edited);
+		if (!saveFieldAndRefresh(dikuai, "boundaryOriginalCoordinates", normalized)) {
+			JOptionPane.showMessageDialog(this, "鏃犳硶鏇存柊杈圭晫鍘熷鍧愭爣", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+		String message = "-1".equals(normalized) ? "杈圭晫鍘熷鍧愭爣宸叉竻绌�" : "杈圭晫鍘熷鍧愭爣宸叉洿鏂�";
+		JOptionPane.showMessageDialog(this, message, "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private void editMowingPattern(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String current = sanitizeValueOrNull(dikuai.getMowingPattern());
+		String normalized = normalizeExistingMowingPattern(current);
+		JRadioButton parallelBtn = new JRadioButton("骞宠绾� (parallel)");
+		JRadioButton spiralBtn = new JRadioButton("铻烘棆褰� (spiral)");
+
+		ButtonGroup group = new ButtonGroup();
+		group.add(parallelBtn);
+		group.add(spiralBtn);
+
+		if ("spiral".equals(normalized)) {
+			spiralBtn.setSelected(true);
+		} else {
+			parallelBtn.setSelected(true);
+		}
+
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+		panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+		panel.add(new JLabel("璇烽�夋嫨鍓茶崏妯″紡:"));
+		panel.add(Box.createVerticalStrut(8));
+		panel.add(parallelBtn);
+		panel.add(Box.createVerticalStrut(4));
+		panel.add(spiralBtn);
+
+		int option = JOptionPane.showConfirmDialog(this, panel, "缂栬緫鍓茶崏妯″紡", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
+		if (option != JOptionPane.OK_OPTION) {
+			return;
+		}
+
+		String selectedValue = parallelBtn.isSelected() ? "parallel" : "spiral";
+		if (!saveFieldAndRefresh(dikuai, "mowingPattern", selectedValue)) {
+			JOptionPane.showMessageDialog(this, "鏃犳硶鏇存柊鍓茶崏妯″紡", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+		JOptionPane.showMessageDialog(this, "鍓茶崏妯″紡宸叉洿鏂�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private String normalizeExistingMowingPattern(String value) {
+		if (value == null) {
+			return "parallel";
+		}
+		String trimmed = value.trim().toLowerCase();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return "parallel";
+		}
+		switch (trimmed) {
+			case "1":
+			case "spiral":
+			case "铻烘棆":
+			case "铻烘棆妯″紡":
+				return "spiral";
+			case "0":
+			case "parallel":
+			case "骞宠":
+			case "骞宠妯″紡":
+			default:
+				if (trimmed.contains("铻烘棆")) {
+					return "spiral";
+				}
+				if (trimmed.contains("spiral")) {
+					return "spiral";
+				}
+				if (trimmed.contains("parallel")) {
+					return "parallel";
+				}
+				if (trimmed.contains("骞宠")) {
+					return "parallel";
+				}
+				return "parallel";
+		}
+	}
+
+	private String sanitizeValueOrNull(String value) {
+		if (value == null) {
+			return null;
+		}
+		String trimmed = value.trim();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return null;
+		}
+		return trimmed;
+	}
+
+	private void generateMowingPath(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		String baseStationValue = prepareCoordinateForEditor(dikuai.getBaseStationCoordinates());
+		String boundaryValue = prepareCoordinateForEditor(dikuai.getBoundaryCoordinates());
+		List<Obstacledge.Obstacle> configuredObstacles = getConfiguredObstacles(dikuai);
+		String obstacleValue = determineInitialObstacleValue(dikuai, configuredObstacles);
+		String widthValue = sanitizeWidthString(dikuai.getMowingWidth());
+		if (widthValue != null) {
+			try {
+				double widthCm = Double.parseDouble(widthValue);
+				widthValue = formatWidthForStorage(widthCm);
+			} catch (NumberFormatException ignored) {
+				// 淇濇寔鍘熷瀛楃涓诧紝绋嶅悗鏍¢獙鎻愮ず
+			}
+		}
+		String modeValue = sanitizeValueOrNull(dikuai.getMowingPattern());
+		String initialGenerated = attemptMowingPathPreview(
+			boundaryValue,
+			obstacleValue,
+			widthValue,
+			modeValue,
+			this,
+			false
+		);
+		showMowingPathDialog(dikuai, baseStationValue, boundaryValue, obstacleValue, widthValue, modeValue, initialGenerated);
+	}
+
+	private void showMowingPathDialog(
+		Dikuai dikuai,
+		String baseStationValue,
+		String boundaryValue,
+		String obstacleValue,
+		String widthValue,
+		String modeValue,
+		String initialGeneratedPath) {
+		Window owner = SwingUtilities.getWindowAncestor(this);
+		JDialog dialog = new JDialog(owner, "鐢熸垚鍓茶崏璺緞", Dialog.ModalityType.APPLICATION_MODAL);
+		dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+		dialog.getContentPane().setLayout(new BorderLayout());
+		dialog.getContentPane().setBackground(BACKGROUND_COLOR);
+
+		JPanel contentPanel = new JPanel();
+		contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
+		contentPanel.setBackground(BACKGROUND_COLOR);
+		contentPanel.setBorder(BorderFactory.createEmptyBorder(12, 16, 12, 16));
+
+		String landName = getDisplayValue(dikuai.getLandName(), "鏈煡鍦板潡");
+		String landNumber = getDisplayValue(dikuai.getLandNumber(), "鏈煡缂栧彿");
+		JLabel headerLabel = new JLabel(landName + " / " + landNumber);
+		headerLabel.setFont(new Font("寰蒋闆呴粦", Font.BOLD, 16));
+		headerLabel.setForeground(TEXT_COLOR);
+		headerLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
+		contentPanel.add(headerLabel);
+		contentPanel.add(Box.createVerticalStrut(12));
+
+		JTextField baseStationField = createInfoTextField(baseStationValue != null ? baseStationValue : "", true);
+		contentPanel.add(createTextFieldSection("鍩虹珯鍧愭爣", baseStationField));
+
+		JTextArea boundaryArea = createInfoTextArea(boundaryValue != null ? boundaryValue : "", true, 6);
+		contentPanel.add(createTextAreaSection("鍦板潡杈圭晫", boundaryArea));
+
+		JTextArea obstacleArea = createInfoTextArea(obstacleValue != null ? obstacleValue : "", true, 6);
+		contentPanel.add(createTextAreaSection("闅滅鐗╁潗鏍�", obstacleArea));
+
+		JTextField widthField = createInfoTextField(widthValue != null ? widthValue : "", true);
+		contentPanel.add(createTextFieldSection("鍓茶崏瀹藉害 (鍘樼背)", widthField));
+		contentPanel.add(createInfoValueSection("鍓茶崏妯″紡", formatMowingPatternForDialog(modeValue)));
+
+		String existingPath = prepareCoordinateForEditor(dikuai.getPlannedPath());
+		String pathSeed = initialGeneratedPath != null ? initialGeneratedPath : existingPath;
+		JTextArea pathArea = createInfoTextArea(pathSeed != null ? pathSeed : "", true, 10);
+		contentPanel.add(createTextAreaSection("鍓茶崏璺緞鍧愭爣", pathArea));
+
+		JScrollPane dialogScrollPane = new JScrollPane(contentPanel);
+		dialogScrollPane.setBorder(BorderFactory.createEmptyBorder());
+		dialogScrollPane.getVerticalScrollBar().setUnitIncrement(16);
+		dialog.add(dialogScrollPane, BorderLayout.CENTER);
+
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 12, 12));
+		buttonPanel.setBackground(BACKGROUND_COLOR);
+
+		JButton generateBtn = createPrimaryFooterButton("鐢熸垚鍓茶崏璺緞");
+		JButton saveBtn = createPrimaryFooterButton("淇濆瓨璺緞");
+		JButton cancelBtn = createPrimaryFooterButton("鍙栨秷");
+
+		generateBtn.addActionListener(e -> {
+			String sanitizedWidth = sanitizeWidthString(widthField.getText());
+			if (sanitizedWidth != null) {
+				try {
+					double widthCm = Double.parseDouble(sanitizedWidth);
+					widthField.setText(formatWidthForStorage(widthCm));
+					sanitizedWidth = formatWidthForStorage(widthCm);
+				} catch (NumberFormatException ex) {
+					widthField.setText(sanitizedWidth);
+				}
+			}
+			String generated = attemptMowingPathPreview(
+				boundaryArea.getText(),
+				obstacleArea.getText(),
+				sanitizedWidth,
+				modeValue,
+				dialog,
+				true
+			);
+			if (generated != null) {
+				pathArea.setText(generated);
+				pathArea.setCaretPosition(0);
+			}
+		});
+
+		saveBtn.addActionListener(e -> {
+			String baseStationNormalized = normalizeCoordinateInput(baseStationField.getText());
+			String boundaryNormalized = normalizeCoordinateInput(boundaryArea.getText());
+			if (!"-1".equals(boundaryNormalized)) {
+				boundaryNormalized = boundaryNormalized
+					.replace("\r\n", ";")
+					.replace('\r', ';')
+					.replace('\n', ';')
+					.replaceAll(";+", ";")
+					.replaceAll("\\s*;\\s*", ";")
+					.trim();
+				if (boundaryNormalized.isEmpty()) {
+					boundaryNormalized = "-1";
+				}
+			}
+			String obstacleNormalized = normalizeCoordinateInput(obstacleArea.getText());
+			if (!"-1".equals(obstacleNormalized)) {
+				obstacleNormalized = obstacleNormalized
+					.replace("\r\n", " ")
+					.replace('\r', ' ')
+					.replace('\n', ' ')
+					.replaceAll("\\s{2,}", " ")
+					.trim();
+				if (obstacleNormalized.isEmpty()) {
+					obstacleNormalized = "-1";
+				}
+			}
+			String rawWidthInput = widthField.getText() != null ? widthField.getText().trim() : "";
+			String widthSanitized = sanitizeWidthString(widthField.getText());
+			if (widthSanitized == null) {
+				String message = rawWidthInput.isEmpty() ? "璇峰厛璁剧疆鍓茶崏瀹藉害(鍘樼背)" : "鍓茶崏瀹藉害鏍煎紡涓嶆纭�";
+				JOptionPane.showMessageDialog(dialog, message, "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+			double widthCm;
+			try {
+				widthCm = Double.parseDouble(widthSanitized);
+			} catch (NumberFormatException ex) {
+				JOptionPane.showMessageDialog(dialog, "鍓茶崏瀹藉害鏍煎紡涓嶆纭�", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+			if (widthCm <= 0) {
+				JOptionPane.showMessageDialog(dialog, "鍓茶崏瀹藉害蹇呴』澶т簬0", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+			String widthNormalized = formatWidthForStorage(widthCm);
+			widthField.setText(widthNormalized);
+			String pathNormalized = normalizeCoordinateInput(pathArea.getText());
+			if (!"-1".equals(pathNormalized)) {
+				pathNormalized = pathNormalized
+					.replace("\r\n", ";")
+					.replace('\r', ';')
+					.replace('\n', ';')
+					.replaceAll(";+", ";")
+					.replaceAll("\\s*;\\s*", ";")
+					.trim();
+				if (pathNormalized.isEmpty()) {
+					pathNormalized = "-1";
+				}
+			}
+			if ("-1".equals(pathNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "璇峰厛鐢熸垚鍓茶崏璺緞", "鎻愮ず", JOptionPane.INFORMATION_MESSAGE);
+				return;
+			}
+			if (!saveFieldAndRefresh(dikuai, "baseStationCoordinates", baseStationNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "鏃犳硶淇濆瓨鍩虹珯鍧愭爣", "閿欒", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+			if (!saveFieldAndRefresh(dikuai, "boundaryCoordinates", boundaryNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "鏃犳硶淇濆瓨鍦板潡杈圭晫", "閿欒", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+			if (!persistObstaclesForLand(dikuai, baseStationNormalized, obstacleNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "鏃犳硶淇濆瓨闅滅鐗╁潗鏍�", "閿欒", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+			if (!saveFieldAndRefresh(dikuai, "mowingWidth", widthNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "鏃犳硶淇濆瓨鍓茶崏瀹藉害", "閿欒", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+			if (!saveFieldAndRefresh(dikuai, "plannedPath", pathNormalized)) {
+				JOptionPane.showMessageDialog(dialog, "鏃犳硶淇濆瓨鍓茶崏璺緞", "閿欒", JOptionPane.ERROR_MESSAGE);
+				return;
+			}
+			JOptionPane.showMessageDialog(dialog, "鍓茶崏璺緞宸蹭繚瀛�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+			dialog.dispose();
+		});
+
+		cancelBtn.addActionListener(e -> dialog.dispose());
+
+		buttonPanel.add(generateBtn);
+		buttonPanel.add(saveBtn);
+		buttonPanel.add(cancelBtn);
+		dialog.add(buttonPanel, BorderLayout.SOUTH);
+
+		dialog.pack();
+		dialog.setSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT));
+		dialog.setLocationRelativeTo(owner);
+		dialog.setVisible(true);
+	}
+
+	private String attemptMowingPathPreview(
+		String boundaryInput,
+		String obstacleInput,
+		String widthCmInput,
+		String modeInput,
+		Component parentComponent,
+		boolean showMessages) {
+		String boundary = sanitizeValueOrNull(boundaryInput);
+		if (boundary == null) {
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "褰撳墠鍦板潡鏈缃竟鐣屽潗鏍囷紝鏃犳硶鐢熸垚璺緞", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+			}
+			return null;
+		}
+		String rawWidth = widthCmInput != null ? widthCmInput.trim() : "";
+		String widthStr = sanitizeWidthString(widthCmInput);
+		if (widthStr == null) {
+			if (showMessages) {
+				String message = rawWidth.isEmpty() ? "璇峰厛璁剧疆鍓茶崏瀹藉害(鍘樼背)" : "鍓茶崏瀹藉害鏍煎紡涓嶆纭�";
+				JOptionPane.showMessageDialog(parentComponent, message, "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+			}
+			return null;
+		}
+		double widthCm;
+		try {
+			widthCm = Double.parseDouble(widthStr);
+		} catch (NumberFormatException ex) {
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "鍓茶崏瀹藉害鏍煎紡涓嶆纭�", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+			}
+			return null;
+		}
+		if (widthCm <= 0) {
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "鍓茶崏瀹藉害蹇呴』澶т簬0", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+			}
+			return null;
+		}
+		double widthMeters = widthCm / 100.0d;
+		String plannerWidth = BigDecimal.valueOf(widthMeters)
+			.setScale(3, RoundingMode.HALF_UP)
+			.stripTrailingZeros()
+			.toPlainString();
+		String obstacles = sanitizeValueOrNull(obstacleInput);
+		if (obstacles != null) {
+			obstacles = obstacles.replace("\r\n", " ").replace('\r', ' ').replace('\n', ' ');
+		}
+		String mode = normalizeExistingMowingPattern(modeInput);
+		try {
+			String generated = Lunjingguihua.generatePathFromStrings(boundary, obstacles, plannerWidth, mode);
+			String trimmed = generated != null ? generated.trim() : "";
+			if (trimmed.isEmpty()) {
+				if (showMessages) {
+					JOptionPane.showMessageDialog(parentComponent, "鏈敓鎴愭湁鏁堢殑鍓茶崏璺緞锛岃妫�鏌ュ湴鍧楁暟鎹�", "鎻愮ず", JOptionPane.INFORMATION_MESSAGE);
+				}
+				return null;
+			}
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "鍓茶崏璺緞宸茬敓鎴�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+			}
+			return trimmed;
+		} catch (IllegalArgumentException ex) {
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "鐢熸垚鍓茶崏璺緞澶辫触: " + ex.getMessage(), "閿欒", JOptionPane.ERROR_MESSAGE);
+			}
+		} catch (Exception ex) {
+			if (showMessages) {
+				JOptionPane.showMessageDialog(parentComponent, "鐢熸垚鍓茶崏璺緞鏃跺彂鐢熷紓甯�: " + ex.getMessage(), "閿欒", JOptionPane.ERROR_MESSAGE);
+			}
+		}
+		return null;
+	}
+
+	private JTextArea createInfoTextArea(String text, boolean editable, int rows) {
+		JTextArea area = new JTextArea(text);
+		area.setEditable(editable);
+		area.setLineWrap(true);
+		area.setWrapStyleWord(true);
+		area.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 13));
+		area.setRows(Math.max(rows, 2));
+		area.setCaretPosition(0);
+		area.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
+		area.setBackground(editable ? WHITE : new Color(245, 245, 245));
+		return area;
+	}
+
+	private JPanel createTextAreaSection(String title, JTextArea textArea) {
+		JPanel section = new JPanel(new BorderLayout(0, 6));
+		section.setBackground(BACKGROUND_COLOR);
+		section.setAlignmentX(Component.LEFT_ALIGNMENT);
+
+		JLabel titleLabel = new JLabel(title);
+		titleLabel.setFont(new Font("寰蒋闆呴粦", Font.BOLD, 14));
+		titleLabel.setForeground(TEXT_COLOR);
+		section.add(titleLabel, BorderLayout.NORTH);
+
+		JScrollPane scrollPane = new JScrollPane(textArea);
+		scrollPane.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
+		scrollPane.getVerticalScrollBar().setUnitIncrement(12);
+		section.add(scrollPane, BorderLayout.CENTER);
+
+		section.setBorder(BorderFactory.createEmptyBorder(4, 0, 12, 0));
+		return section;
+	}
+
+	private JTextField createInfoTextField(String text, boolean editable) {
+		JTextField field = new JTextField(text);
+		field.setEditable(editable);
+		field.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 13));
+		field.setForeground(TEXT_COLOR);
+		field.setBackground(editable ? WHITE : new Color(245, 245, 245));
+		field.setCaretPosition(0);
+		field.setBorder(BorderFactory.createEmptyBorder(4, 6, 4, 6));
+		field.setFocusable(true);
+		field.setOpaque(true);
+		return field;
+	}
+
+	private JPanel createTextFieldSection(String title, JTextField textField) {
+		JPanel section = new JPanel(new BorderLayout(0, 6));
+		section.setBackground(BACKGROUND_COLOR);
+		section.setAlignmentX(Component.LEFT_ALIGNMENT);
+
+		JLabel titleLabel = new JLabel(title);
+		titleLabel.setFont(new Font("寰蒋闆呴粦", Font.BOLD, 14));
+		titleLabel.setForeground(TEXT_COLOR);
+		section.add(titleLabel, BorderLayout.NORTH);
+
+		JPanel fieldWrapper = new JPanel(new BorderLayout());
+		fieldWrapper.setBackground(textField.isEditable() ? WHITE : new Color(245, 245, 245));
+		fieldWrapper.setBorder(BorderFactory.createLineBorder(BORDER_COLOR));
+		fieldWrapper.add(textField, BorderLayout.CENTER);
+		section.add(fieldWrapper, BorderLayout.CENTER);
+
+		section.setBorder(BorderFactory.createEmptyBorder(4, 0, 12, 0));
+		return section;
+	}
+
+	private JPanel createInfoValueSection(String title, String value) {
+		JPanel section = new JPanel();
+		section.setLayout(new BoxLayout(section, BoxLayout.X_AXIS));
+		section.setBackground(BACKGROUND_COLOR);
+		section.setAlignmentX(Component.LEFT_ALIGNMENT);
+		section.setBorder(BorderFactory.createEmptyBorder(4, 0, 4, 0));
+
+		JLabel titleLabel = new JLabel(title + ":");
+		titleLabel.setFont(new Font("寰蒋闆呴粦", Font.BOLD, 14));
+		titleLabel.setForeground(TEXT_COLOR);
+		section.add(titleLabel);
+		section.add(Box.createHorizontalStrut(8));
+
+		JLabel valueLabel = new JLabel(value);
+		valueLabel.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 14));
+		valueLabel.setForeground(TEXT_COLOR);
+		section.add(valueLabel);
+
+		section.add(Box.createHorizontalGlue());
+		return section;
+	}
+
+	private String formatMowingPatternForDialog(String patternValue) {
+		String sanitized = sanitizeValueOrNull(patternValue);
+		if (sanitized == null) {
+			return "鏈缃�";
+		}
+		String normalized = normalizeExistingMowingPattern(sanitized);
+		if ("parallel".equals(normalized)) {
+			return "骞宠妯″紡 (parallel)";
+		}
+		if ("spiral".equals(normalized)) {
+			return "铻烘棆妯″紡 (spiral)";
+		}
+		return sanitized;
+	}
+
+	private List<Obstacledge.Obstacle> getConfiguredObstacles(Dikuai dikuai) {
+		if (dikuai == null) {
+			return Collections.emptyList();
+		}
+		List<Obstacledge.Obstacle> obstacles = loadObstaclesFromConfig(dikuai.getLandNumber());
+		if (obstacles == null) {
+			return Collections.emptyList();
+		}
+		return obstacles;
+	}
+
+	private String determineInitialObstacleValue(Dikuai dikuai, List<Obstacledge.Obstacle> configuredObstacles) {
+		if (configuredObstacles != null && !configuredObstacles.isEmpty()) {
+			String payload = Obstacledge.buildPlannerPayload(configuredObstacles);
+			if (payload != null && !payload.trim().isEmpty()) {
+				return payload;
+			}
+		}
+		return "";
+	}
+
+	private String sanitizeWidthString(String input) {
+		if (input == null) {
+			return null;
+		}
+		String trimmed = input.trim();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return null;
+		}
+		String cleaned = trimmed.replaceAll("[^0-9.+-]", "");
+		return cleaned.isEmpty() ? null : cleaned;
+	}
+
+	private String formatWidthForStorage(double widthCm) {
+		return BigDecimal.valueOf(widthCm)
+			.setScale(2, RoundingMode.HALF_UP)
+			.stripTrailingZeros()
+			.toPlainString();
+	}
+
+	private boolean persistObstaclesForLand(Dikuai dikuai, String baseStationValue, String obstaclePayload) {
+		if (dikuai == null || dikuai.getLandNumber() == null) {
+			return false;
+		}
+		String landNumber = dikuai.getLandNumber().trim();
+		try {
+			File configFile = new File("Obstacledge.properties");
+			Obstacledge.ConfigManager manager = new Obstacledge.ConfigManager();
+			if (configFile.exists()) {
+				if (!manager.loadFromFile(configFile.getAbsolutePath())) {
+					return false;
+				}
+			}
+
+			Obstacledge.Plot plot = manager.getPlotById(landNumber);
+			if (plot == null) {
+				plot = new Obstacledge.Plot(landNumber);
+				manager.addPlot(plot);
+			}
+
+			applyBaseStationValue(plot, baseStationValue, dikuai.getBaseStationCoordinates());
+
+			List<Obstacledge.Obstacle> obstacles;
+			if (obstaclePayload == null || "-1".equals(obstaclePayload.trim())) {
+				obstacles = new ArrayList<>();
+			} else {
+				obstacles = Obstacledge.parsePlannerPayload(obstaclePayload, landNumber);
+			}
+			plot.setObstacles(obstacles);
+
+			if (!manager.saveToFile(configFile.getAbsolutePath())) {
+				return false;
+			}
+
+			obstacleSummaryCache = loadObstacleSummaries();
+			boolean isCurrent = landNumber.equals(currentWorkLandNumber);
+			loadDikuaiData();
+			if (isCurrent) {
+				setCurrentWorkLand(landNumber, dikuai.getLandName());
+			}
+			return true;
+		} catch (Exception ex) {
+			System.err.println("淇濆瓨闅滅鐗╅厤缃け璐�: " + ex.getMessage());
+			return false;
+		}
+	}
+
+	private void applyBaseStationValue(Obstacledge.Plot plot, String baseStationValue, String fallbackValue) {
+		if (plot == null) {
+			return;
+		}
+		String sanitized = sanitizeBaseStationValue(baseStationValue);
+		if (sanitized == null) {
+			sanitized = sanitizeBaseStationValue(fallbackValue);
+		}
+		if (sanitized == null) {
+			return;
+		}
+		try {
+			plot.setBaseStationString(sanitized);
+		} catch (Exception ex) {
+			System.err.println("鏇存柊闅滅鐗╅厤缃腑鐨勫熀绔欏潗鏍囧け璐�: " + ex.getMessage());
+		}
+	}
+
+	private String sanitizeBaseStationValue(String value) {
+		if (value == null) {
+			return null;
+		}
+		String trimmed = value.trim();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return null;
+		}
+		return trimmed.replaceAll("\\s+", "");
+	}
+
 	private String getDisplayValue(String value, String defaultValue) {
 		if (value == null || value.equals("-1") || value.trim().isEmpty()) {
 			return defaultValue;
@@ -500,22 +1351,27 @@
 	}
 
 	private JButton createSmallButton(String text) {
+		return createSmallButton(text, PRIMARY_COLOR, PRIMARY_DARK);
+	}
+
+	private JButton createSmallButton(String text, Color backgroundColor, Color hoverColor) {
 		JButton button = new JButton(text);
 		button.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
-		button.setBackground(PRIMARY_COLOR);
+		Color baseColor = backgroundColor == null ? PRIMARY_COLOR : backgroundColor;
+		Color hover = hoverColor == null ? baseColor : hoverColor;
+		button.setBackground(baseColor);
 		button.setForeground(WHITE);
 		button.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 10));
 		button.setMargin(new Insets(0, 0, 0, 0));
 		button.setFocusPainted(false);
 		button.setCursor(new Cursor(Cursor.HAND_CURSOR));
 
-		// 鎮仠鏁堟灉
 		button.addMouseListener(new MouseAdapter() {
 			public void mouseEntered(MouseEvent e) {
-				button.setBackground(PRIMARY_DARK);
+				button.setBackground(hover);
 			}
 			public void mouseExited(MouseEvent e) {
-				button.setBackground(PRIMARY_COLOR);
+				button.setBackground(baseColor);
 			}
 		});
 
@@ -580,6 +1436,28 @@
 		return button;
 	}
 
+	private JButton createPrimaryFooterButton(String text) {
+		JButton button = new JButton(text);
+		button.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
+		button.setBackground(PRIMARY_COLOR);
+		button.setForeground(WHITE);
+		button.setBorder(BorderFactory.createEmptyBorder(6, 12, 6, 12));
+		button.setFocusPainted(false);
+		button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+		button.addMouseListener(new MouseAdapter() {
+			public void mouseEntered(MouseEvent e) {
+				button.setBackground(PRIMARY_DARK);
+			}
+
+			public void mouseExited(MouseEvent e) {
+				button.setBackground(PRIMARY_COLOR);
+			}
+		});
+
+		return button;
+	}
+
 	private JButton createWorkToggleButton(Dikuai dikuai) {
 		JButton button = new JButton();
 		button.setContentAreaFilled(false);
@@ -644,10 +1522,19 @@
 	}
 
 	public static void setCurrentWorkLand(String landNumber, String landName) {
-		currentWorkLandNumber = landNumber;
+		String sanitizedLandNumber = sanitizeLandNumber(landNumber);
+		boolean changed = !Objects.equals(currentWorkLandNumber, sanitizedLandNumber);
+		if (!changed) {
+			String persisted = readPersistedWorkLandNumber();
+			if (!Objects.equals(persisted, sanitizedLandNumber)) {
+				changed = true;
+			}
+		}
+		currentWorkLandNumber = sanitizedLandNumber;
+
 		Dikuai dikuai = null;
-		if (landNumber != null) {
-			dikuai = Dikuai.getDikuai(landNumber);
+		if (sanitizedLandNumber != null) {
+			dikuai = Dikuai.getDikuai(sanitizedLandNumber);
 			if (dikuai != null && (landName == null || "-1".equals(landName) || landName.trim().isEmpty())) {
 				landName = dikuai.getLandName();
 			}
@@ -658,22 +1545,32 @@
 
 		Shouye shouye = Shouye.getInstance();
 		if (shouye != null) {
-			if (landNumber == null) {
+			if (sanitizedLandNumber == null) {
 				shouye.updateCurrentAreaName(null);
 			} else {
 				shouye.updateCurrentAreaName(landName);
 			}
 			MapRenderer renderer = shouye.getMapRenderer();
 			if (renderer != null) {
+				renderer.applyLandMetadata(dikuai);
 				String boundary = (dikuai != null) ? dikuai.getBoundaryCoordinates() : null;
 				String plannedPath = (dikuai != null) ? dikuai.getPlannedPath() : null;
-				String obstacles = (dikuai != null) ? dikuai.getObstacleCoordinates() : null;
-				renderer.setCurrentBoundary(boundary, landNumber, landNumber == null ? null : landName);
+				List<Obstacledge.Obstacle> configuredObstacles = (sanitizedLandNumber != null) ? loadObstaclesFromConfig(sanitizedLandNumber) : Collections.emptyList();
+				if (configuredObstacles == null) {
+					configuredObstacles = Collections.emptyList();
+				}
+				renderer.setCurrentBoundary(boundary, sanitizedLandNumber, sanitizedLandNumber == null ? null : landName);
 				renderer.setCurrentPlannedPath(plannedPath);
-				renderer.setCurrentObstacles(obstacles, landNumber);
-				boolean showBoundaryPoints = landNumber != null && boundaryPointVisibility.getOrDefault(landNumber, false);
+				renderer.setCurrentObstacles(configuredObstacles, sanitizedLandNumber);
+				boolean showBoundaryPoints = sanitizedLandNumber != null && boundaryPointVisibility.getOrDefault(sanitizedLandNumber, false);
 				renderer.setBoundaryPointsVisible(showBoundaryPoints);
+				renderer.setBoundaryPointSizeScale(showBoundaryPoints ? 0.5d : 1.0d);
 			}
+			shouye.refreshMowingIndicators();
+		}
+
+		if (changed) {
+			persistCurrentWorkLand(sanitizedLandNumber);
 		}
 	}
 
@@ -681,6 +1578,62 @@
 		return currentWorkLandNumber;
 	}
 
+	public static String getPersistedWorkLandNumber() {
+		return readPersistedWorkLandNumber();
+	}
+
+	private static String sanitizeLandNumber(String landNumber) {
+		if (landNumber == null) {
+			return null;
+		}
+		String trimmed = landNumber.trim();
+		if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+			return null;
+		}
+		return trimmed;
+	}
+
+	private static void persistCurrentWorkLand(String landNumber) {
+		synchronized (Dikuaiguanli.class) {
+			Properties props = new Properties();
+			try (FileInputStream in = new FileInputStream(PROPERTIES_FILE)) {
+				props.load(in);
+			} catch (IOException ignored) {
+				// Use empty defaults when the configuration file is missing.
+			}
+
+			if (landNumber == null) {
+				props.setProperty(WORK_LAND_KEY, "-1");
+			} else {
+				props.setProperty(WORK_LAND_KEY, landNumber);
+			}
+
+			try (FileOutputStream out = new FileOutputStream(PROPERTIES_FILE)) {
+				props.store(out, "Current work land selection updated");
+			} catch (IOException ex) {
+				System.err.println("鏃犳硶淇濆瓨褰撳墠浣滀笟鍦板潡: " + ex.getMessage());
+			}
+		}
+	}
+
+	private static String readPersistedWorkLandNumber() {
+		Properties props = new Properties();
+		try (FileInputStream in = new FileInputStream(PROPERTIES_FILE)) {
+			props.load(in);
+			String value = props.getProperty(WORK_LAND_KEY);
+			if (value == null) {
+				return null;
+			}
+			String trimmed = value.trim();
+			if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+				return null;
+			}
+			return trimmed;
+		} catch (IOException ex) {
+			return null;
+		}
+	}
+
 	private ImageIcon loadIcon(String path, int width, int height) {
 		try {
 			ImageIcon rawIcon = new ImageIcon(path);
@@ -734,39 +1687,177 @@
 		loadDikuaiData();
 	}
 
+	private void showCompletedMowingTrackDialog(Dikuai dikuai) {
+		if (dikuai == null) {
+			return;
+		}
+		Window owner = SwingUtilities.getWindowAncestor(this);
+		JDialog dialog = new JDialog(owner, "宸插畬鎴愮殑鍓茶崏璺緞鍧愭爣", Dialog.ModalityType.APPLICATION_MODAL);
+		dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+		dialog.setLayout(new BorderLayout());
+		dialog.getContentPane().setBackground(WHITE);
+
+		String normalizedTrack = prepareCoordinateForEditor(dikuai.getMowingTrack());
+		boolean hasTrack = normalizedTrack != null && !normalizedTrack.isEmpty();
+
+		JTextArea textArea = new JTextArea(hasTrack ? normalizedTrack : "");
+		textArea.setEditable(false);
+		textArea.setLineWrap(true);
+		textArea.setWrapStyleWord(true);
+		textArea.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 13));
+		textArea.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+		textArea.setCaretPosition(0);
+
+	JScrollPane scrollPane = new JScrollPane(textArea);
+	scrollPane.setPreferredSize(new Dimension(342, 240));
+		scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 12));
+
+		JLabel statusLabel = new JLabel(hasTrack ? "褰撳墠宸蹭繚瀛樺畬鎴愮殑鍓茶崏璺緞璁板綍銆�" : "褰撳墠鏆傛棤瀹屾垚鐨勫壊鑽夎矾寰勮褰曘��");
+		statusLabel.setBorder(BorderFactory.createEmptyBorder(12, 12, 6, 12));
+		statusLabel.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
+		statusLabel.setForeground(hasTrack ? TEXT_COLOR : LIGHT_TEXT);
+
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0));
+		buttonPanel.setBackground(WHITE);
+		buttonPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
+
+		JButton deleteButton = createSmallButton("鍒犻櫎璁板綍", RED_COLOR, RED_DARK);
+		deleteButton.setEnabled(hasTrack);
+		JButton closeButton = createSmallButton("鍏抽棴", PRIMARY_COLOR, PRIMARY_DARK);
+
+		deleteButton.addActionListener(e -> {
+			String latestTrack = prepareCoordinateForEditor(dikuai.getMowingTrack());
+			if (latestTrack == null || latestTrack.isEmpty()) {
+				JOptionPane.showMessageDialog(dialog, "褰撳墠娌℃湁鍙垹闄ょ殑杞ㄨ抗璁板綍銆�", "鎻愮ず", JOptionPane.INFORMATION_MESSAGE);
+				return;
+			}
+			int choice = JOptionPane.showConfirmDialog(dialog, "纭畾瑕佸垹闄ゅ凡瀹屾垚鐨勫壊鑽夎矾寰勮褰曞悧锛�", "纭鍒犻櫎", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
+			if (choice != JOptionPane.YES_OPTION) {
+				return;
+			}
+			if (saveFieldAndRefresh(dikuai, "mowingTrack", "-1")) {
+				dikuai.setMowingTrack("-1");
+				textArea.setText("");
+				statusLabel.setText("褰撳墠鏆傛棤瀹屾垚鐨勫壊鑽夎矾寰勮褰曘��");
+				statusLabel.setForeground(LIGHT_TEXT);
+				deleteButton.setEnabled(false);
+				JOptionPane.showMessageDialog(dialog, "宸插垹闄ゅ畬鎴愯矾寰勮褰�", "鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+			} else {
+				JOptionPane.showMessageDialog(dialog, "鍒犻櫎澶辫触锛岃绋嶅悗閲嶈瘯銆�", "閿欒", JOptionPane.ERROR_MESSAGE);
+			}
+		});
+
+		closeButton.addActionListener(e -> dialog.dispose());
+
+		buttonPanel.add(deleteButton);
+		buttonPanel.add(closeButton);
+
+		dialog.add(statusLabel, BorderLayout.NORTH);
+		dialog.add(scrollPane, BorderLayout.CENTER);
+		dialog.add(buttonPanel, BorderLayout.SOUTH);
+		dialog.pack();
+	dialog.setMinimumSize(new Dimension(378, 320));
+		dialog.setLocationRelativeTo(owner);
+		dialog.setVisible(true);
+	}
+
+	private Map<String, ObstacleSummary> loadObstacleSummaries() {
+		Map<String, ObstacleSummary> summaries = new HashMap<>();
+		try {
+			File configFile = new File("Obstacledge.properties");
+			if (!configFile.exists()) {
+				return summaries;
+			}
+			Obstacledge.ConfigManager manager = new Obstacledge.ConfigManager();
+			if (!manager.loadFromFile(configFile.getAbsolutePath())) {
+				return summaries;
+			}
+			for (Obstacledge.Plot plot : manager.getPlots()) {
+				if (plot == null) {
+					continue;
+				}
+				String plotId = plot.getPlotId();
+				if (plotId == null || plotId.trim().isEmpty()) {
+					continue;
+				}
+				List<String> names = new ArrayList<>();
+				for (Obstacledge.Obstacle obstacle : plot.getObstacles()) {
+					if (obstacle == null) {
+						continue;
+					}
+					String name = obstacle.getObstacleName();
+					if (name == null) {
+						continue;
+					}
+					String trimmed = name.trim();
+					if (!trimmed.isEmpty()) {
+						names.add(trimmed);
+					}
+				}
+				summaries.put(plotId.trim(), ObstacleSummary.of(names));
+			}
+		} catch (Exception ex) {
+			System.err.println("璇诲彇闅滅鐗╅厤缃け璐�: " + ex.getMessage());
+		}
+		return summaries;
+	}
+
+	private static List<Obstacledge.Obstacle> loadObstaclesFromConfig(String landNumber) {
+		if (landNumber == null || landNumber.trim().isEmpty()) {
+			return Collections.emptyList();
+		}
+		try {
+			File configFile = new File("Obstacledge.properties");
+			if (!configFile.exists()) {
+				return null;
+			}
+			Obstacledge.ConfigManager manager = new Obstacledge.ConfigManager();
+			if (!manager.loadFromFile(configFile.getAbsolutePath())) {
+				return null;
+			}
+			Obstacledge.Plot plot = manager.getPlotById(landNumber.trim());
+			if (plot == null) {
+				return Collections.emptyList();
+			}
+			List<Obstacledge.Obstacle> obstacles = plot.getObstacles();
+			if (obstacles == null || obstacles.isEmpty()) {
+				return Collections.emptyList();
+			}
+			return new ArrayList<>(obstacles);
+		} catch (Exception ex) {
+			System.err.println("璇诲彇闅滅鐗╅厤缃け璐�: " + ex.getMessage());
+			return null;
+		}
+	}
+
+	private ObstacleSummary getObstacleSummaryFromCache(String landNumber) {
+		if (landNumber == null || landNumber.trim().isEmpty()) {
+			return ObstacleSummary.empty();
+		}
+		if (obstacleSummaryCache == null || obstacleSummaryCache.isEmpty()) {
+			return ObstacleSummary.empty();
+		}
+		ObstacleSummary summary = obstacleSummaryCache.get(landNumber.trim());
+		return summary != null ? summary : ObstacleSummary.empty();
+	}
+
 	private List<String> loadObstacleNamesForLand(String landNumber) {
 		List<String> names = new ArrayList<>();
 		if (landNumber == null || landNumber.trim().isEmpty()) {
 			return names;
 		}
-		try {
-			File configFile = new File("Obstacledge.properties");
-			if (!configFile.exists()) {
-				return names;
-			}
-			Obstacledge.ConfigManager manager = new Obstacledge.ConfigManager();
-			if (!manager.loadFromFile(configFile.getAbsolutePath())) {
-				return names;
-			}
-			Obstacledge.Plot plot = manager.getPlotById(landNumber.trim());
-			if (plot == null) {
-				return names;
-			}
-			for (Obstacledge.Obstacle obstacle : plot.getObstacles()) {
-				if (obstacle == null) {
-					continue;
-				}
-				String name = obstacle.getObstacleName();
-				if (name == null) {
-					continue;
-				}
-				String trimmed = name.trim();
-				if (!trimmed.isEmpty() && !names.contains(trimmed)) {
-					names.add(trimmed);
-				}
-			}
-		} catch (Exception ex) {
-			System.err.println("璇诲彇闅滅鐗╅厤缃け璐�: " + ex.getMessage());
+		ObstacleSummary cached = getObstacleSummaryFromCache(landNumber);
+		if (!cached.isEmpty()) {
+			names.addAll(cached.copyNames());
+			return names;
+		}
+		Map<String, ObstacleSummary> latest = loadObstacleSummaries();
+		if (!latest.isEmpty()) {
+			obstacleSummaryCache = latest;
+		}
+		ObstacleSummary refreshed = getObstacleSummaryFromCache(landNumber);
+		if (!refreshed.isEmpty()) {
+			names.addAll(refreshed.copyNames());
 		}
 		return names;
 	}
@@ -887,4 +1978,68 @@
 		}
 		boundaryPointVisibility.put(landNumber, visible);
 	}
+
+	private static final class ObstacleSummary {
+		private static final ObstacleSummary EMPTY = new ObstacleSummary(Collections.emptyList());
+		private final List<String> names;
+
+		private ObstacleSummary(List<String> names) {
+			this.names = names;
+		}
+
+		static ObstacleSummary of(List<String> originalNames) {
+			if (originalNames == null || originalNames.isEmpty()) {
+				return empty();
+			}
+			List<String> cleaned = new ArrayList<>();
+			for (String name : originalNames) {
+				if (name == null) {
+					continue;
+				}
+				String trimmed = name.trim();
+				if (trimmed.isEmpty()) {
+					continue;
+				}
+				boolean duplicated = false;
+				for (String existing : cleaned) {
+					if (existing.equalsIgnoreCase(trimmed)) {
+						duplicated = true;
+						break;
+					}
+				}
+				if (!duplicated) {
+					cleaned.add(trimmed);
+				}
+			}
+			if (cleaned.isEmpty()) {
+				return empty();
+			}
+			cleaned.sort(String::compareToIgnoreCase);
+			return new ObstacleSummary(Collections.unmodifiableList(cleaned));
+		}
+
+		static ObstacleSummary empty() {
+			return EMPTY;
+		}
+
+		boolean isEmpty() {
+			return names.isEmpty();
+		}
+
+		int count() {
+			return names.size();
+		}
+
+		String buildDisplayValue() {
+			return count() > 0 ? String.format("闅滅鐗�%d涓�", count()) : "鏆傛棤闅滅鐗�";
+		}
+
+		String buildTooltip() {
+			return count() > 0 ? String.join("锛�", names) : "鏆傛棤闅滅鐗�";
+		}
+
+		List<String> copyNames() {
+			return new ArrayList<>(names);
+		}
+	}
 }
\ No newline at end of file

--
Gitblit v1.10.0