-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Scene } from '@antv/l7'; | ||
import { DrawControl } from '@antv/l7-draw'; | ||
import { GaodeMap, Mapbox } from '@antv/l7-maps'; | ||
|
||
import * as React from 'react'; | ||
export default class AMapDraw extends React.Component { | ||
private scene: Scene; | ||
|
||
public componentWillUnmount() { | ||
this.scene.destroy(); | ||
} | ||
|
||
public async componentDidMount() { | ||
const scene = new Scene({ | ||
id: 'map', | ||
map: new GaodeMap({ | ||
pitch: 0, | ||
style: 'dark', // hosted style id | ||
center: [112.874, 32.76], // starting position | ||
zoom: 12, // starting zoom | ||
}), | ||
}); | ||
this.scene = scene; | ||
|
||
scene.on('loaded', () => { | ||
const drawControl = new DrawControl(scene, { | ||
position: 'topright', | ||
layout: 'horizontal', // horizontal vertical | ||
controls: { | ||
point: true, | ||
polygon: true, | ||
line: true, | ||
circle: true, | ||
rect: true, | ||
delete: true, | ||
}, | ||
}); | ||
scene.on('click', () => {}); | ||
scene.addControl(drawControl); | ||
}); | ||
} | ||
|
||
public render() { | ||
return ( | ||
<div | ||
id="map" | ||
style={{ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
}} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters