2021-06-01 19:05:03 +08:00
|
|
|
// @ts-ignore
|
|
|
|
import { LineLayer, Scene } from '@antv/l7';
|
2021-06-28 21:02:52 +08:00
|
|
|
import { GaodeMap, GaodeMapV2, Mapbox } from '@antv/l7-maps';
|
2021-06-01 19:05:03 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
export default class Amap2demo_arcLine3DTex extends React.Component {
|
|
|
|
// @ts-ignore
|
|
|
|
private scene: Scene;
|
|
|
|
|
|
|
|
public componentWillUnmount() {
|
|
|
|
this.scene.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public async componentDidMount() {
|
|
|
|
const scene = new Scene({
|
|
|
|
id: 'map',
|
2021-06-28 21:02:52 +08:00
|
|
|
map: new Mapbox({
|
2021-06-01 19:05:03 +08:00
|
|
|
pitch: 40,
|
|
|
|
center: [107.77791556935472, 35.443286920228644],
|
|
|
|
zoom: 2.9142882493605033,
|
|
|
|
viewMode: '3D',
|
2021-06-01 19:15:37 +08:00
|
|
|
style: 'dark',
|
2021-06-01 19:05:03 +08:00
|
|
|
}),
|
|
|
|
});
|
|
|
|
this.scene = scene;
|
|
|
|
|
|
|
|
scene.on('loaded', () => {
|
2021-06-28 21:02:52 +08:00
|
|
|
// setTimeout(() => {
|
|
|
|
// scene.setPitch(0);
|
|
|
|
// }, 4000);
|
2021-06-01 19:05:03 +08:00
|
|
|
scene.addImage(
|
|
|
|
'02',
|
|
|
|
'https://gw.alipayobjects.com/zos/bmw-prod/0ca1668e-38c2-4010-8568-b57cb33839b9.svg',
|
|
|
|
);
|
|
|
|
|
|
|
|
let data = [
|
|
|
|
{
|
|
|
|
lng1: 75.76171875,
|
|
|
|
lat1: 36.31512514748051,
|
|
|
|
lng2: 46.23046874999999,
|
|
|
|
lat2: 52.802761415419674,
|
2021-06-28 21:02:52 +08:00
|
|
|
testOpacity: 0.3
|
2021-06-01 19:05:03 +08:00
|
|
|
},
|
|
|
|
];
|
2021-06-08 14:32:49 +08:00
|
|
|
//// @ts-ignore
|
2021-06-01 19:05:03 +08:00
|
|
|
const layer = new LineLayer({
|
|
|
|
blend: 'normal',
|
|
|
|
})
|
|
|
|
.source(data, {
|
|
|
|
parser: {
|
|
|
|
type: 'json',
|
|
|
|
x: 'lng1',
|
|
|
|
y: 'lat1',
|
|
|
|
x1: 'lng2',
|
|
|
|
y1: 'lat2',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.size(10)
|
|
|
|
.shape('arc3d')
|
2021-06-08 14:32:49 +08:00
|
|
|
.texture('02')
|
2021-06-01 19:05:03 +08:00
|
|
|
.color('#8C1EB2')
|
|
|
|
.style({
|
2021-06-08 14:32:49 +08:00
|
|
|
lineTexture: true, // 开启线的贴图功能
|
|
|
|
iconStep: 10, // 设置贴图纹理的间距
|
|
|
|
// opacity: 0,
|
2021-06-28 21:02:52 +08:00
|
|
|
// opacity: ['testOpacity', ((d: any) => d*2)],
|
|
|
|
opacity: "testOpacity",
|
2021-06-08 14:32:49 +08:00
|
|
|
// opacity: 0.2,
|
2021-06-08 20:31:59 +08:00
|
|
|
// lineType: 'dash',
|
|
|
|
// dashArray: [5, 5],
|
2021-06-28 21:02:52 +08:00
|
|
|
textureBlend: 'replace',
|
2021-06-08 14:32:49 +08:00
|
|
|
// textureBlend: 'normal',
|
2021-06-28 21:02:52 +08:00
|
|
|
// sourceColor: '#f00',
|
|
|
|
// targetColor: '#0f0',
|
|
|
|
})
|
2021-06-01 19:05:03 +08:00
|
|
|
// .animate({
|
|
|
|
// duration: 50,
|
2021-06-08 14:32:49 +08:00
|
|
|
// interval: 0.2,
|
2021-06-28 21:02:52 +08:00
|
|
|
// trailLength: 0.05,
|
2021-06-01 19:05:03 +08:00
|
|
|
// });
|
|
|
|
scene.addLayer(layer);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div
|
|
|
|
id="map"
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|