From 7c24257d14c8a773aef0586c0195642c15246038 Mon Sep 17 00:00:00 2001 From: yxl <584911253@qq.com> Date: 星期一, 20 一月 2025 17:59:41 +0800 Subject: [PATCH] commit --- src/assets/js/map/mapView.js | 67 ++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/assets/js/map/mapView.js b/src/assets/js/map/mapView.js index 4bdab51..53aa2dc 100644 --- a/src/assets/js/map/mapView.js +++ b/src/assets/js/map/mapView.js @@ -36,10 +36,8 @@ console.log("鐐瑰嚮鐨勫璞�:", pickedObject); } }, Cesium.ScreenSpaceEventType.LEFT_CLICK); - // earthCtrl.factory.createTerrainLayer({ - // sourceType: "ctb", - // url: "https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405" - // }); + //鍔犺浇鍏ㄧ悆鍦板舰 + this.addTerrain(); this.addImageLayer(); // this.addqqmap(); let now2 = new Date(); @@ -57,15 +55,15 @@ height: 2732.163687177577 }; Viewer.clock.currentTime = Cesium.JulianDate.fromDate(todayNoon); - earthCtrl.camera.flyTo( - res.longitude, - res.latitude, - res.height, - 4.501790216143808, - -32.230361363631324, - 0.001313831409284339, - 2 - ); + // earthCtrl.camera.flyTo( + // res.longitude, + // res.latitude, + // res.height, + // 4.501790216143808, + // -32.230361363631324, + // 0.001313831409284339, + // 2 + // ); // setTimeout(() => { // mapModel.init(); // }, 5000); @@ -116,6 +114,9 @@ // lat: 23.990136825668284, // alt: 150 // }) + earthCtrl.measure.pickPosition({}, function (e) { + console.info(e); + }); }, addTetrahedron(res) { earthCtrl.factory.addTetrahedron({ @@ -250,14 +251,14 @@ width: 1.5, color: '#87CEFA', }) - earthCtrl.factory.createWfsLayer('polyline', { + const layer1 = earthCtrl.factory.createWfsLayer('polyline', { urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', layer: 'JiaShanBase:RadarM', width: 1.5, color: '#de3', }) - earthCtrl.factory.createWfsLayer('polyline', { + const layer2 = earthCtrl.factory.createWfsLayer('polyline', { urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', layer: 'JiaShanBase:RadarS', width: 1.5, @@ -286,30 +287,36 @@ }, addModel() { const entity = earthCtrl.viewer.entities.add({ - position: SmartEarth.Cesium.Cartesian3.fromDegrees( - 121.614202387521061, - 23.990136825668284, - 0 + position: Cesium.Cartesian3.fromDegrees( + 121.576830, + 24.006230, ), model: { - uri: '/gltf/tank.glb', - scale: 15, - heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND, - disableDepthTestDistance: Number.POSITIVE_INFINITY // 绂佺敤娣卞害娴嬭瘯 + uri: '/gltf/ddc.glb', + scale: 20, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, + // disableDepthTestDistance: Number.POSITIVE_INFINITY // 绂佺敤娣卞害娴嬭瘯 }, label: { show: true, - text: '缁忓害锛�121.6142023,绾害锛�23.9901368', - color: SmartEarth.Cesium.Color.fromCssColorString("#fff"), + text: '缁忓害锛�121.576830,绾害锛�24.006230', + color: Cesium.Color.fromCssColorString("#fff"), font: "normal 14px MicroSoft YaHei", showBackground: true, - outlineColor: SmartEarth.Cesium.Color.WHITE, - pixelOffset: new SmartEarth.Cesium.Cartesian2(10, -30), - horizontalOrigin: SmartEarth.Cesium.HorizontalOrigin.CENTER, - verticalOrigin: SmartEarth.Cesium.VerticalOrigin.BOTTOM, - heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND, + outlineColor: Cesium.Color.WHITE, + pixelOffset: new Cesium.Cartesian2(10, -30), + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, }, }); + }, + //鍔犺浇鍏ㄧ悆鍦板舰 + addTerrain() { + window.terrain = earthCtrl.factory.createTerrainLayer({ + sourceType: "ctb", + url:config.terrainUrl + }); } }; export default mapViewer; -- Gitblit v1.9.3