diff --git a/.env.dev b/.env.dev index ea5debf..c68c3b4 100644 --- a/.env.dev +++ b/.env.dev @@ -23,14 +23,14 @@ VUE_APP_OIDC_SILENTREDIRECTURI = http://112.233.241.108:1803/silent-renew-oidc.h #VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws # 1240服务器http接口 -#VUE_APP_BASE_API = http://123.132.248.154:9231/api -#VUE_APP_BASE_IMG_URL = http://123.132.248.154:9231 -#VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws +VUE_APP_BASE_API = http://123.132.248.154:9231/api +VUE_APP_BASE_IMG_URL = http://123.132.248.154:9231 +VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws # 费县服务器https接口 -VUE_APP_BASE_API = https://py.hopetrytech.com:7001/api -VUE_APP_BASE_IMG_URL = https://py.hopetrytech.com:7001 -VUE_APP_WEBSOCKET_URL = wss://py.hopetrytech.com:7002/ws +# VUE_APP_BASE_API = https://py.hopetrytech.com:7001/api +# VUE_APP_BASE_IMG_URL = https://py.hopetrytech.com:7001 +# VUE_APP_WEBSOCKET_URL = wss://py.hopetrytech.com:7002/ws #VUE_APP_BASE_API = http://123.132.248.154:9224/api #VUE_APP_BASE_IMG_URL = http://123.132.248.154:9224 diff --git a/public/config/app.json b/public/config/app.json index e3032a1..b9321fa 100644 --- a/public/config/app.json +++ b/public/config/app.json @@ -6,7 +6,7 @@ "appname":"平邑县森林火灾指挥调度系统", "area":"平邑县", "baseUrl":"http://123.132.248.154:9210", - "layerurl":"https://fx.hopetrytech.com:7006/applicationMars/getApplicationInfo/pingyixian", + "layerurl":"http://123.132.248.154:9236/applicationMars/getApplicationInfo/pingyixian", "uavWebSocketUrl":"ws://123.132.248.154:9211/", "map":{ "center":[], diff --git a/src/App.vue b/src/App.vue index 94a7687..0b7b71b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,6 +51,7 @@ export default { // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https // let wsUrl = ""; window.websocket = new WebSocket(Socket_Url); + console.log('Socket_Url::: ', Socket_Url); window.websocket.onopen = this.websocketonopen; window.websocket.onerror = this.websocketonerror; window.websocket.onmessage = this.setOnmessageMessage; diff --git a/src/components/mars3d/Map.vue b/src/components/mars3d/Map.vue index d1c30fa..e8b80ee 100644 --- a/src/components/mars3d/Map.vue +++ b/src/components/mars3d/Map.vue @@ -144,7 +144,7 @@ export default { // 抛出事件 this.$emit('onload', map) - //开场动画 + // 开场动画 map.openFlyAnimation({ // duration1:4, // easingFunction1: Cesium.EasingFunction.QUINTIC_IN_OUT, diff --git a/src/views/home/lib/routePath.js b/src/views/home/lib/routePath.js index bc1eeed..c795196 100644 --- a/src/views/home/lib/routePath.js +++ b/src/views/home/lib/routePath.js @@ -31,10 +31,10 @@ export const getRouterFunc = (params, method = 'all') => { endlng: endlng, endlat: endlat, areaname: localStorage.getItem("areaName"), + strategy:37 } - getRouterByPostGis(postgisParams).then(geojson => { - //postGisCoordinates:postgis返回的geojson取出坐标数组 - let postGisCoordinates = getOneLineCoordinatesFromGeometry(geojson) + getRouterByPostGis(postgisParams).then(coordinates => { + let postGisCoordinates = coordinates let startRouterLngLat = postGisCoordinates[0] let endRouterLngLat = postGisCoordinates.at(-1) let resObject = { @@ -67,9 +67,9 @@ export const getRouterFunc = (params, method = 'all') => { areaname: localStorage.getItem("areaName"), } //使用gpostgis求出剩下的路线 - getRouterByPostGis(postgisParams).then(geojson => { + getRouterByPostGis(postgisParams).then(coordinates => { //postGisCoordinates:postgis返回的geojson取出坐标数组 - let postGisCoordinates = getOneLineCoordinatesFromGeometry(geojson) + let postGisCoordinates = coordinates // 高德返回的第一条线路的坐标数组 let path_gd = gdRoute.path_polyline //合并高德和postgis的路线 @@ -99,36 +99,21 @@ export const getRouterFunc = (params, method = 'all') => { getRouterByGD(params).then(solution => { // solution 为多条线路的数组,现在先用第一条线路 solution.path[0] let gdRoute = solution.path[0] - let postgisParams = { - startlng: gdRoute.endCoordinates[0], - startlat: gdRoute.endCoordinates[1], - endlng: endlng, - endlat: endlat, - areaname: localStorage.getItem("areaName"), + let path_gd = gdRoute.path_polyline + let allCoordinates = path_gd + let startRouterLngLat = allCoordinates[0] + let endRouterLngLat = allCoordinates.at(-1) + let resObject = { + allCoordinates: allCoordinates, //全部线路 + gdRoute: path_gd, //高德的线路 + postGisRoute: [], // postgis的线路 + startLngLat: [startlng, startlat], // 起点 + endLngLat: [endlng, endlat], //终点 + startRouterLngLat: startRouterLngLat, // 路线查询结果的起点 + endRouterLngLat: endRouterLngLat, //路线查询结果的终点 } - //使用gpostgis求出剩下的路线 - getRouterByPostGis(postgisParams).then(geojson => { - //postGisCoordinates:postgis返回的geojson取出坐标数组 - let postGisCoordinates = getOneLineCoordinatesFromGeometry(geojson) - // 高德返回的第一条线路的坐标数组 - let path_gd = gdRoute.path_polyline - //合并高德和postgis的路线 - let allCoordinates = path_gd.concat(postGisCoordinates) - //导航线路的起点和终点 - let startRouterLngLat = allCoordinates[0] - let endRouterLngLat = allCoordinates.at(-1) - let resObject = { - allCoordinates: allCoordinates, //全部线路 - gdRoute: path_gd, //高德的线路 - postGisRoute: postGisCoordinates, // postgis的线路 - startLngLat: [startlng, startlat], // 起点 - endLngLat: [endlng, endlat], //终点 - startRouterLngLat: startRouterLngLat, // 路线查询结果的起点 - endRouterLngLat: endRouterLngLat, //路线查询结果的终点 - } - let simpleRoute = getMinimumRoute(resObject) - resolve(simpleRoute) - }) + let simpleRoute = getMinimumRoute(resObject) + resolve(simpleRoute) }) }) } @@ -210,16 +195,21 @@ export const getRouterByGD = (params) => { //使用postgres + postgis寻路 export const getRouterByPostGis = (params) => { return new Promise((resolve, reject) => { - getMethodCommon("/FirePrevention/LoadRoad", params).then((res) => { + getMethodCommon("/FirePrevention/LoadRoadForAndroid", params).then((res) => { if (res.data.length > 0) { console.log('res.data::: ', res.data); - let LineString = res.data[0].route; - if (LineString == null || LineString == "null") { + + if (res.data == null || res.data.length < 1) { //没有找到路线,返回空 console.log('PostGIS未找到合适了路线') resolve(parse(null)) } else { - resolve(parse(LineString)) + let LineString = [] + res.data.map(r=>{ + let geom = JSON.parse(r.geom) + LineString = LineString.concat(geom.coordinates) + }) + resolve(LineString) } } else { console.log('PostGIS未找到合适了路线') @@ -414,23 +404,6 @@ const comLineStringGeoJson = (coordinates) => { } } } -// 从一条线的geometry中获取坐标 -const getOneLineCoordinatesFromGeometry = (geometry) => { - let coordinates = geometry.coordinates - console.log('geometry::: ', geometry); - let list = [] - if (geometry.type == "MultiLineString") { - coordinates.map(coord => { - list = list.concat(coord) - }) - } else if (geometry.type == 'LineString') { - list = list.concat(geometry.coordinates) - } else { - list = [] - } - return list - -} //从一个点的geojson中返回坐标点 const getOnePointCoordinatesFromGeoJson = (geojson) => { return geojson.geometry.coordinates