FMapLocation 位置服务
FMapLocation 提供轨迹回放与定位标记能力。
ts
const location = new FMapLocation(fmap);
const player = location.createTracksPlayer({
tracks: [
{
points: [
{ x: 121.23, y: 31.02, level: 1 },
{ x: 121.25, y: 31.04, level: 1 },
{ x: 121.28, y: 31.06, level: 1 },
],
},
],
autoConnectBuilding: true,
trackStyle: { color: '#1890ff', width: 4 },
markerStyle: { url: '/markers/pointer.png', size: 32 },
});
location.play(); // 播放
location.pause(); // 暂停
location.setSpeed(2); // 2 倍速
location.stop(); // 停止| 方法 | 说明 |
|---|---|
createTracksPlayer(options) | 创建轨迹播放器(tracks 轨迹数据、trackStyle 线样式、markerStyle 移动标记) |
play() / pause() / stop() | 播放控制 |
setSpeed(speed) | 播放速度 |
on(type, cb) | 轨迹事件(如 onTrackPlayerPlay) |
getMarker(type) | 获取定位标记 |
addLocationMarker(options) / removeLocationMarker(marker) | 添加 / 移除定位标记 |