Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
oEshield
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e588e750
authored
May 20, 2022
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
轨迹回放速度 代码优化
1 parent
8492947a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
src/utils/replay.js
src/utils/replay.js
View file @
e588e75
...
@@ -277,27 +277,36 @@ const replay = {
...
@@ -277,27 +277,36 @@ const replay = {
//mapService.setFitView(MAP);
//mapService.setFitView(MAP);
},
},
speedEvent
(
idx
,
dis
)
{
let
timeArr
=
[[
40
,
30
,
16
],
[
30
,
20
,
12
],
[
20
,
12
,
8
],
[
5
,
3
,
2
]]
// 慢 正常 快 很快
let
speed
if
(
dis
>=
100
)
{
// 100公里以上
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
0
])
*
3600
)
}
else
if
(
dis
>
10
&&
dis
<
100
)
{
// 10-100公里
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
1
])
*
3600
)
}
else
{
// 10公里以内
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
2
])
*
3600
)
}
return
speed
},
getSpeed
(
idx
,
dis
){
// 根据路径距离和回放时间 算出回放的speed
getSpeed
(
idx
,
dis
){
// 根据路径距离和回放时间 算出回放的speed
let
speed
;
//
let speed;
switch
(
idx
){
//
switch(idx){
case
1
:
//
case 1:
// speed = 2000
// speed = 2000
speed
=
dis
>=
100
?
Math
.
floor
((
dis
/
30
)
*
3600
)
:
dis
>
10
&&
dis
<
100
?
Math
.
floor
((
dis
/
20
)
*
3600
)
:
Math
.
floor
((
dis
/
12
)
*
3600
);
// break;
break
;
// case 2:
case
2
:
// speed = 5000;
// speed = 5000;
speed
=
dis
>=
100
?
Math
.
floor
((
dis
/
20
)
*
3600
)
:
dis
>
10
&&
dis
<
100
?
Math
.
floor
((
dis
/
12
)
*
3600
)
:
Math
.
floor
((
dis
/
8
)
*
3600
);
// break;
break
;
// case 3:
case
3
:
// speed = 10000;
// speed = 10000;
speed
=
dis
>=
100
?
Math
.
floor
((
dis
/
5
)
*
3600
)
:
dis
>
10
&&
dis
<
100
?
Math
.
floor
((
dis
/
3
)
*
3600
)
:
Math
.
floor
((
dis
/
2
)
*
3600
);
// break;
break
;
// default:
default
:
// speed = 500;
// speed = 500;
speed
=
dis
>=
100
?
Math
.
floor
((
dis
/
40
)
*
3600
)
:
dis
>
10
&&
dis
<
100
?
Math
.
floor
((
dis
/
30
)
*
3600
)
:
Math
.
floor
((
dis
/
16
)
*
3600
)
;
// break
;
break
;
// }
}
// return speed;
return
speed
;
return
this
.
speedEvent
(
idx
,
dis
)
},
},
clearTimeoutIds
(){
clearTimeoutIds
(){
replay
.
timeoutIds
.
forEach
((
item
)
=>
{
replay
.
timeoutIds
.
forEach
((
item
)
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment