From c65f8b4b17fe859580252c59b75e4e03ed85b6c8 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 05 六月 2023 14:00:51 +0800 Subject: [PATCH] 修改溯源势力图的层级 --- src/main/java/com/yssh/utils/CalculateUtils.java | 133 ++++++++++++++++++++++---------------------- 1 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/yssh/utils/CalculateUtils.java b/src/main/java/com/yssh/utils/CalculateUtils.java index 8632877..267b97a 100644 --- a/src/main/java/com/yssh/utils/CalculateUtils.java +++ b/src/main/java/com/yssh/utils/CalculateUtils.java @@ -7,83 +7,84 @@ public class CalculateUtils { /** + * @param @param x + * @param @param y + * @param @return 鍙傛暟 + * @return double 杩斿洖绫诲瀷 + * @throws * @Title: getLon * @Description: 璁$畻缁忓害 - * @param @param x - * @param @param y - * @param @return 鍙傛暟 - * @return double 杩斿洖绫诲瀷 - * @throws */ public static double getLon(int x, int y) { - double lon = 115.9165227 + 0.000116732 * (x - 0.5) + 0.00000116862 * (y - 0.5); - if (lon < 115 || lon > 116) { - System.out.println("lon is invalid"); - } - return lon; - } + double lon = 115.9165227 + 0.000116732 * (x - 0.5) + 0.00000116862 * (y - 0.5); + if (lon < 115 || lon > 116) { + System.out.println("lon is invalid"); + } + return lon; + } /** - * @Title: getLat - * @Description: 璁$畻缁村害 - * @param @param x - * @param @param y + * @param @param x + * @param @param y * @param @return 鍙傛暟 * @return double 杩斿洖绫诲瀷 * @throws + * @Title: getLat + * @Description: 璁$畻缁村害 */ public static double getLat(int x, int y) { - double lat = 39.77250000 + 0.000001000 * (x - 0.5) - 0.00009000000 * (y - 0.5); - if (lat < 39 || lat > 40) { - System.out.println("lat is invalid"); - } - return lat; - } - + double lat = 39.77250000 + 0.000001000 * (x - 0.5) - 0.00009000000 * (y - 0.5); + if (lat < 39 || lat > 40) { + System.out.println("lat is invalid"); + } + return lat; + } + /** - * @Title: assembleId - * @Description: 缁勮id - * @param @param checkPoints + * @param @param checkPoints * @param @return 鍙傛暟 * @return List<String> 杩斿洖绫诲瀷 * @throws + * @Title: assembleId + * @Description: 缁勮id */ - public static List<String> assembleId(List<MonitorPointPosition> checkPoints){ + public static List<String> assembleId(List<MonitorPointPosition> checkPoints) { List<String> ids2d = new ArrayList<String>(); for (MonitorPointPosition point : checkPoints) { ids2d.add(point.getX() + "_" + point.getY() + "_" + point.getZ()); } return ids2d; } - + /** - * @Title: aloneCrosswiseScope - * @Description: 鍗曠嫭鐐逛綅妯悜鑼冨洿鎵╁睍 - * @param @param checkPoint - * @param @param range + * @param @param checkPoint + * @param @param range * @param @return 鍙傛暟 * @return List<String> 杩斿洖绫诲瀷 - * @throws + * @Title: aloneCrosswiseScope + * @Description: 鍗曠嫭鐐逛綅妯悜鑼冨洿鎵╁睍 + * @backup 寮哄埗灏嗗眰绾ф敼涓� 0 */ - public static List<String> aloneCrosswiseExtend(MonitorPointPosition checkPoint, int range){ + public static List<String> aloneCrosswiseExtend(MonitorPointPosition checkPoint, int range) { List<String> ids = new ArrayList<String>(); Integer x = checkPoint.getX(); Integer y = checkPoint.getY(); - for (int i = x - range/2; i <= x + range/2; i++) { - for (int j = y - range/2; j <= y + range/2; j++) { - ids.add(i + "_" + j + "_" + checkPoint.getZ()); + for (int i = x - range / 2; i <= x + range / 2; i++) { + for (int j = y - range / 2; j <= y + range / 2; j++) { + // ids.add(i + "_" + j + "_" + checkPoint.getZ()); + ids.add(i + "_" + j + "_" + 0); } } return ids; } - - public static List<String> temporary(MonitorPointPosition point, int range){ + + public static List<String> temporary(MonitorPointPosition point, int range) { List<String> ids3d = new ArrayList<String>(); Integer x = point.getX(); Integer y = point.getY(); Integer z = point.getZ(); - for (int i = x - range/2; i <= x + range/2; i++) { - for (int j = y - range/2; j <= y + range/2; j++) { + for (int i = x - range / 2; i <= x + range / 2; i++) { + for (int j = y - range / 2; j <= y + range / 2; j++) { for (int k = z; k < 100; k++) { ids3d.add(i + "_" + j + "_" + k); } @@ -91,52 +92,52 @@ } return ids3d; } - + /** - * @Title: getWindSpeed - * @Description: 璁$畻椋庨�� * @param @return 鍙傛暟 * @return Double 杩斿洖绫诲瀷 * @throws + * @Title: getWindSpeed + * @Description: 璁$畻椋庨�� */ - public static Double getWindSpeed(double v, double u){ + public static Double getWindSpeed(double v, double u) { return Math.sqrt(v * v + u * u); } - + /** - * @Title: getWindDirection - * @Description: 璁$畻椋庡悜 - * @param @param v - * @param @param u + * @param @param v + * @param @param u * @param @return 鍙傛暟 * @return double 杩斿洖绫诲瀷 * @throws + * @Title: getWindDirection + * @Description: 璁$畻椋庡悜 */ - public static double getWindDirection(double v, double u){ + public static double getWindDirection(double v, double u) { double result = Math.atan(u / (v + Math.pow(10, -5))) / Math.PI * 180; - if (result <0 ){ + if (result < 0) { result += 180; - }else if(u < 0 && v > 0){ + } else if (u < 0 && v > 0) { result += 360; } return result; } - + /** + * @param @param list 鎺掑簭瀵硅薄 + * @param @param property 鎺掑簭鍙傛暟 + * @param @param order 鎺掑簭椤哄簭 + * @param @return 鍙傛暟 + * @return List<Map < String, Object>> 杩斿洖绫诲瀷 + * @throws * @Title: sort * @Description: 鎺掑簭 - * @param @param list 鎺掑簭瀵硅薄 - * @param @param property 鎺掑簭鍙傛暟 - * @param @param order 鎺掑簭椤哄簭 - * @param @return 鍙傛暟 - * @return List<Map<String,Object>> 杩斿洖绫诲瀷 - * @throws */ - public static List<Map<String, Object>> sort(List<Map<String, Object>> list,final String property,final boolean order){ - if(list == null || property == null){ + public static List<Map<String, Object>> sort(List<Map<String, Object>> list, final String property, final boolean order) { + if (list == null || property == null) { return null; - } - Collections.sort(list, new Comparator<Map<String, Object>>(){ + } + Collections.sort(list, new Comparator<Map<String, Object>>() { @Override public int compare(Map<String, Object> o1, Map<String, Object> o2) { try { @@ -160,12 +161,12 @@ if (Double.parseDouble(oo1.toString()) == Double.parseDouble(oo2.toString())) { return 0; } - }catch (Exception ex){ + } catch (Exception ex) { System.out.println(ex.getMessage()); } - return -1; + return -1; } - }); + }); return list; } } -- Gitblit v1.9.3