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
c67ed13d
Commit
c67ed13d
authored
Oct 08, 2022
by
xxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
78c02a89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
1 deletion
+77
-1
Map2.vue
src/components/mars3d/Map2.vue
+77
-1
No files found.
src/components/mars3d/Map2.vue
View file @
c67ed13d
...
...
@@ -26,6 +26,7 @@ Vue.prototype.mars3d = mars3d
Vue
.
prototype
.
Cesium
=
mars3d
.
Cesium
var
map
;
let
pathEntity
=
null
;
export
default
{
name
:
'
mars3dViewer
'
,
...
...
@@ -195,7 +196,7 @@ export default {
// 抛出事件
this
.
$emit
(
'
onload
'
,
map
)
},
//车辆轨迹
//车辆轨迹
1
addGraphic_02
(
graphicLayer2
,
positions
,
truckName
)
{
let
that
=
this
;
var
property
=
new
Cesium
.
SampledPositionProperty
();
...
...
@@ -244,6 +245,81 @@ export default {
graphicLayer2
.
addGraphic
(
graphic
);
//还可以另外一种写法: graphic.addTo(graphicLayer)
},
//车辆轨迹2
initPath
(
data
,
graphicLayer2
,
positions
,
truckName
)
{
const
property
=
new
Cesium
.
SampledPositionProperty
()
property
.
forwardExtrapolationType
=
Cesium
.
ExtrapolationType
.
HOLD
let
start
;
let
stop
;
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
const
item
=
data
[
i
]
const
lng
=
Number
(
item
.
x
.
toFixed
(
6
))
// 经度
const
lat
=
Number
(
item
.
y
.
toFixed
(
6
))
// 纬度
const
height
=
item
.
z
// 高度
const
time
=
item
.
time
// 时间
let
position
=
null
if
(
lng
&&
lat
)
{
position
=
Cesium
.
Cartesian3
.
fromDegrees
(
lng
,
lat
,
height
)
}
let
juliaDate
=
null
if
(
time
)
{
juliaDate
=
Cesium
.
JulianDate
.
fromIso8601
(
time
)
}
if
(
position
&&
juliaDate
)
{
property
.
addSample
(
juliaDate
,
position
)
}
if
(
i
===
0
)
{
start
=
juliaDate
}
else
if
(
i
===
len
-
1
)
{
stop
=
juliaDate
}
}
// 设置时钟属性
map
.
clock
.
startTime
=
start
.
clone
()
map
.
clock
.
stopTime
=
stop
.
clone
()
map
.
clock
.
currentTime
=
start
.
clone
()
map
.
clock
.
clockRange
=
Cesium
.
ClockRange
.
LOOP_STOP
map
.
clock
.
multiplier
=
5
if
(
map
.
controls
.
timeline
)
{
map
.
controls
.
timeline
.
zoomTo
(
start
,
stop
)
}
// 创建path对象
pathEntity
=
new
mars3d
.
graphic
.
PathEntity
({
position
:
property
,
orientation
:
new
Cesium
.
VelocityOrientationProperty
(
property
),
style
:
{
width
:
3
,
color
:
"
#ff0000
"
,
opacity
:
1.0
,
leadTime
:
0
,
// 前方的路线不显示
},
label
:
{
text
:
truckName
,
font_size
:
22
,
font_family
:
"
楷体
"
,
color
:
"
#ff0000
"
,
outline
:
true
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
2
,
horizontalOrigin
:
Cesium
.
HorizontalOrigin
.
CENTER
,
verticalOrigin
:
Cesium
.
VerticalOrigin
.
BOTTOM
,
pixelOffset
:
new
Cesium
.
Cartesian2
(
10
,
-
25
)
// 偏移量
},
model
:
{
url
:
'
//data.mars3d.cn/gltf/mars/car/tufangche.glb
'
,
scale
:
1
,
minimumPixelSize
:
50
,
},
})
graphicLayer2
.
addGraphic
(
pathEntity
)
},
getSampledPositionProperty
(
points
){
let
property
=
new
Cesium
.
SampledPositionProperty
();
let
start
=
this
.
map
.
clock
.
currentTime
;
...
...
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