-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: marker,polyline 支持更新 * docs: 修改一些描述信息和配置 * chore: setting * Update settings.json * Create strange-turtles-allow.md --------- Co-authored-by: 象数 <[email protected]> Co-authored-by: lvisei <[email protected]>
- Loading branch information
1 parent
50cbb53
commit 376c22b
Showing
8 changed files
with
117 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@antv/gpt-vis': patch | ||
--- | ||
|
||
feat: map support update |
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,20 @@ | ||
import { useScene } from '@antv/larkmap'; | ||
import { useEffect } from 'react'; | ||
import type { Map } from '../../types/map'; | ||
import { fitBounds, setMapStatus, setMapView } from '../../utils/map'; | ||
|
||
// 更新地图视野 | ||
export default (props: Map) => { | ||
const scene = useScene(); | ||
useEffect(() => { | ||
setMapView(props, scene); | ||
}, []); | ||
useEffect(() => { | ||
setMapStatus(props, scene); | ||
}, [props.enableRotate, props.enableScroll, props.enableZoom]); | ||
useEffect(() => { | ||
fitBounds(props, scene); | ||
}, [props.includePoints, props.markers, props.polyline, props.includePadding]); | ||
|
||
return null; | ||
}; |
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,33 @@ | ||
import type { ILayer } from '@antv/l7'; | ||
import { useScene } from '@antv/larkmap'; | ||
import { useEffect, useState } from 'react'; | ||
import type { Map } from '../../types/map'; | ||
import { setMapContext, setMarkers } from '../../utils/map'; | ||
// 渲染标记点 | ||
export default (props: Map) => { | ||
const scene = useScene(); | ||
const [layers, setLayers] = useState<ILayer[]>([]); | ||
const removeLayers = () => { | ||
layers.forEach((item) => { | ||
scene.removeLayer(item); | ||
}); | ||
}; | ||
useEffect(() => { | ||
if (!props.markers) return; | ||
// 异步调用 | ||
setMapContext(props, scene)?.then(() => { | ||
// 初始化资源 | ||
const markerLayer = setMarkers(props.markers || []); | ||
removeLayers(); | ||
markerLayer.forEach((item) => { | ||
scene.addLayer(item); | ||
}); | ||
setLayers(markerLayer); | ||
}); | ||
return () => { | ||
removeLayers(); | ||
}; | ||
}, [props.markers]); | ||
|
||
return null; | ||
}; |
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,30 @@ | ||
import type { ILayer } from '@antv/l7'; | ||
import { useScene } from '@antv/larkmap'; | ||
import { useEffect, useState } from 'react'; | ||
import type { Map } from '../../types/map'; | ||
import { setPolyline } from '../../utils/map'; | ||
// 渲染线图层 | ||
export default (props: Map) => { | ||
const scene = useScene(); | ||
const [layers, setLayers] = useState<ILayer[]>([]); | ||
const removeLayers = () => { | ||
layers.forEach((item) => { | ||
scene.removeLayer(item); | ||
}); | ||
}; | ||
useEffect(() => { | ||
if (!props.polyline) return; | ||
const lineLayers = setPolyline(props.polyline || []); | ||
removeLayers(); | ||
lineLayers.forEach((item) => { | ||
scene.addLayer(item); | ||
}); | ||
setLayers(lineLayers); | ||
|
||
return () => { | ||
removeLayers(); | ||
}; | ||
}, [props.polyline]); | ||
|
||
return null; | ||
}; |
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,5 @@ | ||
import MapView from './MapView'; | ||
import Marker from './Marker'; | ||
import Polyline from './Polyline'; | ||
|
||
export { MapView, Marker, Polyline }; |
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