826220679@qq.com
2 天以前 48ee74129bb09a817a0bbbabe860c4007b74c66b
src/dikuai/addzhangaiwu.java
@@ -46,6 +46,7 @@
import baseStation.BaseStation;
import gecaoji.Device;
import publicway.buttonset;
import set.Setsys;
import ui.UIConfig;
import zhuye.Coordinate;
@@ -54,13 +55,14 @@
import zhangaiwu.AddDikuai;
import zhangaiwu.Obstacledge;
import zhangaiwu.yulanzhangaiwu;
import zhuye.buttonset;
import bianjie.bianjieguihua2;
import bianjie.ThreePointCircle;
/**
 * 障碍物新增/编辑对话框。设计语言参考 {@link AddDikuai},支持通过实地绘制采集障碍物坐标。
 */
import publicway.Gpstoxuzuobiao;
public class addzhangaiwu extends JDialog {
    private static final long serialVersionUID = 1L;
    private static final double METERS_PER_DEGREE_LAT = 111320.0d;
@@ -797,7 +799,7 @@
            return;
        }
        if (userTriggered && "handheld".equalsIgnoreCase(type) && !hasConfiguredHandheldMarker()) {
            JOptionPane.showMessageDialog(this, "请先添加便携打点器编号", "提示", JOptionPane.WARNING_MESSAGE);
            JOptionPane.showMessageDialog(this, "请先去系统设置添加便携打点器编号", "提示", JOptionPane.WARNING_MESSAGE);
            return;
        }
        if (selectedMethodPanel != null && selectedMethodPanel != option) {
@@ -1217,34 +1219,11 @@
    }
    private static double parseDMToDecimal(String dmm, String direction) {
        if (dmm == null || dmm.trim().isEmpty()) {
            return Double.NaN;
        }
        try {
            String trimmed = dmm.trim();
            int dotIndex = trimmed.indexOf('.');
            if (dotIndex < 2) {
                return Double.NaN;
            }
            int degrees = Integer.parseInt(trimmed.substring(0, dotIndex - 2));
            double minutes = Double.parseDouble(trimmed.substring(dotIndex - 2));
            double decimal = degrees + minutes / 60.0;
            if ("S".equalsIgnoreCase(direction) || "W".equalsIgnoreCase(direction)) {
                decimal = -decimal;
            }
            return decimal;
        } catch (NumberFormatException ex) {
            return Double.NaN;
        }
        return Gpstoxuzuobiao.parseDMToDecimal(dmm, direction);
    }
    private static double[] convertLatLonToLocal(double lat, double lon, double baseLat, double baseLon) {
        double deltaLat = lat - baseLat;
        double deltaLon = lon - baseLon;
        double meanLatRad = Math.toRadians((baseLat + lat) / 2.0);
        double eastMeters = deltaLon * METERS_PER_DEGREE_LAT * Math.cos(meanLatRad);
        double northMeters = deltaLat * METERS_PER_DEGREE_LAT;
        return new double[]{eastMeters, northMeters};
        return Gpstoxuzuobiao.convertLatLonToLocal(lat, lon, baseLat, baseLon);
    }
    private static CircleFitResult fitCircleFromPoints(List<double[]> points) {
@@ -1359,7 +1338,7 @@
        }
        if (!configMap.isEmpty()) {
            List<ExistingObstacle> remaining = new ArrayList<>(configMap.values());
            remaining.sort(Comparator.comparing(ExistingObstacle::getName, String.CASE_INSENSITIVE_ORDER));
            remaining.sort((a, b) -> String.CASE_INSENSITIVE_ORDER.compare(a.getName(), b.getName()));
            result.addAll(remaining);
        }
        if (result.isEmpty()) {