03ee6fa8 张雷

人员定位接口修改

1 个父辈 34445ef6
......@@ -71,20 +71,30 @@ public class IThirdServiceImpl implements IThirdService {
}
public static void main(String[] args) {
String x1 = "463.7121276855469";
String y1 = "142.59878540039062";
double fd_x = CommonConstant.BLC1*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X;
double fd_y = CommonConstant.BLC1*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y;
System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y);
double a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x
double b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y
System.out.println("偏移a:"+a+",b:"+b);
double x = Double.valueOf(fd_x) + a;
double y = Double.valueOf(fd_y) + b;
System.out.println("新坐标为:X:"+x+",Y:-"+y);
String x1 = "22.99456";
String y1 = "330.3669";
Map<String,Double> map = new HashMap<>();//初始化
map = CoordinateUtil.changCoordinate("B2",x1,y1);
System.out.println("新坐标为:X:"+map.get("x")+",Y:"+map.get("y"));
// double sin = Math.sin(CommonConstant.XZJD);
// double cos = Math.cos(CommonConstant.XZJD);
// System.out.println("sin:"+sin+",cos:"+cos);
// //平移到原点
// double x0 = Double.valueOf(x1) - CommonConstant.LT_B1_X;
// double y0 = Double.valueOf(y1) - CommonConstant.LT_B1_Y;
// System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0);
// //旋转坐标
// double x = x0*sin + y0*cos;
// double y = y0*sin - x0*cos;
// System.out.println("旋转后坐标为:X:"+x+",Y:"+y);
// //平移后的坐标
// double py_x = x + CommonConstant.MQ_B1_X/CommonConstant.BLC_X;
// double py_y = y + CommonConstant.MQ_B1_Y/CommonConstant.BLC_Y;
// System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y);
// //放大后的坐标
// double fd_x = CommonConstant.BLC_X*py_x;
// double fd_y = CommonConstant.BLC_Y*py_y;
// System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y);
}
//B1定位坐标
......
......@@ -6,21 +6,23 @@ public interface CommonConstant {
Integer SC_ERROR_500 = 500;//错误代码
Integer SC_OK_200 = 200;//成功代码
//**********************联通中心坐标***************************
Double LT_B1_X = 379.2256164550781;//联通B1层X坐标
Double LT_B1_Y = 368.61126708984375;//联通B1层Y坐标
Double LT_B2_X = 397.35992431640625;//联通B2层X坐标
Double LT_B2_Y = 384.9845886230469;//联通B2层Y坐标
//**********************鸣启中心坐标***************************
Double MQ_B1_X = -178.527924;//鸣启B1层X坐标
Double MQ_B1_Y = -1226.708374;//鸣启B1层Y坐标
Double MQ_B2_X = -178.527924;//鸣启B2层X坐标
Double MQ_B2_Y = -1226.708374;//鸣启B2层Y坐标
//**********************联通坐标***************************
Double LT_B1_X = 42.8238;//联通B1层X坐标
Double LT_B1_Y = 325.8339;//联通B1层Y坐标
Double LT_B2_X = 22.4297;//联通B2层X坐标
Double LT_B2_Y = 330.5528;//联通B2层Y坐标
//**********************鸣启坐标***************************
Double MQ_B1_X = -9850.00;//鸣启B1层X坐标
Double MQ_B1_Y = -7400.00;//鸣启B1层Y坐标
Double MQ_B2_X = -9850.00;//鸣启B2层X坐标
Double MQ_B2_Y = -7430.00;//鸣启B2层Y坐标
//**********************比例尺***************************
Double BLC1 = 100/2.54;//比例尺
Double BLC2 = 100/2.54;//比例尺
Double BLC_X = 43.7;//比例尺
Double BLC_Y = 43.58;//比例尺
//**********************旋转角度***************************
Double XZJD = 64.7989;//旋转角度
//**********************推送用户***************************
String CMCC = "CMCC";//联通推送用户
......
......@@ -9,33 +9,47 @@ public class CoordinateUtil {
Map<String,Double> map = new HashMap<>();//初始化
map.put("x", 0.00);
map.put("y", 0.00);
double fd_x = 0.00;//放大的X坐标
double fd_y = 0.00;//放大的Y坐标
double a = 0.00;//X偏移量
double b = 0.00;//Y偏移量
double py_x = 0.00;
double py_y = 0.00;
double sin = Math.sin(CommonConstant.XZJD);
double cos = Math.cos(CommonConstant.XZJD);
System.out.println("sin:"+sin+",cos:"+cos);
if("B2".equals(floor)){
fd_x = CommonConstant.BLC2*(Double.valueOf(x1)-CommonConstant.LT_B2_X)+CommonConstant.LT_B2_X;
fd_y = CommonConstant.BLC2*(Double.valueOf(y1)+CommonConstant.LT_B2_Y)-CommonConstant.LT_B2_Y;
a = CommonConstant.MQ_B2_X - CommonConstant.LT_B2_X;//原点偏移x
b = CommonConstant.MQ_B2_Y - CommonConstant.LT_B2_Y;//原点偏移y
//平移到原点
double x0 = Double.valueOf(x1) - CommonConstant.LT_B2_X;
double y0 = Double.valueOf(y1) - CommonConstant.LT_B2_Y;
System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0);
//旋转坐标
double x = x0*sin + y0*cos;
double y = y0*sin - x0*cos;
System.out.println("旋转后坐标为:X:"+x+",Y:"+y);
//平移后的坐标
py_x = x + CommonConstant.MQ_B2_X/CommonConstant.BLC_X;
py_y = y + CommonConstant.MQ_B2_Y/CommonConstant.BLC_Y;
System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y);
}else if("B1".equals(floor)){
fd_x = CommonConstant.BLC1*(Double.valueOf(x1)-CommonConstant.LT_B1_X)+CommonConstant.LT_B1_X;
fd_y = CommonConstant.BLC1*(Double.valueOf(y1)+CommonConstant.LT_B1_Y)-CommonConstant.LT_B1_Y;
a = CommonConstant.MQ_B1_X - CommonConstant.LT_B1_X;//原点偏移x
b = CommonConstant.MQ_B1_Y - CommonConstant.LT_B1_Y;//原点偏移y
//平移到原点
double x0 = Double.valueOf(x1) - CommonConstant.LT_B1_X;
double y0 = Double.valueOf(y1) - CommonConstant.LT_B1_Y;
System.out.println("平移后的坐标:x0:"+x0+",y0:"+y0);
//旋转坐标
double x = x0*sin + y0*cos;
double y = y0*sin - x0*cos;
System.out.println("旋转后坐标为:X:"+x+",Y:"+y);
//平移后的坐标
py_x = x + CommonConstant.MQ_B1_X/CommonConstant.BLC_X;
py_y = y + CommonConstant.MQ_B1_Y/CommonConstant.BLC_Y;
System.out.println("平移后的坐标为:X:"+py_x+",Y:"+py_y);
}else{
fd_x = 0.00;
fd_y = 0.00;
a = 0.00;
b = 0.00;
py_x = 0.00;
py_y = 0.00;
}
//放大后的坐标
double fd_x = CommonConstant.BLC_X*py_x;
double fd_y = CommonConstant.BLC_Y*py_y;
System.out.println("放大后的坐标为:X:"+fd_x+",Y:"+fd_y);
System.out.println("偏移a:"+a+",b:"+b);
double x = Double.valueOf(fd_x) + a;
double y = Double.valueOf(fd_y) + b;
System.out.println("新坐标为:X:"+x+",Y:"+y);
map.put("x",x);
map.put("y",y);
map.put("x",fd_x);
map.put("y",fd_y);
return map;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!