diff --git a/src/components/GdMap/index.vue b/src/components/GdMap/index.vue index 32ff62e..8c35759 100644 --- a/src/components/GdMap/index.vue +++ b/src/components/GdMap/index.vue @@ -1,8 +1,7 @@ @@ -74,7 +74,7 @@ const props = defineProps({ }); try { const userInfo = getItem("deptId")[0].deptCode; -} catch (error) { } +} catch (error) {} let map; let mapLayer; let mapLayer1; @@ -85,36 +85,30 @@ onMounted(() => { box[0].style.right = !res ? "4px" : "398px"; box[0].style.transition = "0.5s"; }); - + map = new EliMap({ id: props.mapid, - crs: "EPSG:4490", + crs: "EPSG:3857", style: { glyphs: "./fonts/{fontstack}/{range}.pbf", - center: [94.36057012, 29.64276831], - zoom: 15 + center: [94.36,29.65], + zoom: 10 }, - minZoom: 7, - maxZoom: 18, + transformRequest: (url) => { + if (url.indexOf("TileMatrix=") != -1) { + const arr = url.split("TileMatrix="); + const arr1 = arr[1].split("&"); + const nurl = `${arr[0]}&TileMatrix=${Number(arr1[0])}&${arr1[1]}&${arr1[2]}`; + + } + } }); + window.map = map; map.mapboxGLMap.on("load", () => { - map.addWMTSLayer( - "/PGIS_S_TileMapServer/Maps/XZDJ_SL/EzMap" - , - { - Service: "getImage", - Type: "RGB", - ZoomOffset: "0", - V: "0.3", - Zoom: "{z}", - Row: "{y}", - Col: "{x}" - }, - { - tileSize: 300 - } - ); + map.addGaudLayer({ + url: 'http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', + }) zoomTarget.value = map.mapboxGLMap.getZoom(); }); mapUtil.value = new MapUtil(map); @@ -172,7 +166,7 @@ onMounted(() => { }); // 回显线 emitter.on("echoLine", (res) => { - mapUtil.value.createLine(res, res.flag); + mapUtil.value.createLine(res); }); //创建边界面(geojson) emitter.on("setBoundarys", (res) => { @@ -203,6 +197,11 @@ onMounted(() => { mapUtil.value.diffusionCircle(res); }); + // 清除全部覆盖物 + emitter.on("removeElementAll", () => { + mapUtil.value.removeElementAll(); + }); + // 展示盘曲 emitter.on("showGapText", (obj) => { mapUtil.value.gapText(obj); @@ -301,6 +300,7 @@ onUnmounted(() => { emitter.off("diffusionCircle"); emitter.off("SsCircle"); emitter.off("ClearssCircle"); + emitter.off("removeElementAll"); }); @@ -323,35 +323,29 @@ onUnmounted(() => { right: 398px; bottom: 4px; z-index: 9; - .mapImageItem { border: 1px solid #08aae8; background: rgb(9, 26, 70); - - &>img { + & > img { width: 100%; height: 50px; } - - &>div { + & > div { text-align: center; position: relative; top: -3px; } } - .zoomTargetBox { margin-top: 10px; margin-left: 23px; } - ::v-deep .el-input-number__decrease, ::v-deep .el-input-number__increase { background: #133362; color: #fff; border: none; } - ::v-deep .el-input__inner { background: #0c1641; }