From 71fa6546c0ff5822bdf1e950f637a603a515f529 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 08 Dec 2023 15:50:59 +0800
Subject: [PATCH] 移动端路网
---
src/store/modules/mobile.js | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 27b8595..b7a1cef 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -17,6 +17,7 @@
import { Icon, Style, Fill, Text, Stroke } from "ol/style.js";
import openlayerData from "./openlayerData";
+import mobilePosition from "./mobilePosition";
window.popupsDom = null; // mobileDivForms的实体类
window.flytoPosition = null; // mobileDivForms的实体类
@@ -57,6 +58,17 @@
// window.newLayer = null;
// window.usetowpointfive = null;
+
+let pathUrl = [
+ {
+ key: 1,
+ url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/hjzlw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+ },
+ {
+ key: 2,
+ url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/fllw/NAServer/%E8%B7%AF%E5%BE%84/solve",
+ },
+];
const mobile = {
state: {
@@ -893,10 +905,10 @@
Number(val.end[1]).toFixed(6),
]; // 导航终点
- // 获取路径
- const url =
- "https://dev.jxpskj.com:8023/arcgis/rest/services/jglw/NAServer/%E8%B7%AF%E5%BE%84/solve"; // 默认api步行
- // const url = 'https://dev.jxpskj.com:8023/arcgis/rest/services/testroad/NAServer/%E8%B7%AF%E5%BE%84/solve' // 默认api步行
+ let curPath = pathUrl.find(
+ (item) => item.key == mobilePosition.state.currentCampus
+ );
+
const data = {
stops: {
features: [
@@ -919,7 +931,7 @@
f: "json",
};
axios
- .get(url, {
+ .get(curPath.url, {
params: {
...data,
},
@@ -927,11 +939,11 @@
.then((res) => {
// 回调
- let Str = ""; // 加入起点
- res.data.routes.features[0].geometry.paths[0].forEach((item) => {
- Str += `${item[0]},${item[1]};`;
- });
- // Str += state.navigationEndLngLat.join(',') // 加入终点
+ let Str = res.data.routes.features[0].geometry.paths[0].map(
+ (item) => {
+ return [item[0], item[1]];
+ }
+ );
if (val.fn) {
const dataS = {
@@ -959,11 +971,7 @@
});
openlayerData.state.openlayers.map2D.addLayer(window.drawALineLayer);
- const lineCoordinates = value
- .split(";")
- .map((item) => item.split(",").map((i) => Number(i)));
-
- const line = new LineString(lineCoordinates);
+ const line = new LineString(value);
const style = new Style({
stroke: new Stroke({
--
Gitblit v1.9.3