From 27a2d08bbdeec0cef108d171fb314e4ada9be861 Mon Sep 17 00:00:00 2001 From: lixuliang <lixuliang_hd@126.com> Date: 星期四, 16 十一月 2023 10:46:52 +0800 Subject: [PATCH] 信息弹框 --- src/components/map/viewer.vue | 101 +++++++++++++++++++++++++++++--------------------- 1 files changed, 59 insertions(+), 42 deletions(-) diff --git a/src/components/map/viewer.vue b/src/components/map/viewer.vue index b9fc8a4..a29d709 100644 --- a/src/components/map/viewer.vue +++ b/src/components/map/viewer.vue @@ -2,7 +2,7 @@ <div> <div id="sdkContainer"></div> <div class="listBox" v-show="viewer1Show && !isLand"> - <ul> + <ul id="viewer_lsyx"> <li v-for="(item, index) in arr" :key="index" @click="changeLeftMap($event, item, index)"> {{ item }} </li> @@ -43,7 +43,7 @@ import "animate.css"; import Bus from "@tools/Bus"; -let activeLi, nLayer,LWLayer; +let activeLi, nLayer, LWLayer; export default { name: "viewer", components: { @@ -77,14 +77,19 @@ viewer1Show(newvalue, oldvalue) { if (!newvalue) { this.destroyImageLayer(); + } else { + if (!this.isLand) { + this.initLSYX(); + } } }, isLand(newvalue, oldvalue) { if (newvalue) { this.destroyImageLayer(); + } else { + this.initLSYX(); } - - } + }, }, mounted() { this.$nextTick(function () { @@ -95,6 +100,7 @@ { StaticFileBaseUrl: "../../../static/CimSDK/", // StaticFileBaseUrl: "../../../SW/static/CimSDK/", + // StaticFileBaseUrl: "../../../YZXNCS/static/CimSDK/", }, {}, {}, @@ -139,7 +145,8 @@ } ); window.Viewer = sgworld._Viewer; - window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer); + + window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer, Cesium); Viewer.shadows = false; //娣卞害妫�娴� sgworld.Analysis.depthTestAgainstTerrain(true); @@ -209,15 +216,6 @@ }, }); - - - - - - - - - //鍒濆鍖栧脊绐椾簨浠� // that.showBottom(); that.initLayerOpen(); @@ -264,9 +262,14 @@ this.destroyImageLayer(); } }, + initLSYX() { + let ul = document.getElementById("viewer_lsyx"); + let lis = ul.getElementsByTagName('li'); + lis[19].click(); + }, destroyImageLayer() { if (activeLi) { - activeLi.classList.remove('active'); + activeLi.classList.remove("active"); activeLi = null; } if (nLayer) { @@ -281,10 +284,10 @@ changeLeftMap(event, item, index) { let liObj = event.currentTarget; if (activeLi) { - activeLi.classList.remove('active'); + activeLi.classList.remove("active"); activeLi = null; } - liObj.classList.add('active'); + liObj.classList.add("active"); activeLi = liObj; this.loadImageLayer(item); }, @@ -294,25 +297,29 @@ nLayer = null; } nLayer = this.loadBJ54ImageLayer(year); - if(!LWLayer) - { + if (!LWLayer||Viewer.imageryLayers.indexOf(LWLayer)<0) { + if(LWLayer) + { + LWLayer.destroy(); + } LWLayer = this.loadBJ54LWLayer(); } + }, loadBJ54LWLayer() { let url = "http://172.26.64.84/service/ImageEngine/picdis/abc"; //let url = option.url; //let year = option.year; let paramUrl = `${url}?user=jjjskfq&password=Jjjskfq@2022&layer=Shiliang_Lw_2019&style=&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={z}&TileCol={nx}&TileRow={ny}`; - let minx = 113.168199 * Math.PI / 180.0; - let miny = 39.230551 * Math.PI / 180.0; - let maxx = 118.562362 * Math.PI / 180.0; - let maxy = 41.294714 * Math.PI / 180.0; + let minx = (113.168199 * Math.PI) / 180.0; + let miny = (39.230551 * Math.PI) / 180.0; + let maxx = (118.562362 * Math.PI) / 180.0; + let maxy = (41.294714 * Math.PI) / 180.0; let rectangle = new Cesium.Rectangle(minx, miny, maxx, maxy); let tilingScheme = new Cesium.GeographicTilingScheme({ rectangle: rectangle, numberOfLevelZeroTilesX: 2, - numberOfLevelZeroTilesY: 1 + numberOfLevelZeroTilesY: 1, }); var dx = { url: paramUrl, @@ -323,11 +330,14 @@ }, ny: function (imageryProvider, x, y, level) { return (2 << (level - 1)) + y; - } - } + }, + }, }; var imageryProvider = new Cesium.UrlTemplateImageryProvider(dx); - let imageLayer = new Cesium.ImageryLayer(imageryProvider, { alpha: 1, brightness: 1.0 }); + let imageLayer = new Cesium.ImageryLayer(imageryProvider, { + alpha: 1, + brightness: 1.0, + }); Viewer.imageryLayers.add(imageLayer, 3); return imageLayer; }, @@ -336,15 +346,15 @@ //let url = option.url; //let year = option.year; let paramUrl = `${url}?user=jjjskfq&password=Jjjskfq@2022&layer=Sate_${year}&style=&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={z}&TileCol={nx}&TileRow={ny}`; - let minx = 113.168199 * Math.PI / 180.0; - let miny = 39.230551 * Math.PI / 180.0; - let maxx = 118.562362 * Math.PI / 180.0; - let maxy = 41.294714 * Math.PI / 180.0; + let minx = (113.168199 * Math.PI) / 180.0; + let miny = (39.230551 * Math.PI) / 180.0; + let maxx = (118.562362 * Math.PI) / 180.0; + let maxy = (41.294714 * Math.PI) / 180.0; let rectangle = new Cesium.Rectangle(minx, miny, maxx, maxy); let tilingScheme = new Cesium.GeographicTilingScheme({ rectangle: rectangle, numberOfLevelZeroTilesX: 2, - numberOfLevelZeroTilesY: 1 + numberOfLevelZeroTilesY: 1, }); var dx = { url: paramUrl, @@ -355,11 +365,14 @@ }, ny: function (imageryProvider, x, y, level) { return (2 << (level - 1)) + y; - } - } + }, + }, }; var imageryProvider = new Cesium.UrlTemplateImageryProvider(dx); - let imageLayer = new Cesium.ImageryLayer(imageryProvider, { alpha: 1, brightness: 1.0 }); + let imageLayer = new Cesium.ImageryLayer(imageryProvider, { + alpha: 1, + brightness: 1.0, + }); Viewer.imageryLayers.add(imageLayer, 2); return imageLayer; }, @@ -383,10 +396,17 @@ this.switchImagerLayer = !this.switchImagerLayer; }, ArcgisImageryLayer() { - var layer = sgworld.factory.createImageryLayer({ - sourceType: "arcgis", - url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", - }); + sgworld.Creator.createArcGisImageryLayer( + "ARCGIS", + { + url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", + enablePickFeatures: false, + }, + "0", + 1, + true, + "" + ); }, //鍒濆鍖栧脊绐椾簨浠� @@ -588,13 +608,10 @@ position: absolute; left: 20px; top: 100px; - } .listBox .active { - background: rgba(255, 166, 0, 0.808); - } .listBox li { -- Gitblit v1.9.3