Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
卡
卡车调度系统
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
caicaicai
卡车调度系统
Commits
ac089eb9
Commit
ac089eb9
authored
May 26, 2022
by
caicaicai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
b19ed065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
109 deletions
+62
-109
Map.vue
src/components/mars3d/Map.vue
+62
-109
No files found.
src/components/mars3d/Map.vue
View file @
ac089eb9
...
...
@@ -30,64 +30,19 @@ export default {
name
:
'
mars3dViewer
'
,
created
(){
this
.
getC
oordinate
();
this
.
getC
arInforFn
();
},
data
(){
return
{
historyTrajectoryData
:[],
persons
:[
[
"
122.128833
"
,
"
37.526448
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128738
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.528518
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.528818
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.525818
"
,
"
500
"
],
[
"
122.121538
"
,
"
37.523318
"
,
"
500
"
],
[
"
122.127833
"
,
"
37.525448
"
,
"
500
"
],
[
"
122.128833
"
,
"
37.526448
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128738
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.528518
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.528818
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.525818
"
,
"
500
"
],
[
"
122.121538
"
,
"
37.523318
"
,
"
500
"
],
[
"
122.127833
"
,
"
37.525448
"
,
"
500
"
],
[
"
122.128833
"
,
"
37.526448
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128738
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.528518
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.528818
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.525818
"
,
"
500
"
],
[
"
122.121538
"
,
"
37.523318
"
,
"
500
"
],
[
"
122.127833
"
,
"
37.525448
"
,
"
500
"
],
[
"
122.128833
"
,
"
37.526448
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128738
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.528518
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.528818
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.525818
"
,
"
500
"
],
[
"
122.121538
"
,
"
37.523318
"
,
"
500
"
],
[
"
122.127833
"
,
"
37.525448
"
,
"
500
"
],
[
"
122.128833
"
,
"
37.526448
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128738
"
,
"
37.522818
"
,
"
500
"
],
[
"
122.128638
"
,
"
37.528518
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.528818
"
,
"
500
"
],
[
"
122.128538
"
,
"
37.525818
"
,
"
500
"
],
[
"
122.121538
"
,
"
37.523318
"
,
"
500
"
],
[
"
122.127833
"
,
"
37.525448
"
,
"
500
"
],
],
deviceId
:
'
DESKTOP-L56LKGM
'
,
zuobianData
:[],
toJavaCoordinates
:[],
weilanName
:[],
areaColorData
:[],
allCarInforData
:[],
defaultjd
:
117.12111
,
defaultwd
:
36.679
,
}
},
...
...
@@ -129,6 +84,16 @@ export default {
},
methods
:
{
//获取实时位置
getCarInforFn
(){
HttpReq
.
truckDispatching
.
carInformationQuery
({
size
:
9999
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
this
.
allCarInforData
=
res
.
data
.
content
;
this
.
getCoordinate
();
}
})
},
//后台获取数据——获取电子围栏
getCoordinate
()
{
let
that
=
this
;
...
...
@@ -150,22 +115,6 @@ export default {
}
that
.
zuobianData
=
data1
//console.log("zuobianData",that.zuobianData);
//console.log("weilanName",that.weilanName);
this
.
getlishiguijiFn
();
}
})
},
//后台获取数据——获取实时位置
getlishiguijiFn
()
{
let
that
=
this
;
HttpReq
.
truckDispatching
.
getCarTrajectoryQuery
().
then
((
res
)
=>
{
//console.log(res);
if
(
res
.
code
==
200
){
that
.
historyTrajectoryData
=
res
.
data
;
this
.
$nextTick
(()
=>
{
if
(
this
.
appendToBody
)
{
...
...
@@ -179,9 +128,10 @@ export default {
})
}
})
}
}
})
},
//创建地图
...
...
@@ -209,16 +159,17 @@ export default {
that
.
addGraphic_01
(
graphicLayer
,
item
,
that
.
weilanName
[
index
],
that
.
areaColorData
[
index
]);
})
//实时位置
// that.
historyTrajectory
Data.forEach((item,index)=>{
//实时位置
1
// that.
allCarInfor
Data.forEach((item,index)=>{
// var graphicLayer4 = new mars3d.layer.GraphicLayer();
// map.addLayer(graphicLayer4)
// that.addDemoGraphics(graphicLayer4,item);
// map.addLayer(graphicLayer4)
;
// that.addDemoGraphics(graphicLayer4,item
.number,item.equipmentName,item.carclass
);
// })
// 抛出事件
this
.
$emit
(
'
onload
'
,
map
)
},
//围栏回显
addGraphic_01
(
graphicLayer
,
positions
,
weilanName
,
color
){
let
graphic
=
new
mars3d
.
graphic
.
PolygonEntity
({
...
...
@@ -241,24 +192,16 @@ export default {
});
graphicLayer
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
},
getSampledPositionProperty
(
points
){
let
property
=
new
Cesium
.
SampledPositionProperty
();
let
start
=
this
.
map
.
clock
.
currentTime
;
let
positions
=
mars3d
.
LatLngArray
.
toCartesians
(
points
);
for
(
let
i
=
0
;
i
<
positions
.
length
;
i
++
)
{
let
time
=
Cesium
.
JulianDate
.
addSeconds
(
start
,
i
*
20
,
new
Cesium
.
JulianDate
());
let
position
=
positions
[
i
];
property
.
addSample
(
time
,
position
);
}
return
property
;
},
//实时位置
addDemoGraphics
(
graphicLayer4
,
item
)
{
//实时位置1
addDemoGraphics
(
graphicLayer4
,
number
,
equipmentName
,
carclass
)
{
let
that
=
this
;
//模型配置
const
graphic
=
new
mars3d
.
graphic
.
ModelPrimitive
({
style
:
{
url
:
"
//data.mars3d.cn/gltf/mars/car/tufangche.glb
"
,
scale
:
0.1
,
url
:
carclass
==
'
电铲
'
?
'
//data.mars3d.cn/gltf/mars/qzcar/GKZY_anim.gltf
'
:
'
//data.mars3d.cn/gltf/imap/1d4f63111fc9499dac5cee2286ad7bb3/gltf/gltf2.gltf
'
,
scale
:
2
,
minimumPixelSize
:
50
,
// 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight
:
{
...
...
@@ -269,9 +212,9 @@ export default {
},
label
:
{
// 不需要文字时,去掉label配置即可
text
:
item
.
name
,
font_size
:
16
,
color
:
"
#ff
ffff
"
,
text
:
number
,
font_size
:
22
,
color
:
"
#ff
0000
"
,
outline
:
true
,
outlineColor
:
"
#000000
"
,
pixelOffsetY
:
-
20
,
...
...
@@ -279,33 +222,43 @@ export default {
distanceDisplayCondition_far
:
50000
,
distanceDisplayCondition_near
:
0
}
}
,
}
})
//载入图层
graphicLayer4
.
addGraphic
(
graphic
)
// 设置动态位置
//初始位置
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
item
.
lat
,
item
.
lon
,
500
))
// 首次出现的位置
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
117.12111
,
36.679
,
1000
))
})
//五秒后位置
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
graphic
.
addDynamicPosition
(
that
.
randomPoint
(
item
.
name
),
6
)
// 按6秒运动至指定位置
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
117.12111
,
36.679
,
1000
),
5
)
})
// 定时更新动态位置(setInterval为演示)
// setInterval((
) => {
// graphicLayer4.eachGraphic((graphic) =>
{
// graphic.addDynamicPosition(that.randomPoint(item.name), 6)
// }
)
// }, 6000
)
},
// 取区域内的随机点
randomPoint
(
name
)
{
HttpReq
.
truckDispatching
.
getCarTrajectoryQuery
({
name
:
name
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
return
Cesium
.
Cartesian3
.
fromDegrees
(
res
.
data
[
0
].
lat
,
res
.
data
[
0
].
lon
,
500
)
}
})
//定时更新动态位置
setInterval
(()
=>
{
HttpReq
.
truckDispatching
.
getOneHistroyCarTrajectoryQuery
({
name
:
equipmentName
}).
then
((
res
)
=>
{
if
(
res
.
data
)
{
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
res
.
data
.
lon
,
res
.
data
.
lat
,
1000
),
5
)
}
)
}
else
{
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
117.12111
,
36.679
,
1000
),
5
)
})
}
}
)
},
4000
)
},
// 在图层绑定Popup弹窗
bindLayerPopup
(
graphicLayer
,
number
)
{
let
that
=
this
;
graphicLayer
.
bindPopup
(
function
(
event
)
{
that
.
$parent
.
smallWinFn
(
number
);
})
}
}
}
...
...
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