From e8a4f9014fbea4159ea15642226c6793d57d13ee Mon Sep 17 00:00:00 2001 From: Administrator <1144154118@qq.com> Date: 星期二, 22 八月 2023 11:05:44 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java b/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java index bb36308..48c156f 100644 --- a/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java +++ b/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java @@ -35,15 +35,15 @@ } public static void main(String[] args) { - // 琚娴嬬殑缁忕含搴︾偣 - Point2D point2D= new Point2D.Double(126.649261,45.687377); - // 鍟嗕笟鍖哄煙锛堢櫨搴﹀杈瑰舰鍖哄煙缁忕含搴﹂泦鍚堬級 - List<Point2D> partitionLocation = new ArrayList<>(); - partitionLocation.add(new Point2D.Double(126.64459,45.688548)); - partitionLocation.add(new Point2D.Double(126.653376,45.68938)); - partitionLocation.add(new Point2D.Double(126.645776,45.685048)); - partitionLocation.add(new Point2D.Double(126.654184,45.685778)); - System.out.println(isInPolygon(point2D,partitionLocation)); +// // 琚娴嬬殑缁忕含搴︾偣 +// Point point= new Point(126.649261,45.687377); +// // 鍟嗕笟鍖哄煙锛堢櫨搴﹀杈瑰舰鍖哄煙缁忕含搴﹂泦鍚堬級 +// List<Point> partitionLocation = new ArrayList<>(); +// partitionLocation.add(new Point(126.64459,45.688548)); +// partitionLocation.add(new Point(126.653376,45.68938)); +// partitionLocation.add(new Point(126.645776,45.685048)); +// partitionLocation.add(new Point(126.654184,45.685778)); +// System.out.println(isInPolygon(point,partitionLocation)); } /** @@ -52,17 +52,17 @@ * @param partitionLocation 鍖哄煙椤剁偣 * @return */ - public static boolean isInPolygon(Point2D orderLocation,List<Point2D> partitionLocation){ + public static boolean isInPolygon(Point orderLocation,List<Point> partitionLocation){ - double p_x =orderLocation.getX(); - double p_y =orderLocation.getY(); + double p_x =orderLocation.getLongitude(); + double p_y =orderLocation.getLatitude(); Point2D.Double point = new Point2D.Double(p_x, p_y); List<Point2D.Double> pointList= new ArrayList<Point2D.Double>(); - for (Point2D points : partitionLocation){ - double polygonPoint_x=points.getX(); - double polygonPoint_y=points.getY(); + for (Point points : partitionLocation){ + double polygonPoint_x=points.getLongitude(); + double polygonPoint_y=points.getLatitude(); Point2D.Double polygonPoint = new Point2D.Double(polygonPoint_x,polygonPoint_y); pointList.add(polygonPoint); } -- Gitblit v1.9.3