瀏覽代碼

修改航迹

zansimple 2 天之前
父節點
當前提交
fef1751881
共有 1 個文件被更改,包括 35 次插入0 次删除
  1. 35 0
      SimulationServer/Utils/Util.cs

+ 35 - 0
SimulationServer/Utils/Util.cs

@@ -134,6 +134,41 @@ public class Util
         return fuel.data[0];
     }
     
+    public static List<LocationInfo> GetAltitude(List<double[]> latlon)
+    {
+        
+        List<string> key = new List<string>() { "wkt" };
+        List<string> value = new List<string>() { "POLYGON((" + latlon[0][0] + " " + latlon[0][1] + ", " + latlon[1][0] + " " + latlon[1][1] + ", " + latlon[2][0] + " " + latlon[2][1] + ", " + latlon[3][0] + " " + latlon[3][1] + ", " + latlon[0][0] + " " + latlon[0][1] + ")) " };
+        string content = HttpManager.Get(HttpInterface.getLocationInfo ,new List<string>
+        {
+            "wkt"
+        }, value);
+        
+        var altitude = JsonHelper.FromJson<Altitude>(content);
+        
+        return altitude.data;
+    }
+    
+    public static List<double[]> GetBoundingBox(List<double[]> points)
+    {
+        // 初始化最小和最大经纬度
+        double minLat = points.Min(p => p[1]);
+        double maxLat = points.Max(p => p[1]);
+        double minLon = points.Min(p => p[0]);
+        double maxLon = points.Max(p => p[0]);
+
+        // 创建一个List来存储矩形的四个顶点
+        List<double[]> boundingBox = new List<double[]>();
+
+        // 依次按照右下角、右上角、左上角、左下角的顺序存储
+        boundingBox.Add(new double[] { maxLon, minLat }); // 右下角
+        boundingBox.Add(new double[] { maxLon, maxLat }); // 右上角
+        boundingBox.Add(new double[] { minLon, maxLat }); // 左上角
+        boundingBox.Add(new double[] { minLon, minLat }); // 左下角
+
+        return boundingBox;
+    }
+    
     public static EntitySheetReportValue GetSheetReportValue(string name,Dictionary<string, Dictionary<string, List<string>>> report)
     {
         EntitySheetReportValue aircraftValue = new EntitySheetReportValue();