826220679@qq.com
2 天以前 48ee74129bb09a817a0bbbabe860c4007b74c66b
src/yaokong/Control02.java
@@ -3,6 +3,8 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import publicway.Gpstoxuzuobiao;
public class Control02 {
    
    /**
@@ -98,29 +100,7 @@
     * 例如:3949.90238860 -> 39.83170647666667
     */
    private static double parseDMToDecimal(String dmm, String direction) {
        try {
            // 找到小数点的位置
            int dotIndex = dmm.indexOf('.');
            if (dotIndex < 2) {
                throw new IllegalArgumentException("度分格式错误: " + dmm);
            }
            // 提取度和分
            int degrees = Integer.parseInt(dmm.substring(0, dotIndex - 2));
            double minutes = Double.parseDouble(dmm.substring(dotIndex - 2));
            // 转换为十进制
            double decimal = degrees + minutes / 60.0;
            // 根据方向调整正负
            if ("S".equalsIgnoreCase(direction) || "W".equalsIgnoreCase(direction)) {
                decimal = -decimal;
            }
            return decimal;
        } catch (Exception e) {
            throw new IllegalArgumentException("坐标格式解析错误: " + dmm, e);
        }
        return Gpstoxuzuobiao.parseDMToDecimal(dmm, direction);
    }
    
    private static String bytesToHex(byte[] bytes) {