UNPKG

gisviewer-vue3-arcgis

Version:

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

70 lines (69 loc) 2.84 kB
import h from "pako"; import c from "../common-utils.mjs"; class e { constructor(o, s) { this.parentName = "", this.signals = [], this.subDistricts = [], this.areaColor = this.getDarkNonGrayColor(), this.signalCount = 0, this.subDistrictCount = 0, this.roadConnections = [], this.id = o.name, this.name = o.areaDesc, this.parentId = o.parentId, s === "alarm" && (this.areaColor = [255, 0, 0]); for (const t of o.children) if (t.children) { const i = new e(t, s); if (i.id = t.id, i.name = `SS ${t.name}`, i.parentId = this.id, i.parentName = this.name, i.areaColor = this.getDarkNonGrayColor(t.id), this.subDistricts.push(i), this.subDistrictCount++, this.signalCount += i.signalCount, t.mapConnectList) try { const a = t.mapConnectList, n = new Uint8Array( window.atob(a).split("").map((r) => r.charCodeAt(0)) ), l = h.inflate(n, { to: "string" }), d = JSON.parse(l); i.roadConnections.push( ...d.map((r) => ({ id: r.roadsectId, coordinates: JSON.parse(r.geomData).coordinates, districtId: i.parentId, subDistrictId: i.id })) ), console.log(i.roadConnections); } catch (a) { console.error("解压子区路段连接信息失败:", a); } } else if (c.isCoordinateValid(t)) { const i = { id: t.id, name: t.name, parentId: t.parentId, latitude: Number(t.latitude), longitude: Number(t.longitude), signalId: t.signalId, nodeId: t.nodeId, isKey: t.isKey === 1 }; this.signals.push(i), this.signalCount++; } } /** * 获取区控/子区下的所有信号机 * @returns */ getAllSignalCoordinates() { const o = []; for (const s of this.signals) o.push([s.longitude, s.latitude]); for (const s of this.subDistricts) o.push(...s.getAllSignalCoordinates()); return o; } getDarkNonGrayColor(o) { let s, t, i; if (o) { const a = this.cyrb53(o); s = ((a & 16711680) >> 16) % 200, t = ((a & 65280) >> 8) % 200, i = (a & 255) % 200; } else s = Math.floor(Math.random() * 256), t = Math.floor(Math.random() * 256), i = Math.floor(Math.random() * 256); return [s, t, i]; } cyrb53(o, s = 0) { let t = 3735928559 ^ s, i = 1103547991 ^ s; for (let a = 0, n; a < o.length; a++) n = o.charCodeAt(a), t = Math.imul(t ^ n, 2654435761), i = Math.imul(i ^ n, 1597334677); return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(t ^ t >>> 13, 3266489909), 4294967296 * (2097151 & i) + (t >>> 0); } } export { e as default };