From 236b037b0d8d2673bb8f1f00013983459c6e669c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 14 九月 2023 16:57:24 +0800 Subject: [PATCH] 修改栅格分析的线分析功能-2 --- src/main/java/com/moon/server/helper/GeoHelper.java | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/moon/server/helper/GeoHelper.java b/src/main/java/com/moon/server/helper/GeoHelper.java index 556c784..20ac8da 100644 --- a/src/main/java/com/moon/server/helper/GeoHelper.java +++ b/src/main/java/com/moon/server/helper/GeoHelper.java @@ -39,9 +39,20 @@ } /** - * 鑾峰彇璺濈1 + * 鑾峰彇璺濈 */ - public static double getDistance1(double lon1, double lat1, double lon2, double lat2) { + public static double getDistance(double x1, double y1, double x2, double y2) { + GeodeticCalculator geodeticCalculator = new GeodeticCalculator(crs104903); + geodeticCalculator.setStartingGeographicPoint(x1, y1); + geodeticCalculator.setDestinationGeographicPoint(x2, y2); + + return geodeticCalculator.getOrthodromicDistance(); + } + + /** + * 鑾峰彇璺濈2 + */ + public static double getDistance2(double lon1, double lat1, double lon2, double lat2) { double radLat1 = Math.toRadians(lat1); double radLat2 = Math.toRadians(lat2); double a = radLat1 - radLat2; @@ -52,17 +63,6 @@ } /** - * 鑾峰彇璺濈2 - */ - public static double getDistance2(double x1, double y1, double x2, double y2) { - GeodeticCalculator geodeticCalculator = new GeodeticCalculator(crs104903); - geodeticCalculator.setStartingGeographicPoint(x1, y1); - geodeticCalculator.setDestinationGeographicPoint(x2, y2); - - return geodeticCalculator.getOrthodromicDistance(); - } - - /** * 鑾峰彇鏂瑰悜瑙� */ public static double getBearing(double x1, double y1, double x2, double y2) { @@ -70,9 +70,9 @@ } /** - * 鑾峰彇瑙掑害1 + * 鑾峰彇瑙掑害 */ - public static double getAngle1(double x1, double y1, double x2, double y2) { + public static double getAngle(double x1, double y1, double x2, double y2) { DirectPosition2D p1 = new DirectPosition2D(crs104903, x1, y1); DirectPosition2D p2 = new DirectPosition2D(crs104903, x2, y2); @@ -100,7 +100,7 @@ /** * 鏍规嵁璺濈鍜岃搴﹁幏鍙栫洰鏍囩偣 */ - private static Point2D getPointByDistanceAndAngle(double x, double y, double angle, double distance) { + public static Point2D getPointByDistanceAndAngle(double x, double y, double angle, double distance) { DirectPosition2D p1 = new DirectPosition2D(x, y); GeodeticCalculator gc = new GeodeticCalculator(); -- Gitblit v1.9.3