antv-l7/stories/layerbuild/components/LineLinear.tsx

71 lines
1.5 KiB
TypeScript

// @ts-nocheck
// @ts-ignore
import { Scene, Source } from '@antv/l7';
import { LineLayer } from '@antv/l7-layers';
import { GaodeMap } from '@antv/l7-maps';
import * as React from 'react';
export default class Demo extends React.Component {
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new GaodeMap({
center: [120, 30],
pitch: 0,
zoom: 2,
}),
});
const layer = new LineLayer()
.source({
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'LineString',
coordinates: [
[95.625, 38.47939467327645],
[115.48828125000001, 28.92163128242129],
],
},
},
],
})
.shape('linearline')
.color('#f00')
.size(5)
.style({
rampColors: {
colors: [
'#FF4818',
'#F7B74A',
'#FFF598',
'#91EABC',
'#2EA9A1',
'#206C7C',
],
positions: [0, 0.2, 0.4, 0.6, 0.8, 1.0],
},
});
scene.on('loaded', () => {
scene.addLayer(layer);
});
}
public render() {
return (
<div
id="map"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
></div>
);
}
}