2021-05-27 19:53:22 +08:00
|
|
|
import { LineLayer, Scene } from '@antv/l7';
|
|
|
|
import { GaodeMap, Mapbox } from '@antv/l7-maps';
|
2021-04-22 15:08:41 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
export default class Amap2demo_arcLine extends React.Component {
|
|
|
|
// @ts-ignore
|
|
|
|
private scene: Scene;
|
|
|
|
|
|
|
|
public componentWillUnmount() {
|
|
|
|
this.scene.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public async componentDidMount() {
|
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2021-05-27 19:53:22 +08:00
|
|
|
map: new GaodeMap({
|
|
|
|
pitch: 40,
|
2021-04-22 15:08:41 +08:00
|
|
|
center: [107.77791556935472, 35.443286920228644],
|
|
|
|
zoom: 2.9142882493605033,
|
2021-05-27 19:53:22 +08:00
|
|
|
viewMode: '3D',
|
2021-04-22 15:08:41 +08:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
this.scene = scene;
|
|
|
|
|
|
|
|
scene.on('loaded', () => {
|
|
|
|
fetch(
|
|
|
|
'https://gw.alipayobjects.com/os/rmsportal/UEXQMifxtkQlYfChpPwT.txt',
|
|
|
|
)
|
|
|
|
.then((res) => res.text())
|
|
|
|
.then((data) => {
|
|
|
|
const layer = new LineLayer({})
|
|
|
|
.source(data, {
|
|
|
|
parser: {
|
|
|
|
type: 'csv',
|
|
|
|
x: 'lng1',
|
|
|
|
y: 'lat1',
|
|
|
|
x1: 'lng2',
|
|
|
|
y1: 'lat2',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.size(1)
|
|
|
|
.shape('arc')
|
|
|
|
.color('#8C1EB2')
|
|
|
|
.style({
|
|
|
|
opacity: 0.8,
|
|
|
|
blur: 0.99,
|
2021-09-16 12:00:58 +08:00
|
|
|
// segmentNumber: 3,
|
2022-02-15 16:58:57 +08:00
|
|
|
lineType: 'dash',
|
2021-09-02 11:59:12 +08:00
|
|
|
// dashArray: [5, 5],
|
2021-04-22 15:08:41 +08:00
|
|
|
});
|
2021-05-27 19:53:22 +08:00
|
|
|
// .forward(false)
|
2021-04-22 15:08:41 +08:00
|
|
|
scene.addLayer(layer);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div
|
|
|
|
id="map"
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|