Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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
耿迪迪
gassafety-progress
Commits
9e9ad3b3
Commit
9e9ad3b3
authored
Mar 18, 2022
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加小汽车轨迹回放功能
parent
5681ae07
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
3 deletions
+51
-3
map.js
gassafetyprogress-web/src/utils/mapClass/map.js
+51
-3
No files found.
gassafetyprogress-web/src/utils/mapClass/map.js
View file @
9e9ad3b3
/*
* @Author: your name
* @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-03-1
6 15:06:43
* @LastEditTime: 2022-03-1
8 10:59:31
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js
...
...
@@ -79,7 +79,7 @@ export class EditorMap {
// 获取朝阳区的边界信息
var
bounds
=
result
.
districtList
[
0
].
boundaries
;
var
polygons
=
[];
console
.
log
(
"boundsboundsboundsboundsbounds"
,
bounds
)
console
.
log
(
"boundsboundsboundsboundsbounds"
,
bounds
);
if
(
bounds
)
{
for
(
var
i
=
0
,
l
=
bounds
.
length
;
i
<
l
;
i
++
)
{
...
...
@@ -97,7 +97,7 @@ export class EditorMap {
strokeWeight
:
4
,
strokeColor
:
"#09f"
,
path
:
bounds
[
i
],
})
})
;
// polygons.push(polygon);
}
}
...
...
@@ -407,6 +407,7 @@ export class EditorMap {
createMarker
(
MarkerOptions
)
{
return
new
AMap
.
Marker
(
MarkerOptions
);
}
// 地图上add管道
addPipeLine
(
objData
,
component
)
{
const
{
path
,
pipePressure
,
iconType
}
=
objData
;
...
...
@@ -670,4 +671,51 @@ export class EditorMap {
}
}
}
// 轨迹回放
/**
* @description:
* @param {*} vehicleId 设备id
* @param {*} path 轨迹回访率丼
* @return {*}
*/
backTrack
(
vehicleId
,
path
)
{
infowindowClose
();
AMap
.
plugin
(
"AMap.MoveAnimation"
,
()
=>
{
let
marker
=
this
.
allDevice
[
9
].
filter
(
(
item
)
=>
item
.
getExtData
().
vehicleId
==
vehicleId
)[
0
];
// 绘制轨迹
marker
.
polyline
=
new
AMap
.
Polyline
({
map
:
this
.
map
,
path
,
showDir
:
true
,
strokeColor
:
"#28F"
,
//线颜色
// strokeOpacity: 1, //线透明度
strokeWeight
:
6
,
//线宽
// strokeStyle: "solid" //线样式
});
marker
.
passedPolyline
=
new
AMap
.
Polyline
({
map
:
this
.
map
,
strokeColor
:
"#AF5"
,
//线颜色
strokeWeight
:
6
,
//线宽
});
marker
.
on
(
"moving"
,
()
=>
{
marker
.
passedPolyline
.
setPath
(
e
.
passedPath
);
this
.
map
.
setCenter
(
e
.
target
.
getPosition
(),
true
);
});
});
}
clearbackTrack
(
vehicleId
)
{
let
marker
=
this
.
allDevice
[
9
].
filter
(
(
item
)
=>
item
.
getExtData
().
vehicleId
==
vehicleId
)[
0
];
if
(
marker
)
{
this
.
map
.
remove
(
marker
);
this
.
map
.
remove
(
marker
.
polyline
);
this
.
map
.
remove
(
marker
.
passedPolyline
);
infowindowClose
();
}
}
}
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