f0fee236 张雷

定位坐标转换

1 个父辈 70f83082
1 package com.it.entity; 1 package com.it.entity;
2 2
3 public interface CommonConstant { 3 public interface CommonConstant {
4 Integer SC_INTERNAL_SERVER_ERROR_500 = 500; 4 Integer SC_ERROR_500 = 500;
5 Integer SC_OK_200 = 200; 5 Integer SC_OK_200 = 200;
6 6
7 //**********************联通中心坐标*************************** 7 //**********************联通中心坐标***************************
......
...@@ -24,7 +24,7 @@ public class Result<T> implements Serializable { ...@@ -24,7 +24,7 @@ public class Result<T> implements Serializable {
24 24
25 public Result<T> error500(String message) { 25 public Result<T> error500(String message) {
26 this.message = message; 26 this.message = message;
27 this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500; 27 this.code = CommonConstant.SC_ERROR_500;
28 this.success = false; 28 this.success = false;
29 return this; 29 return this;
30 } 30 }
...@@ -61,7 +61,7 @@ public class Result<T> implements Serializable { ...@@ -61,7 +61,7 @@ public class Result<T> implements Serializable {
61 } 61 }
62 62
63 public static Result<Object> error(String msg) { 63 public static Result<Object> error(String msg) {
64 return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg); 64 return error(CommonConstant.SC_ERROR_500, msg);
65 } 65 }
66 66
67 public static Result<Object> error(int code, String msg) { 67 public static Result<Object> error(int code, String msg) {
......
...@@ -49,12 +49,12 @@ public class IThirdServiceImpl implements IThirdService { ...@@ -49,12 +49,12 @@ public class IThirdServiceImpl implements IThirdService {
49 } 49 }
50 50
51 public static void main(String[] args) { 51 public static void main(String[] args) {
52 changCoordinate("600.2330322265625","-300.28587341308594"); 52 changCoordinate("101.1636962890625","325.2133483886719");
53 } 53 }
54 54
55 55
56 private static void changCoordinate(String x1, String y1) { 56 private static void changCoordinate(String x1, String y1) {
57 double blc = 2.54;//联通比例尺 57 double blc = 100/2.54;//比例尺
58 58
59 double fd_x = blc*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X; 59 double fd_x = blc*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X;
60 double fd_y = blc*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y; 60 double fd_y = blc*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y;
...@@ -62,9 +62,15 @@ public class IThirdServiceImpl implements IThirdService { ...@@ -62,9 +62,15 @@ public class IThirdServiceImpl implements IThirdService {
62 62
63 double a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x 63 double a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x
64 double b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y 64 double b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y
65 System.out.println("偏移a:"+a+",b:"+b);
65 66
66 double x = Double.valueOf(fd_x) + a; 67 double x = Double.valueOf(fd_x) + a;
67 double y = Double.valueOf(fd_y) + b; 68 double y = Double.valueOf(fd_y) + b;
68 System.out.println("新坐标为:X:"+x+",Y:"+y); 69 System.out.println("新坐标为:X:"+x+",Y:-"+y);
70
71 //原点偏移
72 // double new_fd_x = 10*(Double.valueOf(x)-CommonConstant.MQ_B1_X)+CommonConstant.MQ_B1_X;
73 // double new_fd_y = 10*(Double.valueOf(y)+CommonConstant.MQ_B1_Y)-CommonConstant.MQ_B1_Y;
74 // System.out.println("新放大后的坐标为:X:"+new_fd_x+",Y:"+new_fd_y);
69 } 75 }
70 } 76 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!