Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skreceive
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
9372cbec
由
张雷
编写于
2022-09-15 13:46:04 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
人员定位代码优化修改
1 个父辈
3fd840a0
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
54 行增加
和
39 行删除
src/main/java/com/jkdata/service/impl/IThirdServiceImpl.java
src/main/java/com/jkdata/tool/CoordinateUtil.java
src/main/java/com/jkdata/service/impl/IThirdServiceImpl.java
查看文件 @
9372cbe
...
...
@@ -2,13 +2,10 @@ package com.jkdata.service.impl;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jkdata.tool.
CommonConstant
;
import
com.jkdata.tool.
*
;
import
com.jkdata.entity.ThirdPosition
;
import
com.jkdata.mapper.ThirdMapper
;
import
com.jkdata.service.IThirdService
;
import
com.jkdata.tool.MD5Util
;
import
com.jkdata.tool.RedisUtil
;
import
com.jkdata.tool.UUIDGenerator
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -89,49 +86,23 @@ public class IThirdServiceImpl implements IThirdService {
//B1定位坐标
private
void
changCoordinateB1
(
ThirdPosition
thirdPosition
)
{
Map
<
String
,
Double
>
map
=
new
HashMap
<>();
//初始化
String
x1
=
thirdPosition
.
getPositionx
();
String
y1
=
thirdPosition
.
getPositiony
();
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
);
//原点偏移
// double new_fd_x = 10*(Double.valueOf(x)-CommonConstant.MQ_B1_X)+CommonConstant.MQ_B1_X;
// double new_fd_y = 10*(Double.valueOf(y)+CommonConstant.MQ_B1_Y)-CommonConstant.MQ_B1_Y;
// System.out.println("新放大后的坐标为:X:"+new_fd_x+",Y:"+new_fd_y);
thirdPosition
.
setPositionx
(
String
.
valueOf
(
x
));
thirdPosition
.
setPositiony
(
String
.
valueOf
(
y
));
map
=
CoordinateUtil
.
changCoordinate
(
"B1"
,
x1
,
y1
);
thirdPosition
.
setPositionx
(
String
.
valueOf
(
map
.
get
(
"x"
)));
thirdPosition
.
setPositiony
(
String
.
valueOf
(
map
.
get
(
"y"
)));
addPositionInfo
(
thirdPosition
);
//添加转换后坐标信息
}
//B2定位坐标
private
void
changCoordinateB2
(
ThirdPosition
thirdPosition
)
{
Map
<
String
,
Double
>
map
=
new
HashMap
<>();
//初始化
String
x1
=
thirdPosition
.
getPositionx
();
String
y1
=
thirdPosition
.
getPositiony
();
double
fd_x
=
CommonConstant
.
BLC2
*(
Double
.
valueOf
(
x1
)-
CommonConstant
.
LT_B2_X
)+
CommonConstant
.
LT_B2_X
;
double
fd_y
=
CommonConstant
.
BLC2
*(
Double
.
valueOf
(
y1
)+
CommonConstant
.
LT_B2_Y
)-
CommonConstant
.
LT_B2_Y
;
System
.
out
.
println
(
"放大后的坐标为:X:"
+
fd_x
+
",Y:"
+
fd_y
);
double
a
=
CommonConstant
.
MQ_B2_X
-
CommonConstant
.
LT_B2_X
;
//原点偏移x
double
b
=
CommonConstant
.
MQ_B2_Y
-
CommonConstant
.
LT_B2_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
);
thirdPosition
.
setPositionx
(
String
.
valueOf
(
x
));
thirdPosition
.
setPositiony
(
String
.
valueOf
(
y
));
map
=
CoordinateUtil
.
changCoordinate
(
"B2"
,
x1
,
y1
);
thirdPosition
.
setPositionx
(
String
.
valueOf
(
map
.
get
(
"x"
)));
thirdPosition
.
setPositiony
(
String
.
valueOf
(
map
.
get
(
"y"
)));
addPositionInfo
(
thirdPosition
);
//添加转换后坐标信息
}
...
...
@@ -214,7 +185,7 @@ public class IThirdServiceImpl implements IThirdService {
@Override
public
String
getSafeArea
()
{
String
get
=
HttpUtil
.
get
(
CommonConstant
.
SAFE_AREA_URL
+
"?buildingId=
10"
);
String
get
=
HttpUtil
.
get
(
CommonConstant
.
SAFE_AREA_URL
+
"?buildingId=
"
+
CommonConstant
.
BLD_ID
);
return
get
;
}
...
...
src/main/java/com/jkdata/tool/CoordinateUtil.java
0 → 100644
查看文件 @
9372cbe
package
com
.
jkdata
.
tool
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
CoordinateUtil
{
public
static
Map
<
String
,
Double
>
changCoordinate
(
String
floor
,
String
x1
,
String
y1
){
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偏移量
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
;
System
.
out
.
println
(
"放大后的坐标为:X:"
+
fd_x
+
",Y:"
+
fd_y
);
a
=
CommonConstant
.
MQ_B2_X
-
CommonConstant
.
LT_B2_X
;
//原点偏移x
b
=
CommonConstant
.
MQ_B2_Y
-
CommonConstant
.
LT_B2_Y
;
//原点偏移y
System
.
out
.
println
(
"偏移a:"
+
a
+
",b:"
+
b
);
}
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
;
System
.
out
.
println
(
"放大后的坐标为:X:"
+
fd_x
+
",Y:"
+
fd_y
);
a
=
CommonConstant
.
MQ_B1_X
-
CommonConstant
.
LT_B1_X
;
//原点偏移x
b
=
CommonConstant
.
MQ_B1_Y
-
CommonConstant
.
LT_B1_Y
;
//原点偏移y
System
.
out
.
println
(
"偏移a:"
+
a
+
",b:"
+
b
);
}
else
{
fd_x
=
0.00
;
fd_y
=
0.00
;
a
=
0.00
;
b
=
0.00
;
}
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
);
return
map
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论