张世豪
6 天以前 b315a6943e6c0d6bdf0d5f7565c570d719154d6c
src/dikuai/addzhangaiwu.java
@@ -46,10 +46,12 @@
import set.Setsys;
import ui.UIConfig;
import zhuye.Coordinate;
import zhuye.MapRenderer;
import zhuye.Shouye;
import zhangaiwu.AddDikuai;
import zhangaiwu.Obstacledge;
import zhangaiwu.yulanzhangaiwu;
import zhuye.buttonset;
/**
 * 障碍物新增/编辑对话框。设计语言参考 {@link AddDikuai},支持通过实地绘制采集障碍物坐标。
@@ -286,13 +288,10 @@
    }
    private JButton createInlineButton(String text) {
        JButton button = new JButton(text);
        JButton button = buttonset.createStyledButton(text, PRIMARY_COLOR);
        button.setFont(new Font("微软雅黑", Font.BOLD, 12));
        button.setForeground(WHITE);
        button.setBackground(PRIMARY_COLOR);
        button.setBorder(BorderFactory.createEmptyBorder(6, 16, 6, 16));
        button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        button.setFocusPainted(false);
        Dimension size = new Dimension(72, 28);
        button.setPreferredSize(size);
        button.setMinimumSize(size);
@@ -565,6 +564,9 @@
        prevButton = createSecondaryButton("上一步");
        nextButton = createPrimaryButton("下一步", 16);
        // 设置下一步按钮宽度为300像素
        nextButton.setPreferredSize(new Dimension(300, nextButton.getPreferredSize().height));
        nextButton.setMaximumSize(new Dimension(300, nextButton.getPreferredSize().height));
        saveButton = createPrimaryButton("保存", 16);
        saveButton.setVisible(false);
@@ -752,6 +754,10 @@
        if (option == null) {
            return;
        }
        if (userTriggered && "handheld".equalsIgnoreCase(type) && !hasConfiguredHandheldMarker()) {
            JOptionPane.showMessageDialog(this, "请先添加便携打点器编号", "提示", JOptionPane.WARNING_MESSAGE);
            return;
        }
        if (selectedMethodPanel != null && selectedMethodPanel != option) {
            resetOptionAppearance(selectedMethodPanel);
        }
@@ -763,6 +769,11 @@
        }
    }
    private boolean hasConfiguredHandheldMarker() {
        String handheldId = Setsys.getPropertyValue("handheldMarkerId");
        return handheldId != null && !handheldId.trim().isEmpty();
    }
    private void selectShapeOption(JPanel option, String type, boolean userTriggered) {
        if (option == null) {
            return;
@@ -887,6 +898,15 @@
        activeDrawingShape = shape.toLowerCase(Locale.ROOT);
        Shouye shouyeInstance = Shouye.getInstance();
        if (shouyeInstance != null) {
            shouyeInstance.setHandheldMowerIconActive("handheld".equalsIgnoreCase(method));
            MapRenderer renderer = shouyeInstance.getMapRenderer();
            if (renderer != null) {
                renderer.clearIdleTrail();
            }
        }
        Coordinate.coordinates.clear();
        Coordinate.setActiveDeviceIdFilter(deviceId);
        Coordinate.setStartSaveGngga(true);
@@ -1471,20 +1491,6 @@
            JOptionPane.showMessageDialog(this, "写入障碍物配置失败,请重试", "错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (!Dikuai.updateField(landNumber, "obstacleCoordinates", coords)) {
            JOptionPane.showMessageDialog(this, "无法更新障碍物坐标", "错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (originalCoords != null) {
            if (!Dikuai.updateField(landNumber, "obstacleOriginalCoordinates", originalCoords)) {
                JOptionPane.showMessageDialog(this, "无法更新障碍物原始坐标", "错误", JOptionPane.ERROR_MESSAGE);
                return;
            }
        } else if (!Dikuai.updateField(landNumber, "obstacleOriginalCoordinates", "-1")) {
            JOptionPane.showMessageDialog(this, "无法重置障碍物原始坐标", "错误", JOptionPane.ERROR_MESSAGE);
            return;
        }
        Dikuai.updateField(landNumber, "updateTime", currentTime());
        Dikuai.saveToProperties();
        Dikuaiguanli.notifyExternalCreation(landNumber);
@@ -1870,15 +1876,12 @@
    }
    private JButton createPrimaryButton(String text, int fontSize) {
        JButton button = new JButton(text);
        JButton button = buttonset.createStyledButton(text, PRIMARY_COLOR);
        button.setFont(new Font("微软雅黑", Font.BOLD, fontSize));
        button.setBackground(PRIMARY_COLOR);
        button.setForeground(WHITE);
        button.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(PRIMARY_DARK, 2),
                BorderFactory.createEmptyBorder(10, 22, 10, 22)));
        button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        button.setFocusPainted(false);
        button.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
@@ -1898,15 +1901,13 @@
    }
    private JButton createSecondaryButton(String text) {
        JButton button = new JButton(text);
        JButton button = buttonset.createStyledButton(text, MEDIUM_GRAY);
        button.setFont(new Font("微软雅黑", Font.BOLD, 16));
        button.setBackground(MEDIUM_GRAY);
        button.setForeground(TEXT_COLOR);
        button.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(BORDER_COLOR, 2),
                BorderFactory.createEmptyBorder(10, 22, 10, 22)));
        button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        button.setFocusPainted(false);
        return button;
    }