UNPKG

gisviewer-vue3-arcgis

Version:

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

138 lines (137 loc) 3.46 kB
import i from "@arcgis/core/Graphic"; import h from "@arcgis/core/layers/GraphicsLayer"; import o from "../common-utils.mjs"; class S { constructor(e) { this.view = e, this.signalSystemLayer = new h({ title: "信控系统图层" }), this.view.map.add(this.signalSystemLayer); } /** * 显示信控系统 * @param params * @returns */ async showSignalSystems(e) { return e.areaList.forEach((s) => { this.showSystem(s); }), await o.viewGoto( this.view, this.signalSystemLayer.graphics.toArray() ), { status: 0, message: "success" }; } /** * 显示信控子系统 * @param params * @returns */ async showSubSignalSystems(e) { return e.areaList.forEach((s) => { this.showSubSystem(s); }), await o.viewGoto( this.view, this.signalSystemLayer.graphics.toArray() ), { status: 0, message: "success" }; } removeSubSignalSystems(e) { return e ? this.signalSystemLayer.graphics.filter((s) => s.getAttribute("subCode") === e).forEach((s) => { this.signalSystemLayer.remove(s); }) : this.signalSystemLayer.removeAll(), { status: 0, message: "success" }; } removeSignalSystems(e) { return e ? this.signalSystemLayer.graphics.filter((s) => s.getAttribute("areaCode") === e).forEach((s) => { this.signalSystemLayer.remove(s); }) : this.signalSystemLayer.removeAll(), { status: 0, message: "success" }; } showSystem(e) { if (e.shape) { let s; if (typeof e.shape == "string" ? s = JSON.parse(e.shape) : s = e.shape, s) { const t = new i({ geometry: { type: "polyline", paths: [s] }, symbol: e.lineSymbol || { type: "simple-line", style: "dash", color: [17, 113, 191], width: 2 }, attributes: { areaCode: e.areaCode, type: "signal-system-border" } }); this.signalSystemLayer.add(t); } } e.children.forEach((s) => { this.showSubSystem(s, e.areaCode); }); } showSubSystem(e, s) { if (e.subShape) { let t; typeof e.subShape == "string" ? t = JSON.parse(e.subShape) : t = e.subShape; const a = t.map((r, l) => new i({ geometry: { type: "polyline", paths: [r] }, symbol: e.roadSymbol || { type: "simple-line", color: [23, 151, 255], width: 3 }, attributes: { type: "signal-sub-system", id: e.subAreaCode + "_" + l, subCode: e.subAreaCode, areaCode: s || "" } })); this.signalSystemLayer.addMany(a); } if (e.children) { const t = e.children.map((a) => new i({ geometry: { type: "point", longitude: Number(a.x), latitude: Number(a.y) }, symbol: a.symbol || e.nodeSymbol || { type: "simple-marker", color: [23, 151, 255, 0.8], size: 10, outline: { color: [23, 151, 255], width: 2 } }, attributes: { ...a, type: "signal-sub-system-node", subCode: e.subAreaCode, areaCode: s || "" } })); this.signalSystemLayer.addMany(t); } } } export { S as default };