| | |
| | | package dikuai; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.border.EmptyBorder; |
| | | import javax.swing.plaf.basic.BasicScrollBarUI; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import zhangaiwu.Obstacledge; |
| | | import zhuye.Shouye; |
| | | import zhuye.Coordinate; |
| | | import bianjie.bianjieguihua2; |
| | | import bianjie.Bianjieyouhuatoxy; |
| | | |
| | | /** |
| | | * 障碍物管理页面 - UI优化版 |
| | |
| | | return null; |
| | | } |
| | | |
| | | // 设置到全局坐标列表 |
| | | Coordinate.coordinates.clear(); |
| | | Coordinate.coordinates.addAll(coordinateList); |
| | | // 构建边界字符串,格式为 "(lat1,lon1,alt1;lat2,lon2,alt2;...)" |
| | | String boundaryStr = buildBoundaryStringForOptimization(coordinateList); |
| | | |
| | | // 调用 bianjieguihua2 算法生成优化后的多边形坐标 |
| | | String optimizedCoordsStr = bianjieguihua2.processCoordinateListAuto(baseStation); |
| | | // 调用 Bianjieyouhuatoxy.optimizeBoundary 方法生成优化后的多边形坐标 |
| | | String optimizedCoordsStr = Bianjieyouhuatoxy.optimizeBoundary(baseStation, boundaryStr); |
| | | |
| | | if (optimizedCoordsStr == null || optimizedCoordsStr.trim().isEmpty()) { |
| | | if (optimizedCoordsStr == null || optimizedCoordsStr.trim().isEmpty() || optimizedCoordsStr.startsWith("ERROR")) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 构建用于优化的边界字符串,格式为 "(lat1,lon1,alt1;lat2,lon2,alt2;...)" |
| | | * 其中lat和lon是度分格式(DMM格式),例如 "3949.89151752" |
| | | */ |
| | | private String buildBoundaryStringForOptimization(List<Coordinate> coordinates) { |
| | | if (coordinates == null || coordinates.isEmpty()) { |
| | | return "()"; |
| | | } |
| | | StringBuilder sb = new StringBuilder("("); |
| | | java.text.DecimalFormat elevationFormat = new java.text.DecimalFormat("0.00"); |
| | | for (int i = 0; i < coordinates.size(); i++) { |
| | | Coordinate coord = coordinates.get(i); |
| | | // Coordinate类中的getLatitude()和getLongitude()已经返回度分格式(DMM格式) |
| | | String latDMM = coord.getLatitude(); |
| | | String lonDMM = coord.getLongitude(); |
| | | double elevation = coord.getElevation(); |
| | | |
| | | if (i > 0) { |
| | | sb.append(";"); |
| | | } |
| | | sb.append(latDMM).append(",") |
| | | .append(lonDMM).append(",") |
| | | .append(elevationFormat.format(elevation)); |
| | | } |
| | | sb.append(")"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 格式化度分格式坐标 |
| | | * @param degreeMinute 度分值,如 2324.200273 表示 23度24.200273分 |
| | | * @return 格式化的字符串 |
| | |
| | | |
| | | |
| | | |
| | | |