Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
7be8aa05
Commit
7be8aa05
authored
Nov 10, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.车辆车速原距离算法调整为插帧算法。
parent
31967a74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
12 deletions
+40
-12
WlCarMileageServiceImpl.java
...oin/equipmanage/service/impl/WlCarMileageServiceImpl.java
+40
-12
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlCarMileageServiceImpl.java
View file @
7be8aa05
...
...
@@ -238,17 +238,18 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
if
(
jsonObject
.
containsKey
(
"data"
))
{
JSONObject
data3
=
JSONObject
.
parseObject
(
jsonObject
.
get
(
"data"
).
toString
());
JSONArray
points1
=
JSONArray
.
parseArray
(
data3
.
get
(
"points"
).
toString
());
for
(
int
i
=
0
;
i
<
points1
.
size
();
i
++)
{
JSONObject
jsonObject1
=
JSONObject
.
parseObject
(
points1
.
get
(
i
).
toString
());
List
<
Double
>
doubles
=
new
ArrayList
<>();
Coordinate
coordinate
=
new
Coordinate
();
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()));
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
()));
coordinate
.
setLnglat
(
doubles
);
Double
speeed
=
getSpeedByOriginalData
(
objects
,
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()),
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
()));
coordinate
.
setSpeed
(
speeed
);
coordinates
.
add
(
coordinate
);
}
// for (int i = 0; i < points1.size(); i++) {
// JSONObject jsonObject1 = JSONObject.parseObject(points1.get(i).toString());
// List<Double> doubles = new ArrayList<>();
// Coordinate coordinate = new Coordinate();
// doubles.add(Double.valueOf(jsonObject1.get("x").toString()));
// doubles.add(Double.valueOf(jsonObject1.get("y").toString()));
// coordinate.setLnglat(doubles);
// Double speeed = getSpeedByOriginalData(objects, Double.valueOf(jsonObject1.get("x").toString()), Double.valueOf(jsonObject1.get("y").toString()));
// coordinate.setSpeed(speeed);
// coordinates.add(coordinate);
// }
coordinates
=
giveSpeedToCoordinate
(
objects
,
points1
);
}
}
...
...
@@ -537,10 +538,14 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
for
(
int
i
=
0
;
i
<
objects
.
size
()
-
1
;
i
++)
{
JSONObject
jsonObject1
=
objects
.
getJSONObject
(
i
);
JSONObject
jsonObject2
=
objects
.
getJSONObject
(
i
+
1
);
Double
travel1
=
CoordinateUtil
.
distance
(
startLatitude
,
startLongitude
,
jsonObject1
.
getDoubleValue
(
"x"
),
jsonObject1
.
getDoubleValue
(
"y"
));
Double
travel2
=
CoordinateUtil
.
distance
(
startLatitude
,
startLongitude
,
jsonObject2
.
getDoubleValue
(
"x"
),
jsonObject2
.
getDoubleValue
(
"y"
));
log
.
info
(
"travel1:"
+
travel1
+
"travel2:"
+
travel2
);
if
(
travel2
>=
travel1
)
{
if
(
travel2
>
travel1
)
{
log
.
info
(
"travel1:"
+
travel1
+
"travel2:"
+
travel2
);
log
.
info
(
"lat:"
+
startLatitude
+
"long:"
+
startLongitude
);
log
.
info
(
"lat:"
+
jsonObject1
.
getDoubleValue
(
"x"
)+
"long:"
+
jsonObject1
.
getDoubleValue
(
"y"
));
speed
=
jsonObject1
.
getDoubleValue
(
"sp"
);
break
;
}
else
{
...
...
@@ -549,4 +554,27 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
}
return
speed
;
}
/**
*
* @param originalPoints 原始数据点位
* @param aMapPoints 高德纠偏之后的数据点位
* @return List<Coordinate> 处理之后的数据
*/
public
ArrayList
<
Coordinate
>
giveSpeedToCoordinate
(
JSONArray
originalPoints
,
JSONArray
aMapPoints
){
ArrayList
<
Coordinate
>
result
=
new
ArrayList
<>();
Double
rate
=
originalPoints
.
size
()/(
aMapPoints
.
size
()*
1.0
);
for
(
int
i
=
0
;
i
<
aMapPoints
.
size
();
i
++)
{
Integer
speedIndex
=
Double
.
valueOf
(
i
*
rate
).
intValue
();
JSONObject
jsonObject1
=
JSONObject
.
parseObject
(
aMapPoints
.
get
(
i
).
toString
());
List
<
Double
>
doubles
=
new
ArrayList
<>();
Coordinate
coordinate
=
new
Coordinate
();
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"x"
).
toString
()));
doubles
.
add
(
Double
.
valueOf
(
jsonObject1
.
get
(
"y"
).
toString
()));
coordinate
.
setLnglat
(
doubles
);
coordinate
.
setSpeed
(
originalPoints
.
getJSONObject
(
speedIndex
).
getDoubleValue
(
"sp"
));
result
.
add
(
coordinate
);
}
return
result
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment