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'),
icon: 'symbolic-map'
},
{
render: 'antv',
category: 'map',
value: 'three-map',
title: t('chart.three_map'),
icon: 'three-map'
}
// {
// render: 'antv',
// category: 'map',
// value: 'three-map',
// title: t('chart.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_grey'), value: 'grey' },
{ name: t('chart.map_style_blue'), value: 'blue' },
{ name: t('chart.map_style_translate'), value: 'Satellite' },
{ 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 { LineLayer } 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 { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const { t } = useI18n()
/**
@ -87,7 +89,6 @@ export class FlowMap extends L7ChartView<Scene, L7Config> {
const xAxis = deepCopy(chart.xAxis)
const xAxisExt = deepCopy(chart.xAxisExt)
const { basicStyle, misc } = deepCopy(parseJson(chart.customAttr))
let center: [number, number] = [
DEFAULT_BASIC_STYLE.mapCenter.longitude,
DEFAULT_BASIC_STYLE.mapCenter.latitude
@ -99,47 +100,67 @@ export class FlowMap extends L7ChartView<Scene, L7Config> {
if (basicStyle.mapStyle !== 'custom') {
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>
let scene = chartObj?.getScene()
if(scene){
if (scene.getLayers()?.length) {
await scene.removeAllLayer()
scene.setPitch(misc.mapPitch)
}
}
if (mapStyle.indexOf('Satellite') == -1) {
scene = new Scene({
id: container,
logoVisible: false,
map: new GaodeMap({
token: mapKey?.key ?? undefined,
style: mapStyle,
pitch: misc.mapPitch,
center,
zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
showLabel: !(basicStyle.showLabel === false),
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
}
})
})
}
scene = await getMapScene(
chart,
scene,
container,
mapKey,
basicStyle,
misc,
mapStyle,
center
)
// if(scene){
// if (scene.getLayers()?.length) {
// await scene.removeAllLayer()
// scene.setPitch(misc.mapPitch)
// }
// }
// if (mapStyle.indexOf('Satellite') == -1) {
// scene = new Scene({
// id: container,
// logoVisible: false,
// map: new GaodeMap({
// token: mapKey?.key ?? undefined,
// style: mapStyle,
// pitch: misc.mapPitch,
// center,
// zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
// showLabel: !(basicStyle.showLabel === false),
// 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) {
// scene = new Scene({
// id: container,

View File

@ -12,7 +12,9 @@ import { GaodeMap } from '@antv/l7-maps'
import { Scene } from '@antv/l7-scene'
import { HeatmapLayer } from '@antv/l7-layers'
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()
/**
@ -80,48 +82,68 @@ export class HeatMap extends L7ChartView<Scene, L7Config> {
if (basicStyle.mapStyle !== 'custom') {
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>
let scene = chartObj?.getScene()
if(scene){
if (scene.getLayers()?.length) {
await scene.removeAllLayer()
scene.setPitch(miscStyle.mapPitch)
}
}
scene = await getMapScene(
chart,
scene,
container,
mapKey,
basicStyle,
miscStyle,
mapStyle,
center
)
// if(scene){
// if (scene.getLayers()?.length) {
// await scene.removeAllLayer()
// scene.setPitch(miscStyle.mapPitch)
// }
// }
if (mapStyle.indexOf('Satellite') == -1) {
scene = new Scene({
id: container,
logoVisible: false,
map: new GaodeMap({
token: mapKey?.key ?? undefined,
style: mapStyle,
pitch: miscStyle.mapPitch,
center,
zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
showLabel: !(basicStyle.showLabel === false),
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 (mapStyle.indexOf('Satellite') == -1) {
// scene = new Scene({
// id: container,
// logoVisible: false,
// map: new GaodeMap({
// token: mapKey?.key ?? undefined,
// style: mapStyle,
// pitch: miscStyle.mapPitch,
// center,
// zoom: basicStyle.autoFit === false ? basicStyle.zoomLevel : undefined,
// showLabel: !(basicStyle.showLabel === false),
// 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
// }
// })
// })
// }
// } else {
// // if (scene.getLayers()?.length) {
@ -135,19 +157,19 @@ export class HeatMap extends L7ChartView<Scene, L7Config> {
// // }
// }
mapRendering(container)
if (mapStyle.indexOf('Satellite') == -1) {
scene.once('loaded', () => {
mapRendered(container)
})
} else {
scene.once('loaded', () => {
// 创建卫星图层实例
const satelliteLayer = new AMap.TileLayer.Satellite()
// 与矢量图层叠加显示
satelliteLayer.setMap(scene.map)
mapRendered(container)
})
}
// if (mapStyle.indexOf('Satellite') == -1) {
// scene.once('loaded', () => {
// mapRendered(container)
// })
// } else {
// scene.once('loaded', () => {
// // 创建卫星图层实例
// const satelliteLayer = new AMap.TileLayer.Satellite()
// // 与矢量图层叠加显示
// satelliteLayer.setMap(scene.map)
// mapRendered(container)
// })
// }
this.configZoomButton(chart, scene)
if (xAxis?.length < 2 || yAxis?.length < 1) {

View File

@ -25,6 +25,8 @@ import {
} from '@/views/chart/components/js/panel/common/common_antv'
import { configCarouselTooltip } from '@/views/chart/components/js/panel/charts/map/tooltip-carousel'
import { filter } from 'lodash-es'
import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
const { t } = useI18n()
/**
@ -105,8 +107,20 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
basicStyle = parseJson(chart.customAttr).basicStyle
miscStyle = parseJson(chart.customAttr).misc
}
const mapKey = await this.getMapKey()
// beijing:beijing3
// 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)
let center = getMapCenter(basicStyle)