From 8d9a2d656e4ae007590c622e5f7c228adacdca49 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Fri, 14 Jun 2024 10:11:36 +0800
Subject: [PATCH] 统一风格

---
 src/main/java/com/dji/sample/patches/utils/GeoToolsUtil.java |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/dji/sample/patches/utils/GeoToolsUtil.java b/src/main/java/com/dji/sample/patches/utils/GeoToolsUtil.java
index af191ef..5ea11e8 100644
--- a/src/main/java/com/dji/sample/patches/utils/GeoToolsUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/GeoToolsUtil.java
@@ -176,7 +176,7 @@
 //        });
 
 
-        List<PointPO> pointPOS = getRoutePointOrder(list,28.624514734, 115.856725497);
+        List<PointPO> pointPOS = getRoutePointOrder(list, 28.624514734, 115.856725497);
 
         for (PointPO c :
                 pointPOS) {
@@ -194,9 +194,9 @@
     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());
@@ -209,6 +209,13 @@
 
             // 开始封装中心点坐标
             Coordinate coordinateCentro = getCentro(polygon);
+
+            double distance = DistanceCalculator.calculateDistance(airportLat, airportLon, coordinateCentro.y,coordinateCentro.x);
+            // 机场范围,操作机场范围将不生成
+            if (distance * 1000 > 7000) {
+                continue;
+            }
+
             centros.add(coordinateCentro);
 
             // 开始封装图斑4个航线
@@ -219,8 +226,8 @@
 
             // 保存稀释拐点之后总数量
             numSize.set(numSize.get() + coordinatePointList.size());
+        }
 
-        });
 
         // 开始排序
         Coordinate[] coordinates = new Coordinate[centros.size() + 1];
@@ -275,7 +282,7 @@
         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);
@@ -288,14 +295,13 @@
 
         // 根据排序前的索引按顺序赋值
         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;

--
Gitblit v1.9.3