徐景良 2023-10-09 09:59:19 +08:00
commit 17c9c66d91
5 changed files with 37 additions and 63 deletions

View File

@ -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 #VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws
# 1240服务器http接口 # 1240服务器http接口
#VUE_APP_BASE_API = http://123.132.248.154:9231/api VUE_APP_BASE_API = http://123.132.248.154:9231/api
#VUE_APP_BASE_IMG_URL = http://123.132.248.154:9231 VUE_APP_BASE_IMG_URL = http://123.132.248.154:9231
#VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws
# 费县服务器https接口 # 费县服务器https接口
VUE_APP_BASE_API = https://py.hopetrytech.com:7001/api # VUE_APP_BASE_API = https://py.hopetrytech.com:7001/api
VUE_APP_BASE_IMG_URL = https://py.hopetrytech.com:7001 # VUE_APP_BASE_IMG_URL = https://py.hopetrytech.com:7001
VUE_APP_WEBSOCKET_URL = wss://py.hopetrytech.com:7002/ws # VUE_APP_WEBSOCKET_URL = wss://py.hopetrytech.com:7002/ws
#VUE_APP_BASE_API = http://123.132.248.154:9224/api #VUE_APP_BASE_API = http://123.132.248.154:9224/api
#VUE_APP_BASE_IMG_URL = http://123.132.248.154:9224 #VUE_APP_BASE_IMG_URL = http://123.132.248.154:9224

View File

@ -6,7 +6,7 @@
"appname":"平邑县森林火灾指挥调度系统", "appname":"平邑县森林火灾指挥调度系统",
"area":"平邑县", "area":"平邑县",
"baseUrl":"http://123.132.248.154:9210", "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/", "uavWebSocketUrl":"ws://123.132.248.154:9211/",
"map":{ "map":{
"center":[], "center":[],

View File

@ -51,6 +51,7 @@ export default {
// WebSocketwshttpwsshttps // WebSocketwshttpwsshttps
// let wsUrl = ""; // let wsUrl = "";
window.websocket = new WebSocket(Socket_Url); window.websocket = new WebSocket(Socket_Url);
console.log('Socket_Url::: ', Socket_Url);
window.websocket.onopen = this.websocketonopen; window.websocket.onopen = this.websocketonopen;
window.websocket.onerror = this.websocketonerror; window.websocket.onerror = this.websocketonerror;
window.websocket.onmessage = this.setOnmessageMessage; window.websocket.onmessage = this.setOnmessageMessage;

View File

@ -144,7 +144,7 @@ export default {
// //
this.$emit('onload', map) this.$emit('onload', map)
// //
map.openFlyAnimation({ map.openFlyAnimation({
// duration1:4, // duration1:4,
// easingFunction1: Cesium.EasingFunction.QUINTIC_IN_OUT, // easingFunction1: Cesium.EasingFunction.QUINTIC_IN_OUT,

View File

@ -31,10 +31,10 @@ export const getRouterFunc = (params, method = 'all') => {
endlng: endlng, endlng: endlng,
endlat: endlat, endlat: endlat,
areaname: localStorage.getItem("areaName"), areaname: localStorage.getItem("areaName"),
strategy:37
} }
getRouterByPostGis(postgisParams).then(geojson => { getRouterByPostGis(postgisParams).then(coordinates => {
//postGisCoordinates:postgis返回的geojson取出坐标数组 let postGisCoordinates = coordinates
let postGisCoordinates = getOneLineCoordinatesFromGeometry(geojson)
let startRouterLngLat = postGisCoordinates[0] let startRouterLngLat = postGisCoordinates[0]
let endRouterLngLat = postGisCoordinates.at(-1) let endRouterLngLat = postGisCoordinates.at(-1)
let resObject = { let resObject = {
@ -67,9 +67,9 @@ export const getRouterFunc = (params, method = 'all') => {
areaname: localStorage.getItem("areaName"), areaname: localStorage.getItem("areaName"),
} }
//使用gpostgis求出剩下的路线 //使用gpostgis求出剩下的路线
getRouterByPostGis(postgisParams).then(geojson => { getRouterByPostGis(postgisParams).then(coordinates => {
//postGisCoordinates:postgis返回的geojson取出坐标数组 //postGisCoordinates:postgis返回的geojson取出坐标数组
let postGisCoordinates = getOneLineCoordinatesFromGeometry(geojson) let postGisCoordinates = coordinates
// 高德返回的第一条线路的坐标数组 // 高德返回的第一条线路的坐标数组
let path_gd = gdRoute.path_polyline let path_gd = gdRoute.path_polyline
//合并高德和postgis的路线 //合并高德和postgis的路线
@ -99,36 +99,21 @@ export const getRouterFunc = (params, method = 'all') => {
getRouterByGD(params).then(solution => { getRouterByGD(params).then(solution => {
// solution 为多条线路的数组,现在先用第一条线路 solution.path[0] // solution 为多条线路的数组,现在先用第一条线路 solution.path[0]
let gdRoute = solution.path[0] let gdRoute = solution.path[0]
let postgisParams = { let path_gd = gdRoute.path_polyline
startlng: gdRoute.endCoordinates[0], let allCoordinates = path_gd
startlat: gdRoute.endCoordinates[1], let startRouterLngLat = allCoordinates[0]
endlng: endlng, let endRouterLngLat = allCoordinates.at(-1)
endlat: endlat, let resObject = {
areaname: localStorage.getItem("areaName"), allCoordinates: allCoordinates, //全部线路
gdRoute: path_gd, //高德的线路
postGisRoute: [], // postgis的线路
startLngLat: [startlng, startlat], // 起点
endLngLat: [endlng, endlat], //终点
startRouterLngLat: startRouterLngLat, // 路线查询结果的起点
endRouterLngLat: endRouterLngLat, //路线查询结果的终点
} }
//使用gpostgis求出剩下的路线 let simpleRoute = getMinimumRoute(resObject)
getRouterByPostGis(postgisParams).then(geojson => { resolve(simpleRoute)
//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)
})
}) })
}) })
} }
@ -210,16 +195,21 @@ export const getRouterByGD = (params) => {
//使用postgres + postgis寻路 //使用postgres + postgis寻路
export const getRouterByPostGis = (params) => { export const getRouterByPostGis = (params) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getMethodCommon("/FirePrevention/LoadRoad", params).then((res) => { getMethodCommon("/FirePrevention/LoadRoadForAndroid", params).then((res) => {
if (res.data.length > 0) { if (res.data.length > 0) {
console.log('res.data::: ', res.data); 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未找到合适了路线') console.log('PostGIS未找到合适了路线')
resolve(parse(null)) resolve(parse(null))
} else { } else {
resolve(parse(LineString)) let LineString = []
res.data.map(r=>{
let geom = JSON.parse(r.geom)
LineString = LineString.concat(geom.coordinates)
})
resolve(LineString)
} }
} else { } else {
console.log('PostGIS未找到合适了路线') 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中返回坐标点 //从一个点的geojson中返回坐标点
const getOnePointCoordinatesFromGeoJson = (geojson) => { const getOnePointCoordinatesFromGeoJson = (geojson) => {
return geojson.geometry.coordinates return geojson.geometry.coordinates