From cc4b3f8713b4c561c193fa1abdae0ab69b98750d Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 23 八月 2023 14:49:34 +0800
Subject: [PATCH] 优化
---
ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 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..4682ff7 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
@@ -36,14 +36,14 @@
public static void main(String[] args) {
// 琚娴嬬殑缁忕含搴︾偣
- Point2D point2D= new Point2D.Double(126.649261,45.687377);
+ Point point= new Point(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));
+ 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