From 7054e09fbcd57115641a9394e912a5ad2db05eba Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Mon, 26 Sep 2022 16:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E5=9C=B0=E5=9B=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/visual/cpts/map/index.vue | 80 ++- .../modules/visual/cpts/map/index备份.vue | 617 ++++++++++++++++++ 2 files changed, 686 insertions(+), 11 deletions(-) create mode 100644 src/views/modules/visual/cpts/map/index备份.vue diff --git a/src/views/modules/visual/cpts/map/index.vue b/src/views/modules/visual/cpts/map/index.vue index acd84557f..29c390945 100644 --- a/src/views/modules/visual/cpts/map/index.vue +++ b/src/views/modules/visual/cpts/map/index.vue @@ -17,8 +17,14 @@ import { requestPost } from "@/js/dai/request"; import cptCard from "@/views/modules/visual/cpts/card"; import cptTb from "@/views/modules/visual/cpts/tb"; import nextTick from "dai-js/tools/nextTick"; -import { Scene, PolygonLayer, LineLayer, PointLayer } from "@antv/l7"; -import { GaodeMap, Map } from "@antv/l7-maps"; +import { + Scene, + RasterLayer, + PolygonLayer, + LineLayer, + PointLayer, +} from "@antv/l7"; +import { GaodeMap, Map, Mapbox } from "@antv/l7-maps"; import { spliceIntoChunks } from "@/utils/index"; let scene; @@ -240,7 +246,6 @@ export default { }; }, - dotData2() { const { dotList2 } = this; return { @@ -296,9 +301,26 @@ export default { scene = new Scene({ id: "map", logoVisible: false, - map: new GaodeMap({ - pitch: this.pitch, - style: styleConfig.style, + // map: new GaodeMap({ + // pitch: this.pitch, + // style: styleConfig.style, + // center: [ + // srcGridData.longitude || + // this.$store.state.user.longitude || + // 116.39743841556731, + // srcGridData.latitude || + // this.$store.state.user.latitude || + // 39.9088810666821, + // ], + // token: "fc14b42e0ca18387866d68ebd4f150c1", + // zoom: 18, + // isHotspot: false, + // resizeEnable: true, + // doubleClickZoom: false, + // }), + + map: new Mapbox({ + style: "blank", center: [ srcGridData.longitude || this.$store.state.user.longitude || @@ -307,15 +329,12 @@ export default { this.$store.state.user.latitude || 39.9088810666821, ], - token: "fc14b42e0ca18387866d68ebd4f150c1", zoom: 18, - isHotspot: false, - resizeEnable: true, - doubleClickZoom: false, }), }); scene.on("loaded", async () => { + this.iniBaseMap(scene); this.iniMapGrid(scene); this.iniMapDot(scene); this.iniMapDot2(scene); @@ -324,6 +343,45 @@ export default { }); }, + iniBaseMap(scene) { + // 底图服务 + const baseLayer = new RasterLayer({ + // zIndex: 0, + }); + baseLayer.source( + "http://t4.tianditu.com/DataServer?T=vec_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", + { + parser: { + type: "rasterTile", + tileSize: 256, + // minZoom: 6, + // maxZoom: 15, + zoomOffset: 0, + }, + } + ); + + // 注记服务 + const annotionLayer = new RasterLayer({ + // zIndex: 1, + }); + annotionLayer.source( + "http://t4.tianditu.com/DataServer?T=cva_w&tk=8a08c117ab9ee45d508686b01cc8d397&x={x}&y={y}&l={z}", + { + parser: { + type: "rasterTile", + tileSize: 256, + // minZoom: 6, + // maxZoom: 15, + zoomOffset: 0, + }, + } + ); + + scene.addLayer(baseLayer); + scene.addLayer(annotionLayer); + }, + iniMapGrid(scene) { const { darkStyle, lightStyle, polygonData, polygonDotData } = this; @@ -560,7 +618,7 @@ export default { }, updateGrid() { - const { polygonData,polygonDotData } = this; + const { polygonData, polygonDotData } = this; if (polygonLayer) { polygonLayer.setData(polygonData); lineLayer.setData(polygonData); diff --git a/src/views/modules/visual/cpts/map/index备份.vue b/src/views/modules/visual/cpts/map/index备份.vue new file mode 100644 index 000000000..af3c8678a --- /dev/null +++ b/src/views/modules/visual/cpts/map/index备份.vue @@ -0,0 +1,617 @@ + + + + +