| | |
| | | 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的实体类 |
| | |
| | | |
| | | // 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: { |
| | |
| | | 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: [ |
| | |
| | | f: "json", |
| | | }; |
| | | axios |
| | | .get(url, { |
| | | .get(curPath.url, { |
| | | params: { |
| | | ...data, |
| | | }, |
| | |
| | | .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 = { |
| | |
| | | }); |
| | | 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({ |