地图上画轨迹
This commit is contained in:
@@ -175,7 +175,20 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
viewer.entities.remove(trackLineRef.current);
|
viewer.entities.remove(trackLineRef.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!points || points.length === 0) return;
|
// 2. 传入的 points 本身为空 → 清空轨迹退出
|
||||||
|
if (!points || points.length === 0) {
|
||||||
|
const viewer = viewerRef.current;
|
||||||
|
if (viewer) {
|
||||||
|
try {
|
||||||
|
if (trackLineRef.current) {
|
||||||
|
viewer.entities.remove(trackLineRef.current);
|
||||||
|
trackLineRef.current = null;
|
||||||
|
}
|
||||||
|
} catch (e) { }
|
||||||
|
viewer.scene.requestRender(); // 强制刷新!
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const validPoints = points.filter(p => {
|
const validPoints = points.filter(p => {
|
||||||
const lon = Number(p.lon);
|
const lon = Number(p.lon);
|
||||||
|
|||||||
Reference in New Issue
Block a user