-
Notifications
You must be signed in to change notification settings - Fork 30
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
谨欣
committed
Dec 26, 2023
1 parent
4179add
commit eac37bc
Showing
4 changed files
with
65 additions
and
2 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
55 changes: 55 additions & 0 deletions
55
src/components/Control/LayerSwitchControl/demos/singleSelection.tsx
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,55 @@ | ||
import { LarkMap, LayerSwitchControl, RasterLayer, useLayer } from '@antv/larkmap'; | ||
import React from 'react'; | ||
|
||
const GOOGLE_TILE_MAP_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=s&gl=CN&x={x}&y={y}&z={z}'; | ||
|
||
const GOOGLE_TILE_MAP_ROUTER_URL = 'https://gac-geo.googlecnapps.cn/maps/vt?lyrs=h&gl=CN&x={x}&y={y}&z={z}'; | ||
|
||
const CustomComponent = () => { | ||
const googleTileMap = useLayer('googleTileMap'); | ||
const googleTileMapRouter = useLayer('googleTileMapRouter'); | ||
|
||
return ( | ||
<LayerSwitchControl | ||
multiple={false} | ||
layers={[ | ||
{ | ||
layer: googleTileMap, | ||
name: '遥感影像图层', | ||
img: 'https://mdn.alipayobjects.com/huamei_k6sfo0/afts/img/A*fG9HQpyNuv0AAAAAAAAAAAAADjWqAQ/original', | ||
}, | ||
{ | ||
layer: googleTileMapRouter, | ||
name: '文字标注图层', | ||
img: 'https://mdn.alipayobjects.com/huamei_k6sfo0/afts/img/A*CP5pQY_8Q_YAAAAAAAAAAAAADjWqAQ/original', | ||
}, | ||
]} | ||
/> | ||
); | ||
}; | ||
|
||
export default () => { | ||
return ( | ||
<LarkMap mapType="Gaode" style={{ height: '400px' }}> | ||
<RasterLayer | ||
key={GOOGLE_TILE_MAP_URL} | ||
zIndex={1} | ||
id="googleTileMap" | ||
source={{ | ||
data: GOOGLE_TILE_MAP_URL, | ||
parser: { type: 'rasterTile', tileSize: 256, zoomOffset: 0 }, | ||
}} | ||
/> | ||
<RasterLayer | ||
key={GOOGLE_TILE_MAP_ROUTER_URL} | ||
zIndex={1} | ||
id="googleTileMapRouter" | ||
source={{ | ||
data: GOOGLE_TILE_MAP_ROUTER_URL, | ||
parser: { type: 'rasterTile', tileSize: 256, zoomOffset: 0 }, | ||
}} | ||
/> | ||
<CustomComponent /> | ||
</LarkMap> | ||
); | ||
}; |
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