-
Notifications
You must be signed in to change notification settings - Fork 659
Open
Description
问题描述
使用官方案例修改了下代码
官方案例
/* eslint-disable no-eval */
import { LineLayer, PointLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
pitch: 40,
center: [40, 40.16797],
style: 'dark',
zoom: 2.5,
}),
});
scene.addImage(
'plane',
'https://gw.alipayobjects.com/zos/bmw-prod/0ca1668e-38c2-4010-8568-b57cb33839b9.svg',
);
scene.on('loaded', () => {
Promise.all([
fetch(
'https://gw.alipayobjects.com/os/bmw-prod/2960e1fc-b543-480f-a65e-d14c229dd777.json',
).then((d) => d.json()),
fetch(
'https://gw.alipayobjects.com/os/basement_prod/4472780b-fea1-4fc2-9e4b-3ca716933dc7.json',
).then((d) => d.text()),
fetch(
'https://gw.alipayobjects.com/os/basement_prod/a5ac7bce-181b-40d1-8a16-271356264ad8.json',
).then((d) => d.text()),
]).then(function onLoad([world, dot, flyline]) {
// @ts-ignore
const flydata = eval(flyline).map((item) => {
// @ts-ignore
const latlng1 = item.from.split(',').map((e) => {
return e * 1;
});
// @ts-ignore
const latlng2 = item.to.split(',').map((e) => {
return e * 1;
});
return { coord: [latlng1, latlng2] };
});
const flyLine2 = new LineLayer()
.source(flydata, {
parser: {
type: 'json',
coordinates: 'coord',
},
})
.color('#ff6b34')
.shape('arc')
.size(1)
.style({
lineType: 'dash',
dashArray: [5, 5],
opacity: 0.5,
});
scene.addLayer(flyLine2);
setTimeout(() => {
flyLine2.shape('line');
scene.render();
setTimeout(() => {
flyLine2.shape('arc');
scene.render();
}, 2000);
}, 2000);
});
});
重现链接
No response
重现步骤
No response
预期行为
No response
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
github-actions
Metadata
Metadata
Assignees
Labels
No labels