-
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.
* feat: 图层显隐控件增加multiple属性 * feat: 图层显隐控件新增多选模式 --------- Co-authored-by: 谨欣 <echo.cmy@antgroup.com>
- Loading branch information
Showing
5 changed files
with
70 additions
and
3 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
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