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 {
...
@@ -30,64 +30,19 @@ export default {
name
:
'
mars3dViewer
'
,
name
:
'
mars3dViewer
'
,
created
(){
created
(){
this
.
getC
oordinate
();
this
.
getC
arInforFn
();
},
},
data
(){
data
(){
return
{
return
{
historyTrajectoryData
:[],
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
:[],
zuobianData
:[],
toJavaCoordinates
:[],
toJavaCoordinates
:[],
weilanName
:[],
weilanName
:[],
areaColorData
:[],
areaColorData
:[],
allCarInforData
:[],
defaultjd
:
117.12111
,
defaultwd
:
36.679
,
}
}
},
},
...
@@ -129,6 +84,16 @@ export default {
...
@@ -129,6 +84,16 @@ export default {
},
},
methods
:
{
methods
:
{
//获取实时位置
getCarInforFn
(){
HttpReq
.
truckDispatching
.
carInformationQuery
({
size
:
9999
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
this
.
allCarInforData
=
res
.
data
.
content
;
this
.
getCoordinate
();
}
})
},
//后台获取数据——获取电子围栏
//后台获取数据——获取电子围栏
getCoordinate
()
{
getCoordinate
()
{
let
that
=
this
;
let
that
=
this
;
...
@@ -150,22 +115,6 @@ export default {
...
@@ -150,22 +115,6 @@ export default {
}
}
that
.
zuobianData
=
data1
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
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
appendToBody
)
{
if
(
this
.
appendToBody
)
{
...
@@ -179,9 +128,10 @@ export default {
...
@@ -179,9 +128,10 @@ export default {
})
})
}
}
})
})
}
}
})
})
},
},
//创建地图
//创建地图
...
@@ -209,16 +159,17 @@ export default {
...
@@ -209,16 +159,17 @@ export default {
that
.
addGraphic_01
(
graphicLayer
,
item
,
that
.
weilanName
[
index
],
that
.
areaColorData
[
index
]);
that
.
addGraphic_01
(
graphicLayer
,
item
,
that
.
weilanName
[
index
],
that
.
areaColorData
[
index
]);
})
})
//实时位置
//实时位置
1
// that.
historyTrajectory
Data.forEach((item,index)=>{
// that.
allCarInfor
Data.forEach((item,index)=>{
// var graphicLayer4 = new mars3d.layer.GraphicLayer();
// var graphicLayer4 = new mars3d.layer.GraphicLayer();
// map.addLayer(graphicLayer4)
// map.addLayer(graphicLayer4)
;
// that.addDemoGraphics(graphicLayer4,item);
// that.addDemoGraphics(graphicLayer4,item
.number,item.equipmentName,item.carclass
);
// })
// })
// 抛出事件
// 抛出事件
this
.
$emit
(
'
onload
'
,
map
)
this
.
$emit
(
'
onload
'
,
map
)
},
},
//围栏回显
//围栏回显
addGraphic_01
(
graphicLayer
,
positions
,
weilanName
,
color
){
addGraphic_01
(
graphicLayer
,
positions
,
weilanName
,
color
){
let
graphic
=
new
mars3d
.
graphic
.
PolygonEntity
({
let
graphic
=
new
mars3d
.
graphic
.
PolygonEntity
({
...
@@ -241,24 +192,16 @@ export default {
...
@@ -241,24 +192,16 @@ export default {
});
});
graphicLayer
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
graphicLayer
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
},
},
getSampledPositionProperty
(
points
){
let
property
=
new
Cesium
.
SampledPositionProperty
();
//实时位置1
let
start
=
this
.
map
.
clock
.
currentTime
;
addDemoGraphics
(
graphicLayer4
,
number
,
equipmentName
,
carclass
)
{
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
)
{
let
that
=
this
;
let
that
=
this
;
//模型配置
const
graphic
=
new
mars3d
.
graphic
.
ModelPrimitive
({
const
graphic
=
new
mars3d
.
graphic
.
ModelPrimitive
({
style
:
{
style
:
{
url
:
"
//data.mars3d.cn/gltf/mars/car/tufangche.glb
"
,
url
:
carclass
==
'
电铲
'
?
'
//data.mars3d.cn/gltf/mars/qzcar/GKZY_anim.gltf
'
:
'
//data.mars3d.cn/gltf/imap/1d4f63111fc9499dac5cee2286ad7bb3/gltf/gltf2.gltf
'
,
scale
:
0.1
,
scale
:
2
,
minimumPixelSize
:
50
,
minimumPixelSize
:
50
,
// 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
// 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight
:
{
highlight
:
{
...
@@ -269,9 +212,9 @@ export default {
...
@@ -269,9 +212,9 @@ export default {
},
},
label
:
{
label
:
{
// 不需要文字时,去掉label配置即可
// 不需要文字时,去掉label配置即可
text
:
item
.
name
,
text
:
number
,
font_size
:
16
,
font_size
:
22
,
color
:
"
#ff
ffff
"
,
color
:
"
#ff
0000
"
,
outline
:
true
,
outline
:
true
,
outlineColor
:
"
#000000
"
,
outlineColor
:
"
#000000
"
,
pixelOffsetY
:
-
20
,
pixelOffsetY
:
-
20
,
...
@@ -279,33 +222,43 @@ export default {
...
@@ -279,33 +222,43 @@ export default {
distanceDisplayCondition_far
:
50000
,
distanceDisplayCondition_far
:
50000
,
distanceDisplayCondition_near
:
0
distanceDisplayCondition_near
:
0
}
}
}
,
}
})
})
//载入图层
graphicLayer4
.
addGraphic
(
graphic
)
graphicLayer4
.
addGraphic
(
graphic
)
//初始位置
// 设置动态位置
graphicLayer4
.
eachGraphic
((
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
)
=>
{
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
graphic
.
addDynamicPosition
(
that
.
randomPoint
(
item
.
name
),
6
)
// 按6秒运动至指定位置
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
117.12111
,
36.679
,
1000
),
5
)
})
})
//定时更新动态位置
// 定时更新动态位置(setInterval为演示)
setInterval
(()
=>
{
// setInterval((
) => {
HttpReq
.
truckDispatching
.
getOneHistroyCarTrajectoryQuery
({
name
:
equipmentName
}).
then
((
res
)
=>
{
// graphicLayer4.eachGraphic((graphic) =>
{
if
(
res
.
data
)
{
// graphic.addDynamicPosition(that.randomPoint(item.name), 6)
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
// }
)
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
res
.
data
.
lon
,
res
.
data
.
lat
,
1000
),
5
)
// }, 6000
)
}
)
},
}
else
{
// 取区域内的随机点
graphicLayer4
.
eachGraphic
((
graphic
)
=>
{
randomPoint
(
name
)
{
graphic
.
addDynamicPosition
(
Cesium
.
Cartesian3
.
fromDegrees
(
117.12111
,
36.679
,
1000
),
5
)
HttpReq
.
truckDispatching
.
getCarTrajectoryQuery
({
name
:
name
}).
then
((
res
)
=>
{
})
if
(
res
.
code
==
200
){
}
return
Cesium
.
Cartesian3
.
fromDegrees
(
res
.
data
[
0
].
lat
,
res
.
data
[
0
].
lon
,
500
)
}
)
}
},
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