| | |
| | | #Dikuai Properties |
| | | #Tue Dec 23 16:12:08 CST 2025 |
| | | #Tue Dec 23 16:39:12 CST 2025 |
| | | LAND1.baseStationCoordinates=3949.89151752,N,11616.79267501,E |
| | | LAND1.boundaryCoordinates=42.327,2.469;39.527,1.769;35.235,0.943;33.800,0.591;32.427,0.156;31.148,-0.377;30.259,-1.257;30.032,-2.368;30.124,-3.806;30.592,-6.598;31.331,-10.769 |
| | | LAND1.boundaryOriginalCoordinates=39.831547,116.280373,49.32;39.831544,116.280357,49.33;39.831541,116.280340,49.29;39.831539,116.280324,49.27;39.831536,116.280307,49.24;39.831534,116.280290,49.25;39.831531,116.280273,49.26;39.831527,116.280257,49.28;39.831522,116.280242,49.21;39.831514,116.280232,49.28;39.831504,116.280229,49.24;39.831491,116.280230,49.33;39.831478,116.280233,49.34;39.831466,116.280236,49.31;39.831454,116.280239,49.31;39.831441,116.280242,49.26;39.831429,116.280244,49.23 |
| | | LAND1.boundaryOriginalXY=42.323,2.417;40.955,2.083;39.502,1.749;38.134,1.526;36.681,1.192;35.227,0.969;33.774,0.635;32.406,0.190;31.124,-0.366;30.269,-1.257;30.013,-2.370;30.098,-3.817;30.355,-5.265;30.611,-6.600;30.868,-7.936;31.124,-9.383;31.295,-10.719 |
| | | LAND1.createTime=2025-12-23 16\:39\:12 |
| | | LAND1.landArea=66.72 |
| | | LAND1.landName=12123 |
| | | LAND1.landNumber=LAND1 |
| | | LAND1.mowingBladeWidth=0.50 |
| | | LAND1.mowingPattern=平行线 |
| | | LAND1.mowingSafetyDistance=0.53 |
| | | LAND1.mowingWidth=43.00 |
| | | LAND1.plannedPath=30.655,-1.967;31.684,-0.728;32.539,-0.371;30.586,-2.723;30.626,-3.348;33.306,-0.122;34.055,0.108;30.685,-3.949;30.779,-4.509;34.757,0.280;35.454,0.445;30.873,-5.069;30.967,-5.629;36.119,0.573;36.784,0.701;31.061,-6.189;31.157,-6.747;37.450,0.829;38.115,0.958;31.255,-7.301;31.353,-7.856;38.780,1.086;39.446,1.214;31.451,-8.411;31.550,-8.965;40.139,1.376;40.845,1.552;31.648,-9.520 |
| | | LAND1.updateTime=2025-12-23 16\:39\:12 |
| | |
| | | #Mower Configuration Properties - Updated |
| | | #Tue Dec 23 16:12:22 CST 2025 |
| | | #Tue Dec 23 16:52:57 CST 2025 |
| | | appVersion=-1 |
| | | boundaryLengthVisible=false |
| | | currentWorkLandNumber=-1 |
| | | currentWorkLandNumber=LAND1 |
| | | cuttingWidth=200 |
| | | firmwareVersion=-1 |
| | | handheldMarkerId=1872 |
| | | idleTrailDurationSeconds=60 |
| | | manualBoundaryDrawingMode=false |
| | | mapScale=15.41 |
| | | mapScale=24.33 |
| | | measurementModeEnabled=false |
| | | mowerId=860 |
| | | serialAutoConnect=true |
| | | serialBaudRate=115200 |
| | | serialPortName=COM15 |
| | | simCardNumber=-1 |
| | | viewCenterX=-14.71 |
| | | viewCenterY=5.21 |
| | | viewCenterX=-35.75 |
| | | viewCenterY=3.10 |
| | |
| | | import java.util.Collections; |
| | | import java.util.Objects; |
| | | import java.util.Properties; |
| | | import java.util.Locale; |
| | | |
| | | import lujing.Lunjingguihua; |
| | | import lujing.MowingPathGenerationPage; |
| | |
| | | contentPanel.add(mowingPatternPanel); |
| | | contentPanel.add(Box.createRigidArea(new Dimension(0, 10))); |
| | | |
| | | // 割草机割刀宽度 |
| | | // 割草机割刀宽度(单位:米,保留2位小数) |
| | | String mowingBladeWidthValue = dikuai.getMowingBladeWidth(); |
| | | String displayBladeWidth = "未设置"; |
| | | if (mowingBladeWidthValue != null && !"-1".equals(mowingBladeWidthValue) && !mowingBladeWidthValue.trim().isEmpty()) { |
| | | try { |
| | | double bladeWidthMeters = Double.parseDouble(mowingBladeWidthValue.trim()); |
| | | double bladeWidthCm = bladeWidthMeters * 100.0; |
| | | displayBladeWidth = String.format("%.2f厘米", bladeWidthCm); |
| | | // 如果值大于100,认为是厘米,需要转换为米 |
| | | if (bladeWidthMeters > 100) { |
| | | bladeWidthMeters = bladeWidthMeters / 100.0; |
| | | } |
| | | displayBladeWidth = String.format(Locale.US, "%.2fm", bladeWidthMeters); |
| | | } catch (NumberFormatException e) { |
| | | displayBladeWidth = "未设置"; |
| | | } |
| | |
| | | contentPanel.add(mowingBladeWidthPanel); |
| | | contentPanel.add(Box.createRigidArea(new Dimension(0, 10))); |
| | | |
| | | // 割草宽度(单位:米,保留2位小数) |
| | | String mowingWidthValue = dikuai.getMowingWidth(); |
| | | String displayWidth = "未设置"; |
| | | if (mowingWidthValue != null && !"-1".equals(mowingWidthValue) && !mowingWidthValue.trim().isEmpty()) { |
| | | displayWidth = mowingWidthValue + "厘米"; |
| | | try { |
| | | double widthCm = Double.parseDouble(mowingWidthValue.trim()); |
| | | // 将厘米转换为米,保留2位小数 |
| | | double widthMeters = widthCm / 100.0; |
| | | displayWidth = String.format(Locale.US, "%.2fm", widthMeters); |
| | | } catch (NumberFormatException e) { |
| | | displayWidth = "未设置"; |
| | | } |
| | | } |
| | | JPanel mowingWidthPanel = createCardInfoItem("割草宽度:", displayWidth); |
| | | contentPanel.add(mowingWidthPanel); |
| | |
| | | if (distanceMeters > 100) { |
| | | distanceMeters = distanceMeters / 100.0; |
| | | } |
| | | displaySafetyDistance = String.format("%.2f米", distanceMeters); |
| | | displaySafetyDistance = String.format(Locale.US, "%.2fm", distanceMeters); |
| | | } catch (NumberFormatException e) { |
| | | displaySafetyDistance = "未设置"; |
| | | } |
| | |
| | | import zhuye.Coordinate; |
| | | import zhuye.MapRenderer; |
| | | import zhuye.Shouye; |
| | | import zhangaiwu.AddDikuai; |
| | | import zhangaiwu.Obstacledge; |
| | | import zhangaiwu.yulanzhangaiwu; |
| | | import bianjie.Bianjieyouhuatoxy; |
| | | import bianjie.ThreePointCircle; |
| | | |
| | | /** |
| | | * 障碍物新增/编辑对话框。设计语言参考 {@link AddDikuai},支持通过实地绘制采集障碍物坐标。 |
| | | */ |
| | |
| | | |
| | | // 割草宽度 |
| | | widthField = createInfoTextField(widthValue != null ? widthValue : "", true); |
| | | contentPanel.add(createTextFieldSection("割草宽度 (厘米)", widthField)); |
| | | contentPanel.add(createTextFieldSection("割草宽度 (cm)", widthField)); |
| | | |
| | | // 割草安全距离(只读显示) |
| | | // 优先从Dikuai对象获取,如果Dikuai中没有,再从Device获取 |
| | | String displaySafetyDistance = "未设置"; |
| | | Device device = Device.getActiveDevice(); |
| | | if (device != null) { |
| | | String safetyDistanceValue = device.getMowingSafetyDistance(); |
| | | if (safetyDistanceValue != null && !"-1".equals(safetyDistanceValue) && !safetyDistanceValue.trim().isEmpty()) { |
| | | try { |
| | | double distanceMeters = Double.parseDouble(safetyDistanceValue.trim()); |
| | | // 如果值大于100,认为是厘米,需要转换为米 |
| | | if (distanceMeters > 100) { |
| | | distanceMeters = distanceMeters / 100.0; |
| | | } |
| | | displaySafetyDistance = String.format("%.2f米", distanceMeters); |
| | | } catch (NumberFormatException e) { |
| | | displaySafetyDistance = "未设置"; |
| | | String safetyDistanceValue = null; |
| | | |
| | | // 首先尝试从Dikuai对象获取 |
| | | if (dikuai != null) { |
| | | safetyDistanceValue = dikuai.getMowingSafetyDistance(); |
| | | } |
| | | |
| | | // 如果Dikuai中没有,从Device获取 |
| | | if ((safetyDistanceValue == null || "-1".equals(safetyDistanceValue) || safetyDistanceValue.trim().isEmpty())) { |
| | | Device device = Device.getActiveDevice(); |
| | | if (device != null) { |
| | | safetyDistanceValue = device.getMowingSafetyDistance(); |
| | | } |
| | | } |
| | | |
| | | // 格式化显示值 |
| | | if (safetyDistanceValue != null && !"-1".equals(safetyDistanceValue) && !safetyDistanceValue.trim().isEmpty()) { |
| | | try { |
| | | double distanceMeters = Double.parseDouble(safetyDistanceValue.trim()); |
| | | // 如果值大于100,认为是厘米,需要转换为米 |
| | | if (distanceMeters > 100) { |
| | | distanceMeters = distanceMeters / 100.0; |
| | | } |
| | | displaySafetyDistance = String.format(Locale.US, "%.2fm", distanceMeters); |
| | | } catch (NumberFormatException e) { |
| | | displaySafetyDistance = "未设置"; |
| | | } |
| | | } |
| | | contentPanel.add(createInfoValueSection("割草安全距离", displaySafetyDistance)); |
| | |
| | | String rawWidthInput = widthField.getText() != null ? widthField.getText().trim() : ""; |
| | | String widthSanitized = sanitizeWidthString(widthField.getText()); |
| | | if (widthSanitized == null) { |
| | | String message = rawWidthInput.isEmpty() ? "请先设置割草宽度(厘米)" : "割草宽度格式不正确"; |
| | | String message = rawWidthInput.isEmpty() ? "请先设置割草宽度(cm)" : "割草宽度格式不正确"; |
| | | JOptionPane.showMessageDialog(this, message, "提示", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | |
| | | String widthStr = sanitizeWidthString(widthCmInput); |
| | | if (widthStr == null) { |
| | | if (showMessages) { |
| | | String message = rawWidth.isEmpty() ? "请先设置割草宽度(厘米)" : "割草宽度格式不正确"; |
| | | String message = rawWidth.isEmpty() ? "请先设置割草宽度(cm)" : "割草宽度格式不正确"; |
| | | JOptionPane.showMessageDialog(parentComponent, message, "提示", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | return null; |
| | |
| | | |
| | | /** |
| | | * 获取安全距离字符串(米) |
| | | * 优先从Dikuai对象获取,如果Dikuai中没有,再从Device获取 |
| | | */ |
| | | private String getSafetyDistanceString() { |
| | | Device device = Device.getActiveDevice(); |
| | | if (device != null) { |
| | | String safetyDistanceValue = device.getMowingSafetyDistance(); |
| | | if (safetyDistanceValue != null && !"-1".equals(safetyDistanceValue) && !safetyDistanceValue.trim().isEmpty()) { |
| | | try { |
| | | double distanceMeters = Double.parseDouble(safetyDistanceValue.trim()); |
| | | // 如果值大于100,认为是厘米,需要转换为米 |
| | | if (distanceMeters > 100) { |
| | | distanceMeters = distanceMeters / 100.0; |
| | | } |
| | | return BigDecimal.valueOf(distanceMeters) |
| | | .setScale(3, RoundingMode.HALF_UP) |
| | | .stripTrailingZeros() |
| | | .toPlainString(); |
| | | } catch (NumberFormatException e) { |
| | | // 解析失败,返回null,使用默认值 |
| | | String safetyDistanceValue = null; |
| | | |
| | | // 首先尝试从Dikuai对象获取 |
| | | if (dikuai != null) { |
| | | safetyDistanceValue = dikuai.getMowingSafetyDistance(); |
| | | } |
| | | |
| | | // 如果Dikuai中没有,从Device获取 |
| | | if ((safetyDistanceValue == null || "-1".equals(safetyDistanceValue) || safetyDistanceValue.trim().isEmpty())) { |
| | | Device device = Device.getActiveDevice(); |
| | | if (device != null) { |
| | | safetyDistanceValue = device.getMowingSafetyDistance(); |
| | | } |
| | | } |
| | | |
| | | // 格式化并返回 |
| | | if (safetyDistanceValue != null && !"-1".equals(safetyDistanceValue) && !safetyDistanceValue.trim().isEmpty()) { |
| | | try { |
| | | double distanceMeters = Double.parseDouble(safetyDistanceValue.trim()); |
| | | // 如果值大于100,认为是厘米,需要转换为米 |
| | | if (distanceMeters > 100) { |
| | | distanceMeters = distanceMeters / 100.0; |
| | | } |
| | | return BigDecimal.valueOf(distanceMeters) |
| | | .setScale(3, RoundingMode.HALF_UP) |
| | | .stripTrailingZeros() |
| | | .toPlainString(); |
| | | } catch (NumberFormatException e) { |
| | | // 解析失败,返回null,使用默认值 |
| | | } |
| | | } |
| | | return null; |