From dda0e6f581e8c2b116f2eae53756d80215d6e5e0 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期三, 01 二月 2023 09:31:37 +0800 Subject: [PATCH] 1 --- src/components/mapsdk.vue | 98 +++++++++++++++++++++++++++++++----------------- 1 files changed, 63 insertions(+), 35 deletions(-) diff --git a/src/components/mapsdk.vue b/src/components/mapsdk.vue index c13c3f4..0134978 100644 --- a/src/components/mapsdk.vue +++ b/src/components/mapsdk.vue @@ -270,6 +270,7 @@ import { select_Comprehensive_ByPageAndCount, select_Comprehensive_SelectWktById, + comprehensive_selectRoute } from '../api/api'; export default { name: '', @@ -354,23 +355,23 @@ }); Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ - url: gaoDeBaseUrl[0].url, - - + url: gaoDeBaseUrl[0].url, + + }) ); Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ - url: gaoDeBaseUrl[1].url, - + url: gaoDeBaseUrl[1].url, + }) ); Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ - url: gaoDeBaseUrl[2].url, - - + url: gaoDeBaseUrl[2].url, + + }) ); @@ -422,15 +423,15 @@ window.elevationTool = new SmartEarth.ElevationTool(window.sgworld); elevationTool.setContourColor('#F1D487'); - var helper = new Cesium.EventHelper(); - helper.add(Viewer.scene.globe.tileLoadProgressEvent, function (e) { - - if (e == 0) { -console.log("杩欎釜鏄姞杞芥渶鍚庝竴涓煝閲忓垏鐗囩殑鍥炶皟"); -} - helper.removeAll(); - helper = undefined; - }); + // var helper = new Cesium.EventHelper(); + // helper.add(Viewer.scene.globe.tileLoadProgressEvent, function (e) { + + // if (e == 0) { + // console.log("杩欎釜鏄姞杞芥渶鍚庝竴涓煝閲忓垏鐗囩殑鍥炶皟"); + // } + // helper.removeAll(); + // helper = undefined; + // }); @@ -621,29 +622,54 @@ break; } }, - showMouseLeftClick(res) { + async showMouseLeftClick(res) { if (res == 3) { if (this.linePath != null) { this.clearPathAll(3); } + var start = this.pathFrom.lon.split(",") + var end = this.pathFrom.lat.split(",") + var startData = { + x1: parseFloat(start[0]), + y1: parseFloat(start[1]), + x2: parseFloat(end[0]), + y2: parseFloat(end[1]) + } - var jsonurl = - wnsUrl + - '?start=' + - this.pathFrom.lon + - '&end=' + - this.pathFrom.lat + - '&propertyName=Shape&tolerance=500&request=FindPath&format=json'; - $.ajax({ - url: jsonurl, - async: false, - type: 'GET', - dataType: 'json', - contentType: 'application/json;charset=utf-8', - success: (data) => { - this.executeFly3D(data); - }, - }); + const data = await comprehensive_selectRoute(startData); + if (data.code != 200) { + return this.$message.error('鏁版嵁璇锋眰澶辫触'); + } + var wkt = this.$wkt.parse(data.result); + var bufferSource = Cesium.GeoJsonDataSource.load(wkt, { + stroke: new Cesium.Color(82 / 255, 152 / 255, 255 / 255, 1), + + strokeWidth: 5, + clampToGround: true, + }) + bufferSource.then((bufferSource) => { + sgworld.Navigate.flyToObj(bufferSource) + Viewer.dataSources.add(bufferSource); + + } + ) + // var jsonurl = + // wnsUrl + + // '?start=' + + // this.pathFrom.lon + + // '&end=' + + // this.pathFrom.lat + + // '&propertyName=Shape&tolerance=500&request=FindPath&format=json'; + // $.ajax({ + // url: jsonurl, + // async: false, + // type: 'GET', + // dataType: 'json', + // contentType: 'application/json;charset=utf-8', + // success: (data) => { + // this.executeFly3D(data); + // }, + // }); } else { var that = this; if (this.handler != null) { @@ -744,6 +770,8 @@ sgworld.Creator.DeleteObject(this.linePath); this.linePath = null; } + + Viewer.dataSources.removeAll( ) break; case 4: if (this.linePath != null) { -- Gitblit v1.9.3