人员定位接口修改
正在显示
3 个修改的文件
包含
75 行增加
和
49 行删除
... | @@ -71,20 +71,30 @@ public class IThirdServiceImpl implements IThirdService { | ... | @@ -71,20 +71,30 @@ public class IThirdServiceImpl implements IThirdService { |
71 | } | 71 | } |
72 | 72 | ||
73 | public static void main(String[] args) { | 73 | public static void main(String[] args) { |
74 | String x1 = "463.7121276855469"; | 74 | String x1 = "22.99456"; |
75 | String y1 = "142.59878540039062"; | 75 | String y1 = "330.3669"; |
76 | 76 | Map<String,Double> map = new HashMap<>();//初始化 | |
77 | double fd_x = CommonConstant.BLC1*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X; | 77 | map = CoordinateUtil.changCoordinate("B2",x1,y1); |
78 | double fd_y = CommonConstant.BLC1*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y; | 78 | System.out.println("新坐标为:X:"+map.get("x")+",Y:"+map.get("y")); |
79 | System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y); | 79 | // double sin = Math.sin(CommonConstant.XZJD); |
80 | 80 | // double cos = Math.cos(CommonConstant.XZJD); | |
81 | double a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x | 81 | // System.out.println("sin:"+sin+",cos:"+cos); |
82 | double b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y | 82 | // //平移到原点 |
83 | System.out.println("偏移a:"+a+",b:"+b); | 83 | // double x0 = Double.valueOf(x1) - CommonConstant.LT_B1_X; |
84 | 84 | // double y0 = Double.valueOf(y1) - CommonConstant.LT_B1_Y; | |
85 | double x = Double.valueOf(fd_x) + a; | 85 | // System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0); |
86 | double y = Double.valueOf(fd_y) + b; | 86 | // //旋转坐标 |
87 | System.out.println("新坐标为:X:"+x+",Y:-"+y); | 87 | // double x = x0*sin + y0*cos; |
88 | // double y = y0*sin - x0*cos; | ||
89 | // System.out.println("旋转后坐标为:X:"+x+",Y:"+y); | ||
90 | // //平移后的坐标 | ||
91 | // double py_x = x + CommonConstant.MQ_B1_X/CommonConstant.BLC_X; | ||
92 | // double py_y = y + CommonConstant.MQ_B1_Y/CommonConstant.BLC_Y; | ||
93 | // System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y); | ||
94 | // //放大后的坐标 | ||
95 | // double fd_x = CommonConstant.BLC_X*py_x; | ||
96 | // double fd_y = CommonConstant.BLC_Y*py_y; | ||
97 | // System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y); | ||
88 | } | 98 | } |
89 | 99 | ||
90 | //B1定位坐标 | 100 | //B1定位坐标 | ... | ... |
... | @@ -6,21 +6,23 @@ public interface CommonConstant { | ... | @@ -6,21 +6,23 @@ public interface CommonConstant { |
6 | Integer SC_ERROR_500 = 500;//错误代码 | 6 | Integer SC_ERROR_500 = 500;//错误代码 |
7 | Integer SC_OK_200 = 200;//成功代码 | 7 | Integer SC_OK_200 = 200;//成功代码 |
8 | 8 | ||
9 | //**********************联通中心坐标*************************** | 9 | //**********************联通坐标*************************** |
10 | Double LT_B1_X = 379.2256164550781;//联通B1层X坐标 | 10 | Double LT_B1_X = 42.8238;//联通B1层X坐标 |
11 | Double LT_B1_Y = 368.61126708984375;//联通B1层Y坐标 | 11 | Double LT_B1_Y = 325.8339;//联通B1层Y坐标 |
12 | Double LT_B2_X = 397.35992431640625;//联通B2层X坐标 | 12 | Double LT_B2_X = 22.4297;//联通B2层X坐标 |
13 | Double LT_B2_Y = 384.9845886230469;//联通B2层Y坐标 | 13 | Double LT_B2_Y = 330.5528;//联通B2层Y坐标 |
14 | 14 | ||
15 | //**********************鸣启中心坐标*************************** | 15 | //**********************鸣启坐标*************************** |
16 | Double MQ_B1_X = -178.527924;//鸣启B1层X坐标 | 16 | Double MQ_B1_X = -9850.00;//鸣启B1层X坐标 |
17 | Double MQ_B1_Y = -1226.708374;//鸣启B1层Y坐标 | 17 | Double MQ_B1_Y = -7400.00;//鸣启B1层Y坐标 |
18 | Double MQ_B2_X = -178.527924;//鸣启B2层X坐标 | 18 | Double MQ_B2_X = -9850.00;//鸣启B2层X坐标 |
19 | Double MQ_B2_Y = -1226.708374;//鸣启B2层Y坐标 | 19 | Double MQ_B2_Y = -7430.00;//鸣启B2层Y坐标 |
20 | 20 | ||
21 | //**********************比例尺*************************** | 21 | //**********************比例尺*************************** |
22 | Double BLC1 = 100/2.54;//比例尺 | 22 | Double BLC_X = 43.7;//比例尺 |
23 | Double BLC2 = 100/2.54;//比例尺 | 23 | Double BLC_Y = 43.58;//比例尺 |
24 | //**********************旋转角度*************************** | ||
25 | Double XZJD = 64.7989;//旋转角度 | ||
24 | 26 | ||
25 | //**********************推送用户*************************** | 27 | //**********************推送用户*************************** |
26 | String CMCC = "CMCC";//联通推送用户 | 28 | String CMCC = "CMCC";//联通推送用户 | ... | ... |
... | @@ -9,33 +9,47 @@ public class CoordinateUtil { | ... | @@ -9,33 +9,47 @@ public class CoordinateUtil { |
9 | Map<String,Double> map = new HashMap<>();//初始化 | 9 | Map<String,Double> map = new HashMap<>();//初始化 |
10 | map.put("x", 0.00); | 10 | map.put("x", 0.00); |
11 | map.put("y", 0.00); | 11 | map.put("y", 0.00); |
12 | double fd_x = 0.00;//放大的X坐标 | 12 | double py_x = 0.00; |
13 | double fd_y = 0.00;//放大的Y坐标 | 13 | double py_y = 0.00; |
14 | double a = 0.00;//X偏移量 | 14 | double sin = Math.sin(CommonConstant.XZJD); |
15 | double b = 0.00;//Y偏移量 | 15 | double cos = Math.cos(CommonConstant.XZJD); |
16 | System.out.println("sin:"+sin+",cos:"+cos); | ||
16 | if("B2".equals(floor)){ | 17 | if("B2".equals(floor)){ |
17 | fd_x = CommonConstant.BLC2*(Double.valueOf(x1)-CommonConstant.LT_B2_X)+CommonConstant.LT_B2_X; | 18 | //平移到原点 |
18 | fd_y = CommonConstant.BLC2*(Double.valueOf(y1)+CommonConstant.LT_B2_Y)-CommonConstant.LT_B2_Y; | 19 | double x0 = Double.valueOf(x1) - CommonConstant.LT_B2_X; |
19 | a = CommonConstant.MQ_B2_X - CommonConstant.LT_B2_X;//原点偏移x | 20 | double y0 = Double.valueOf(y1) - CommonConstant.LT_B2_Y; |
20 | b = CommonConstant.MQ_B2_Y - CommonConstant.LT_B2_Y;//原点偏移y | 21 | System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0); |
22 | //旋转坐标 | ||
23 | double x = x0*sin + y0*cos; | ||
24 | double y = y0*sin - x0*cos; | ||
25 | System.out.println("旋转后坐标为:X:"+x+",Y:"+y); | ||
26 | //平移后的坐标 | ||
27 | py_x = x + CommonConstant.MQ_B2_X/CommonConstant.BLC_X; | ||
28 | py_y = y + CommonConstant.MQ_B2_Y/CommonConstant.BLC_Y; | ||
29 | System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y); | ||
21 | }else if("B1".equals(floor)){ | 30 | }else if("B1".equals(floor)){ |
22 | fd_x = CommonConstant.BLC1*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X; | 31 | //平移到原点 |
23 | fd_y = CommonConstant.BLC1*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y; | 32 | double x0 = Double.valueOf(x1) - CommonConstant.LT_B1_X; |
24 | a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x | 33 | double y0 = Double.valueOf(y1) - CommonConstant.LT_B1_Y; |
25 | b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y | 34 | System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0); |
35 | //旋转坐标 | ||
36 | double x = x0*sin + y0*cos; | ||
37 | double y = y0*sin - x0*cos; | ||
38 | System.out.println("旋转后坐标为:X:"+x+",Y:"+y); | ||
39 | //平移后的坐标 | ||
40 | py_x = x + CommonConstant.MQ_B1_X/CommonConstant.BLC_X; | ||
41 | py_y = y + CommonConstant.MQ_B1_Y/CommonConstant.BLC_Y; | ||
42 | System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y); | ||
26 | }else{ | 43 | }else{ |
27 | fd_x = 0.00; | 44 | py_x = 0.00; |
28 | fd_y = 0.00; | 45 | py_y = 0.00; |
29 | a = 0.00; | ||
30 | b = 0.00; | ||
31 | } | 46 | } |
47 | //放大后的坐标 | ||
48 | double fd_x = CommonConstant.BLC_X*py_x; | ||
49 | double fd_y = CommonConstant.BLC_Y*py_y; | ||
32 | System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y); | 50 | System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y); |
33 | System.out.println("偏移a:"+a+",b:"+b); | 51 | map.put("x",fd_x); |
34 | double x = Double.valueOf(fd_x) + a; | 52 | map.put("y",fd_y); |
35 | double y = Double.valueOf(fd_y) + b; | ||
36 | System.out.println("新坐标为:X:"+x+",Y:"+y); | ||
37 | map.put("x",x); | ||
38 | map.put("y",y); | ||
39 | return map; | 53 | return map; |
40 | } | 54 | } |
41 | 55 | ... | ... |
-
请 注册 或 登录 后发表评论