| | |
| | | import dikuai.Gecaokuanjisuan; |
| | | import dikuai.Gecaoanquanjuli; |
| | | import bianjie.Bianjieyouhuatoxy; |
| | | import lujing.Lunjingguihua; |
| | | |
| | | import lujing.Qufenxingzhuang; |
| | | import lujing.AoxinglujingNoObstacle; |
| | | import lujing.YixinglujingNoObstacle; |
| | |
| | | YixinglujingNoObstacle.planPath(boundaryCoords, widthMetersStr, safetyDistanceMetersStr); |
| | | plannedPath = formatYixingPathSegments(segments); |
| | | } else { |
| | | // 无法判断地块类型,使用默认方法作为后备 |
| | | JOptionPane.showMessageDialog(this, "无法判断地块类型,使用默认路径生成方法", |
| | | // 无法判断地块类型 |
| | | JOptionPane.showMessageDialog(this, "无法判断地块类型,无法生成路径", |
| | | "提示", JOptionPane.WARNING_MESSAGE); |
| | | String plannerMode = resolvePlannerMode(patternDisplay); |
| | | plannedPath = Lunjingguihua.generatePathFromStrings( |
| | | boundaryCoords, |
| | | obstacleCoords != null ? obstacleCoords : "", |
| | | widthMetersStr, |
| | | safetyDistanceMetersStr, |
| | | plannerMode |
| | | ); |
| | | plannedPath = ""; |
| | | } |
| | | |
| | | if (!isMeaningfulValue(plannedPath)) { |
| | |
| | | |
| | | private String generateNewLandNumber() { |
| | | Map<String, Dikuai> existing = Dikuai.getAllDikuai(); |
| | | |
| | | // 获取割草机编号 |
| | | String mowerId = Setsys.getPropertyValue("mowerId"); |
| | | |
| | | // 如果有割草机编号,使用 编号+两位自增数字 格式 |
| | | if (mowerId != null && !mowerId.trim().isEmpty() && !"-1".equals(mowerId)) { |
| | | int attempt = 1; |
| | | while (true) { |
| | | // 格式化为两位数字,如 01, 02, ... |
| | | String suffix = String.format("%02d", attempt); |
| | | String candidate = mowerId + suffix; |
| | | if (!existing.containsKey(candidate)) { |
| | | return candidate; |
| | | } |
| | | attempt++; |
| | | } |
| | | } |
| | | |
| | | // 如果没有割草机编号,回退到默认逻辑 |
| | | int attempt = 1; |
| | | while (true) { |
| | | String candidate = "LAND" + attempt; |