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 | 88 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 73 insertions(+), 15 deletions(-) diff --git a/src/assets/js/map/mapJsonLayer.js b/src/assets/js/map/mapJsonLayer.js index 0105eff..0d46b9f 100644 --- a/src/assets/js/map/mapJsonLayer.js +++ b/src/assets/js/map/mapJsonLayer.js @@ -20,7 +20,8 @@ targetList: [], linePath: null, richTextPoint1: null, - wfsLayer: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,7 +234,11 @@ }, setTitleSetRest() { this.targetList = []; - if(this.wfsLayer){ + if (this.dataSource) { + Viewer.dataSources.remove(this.dataSource); + this.dataSource = null + } + if (this.wfsLayer) { // this.wfsLayer.removeFromMap(); this.wfsLayer.destroy(); } @@ -289,7 +294,7 @@ if (objItem.length <= 0) return; var tileset = objItem[0].layer; const list = this.targetList; - + tileset.style = new Cesium.Cesium3DTileStyle({ color: { evaluateColor: (feature) => { @@ -308,13 +313,66 @@ } }); }, - setAddWfsLayer(){ - this.wfsLayer = earthCtrl.factory.createWfsLayer('polygon', { - urls: 'https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs', - layer: 'weapons', - outlineColor:'#ff0000', - alpha:0, - }) + setAddWfsLayer() { + this.wfsLayer = earthCtrl.factory.createWfsLayer("polygon", { + urls: "https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs", + layer: "weapons", + outlineColor: "#ff0000", + alpha: 0 + }); + }, + 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) => { + 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绫� + var polyPositions = item.polygon.hierarchy.getValue().positions; + var polyCenter = Cesium.BoundingSphere.fromPoints(polyPositions).center; //涓績鐐� + polyCenter = Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(polyCenter); + item.position = polyCenter; + let positions = item.polygon.hierarchy._value.positions; + // 璁剧疆闈㈣疆寤� + item.polyline = new Cesium.PolylineGraphics({ + positions: positions, + clampToGround: true, // 璐村湴 + width: 5, + material: Cesium.Color.fromCssColorString("#FFA500") + }); + + 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.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(that.dataSource); + }); }, getTileSet() { var objItem = mapServer.listData.filter((item) => { @@ -463,7 +521,7 @@ width: 3, //绾垮锛堝彲閫夛級 color: "#00ffff", //绾块鑹诧紙鍙�夛級, LightSpot: true, //鏄惁浣跨敤鍏夌偣鏁堟灉锛堝彲閫夛級 - LightSpotColor: "#ffffff" ,//鍏夌偣棰滆壊锛堝彲閫夛級 + LightSpotColor: "#ffffff", //鍏夌偣棰滆壊锛堝彲閫夛級 height: 100 }; this.linePath = earthCtrl.factory.createTrailLinePath( -- Gitblit v1.9.3