UNPKG

gisviewer-vue3-arcgis

Version:

在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:

113 lines (112 loc) 3.29 kB
import l from "@arcgis/core/Graphic"; import { Point as w } from "@arcgis/core/geometry"; import h from "@arcgis/core/layers/GraphicsLayer"; import { TextSymbol as y, SimpleMarkerSymbol as f } from "@arcgis/core/symbols"; import p from "../common-utils.mjs"; import L from "./cross.mjs"; import A from "./search-nearby-lanes.mjs"; import N from "./indicator-area.mjs"; class k { /** * 道路配置工具相关功能 * @param map map实例 * @param mapConfig 地图配置 */ constructor(e) { this.view = e, this.laneNumberLayer = new h({ minScale: 2257 }), this.view.map.add(this.laneNumberLayer), this.crossIndicatorAreaLayer = new h(), this.view.map.add(this.crossIndicatorAreaLayer); } /** * 在进口道的顶端显示车道序号 * @param params * @returns */ showLaneNumber(e) { const { lanes: i } = e, s = [], o = []; for (const m of i) { const { crossId: n, laneNumber: a, stopLineCenter: r, laneDirection: c } = m; if (!r[0] || !r[1]) continue; let t = new w({ longitude: r[0], latitude: r[1] }); c && (t = p.destinationWithPoint( t, c, -3 )); const d = { type: "laneNumber", id: `${n}_${a}`, crossId: n, laneNumber: a }, u = new l({ geometry: t, symbol: new y({ text: a, color: "red", verticalAlignment: "middle", font: { size: 10 } }) }); o.push(u); const b = new l({ geometry: t, // 半透明白色圆点 symbol: new f({ style: "circle", color: [255, 255, 255, 0.8], size: 14, outline: { color: "white", width: 1 } }), attributes: d }); s.push(b); } return this.laneNumberLayer.addMany(s), this.laneNumberLayer.addMany(o), { status: 0, message: "车道序号显示成功" }; } /** 清除车道序号 */ clearLaneNumber() { this.laneNumberLayer.removeAll(); } /** * 初始化算法区域生成工具 * @param params * @returns Promise<IResult> */ async initializeSearch(e) { var i; return this.searchLaneTool || (this.searchLaneTool = new A(this.view)), this.cross = new L({ id: e.crossId, center: e.crossCenter }), (i = this.indicatorAreaTool) == null || i.clearIndicatorArea(), this.searchLaneTool.initializeSearch(e); } /** * 生成路口指标计算区 */ async calCrossIndicatorArea() { this.cross.initialized || await this.initializeCross(), this.indicatorAreaTool || (this.indicatorAreaTool = new N(this.view)), await this.indicatorAreaTool.showCrossIndicatorArea(this.cross); } /** * 路口初始化,计算周边进口道与车道 * @returns */ async initializeCross() { if (!this.searchLaneTool) return { status: -1, message: "算法区域生成工具未初始化, 请先执行initializeSearch" }; const e = await this.searchLaneTool.getCurrentSearchResult(); this.searchLaneTool.clearResult(), await this.cross.initialize(e); const i = this.cross.getLaneNumberInfo(); this.showLaneNumber({ lanes: i }); } } export { k as default };