This commit is contained in:
jingna 2025-07-29 16:10:57 +08:00
commit 97317baeee
5 changed files with 159 additions and 103 deletions

View File

@ -1575,13 +1575,13 @@ export const CHART_TYPE_CONFIGS = [
title: t('chart.chart_symbolic_map'), title: t('chart.chart_symbolic_map'),
icon: 'symbolic-map' icon: 'symbolic-map'
}, },
{ // {
render: 'antv', // render: 'antv',
category: 'map', // category: 'map',
value: 'three-map', // value: 'three-map',
title: t('chart.three_map'), // title: t('chart.three_map'),
icon: 'three-map' // icon: 'three-map'
} // }
] ]
}, },
{ {

View File

@ -63,7 +63,6 @@ export const gaodeMapStyleOptions = [
{ name: t('chart.map_style_fresh'), value: 'fresh' }, { name: t('chart.map_style_fresh'), value: 'fresh' },
{ name: t('chart.map_style_grey'), value: 'grey' }, { name: t('chart.map_style_grey'), value: 'grey' },
{ name: t('chart.map_style_blue'), value: 'blue' }, { name: t('chart.map_style_blue'), value: 'blue' },
{ name: t('chart.map_style_translate'), value: 'Satellite' },
{ name: t('commons.custom'), value: 'custom' } { name: t('commons.custom'), value: 'custom' }
] ]

View File

@ -12,8 +12,10 @@ import { GaodeMap } from '@antv/l7-maps'
import { Scene } from '@antv/l7-scene' import { Scene } from '@antv/l7-scene'
import { LineLayer } from '@antv/l7-layers' import { LineLayer } from '@antv/l7-layers'
import { PointLayer } from '@antv/l7-layers' import { PointLayer } from '@antv/l7-layers'
import { mapRendered, mapRendering } from '@/views/chart/components/js/panel/common/common_antv' import { mapRendered, mapRendering,getMapScene } from '@/views/chart/components/js/panel/common/common_antv'
import { DEFAULT_BASIC_STYLE } from '@/views/chart/components/editor/util/chart' import { DEFAULT_BASIC_STYLE } from '@/views/chart/components/editor/util/chart'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const { t } = useI18n() const { t } = useI18n()
/** /**
@ -87,7 +89,6 @@ export class FlowMap extends L7ChartView<Scene, L7Config> {
const xAxis = deepCopy(chart.xAxis) const xAxis = deepCopy(chart.xAxis)
const xAxisExt = deepCopy(chart.xAxisExt) const xAxisExt = deepCopy(chart.xAxisExt)
const { basicStyle, misc } = deepCopy(parseJson(chart.customAttr)) const { basicStyle, misc } = deepCopy(parseJson(chart.customAttr))
let center: [number, number] = [ let center: [number, number] = [
DEFAULT_BASIC_STYLE.mapCenter.longitude, DEFAULT_BASIC_STYLE.mapCenter.longitude,
DEFAULT_BASIC_STYLE.mapCenter.latitude DEFAULT_BASIC_STYLE.mapCenter.latitude
@ -99,47 +100,67 @@ export class FlowMap extends L7ChartView<Scene, L7Config> {
if (basicStyle.mapStyle !== 'custom') { if (basicStyle.mapStyle !== 'custom') {
mapStyle = `amap://styles/${basicStyle.mapStyle ? basicStyle.mapStyle : 'normal'}` mapStyle = `amap://styles/${basicStyle.mapStyle ? basicStyle.mapStyle : 'normal'}`
} }
const mapKey = await this.getMapKey() const dvMainStore = dvMainStoreWithOut()
const {
curComponent
} = storeToRefs(dvMainStore)
let mapKey: any
if (curComponent.value && curComponent.value.mapServer) {
mapKey = curComponent.value.mapServer.find(server => server.status === true);
} else {
let allmapKey = await this.idGetMapKey(chart.id)
mapKey = allmapKey.find(server => server.status === true);
}
// 底层 // 底层
const chartObj = drawOption.chartObj as unknown as L7Wrapper<L7Config, Scene> const chartObj = drawOption.chartObj as unknown as L7Wrapper<L7Config, Scene>
let scene = chartObj?.getScene() let scene = chartObj?.getScene()
if(scene){ scene = await getMapScene(
if (scene.getLayers()?.length) { chart,
await scene.removeAllLayer() scene,
scene.setPitch(misc.mapPitch) container,
} mapKey,
} basicStyle,
if (mapStyle.indexOf('Satellite') == -1) { misc,
scene = new Scene({ mapStyle,
id: container, center
logoVisible: false, )
map: new GaodeMap({ // if(scene){
token: mapKey?.key ?? undefined, // if (scene.getLayers()?.length) {
style: mapStyle, // await scene.removeAllLayer()
pitch: misc.mapPitch, // scene.setPitch(misc.mapPitch)
center, // }
zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined, // }
showLabel: !(basicStyle.showLabel === false), // if (mapStyle.indexOf('Satellite') == -1) {
WebGLParams: { // scene = new Scene({
preserveDrawingBuffer: true // id: container,
} // logoVisible: false,
}) // map: new GaodeMap({
}) // token: mapKey?.key ?? undefined,
}else{ // style: mapStyle,
scene = new Scene({ // pitch: misc.mapPitch,
id: container, // center,
logoVisible: false, // zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
map: new GaodeMap({ // showLabel: !(basicStyle.showLabel === false),
token: mapKey?.key ?? undefined, // WebGLParams: {
style: mapStyle, // preserveDrawingBuffer: true
features: ['bg', 'road'], // 必须开启路网层 // }
plugin: ['AMap.TileLayer.Satellite'], // 显式声明卫星图层 // })
WebGLParams: { // })
preserveDrawingBuffer: true // }else{
} // scene = new Scene({
}) // id: container,
}) // logoVisible: false,
} // map: new GaodeMap({
// token: mapKey?.key ?? undefined,
// style: mapStyle,
// features: ['bg', 'road'], // 必须开启路网层
// plugin: ['AMap.TileLayer.Satellite'], // 显式声明卫星图层
// WebGLParams: {
// preserveDrawingBuffer: true
// }
// })
// })
// }
// if (!scene) { // if (!scene) {
// scene = new Scene({ // scene = new Scene({
// id: container, // id: container,

View File

@ -12,7 +12,9 @@ import { GaodeMap } from '@antv/l7-maps'
import { Scene } from '@antv/l7-scene' import { Scene } from '@antv/l7-scene'
import { HeatmapLayer } from '@antv/l7-layers' import { HeatmapLayer } from '@antv/l7-layers'
import { DEFAULT_BASIC_STYLE } from '@/views/chart/components/editor/util/chart' import { DEFAULT_BASIC_STYLE } from '@/views/chart/components/editor/util/chart'
import { mapRendered, mapRendering } from '@/views/chart/components/js/panel/common/common_antv' import { mapRendered, mapRendering, getMapScene } from '@/views/chart/components/js/panel/common/common_antv'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const { t } = useI18n() const { t } = useI18n()
/** /**
@ -80,48 +82,68 @@ export class HeatMap extends L7ChartView<Scene, L7Config> {
if (basicStyle.mapStyle !== 'custom') { if (basicStyle.mapStyle !== 'custom') {
mapStyle = `amap://styles/${basicStyle.mapStyle ? basicStyle.mapStyle : 'normal'}` mapStyle = `amap://styles/${basicStyle.mapStyle ? basicStyle.mapStyle : 'normal'}`
} }
const mapKey = await this.getMapKey() const dvMainStore = dvMainStoreWithOut()
const {
curComponent
} = storeToRefs(dvMainStore)
let mapKey: any
if (curComponent.value && curComponent.value.mapServer) {
mapKey = curComponent.value.mapServer.find(server => server.status === true);
} else {
let allmapKey = await this.idGetMapKey(chart.id)
mapKey = allmapKey.find(server => server.status === true);
}
// 底层 // 底层
const chartObj = drawOption.chartObj as unknown as L7Wrapper<L7Config, Scene> const chartObj = drawOption.chartObj as unknown as L7Wrapper<L7Config, Scene>
let scene = chartObj?.getScene() let scene = chartObj?.getScene()
if(scene){ scene = await getMapScene(
if (scene.getLayers()?.length) { chart,
await scene.removeAllLayer() scene,
scene.setPitch(miscStyle.mapPitch) container,
} mapKey,
} basicStyle,
miscStyle,
mapStyle,
center
)
// if(scene){
// if (scene.getLayers()?.length) {
// await scene.removeAllLayer()
// scene.setPitch(miscStyle.mapPitch)
// }
// }
if (mapStyle.indexOf('Satellite') == -1) { // if (mapStyle.indexOf('Satellite') == -1) {
scene = new Scene({ // scene = new Scene({
id: container, // id: container,
logoVisible: false, // logoVisible: false,
map: new GaodeMap({ // map: new GaodeMap({
token: mapKey?.key ?? undefined, // token: mapKey?.key ?? undefined,
style: mapStyle, // style: mapStyle,
pitch: miscStyle.mapPitch, // pitch: miscStyle.mapPitch,
center, // center,
zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined, // zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
showLabel: !(basicStyle.showLabel === false), // showLabel: !(basicStyle.showLabel === false),
WebGLParams: { // WebGLParams: {
preserveDrawingBuffer: true // preserveDrawingBuffer: true
} // }
}) // })
}) // })
} else { // } else {
scene = new Scene({ // scene = new Scene({
id: container, // id: container,
logoVisible: false, // logoVisible: false,
map: new GaodeMap({ // map: new GaodeMap({
token: mapKey?.key ?? undefined, // token: mapKey?.key ?? undefined,
style: mapStyle, // style: mapStyle,
features: ['bg', 'road'], // 必须开启路网层 // features: ['bg', 'road'], // 必须开启路网层
plugin: ['AMap.TileLayer.Satellite'], // 显式声明卫星图层 // plugin: ['AMap.TileLayer.Satellite'], // 显式声明卫星图层
WebGLParams: { // WebGLParams: {
preserveDrawingBuffer: true // preserveDrawingBuffer: true
} // }
}) // })
}) // })
} // }
// } else { // } else {
// // if (scene.getLayers()?.length) { // // if (scene.getLayers()?.length) {
@ -135,19 +157,19 @@ export class HeatMap extends L7ChartView<Scene, L7Config> {
// // } // // }
// } // }
mapRendering(container) mapRendering(container)
if (mapStyle.indexOf('Satellite') == -1) { // if (mapStyle.indexOf('Satellite') == -1) {
scene.once('loaded', () => { // scene.once('loaded', () => {
mapRendered(container) // mapRendered(container)
}) // })
} else { // } else {
scene.once('loaded', () => { // scene.once('loaded', () => {
// 创建卫星图层实例 // // 创建卫星图层实例
const satelliteLayer = new AMap.TileLayer.Satellite() // const satelliteLayer = new AMap.TileLayer.Satellite()
// 与矢量图层叠加显示 // // 与矢量图层叠加显示
satelliteLayer.setMap(scene.map) // satelliteLayer.setMap(scene.map)
mapRendered(container) // mapRendered(container)
}) // })
} // }
this.configZoomButton(chart, scene) this.configZoomButton(chart, scene)
if (xAxis?.length < 2 || yAxis?.length < 1) { if (xAxis?.length < 2 || yAxis?.length < 1) {

View File

@ -25,6 +25,8 @@ import {
} from '@/views/chart/components/js/panel/common/common_antv' } from '@/views/chart/components/js/panel/common/common_antv'
import { configCarouselTooltip } from '@/views/chart/components/js/panel/charts/map/tooltip-carousel' import { configCarouselTooltip } from '@/views/chart/components/js/panel/charts/map/tooltip-carousel'
import { filter } from 'lodash-es' import { filter } from 'lodash-es'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const { t } = useI18n() const { t } = useI18n()
/** /**
@ -105,8 +107,20 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
basicStyle = parseJson(chart.customAttr).basicStyle basicStyle = parseJson(chart.customAttr).basicStyle
miscStyle = parseJson(chart.customAttr).misc miscStyle = parseJson(chart.customAttr).misc
} }
// beijing:beijing3
const mapKey = await this.getMapKey() // http://192.168.1.70:8080/geoserver/beijing
// const mapKey = await this.getMapKey()
const dvMainStore = dvMainStoreWithOut()
const {
curComponent
} = storeToRefs(dvMainStore)
let mapKey: any
if (curComponent.value && curComponent.value.mapServer) {
mapKey = curComponent.value.mapServer.find(server => server.status === true);
} else {
let allmapKey = await this.idGetMapKey(chart.id)
mapKey = allmapKey.find(server => server.status === true);
}
const mapStyle = getMapStyle(mapKey, basicStyle) const mapStyle = getMapStyle(mapKey, basicStyle)
let center = getMapCenter(basicStyle) let center = getMapCenter(basicStyle)