Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JINRUN-PERPOSITION
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
xinzhedeai
JINRUN-PERPOSITION
Commits
3a3d83c5
Commit
3a3d83c5
authored
Nov 19, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:100米内测试
parent
7b2b66c8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
59 deletions
+74
-59
index-guiji.vue
src/views/index-guiji.vue
+74
-59
No files found.
src/views/index-guiji.vue
View file @
3a3d83c5
...
...
@@ -72,6 +72,12 @@ export default {
trailEntities
:
{},
// 轨迹实体
isTracking
:
false
,
// 是否正在实时追踪
currentTimeDisplay
:
""
,
// 当前显示时间
// 添加轨迹相关配置
trajectoryConfig
:
{
pointCount
:
10
,
// 每个人员的轨迹点数量
maxRange
:
0.001
,
// 约100米范围(1度约等于111公里,0.001度约等于111米)
heightOffset
:
5
,
// 轨迹点高度偏移
},
};
},
mounted
()
{
...
...
@@ -108,9 +114,9 @@ export default {
const
now
=
new
Date
();
const
points
=
[];
//
生成过去1小时的时间点,每5分钟一个
for
(
let
i
=
60
;
i
>=
0
;
i
-=
5
)
{
const
time
=
new
Date
(
now
.
getTime
()
-
i
*
60
*
1000
);
//
只生成10个时间点,用于显示10个轨迹点
for
(
let
i
=
9
;
i
>=
0
;
i
--
)
{
const
time
=
new
Date
(
now
.
getTime
()
-
i
*
5
*
60
*
1000
);
// 每5分钟一个点
points
.
push
(
time
);
}
...
...
@@ -137,21 +143,32 @@ export default {
// 为每个人生成轨迹数据
this
.
personnelList
.
forEach
((
person
)
=>
{
const
trajectories
=
[];
let
currentLng
=
baseLongitude
+
(
Math
.
random
()
-
0.5
)
*
0.0001
;
let
currentLat
=
baseLatitude
+
(
Math
.
random
()
-
0.5
)
*
0.0001
;
this
.
timePoints
.
forEach
((
time
)
=>
{
// 生成平滑的移动路径
currentLng
+=
(
Math
.
random
()
-
0.5
)
*
0.00002
;
currentLat
+=
(
Math
.
random
()
-
0.5
)
*
0.00002
;
// 为每个人生成一个随机的起始位置,在基准点附近
const
personBaseLng
=
baseLongitude
+
(
Math
.
random
()
-
0.5
)
*
this
.
trajectoryConfig
.
maxRange
*
0.5
;
const
personBaseLat
=
baseLatitude
+
(
Math
.
random
()
-
0.5
)
*
this
.
trajectoryConfig
.
maxRange
*
0.5
;
// 生成10个轨迹点,形成一个合理的移动路径
for
(
let
i
=
0
;
i
<
this
.
trajectoryConfig
.
pointCount
;
i
++
)
{
// 在人员基准位置附近生成轨迹点,确保在100米范围内
const
lngOffset
=
(
Math
.
random
()
-
0.5
)
*
this
.
trajectoryConfig
.
maxRange
;
const
latOffset
=
(
Math
.
random
()
-
0.5
)
*
this
.
trajectoryConfig
.
maxRange
;
trajectories
.
push
({
time
,
lng
:
currentLng
,
lat
:
currentLat
,
height
:
baseHeight
,
});
time
:
this
.
timePoints
[
i
],
lng
:
personBaseLng
+
lngOffset
,
lat
:
personBaseLat
+
latOffset
,
height
:
baseHeight
+
(
Math
.
random
()
-
0.5
)
*
this
.
trajectoryConfig
.
heightOffset
,
});
}
this
.
personTrajectories
[
person
.
perName
]
=
trajectories
;
});
...
...
@@ -306,28 +323,25 @@ export default {
);
});
// 创建轨迹线
// 创建轨迹线
,使用更明显的样式
const
trailEntity
=
this
.
viewer
.
entities
.
add
({
polyline
:
{
positions
:
positions
,
width
:
3
,
width
:
4
,
material
:
new
Cesium
.
PolylineGlowMaterialProperty
({
glowPower
:
0.
5
,
glowPower
:
0.
6
,
color
:
Cesium
.
Color
.
YELLOW
,
}),
clampToGround
:
false
,
// 确保轨迹线在倾斜摄影上显示
heightReference
:
Cesium
.
HeightReference
.
CLAMP_TO_3D_TILE
,
},
});
this
.
trailEntities
[
this
.
selectedPerson
]
=
trailEntity
;
// 添加
轨迹点标记
// 添加
所有轨迹点标记,因为只有10个点
trajectories
.
forEach
((
point
,
index
)
=>
{
// 只显示部分点,避免过多标记影响性能
if
(
index
%
Math
.
ceil
(
trajectories
.
length
/
10
)
===
0
||
index
===
trajectories
.
length
-
1
)
{
const
pointEntity
=
this
.
viewer
.
entities
.
add
({
position
:
Cesium
.
Cartesian3
.
fromDegrees
(
point
.
lng
,
...
...
@@ -335,24 +349,21 @@ export default {
point
.
height
+
5
),
point
:
{
pixelSize
:
5
,
pixelSize
:
6
,
color
:
index
===
trajectories
.
length
-
1
?
Cesium
.
Color
.
RED
:
Cesium
.
Color
.
GREEN
,
outlineColor
:
Cesium
.
Color
.
WHITE
,
outlineWidth
:
2
,
// 确保点在倾斜摄影上显示
heightReference
:
Cesium
.
HeightReference
.
CLAMP_TO_3D_TILE
,
},
description
:
`<div><p>时间:
${
this
.
formatTime
(
point
.
time
)}
</p></div>`
,
description
:
`<div><p>时间:
${
this
.
formatTime
(
point
.
time
)}
</p></div>`
,
});
if
(
!
this
.
trailEntities
[
`
${
this
.
selectedPerson
}
_point_
${
index
}
`
])
{
this
.
trailEntities
[
`
${
this
.
selectedPerson
}
_point_
${
index
}
`
]
=
pointEntity
;
}
}
});
},
...
...
@@ -398,7 +409,11 @@ export default {
heightReference
:
Cesium
.
HeightReference
.
CLAMP_TO_3D_TILE
,
},
description
:
`<div><h4>
${
item
[
idField
]}${
item
.
status
}
</h4></div>`
,
fixedFrame
:
Cesium
.
Transforms
.
eastNorthUpToFixedFrame
(
position
),
// 确保实体固定在正确位置
position
:
new
Cesium
.
CallbackProperty
(()
=>
{
return
Cesium
.
Cartesian3
.
fromDegrees
(
lng
,
lat
,
height
);
},
false
),
// 为了在3D Tiles上正确显示,不使用fixedFrame
});
entity
.
info
=
item
;
...
...
@@ -573,28 +588,26 @@ export default {
// 清除现有的人员列表
this.personnelList = [];
// 生成10个不同的经纬度坐标
const maxOffset = 0.00005;
// 生成10个不同的经纬度坐标,范围在100米内
for (let index = 0; index < 10; index++) {
// 生成随机偏移量
const lngOffset = (Math.random() - 0.5) * 2 * maxOffset;
const latOffset = (Math.random() - 0.5) * 2 * maxOffset;
// 生成随机偏移量,确保在100米范围内
const lngOffset =
(Math.random() - 0.5) * this.trajectoryConfig.maxRange;
const latOffset =
(Math.random() - 0.5) * this.trajectoryConfig.maxRange;
this.personnelList.push({
lng: baseLongitude + lngOffset,
lat: baseLatitude + latOffset,
height: baseHeight,
perName: "
张三" + index,
perName: "
人员" + (index + 1), // 修改名称格式
status: "online", // 在线
avatar: "/static/images/avatars/zhangsan.png", // 头像
});
}
// 初始化轨迹数据(如果尚未初始化)
if (Object.keys(this.personTrajectories).length === 0) {
// 重新初始化轨迹数据
this.initPersonTrajectories();
}
fn(this.personnelList);
},
...
...
@@ -731,6 +744,8 @@ export default {
duration: 2, // 过渡时间2秒
complete: () => {
console.log("相机已成功定位到模型上方");
// 先初始化时间点数据,再创建人员模型
this.initTimePoints();
this.createPersonModel(); // 定位后创建人员模型
},
});
...
...
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