mirror of https://gitee.com/antv-l7/antv-l7
46 lines
936 B
TypeScript
46 lines
936 B
TypeScript
|
import { LineLayer, PointLayer, PolygonLayer, Popup, Scene } from '@antv/l7';
|
||
|
import { DrawPoint } from '@antv/l7-draw';
|
||
|
import { GaodeMap, Mapbox } from '@antv/l7-maps';
|
||
|
|
||
|
import * as React from 'react';
|
||
|
export default class Circle extends React.Component {
|
||
|
private scene: Scene;
|
||
|
|
||
|
public componentWillUnmount() {
|
||
|
this.scene.destroy();
|
||
|
}
|
||
|
|
||
|
public async componentDidMount() {
|
||
|
const scene = new Scene({
|
||
|
id: 'map',
|
||
|
map: new Mapbox({
|
||
|
pitch: 0,
|
||
|
style: 'light',
|
||
|
center: [113.775374, 28.31067],
|
||
|
zoom: 12,
|
||
|
}),
|
||
|
});
|
||
|
this.scene = scene;
|
||
|
|
||
|
scene.on('loaded', () => {
|
||
|
const drawPoint = new DrawPoint(scene);
|
||
|
drawPoint.enable();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public render() {
|
||
|
return (
|
||
|
<div
|
||
|
id="map"
|
||
|
style={{
|
||
|
position: 'absolute',
|
||
|
top: 0,
|
||
|
left: 0,
|
||
|
right: 0,
|
||
|
bottom: 0,
|
||
|
}}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
}
|