From 81f92eb9fb83ed5d8ac0b0a5c206315416f10df0 Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期四, 04 七月 2024 10:14:06 +0800 Subject: [PATCH] 系统更新 --- src/assets/js/map/mapJsonLayer.js | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/assets/js/map/mapJsonLayer.js b/src/assets/js/map/mapJsonLayer.js index 927aeac..0d46b9f 100644 --- a/src/assets/js/map/mapJsonLayer.js +++ b/src/assets/js/map/mapJsonLayer.js @@ -21,6 +21,7 @@ linePath: null, richTextPoint1: null, wfsLayer: null, + dataSource: null, init(url) { this.url = url; this.getJsonLayer(); @@ -117,7 +118,7 @@ }); }, setQueryTF2(name) { - // const obj = "weaponname like '%" + name + "%'" + ""; + // const obj = "weaponname like '%鍫や赴绯荤粺%'" + ""; const filed = this.getPublickey(name); const layer = modelLayer.layers.filter((item) => { if (item.name == "姝﹀櫒鐐�") { @@ -134,12 +135,12 @@ dbid: modelLayer.dbid, where: filed }).then((response) => { + if (response.code != 200) return; const geom = response.data.items[0]; - const position = [geom._x, geom._y, 0]; const cylinder = { - radius: 1500, //鍗婂緞 + radius: 400000, //鍗婂緞 angle: 30, //鎵弿瑙掑害锛堝彲閫夛級 speed: 5, //鍊嶉�燂紙鍙�夛級 stackPartitions: 80, //妯悜缃戞牸鏁帮紙鍙�夛級 @@ -150,7 +151,7 @@ position, cylinder ); - // Viewer.zoomTo(this.rectangularSensor.item); + Viewer.zoomTo(this.rectangularSensor.item); }); }, setQueryByFiled(name, color) { @@ -233,6 +234,10 @@ }, setTitleSetRest() { this.targetList = []; + if (this.dataSource) { + Viewer.dataSources.remove(this.dataSource); + this.dataSource = null + } if (this.wfsLayer) { // this.wfsLayer.removeFromMap(); this.wfsLayer.destroy(); @@ -318,18 +323,18 @@ }, setAddWfsJson() { const url = this.getQueryUrl("SubicBayWeapon_wfs", "weapons"); - + const that = this; Cesium.GeoJsonDataSource.load(url, { fill: Cesium.Color.fromCssColorString("#FFFFFF00"), stroke: Cesium.Color.fromCssColorString("#FFFFFF00"), //澶氳竟褰㈡垨绾跨殑棰滆壊 strokeWidth: 0 //澶氳竟褰㈡垨绾� 瀹藉害 }).then((dataSource) => { - const entities = dataSource.entities.values; + that.dataSource = dataSource; + const entities = that.dataSource.entities.values; entities.map((item) => { item.polygon._material.color = Cesium.Color.fromCssColorString("#FFFFFF00"); - item.polygon.heightReference = Cesium.HeightReference.RELATIVE_TO_GROUND; // 璐村湴 item.polygon.height = 0; // 璺濆湴楂樺害0绫� @@ -343,30 +348,30 @@ positions: positions, clampToGround: true, // 璐村湴 width: 5, - material: Cesium.Color.fromCssColorString("#FF0000") + material: Cesium.Color.fromCssColorString("#FFA500") }); - console.log(item._name); - const label_name = item.name ?item.name :""; + + const label_name = item.name ? item.name : ""; item.label = { text: label_name, font: "500 16x sans-serif", style: Cesium.LabelStyle.FILL_AND_OUTLINE, // 瀛椾綋鏍峰紡 - fillColor: new Cesium.Color.fromCssColorString("#FFFFFF"), - outlineWidth: 1, // 瀛椾綋澶栧湀绾垮搴︼紙鍚屾牱涔熸湁棰滆壊鍙缃級 - outlineColor: new Cesium.Color.fromCssColorString("#FFFFFF"), - verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 鍨傜洿浣嶇疆 + fillColor: new Cesium.Color.fromCssColorString("#FFFFFF"), + outlineWidth: 1, // 瀛椾綋澶栧湀绾垮搴︼紙鍚屾牱涔熸湁棰滆壊鍙缃級 + outlineColor: new Cesium.Color.fromCssColorString("#FFFFFF"), + verticalOrigin: Cesium.VerticalOrigin.BASELINE, // 鍨傜洿浣嶇疆 pixelOffset: new Cesium.Cartesian2(0, 0), // 涓績浣嶇疆 disableDepthTestDistance: Number.POSITIVE_INFINITY, distanceDisplayCondition: new Cesium.DistanceDisplayCondition( 500.0, 3000.0 - ), + ) // showBackground:true, // backgroundColor: new Cesium.Color(26 / 255, 196 / 255, 228 / 255, 1.0) //鑳屾櫙椤旇壊 }; }); - Viewer.dataSources.add(dataSource); + Viewer.dataSources.add(that.dataSource); }); }, getTileSet() { -- Gitblit v1.9.3