UNPKG

gisviewer-vue3-arcgis

Version:

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

124 lines (123 loc) 4.55 kB
import l from "@arcgis/core/Graphic"; import d from "@arcgis/core/layers/FeatureLayer"; import o from "../common-utils.mjs"; import { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as p } from "./layer-symbol.mjs"; class E { constructor(e) { this.view = e, this.signalMarkerLayer = new d( y ), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new d( c ), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new d( p ), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = !0, this.view.map.addMany([ this.signalMarkerLayer, this.signalPictureLayer, this.signalClusterLayer ]); } async showSignals(e) { await this.clearSignals(); let r = 0; const a = []; e.forEach((s) => { s.signals.forEach((i) => { const t = new l({ geometry: { type: "point", longitude: i.longitude, latitude: i.latitude }, attributes: { ObjectID: r++, id: i.id, name: i.name, signalId: i.signalId, nodeId: i.nodeId || i.id, districtId: s.id, districtName: s.name, subDistrictId: "", subDistrictName: "", isKey: i.isKey, type: "signal", selected: !0 } }); a.push(t); }), s.subDistricts.forEach((i) => { i.signals.forEach((t) => { const n = new l({ geometry: { type: "point", longitude: t.longitude, latitude: t.latitude }, attributes: { ObjectID: r++, id: t.id, name: t.name, signalId: t.signalId, nodeId: t.nodeId || t.id, districtId: s.id, districtName: s.name, subDistrictId: i.id, subDistrictName: i.name, isKey: t.isKey, type: "signal", selected: !0 } }); a.push(n); }); }); }), await this.signalMarkerLayer.applyEdits({ addFeatures: a }), await this.signalPictureLayer.applyEdits({ addFeatures: a }), await this.signalClusterLayer.applyEdits({ addFeatures: a }); } async clearSignals() { let e = await this.signalMarkerLayer.queryFeatures(); await this.signalMarkerLayer.applyEdits({ deleteFeatures: e.features }), this.signalMarkerLayer.definitionExpression = "1=1", e = await this.signalPictureLayer.queryFeatures(), await this.signalPictureLayer.applyEdits({ deleteFeatures: e.features }), this.signalPictureLayer.definitionExpression = "1=1", e = await this.signalClusterLayer.queryFeatures(), await this.signalClusterLayer.applyEdits({ deleteFeatures: e.features }), this.signalClusterLayer.definitionExpression = "1=1"; } async setPointVisible(e) { this.signalMarkerLayer.visible = e, this.signalPictureLayer.visible = e; } setClusterVisible(e) { this.signalClusterLayer.visible = e; } async locateSignal(e) { return { status: 0, message: "ok" }; } async highlightSignal(e) { let r = "", a = ""; const s = this.signalMarkerLayer.definitionExpression; this.signalMarkerLayer.definitionExpression = `signalId = '${e}'`; const i = await this.signalMarkerLayer.queryFeatures(), t = i.features.length; if (t > 0) { const n = i.features[0].attributes.districtId || "", u = i.features[0].attributes.subDistrictId || ""; return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: u, count: t }; } else this.signalMarkerLayer.definitionExpression = s; return { districtId: r, subDistrictId: a, count: t }; } filter(e) { const { id: r, type: a } = e, s = `${a === "district" ? "districtId" : "subDistrictId"} = '${r}'`; this.signalClusterLayer.definitionExpression = s, this.signalMarkerLayer.definitionExpression = s, this.signalPictureLayer.definitionExpression = s; } resetFilter() { const e = "1=1"; this.signalClusterLayer.definitionExpression = e, this.signalMarkerLayer.definitionExpression = e, this.signalPictureLayer.definitionExpression = e; } } export { E as default };