| | |
| | | // }); |
| | | |
| | | |
| | | List<PointPO> pointPOS = getRoutePointOrder(list,28.624514734, 115.856725497); |
| | | List<PointPO> pointPOS = getRoutePointOrder(list, 28.624514734, 115.856725497); |
| | | |
| | | for (PointPO c : |
| | | pointPOS) { |
| | |
| | | public static List<PointPO> getRoutePointOrder(List<LotInfo> list, double airportLat, double airportLon) { |
| | | List<Coordinate> centros = new ArrayList<>(); |
| | | List<List<Coordinate>> extremePoints = new ArrayList<>(); |
| | | Map<Coordinate, List<Coordinate>> points = new HashMap<>(); |
| | | AtomicInteger numSize = new AtomicInteger(); |
| | | list.forEach(patche -> { |
| | | |
| | | for (LotInfo patche : list) { |
| | | String wkt = patche.getDkfw(); |
| | | // 解析WKT字符串为多边形 |
| | | WKTReader wktReader = new WKTReader(JTSFactoryFinder.getGeometryFactory()); |
| | |
| | | |
| | | // 开始封装中心点坐标 |
| | | Coordinate coordinateCentro = getCentro(polygon); |
| | | |
| | | double distance = DistanceCalculator.calculateDistance(airportLat, airportLon, coordinateCentro.y,coordinateCentro.x); |
| | | // 机场范围,操作机场范围将不生成 |
| | | if (distance * 1000 > 7000) { |
| | | continue; |
| | | } |
| | | |
| | | centros.add(coordinateCentro); |
| | | |
| | | // 开始封装图斑4个航线 |
| | |
| | | |
| | | // 保存稀释拐点之后总数量 |
| | | numSize.set(numSize.get() + coordinatePointList.size()); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 开始排序 |
| | | Coordinate[] coordinates = new Coordinate[centros.size() + 1]; |
| | |
| | | List<Integer> indexs = new ArrayList<>(); |
| | | |
| | | // 拿排序前的索引index 根据排序前和排序后的结果匹对------》后期优化 |
| | | for (int i = 1; i<sortedCoordinates.length; i++) { |
| | | for (int i = 1; i < sortedCoordinates.length; i++) { |
| | | Coordinate c1 = sortedCoordinates[i]; |
| | | for (int j = 1; j < oldCoordinateList.size(); j++) { |
| | | Coordinate c2 = oldCoordinateList.get(j); |
| | |
| | | |
| | | // 根据排序前的索引按顺序赋值 |
| | | int i = 0; |
| | | for (Integer index: indexs) { |
| | | for (Coordinate coordinate:extremePoints.get(index)) { |
| | | i = i+1; |
| | | for (Integer index : indexs) { |
| | | for (Coordinate coordinate : extremePoints.get(index)) { |
| | | i = i + 1; |
| | | retc[i] = coordinate; |
| | | retcList.add(PointPO.builder().index(index).coordinate(coordinate).build()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return retcList; |