gisviewer-vue3-arcgis 1.0.235 → 1.0.237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/utils/common-utils.d.ts +2 -0
- package/es/src/gis-map/utils/common-utils.mjs +37 -23
- package/es/src/gis-map/utils/detect-gpu.mjs +4 -4
- package/es/src/gis-map/utils/signal-control-area/district-controller.d.ts +2 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +42 -26
- package/es/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +19 -24
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +30 -34
- package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +39 -72
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +36 -37
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +95 -107
- package/es/src/types/index.d.ts +6 -0
- package/lib/src/gis-map/utils/common-utils.d.ts +2 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- package/lib/src/gis-map/utils/detect-gpu.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-controller.d.ts +2 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.d.ts +1 -2
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +0 -7
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +3 -4
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.d.ts +13 -6
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -1
- package/lib/src/types/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -2,17 +2,17 @@ import { Polygon as f } from "@arcgis/core/geometry";
|
|
|
2
2
|
import { webMercatorToGeographic as y } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
3
3
|
import g from "@arcgis/core/Graphic";
|
|
4
4
|
import m from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
-
import p from "papaparse";
|
|
6
5
|
import R from "../../stores/index.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import w from "./district-controller.mjs";
|
|
7
|
+
import D from "./district-renderer.mjs";
|
|
8
|
+
import p from "./signal-renderer.mjs";
|
|
10
9
|
import C from "./sub-district-renderer.mjs";
|
|
11
|
-
class
|
|
10
|
+
class N {
|
|
11
|
+
// private roadLines!: IRoadLine[];
|
|
12
12
|
constructor(e) {
|
|
13
|
-
this.detachmentLayerLoaded = !1, this.view = e
|
|
13
|
+
this.detachmentLayerLoaded = !1, this.view = e;
|
|
14
14
|
const t = R.useAppDataStore;
|
|
15
|
-
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new m(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new
|
|
15
|
+
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig)), this.detachmentLayer = new m(), this.view.map.add(this.detachmentLayer), this.districtRenderer = new D(e), this.subDistrictRenderer = new C(e), this.signalRenderer = new p(e);
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* 显示所有区控、子区、信号机
|
|
@@ -20,16 +20,16 @@ class P {
|
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
22
|
async showSignalControlArea(e) {
|
|
23
|
-
this.detachmentLayerLoaded || await this.loadDetachmentLayer(),
|
|
24
|
-
const t = [],
|
|
25
|
-
for (const
|
|
26
|
-
const
|
|
27
|
-
|
|
23
|
+
this.detachmentLayerLoaded || await this.loadDetachmentLayer(), await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
|
|
24
|
+
const t = [], i = [];
|
|
25
|
+
for (const n of e.areaList) {
|
|
26
|
+
const s = new w(
|
|
27
|
+
n,
|
|
28
28
|
e.style || ""
|
|
29
29
|
);
|
|
30
|
-
t.push(
|
|
30
|
+
t.push(s), i.push(...s.subDistricts);
|
|
31
31
|
}
|
|
32
|
-
return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(
|
|
32
|
+
return this.districtRenderer.style = e.style || "", await this.districtRenderer.showDistricts(t), await this.subDistrictRenderer.showSubDistricts(i), await this.signalRenderer.showSignals(t), { status: 0, message: "ok" };
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* 清空区控、子区、信号机
|
|
@@ -88,14 +88,14 @@ class P {
|
|
|
88
88
|
async highlightSignalControlArea(e) {
|
|
89
89
|
switch (this.view.closePopup(), e.type) {
|
|
90
90
|
case "district":
|
|
91
|
-
return await this.districtRenderer.highlightDistrict(e.id) ? (this.subDistrictRenderer.filter(
|
|
91
|
+
return await this.districtRenderer.highlightDistrict(e.id) ? (this.subDistrictRenderer.filter(e), this.signalRenderer.filter(e), await this.subDistrictRenderer.showRoads(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
|
|
92
92
|
case "subDistrict": {
|
|
93
|
-
const { count: t, parentId:
|
|
94
|
-
return t > 0 ? (this.districtRenderer.filter(
|
|
93
|
+
const { count: t, parentId: i } = await this.subDistrictRenderer.highlightSubDistrict(e.id);
|
|
94
|
+
return t > 0 ? (this.districtRenderer.filter(i), this.signalRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
95
95
|
}
|
|
96
96
|
case "signal": {
|
|
97
|
-
const { districtId: t, subDistrictId:
|
|
98
|
-
return
|
|
97
|
+
const { districtId: t, subDistrictId: i, count: n } = await this.signalRenderer.highlightSignal(e.id);
|
|
98
|
+
return n > 0 ? (this.districtRenderer.filter(t), this.subDistrictRenderer.filter(e), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
|
|
99
99
|
}
|
|
100
100
|
default:
|
|
101
101
|
return { status: 1, message: "未知类型" };
|
|
@@ -108,39 +108,6 @@ class P {
|
|
|
108
108
|
async resetHighlight() {
|
|
109
109
|
return this.districtRenderer.resetFilter(), this.subDistrictRenderer.resetFilter(), this.signalRenderer.resetFilter(), { status: 0, message: "ok" };
|
|
110
110
|
}
|
|
111
|
-
/**
|
|
112
|
-
* 获取道路线
|
|
113
|
-
* @returns
|
|
114
|
-
*/
|
|
115
|
-
async loadRoadLine() {
|
|
116
|
-
var t;
|
|
117
|
-
const e = (t = this.mapConfig.signalControlArea) == null ? void 0 : t.roadLayerUrl;
|
|
118
|
-
if (!e) {
|
|
119
|
-
console.warn("未配置道路线图层URL");
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const a = await (await fetch(`/GisViewerAssets/${e}`)).text();
|
|
124
|
-
p.parse(a, {
|
|
125
|
-
header: !0,
|
|
126
|
-
skipEmptyLines: !0,
|
|
127
|
-
complete: (i) => {
|
|
128
|
-
const { data: r } = i;
|
|
129
|
-
this.roadLines = r.map((n) => ({
|
|
130
|
-
id: n.ROADSECT_ID,
|
|
131
|
-
fromNode: n.FROM_NODE_ID,
|
|
132
|
-
toNode: n.TO_NODE_ID,
|
|
133
|
-
coordinates: JSON.parse(n.GEOM).coordinates
|
|
134
|
-
}));
|
|
135
|
-
},
|
|
136
|
-
error: (i) => {
|
|
137
|
-
console.error("道路线CSV解析失败:", i);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
} catch (s) {
|
|
141
|
-
console.error("读取道路线CSV失败:", s);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
111
|
/**
|
|
145
112
|
* 加载支队图层
|
|
146
113
|
* 现场环境用url创建FeatureLayer有各种问题,
|
|
@@ -151,35 +118,35 @@ class P {
|
|
|
151
118
|
if (!e)
|
|
152
119
|
return;
|
|
153
120
|
const t = e.find(
|
|
154
|
-
(
|
|
121
|
+
(i) => i.options.id === "shanghai_district"
|
|
155
122
|
);
|
|
156
123
|
if (t)
|
|
157
124
|
try {
|
|
158
|
-
const
|
|
125
|
+
const n = await (await fetch(
|
|
159
126
|
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
160
|
-
)).json(),
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
127
|
+
)).json(), s = [], { renderer: r, labelingInfo: d } = t.options;
|
|
128
|
+
n.features.forEach((c) => {
|
|
129
|
+
const o = c.attributes.ZD_NAME;
|
|
130
|
+
if (o !== "高架支队") {
|
|
164
131
|
let l = new f({
|
|
165
|
-
rings:
|
|
132
|
+
rings: c.geometry.rings
|
|
166
133
|
});
|
|
167
134
|
l = y(l);
|
|
168
|
-
const
|
|
135
|
+
const a = new g({
|
|
169
136
|
geometry: l,
|
|
170
|
-
attributes:
|
|
137
|
+
attributes: c.attributes
|
|
171
138
|
});
|
|
172
139
|
if (r) {
|
|
173
140
|
if (r.type === "simple")
|
|
174
|
-
|
|
141
|
+
a.symbol = r.symbol;
|
|
175
142
|
else if (r.type === "unique-value") {
|
|
176
|
-
const h =
|
|
143
|
+
const h = a.getAttribute("OBJECTID"), u = r.uniqueValueInfos.find(
|
|
177
144
|
(b) => b.value == h
|
|
178
145
|
);
|
|
179
|
-
|
|
146
|
+
a.symbol = u ? u.symbol : r.defaultSymbol;
|
|
180
147
|
}
|
|
181
148
|
} else
|
|
182
|
-
|
|
149
|
+
a.symbol = {
|
|
183
150
|
type: "simple-fill",
|
|
184
151
|
color: [227, 237, 255, 0.4],
|
|
185
152
|
outline: {
|
|
@@ -187,21 +154,21 @@ class P {
|
|
|
187
154
|
width: 2
|
|
188
155
|
}
|
|
189
156
|
};
|
|
190
|
-
if (
|
|
157
|
+
if (s.push(a), d && o !== "边防港航支队" && o !== "机场支队") {
|
|
191
158
|
const h = new g({
|
|
192
159
|
geometry: l.centroid,
|
|
193
|
-
symbol: { ...
|
|
160
|
+
symbol: { ...d.symbol, text: o }
|
|
194
161
|
});
|
|
195
|
-
|
|
162
|
+
s.push(h);
|
|
196
163
|
}
|
|
197
164
|
}
|
|
198
|
-
}), this.detachmentLayer.addMany(
|
|
199
|
-
} catch (
|
|
200
|
-
console.error("加载支队图层失败:",
|
|
165
|
+
}), this.detachmentLayer.addMany(s), this.detachmentLayerLoaded = !0;
|
|
166
|
+
} catch (i) {
|
|
167
|
+
console.error("加载支队图层失败:", i);
|
|
201
168
|
return;
|
|
202
169
|
}
|
|
203
170
|
}
|
|
204
171
|
}
|
|
205
172
|
export {
|
|
206
|
-
|
|
173
|
+
N as default
|
|
207
174
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { IResult } from '../../../types';
|
|
1
|
+
import { IFindSignalControlAreaParams, IResult } from '../../../types';
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class CrossRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private signalMarkerLayer;
|
|
7
6
|
private signalPictureLayer;
|
|
8
7
|
private signalClusterLayer;
|
|
9
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
8
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
10
9
|
showSignals(controllers: DistrictController[]): Promise<void>;
|
|
11
10
|
clearSignals(): Promise<void>;
|
|
12
11
|
setPointVisible(visible: boolean): Promise<void>;
|
|
@@ -17,6 +16,6 @@ export default class CrossRenderer {
|
|
|
17
16
|
subDistrictId: string;
|
|
18
17
|
count: number;
|
|
19
18
|
}>;
|
|
20
|
-
filter(
|
|
19
|
+
filter(params: IFindSignalControlAreaParams): void;
|
|
21
20
|
resetFilter(): void;
|
|
22
21
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import u from "@arcgis/core/Graphic";
|
|
2
|
+
import d from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
+
import o from "../common-utils.mjs";
|
|
4
|
+
import { signalMarkerLayerOptions as y, signalPictureLayerOptions as c, signalClusterLayerOptions as p } from "./layer-symbol.mjs";
|
|
5
|
+
class E {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.view = e, this.signalMarkerLayer = new d(
|
|
7
8
|
y
|
|
8
|
-
), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new
|
|
9
|
+
), this.signalMarkerLayer.spatialReference = e.spatialReference, this.signalMarkerLayer.popupEnabled = !0, this.signalPictureLayer = new d(
|
|
9
10
|
c
|
|
10
|
-
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new
|
|
11
|
-
|
|
11
|
+
), this.signalPictureLayer.spatialReference = e.spatialReference, this.signalPictureLayer.popupEnabled = !0, this.signalClusterLayer = new d(
|
|
12
|
+
p
|
|
12
13
|
), this.signalClusterLayer.spatialReference = e.spatialReference, this.signalClusterLayer.popupEnabled = !0, this.view.map.addMany([
|
|
13
14
|
this.signalMarkerLayer,
|
|
14
15
|
this.signalPictureLayer,
|
|
@@ -17,24 +18,24 @@ class f {
|
|
|
17
18
|
}
|
|
18
19
|
async showSignals(e) {
|
|
19
20
|
await this.clearSignals();
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
e.forEach((
|
|
23
|
-
|
|
24
|
-
const t = new
|
|
21
|
+
let r = 0;
|
|
22
|
+
const a = [];
|
|
23
|
+
e.forEach((s) => {
|
|
24
|
+
s.signals.forEach((i) => {
|
|
25
|
+
const t = new u({
|
|
25
26
|
geometry: {
|
|
26
27
|
type: "point",
|
|
27
28
|
longitude: i.longitude,
|
|
28
29
|
latitude: i.latitude
|
|
29
30
|
},
|
|
30
31
|
attributes: {
|
|
31
|
-
ObjectID:
|
|
32
|
+
ObjectID: r++,
|
|
32
33
|
id: i.id,
|
|
33
34
|
name: i.name,
|
|
34
35
|
signalId: i.signalId,
|
|
35
36
|
nodeId: i.nodeId || i.id,
|
|
36
|
-
districtId:
|
|
37
|
-
districtName:
|
|
37
|
+
districtId: s.id,
|
|
38
|
+
districtName: s.name,
|
|
38
39
|
subDistrictId: "",
|
|
39
40
|
subDistrictName: "",
|
|
40
41
|
isKey: i.isKey,
|
|
@@ -42,23 +43,23 @@ class f {
|
|
|
42
43
|
selected: !0
|
|
43
44
|
}
|
|
44
45
|
});
|
|
45
|
-
|
|
46
|
-
}),
|
|
46
|
+
a.push(t);
|
|
47
|
+
}), s.subDistricts.forEach((i) => {
|
|
47
48
|
i.signals.forEach((t) => {
|
|
48
|
-
const n = new
|
|
49
|
+
const n = new u({
|
|
49
50
|
geometry: {
|
|
50
51
|
type: "point",
|
|
51
52
|
longitude: t.longitude,
|
|
52
53
|
latitude: t.latitude
|
|
53
54
|
},
|
|
54
55
|
attributes: {
|
|
55
|
-
ObjectID:
|
|
56
|
+
ObjectID: r++,
|
|
56
57
|
id: t.id,
|
|
57
58
|
name: t.name,
|
|
58
59
|
signalId: t.signalId,
|
|
59
60
|
nodeId: t.nodeId || t.id,
|
|
60
|
-
districtId:
|
|
61
|
-
districtName:
|
|
61
|
+
districtId: s.id,
|
|
62
|
+
districtName: s.name,
|
|
62
63
|
subDistrictId: i.id,
|
|
63
64
|
subDistrictName: i.name,
|
|
64
65
|
isKey: t.isKey,
|
|
@@ -66,15 +67,15 @@ class f {
|
|
|
66
67
|
selected: !0
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
|
-
|
|
70
|
+
a.push(n);
|
|
70
71
|
});
|
|
71
72
|
});
|
|
72
73
|
}), await this.signalMarkerLayer.applyEdits({
|
|
73
|
-
addFeatures:
|
|
74
|
+
addFeatures: a
|
|
74
75
|
}), await this.signalPictureLayer.applyEdits({
|
|
75
|
-
addFeatures:
|
|
76
|
+
addFeatures: a
|
|
76
77
|
}), await this.signalClusterLayer.applyEdits({
|
|
77
|
-
addFeatures:
|
|
78
|
+
addFeatures: a
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
async clearSignals() {
|
|
@@ -97,21 +98,19 @@ class f {
|
|
|
97
98
|
return { status: 0, message: "ok" };
|
|
98
99
|
}
|
|
99
100
|
async highlightSignal(e) {
|
|
100
|
-
let
|
|
101
|
-
const
|
|
101
|
+
let r = "", a = "";
|
|
102
|
+
const s = this.signalMarkerLayer.definitionExpression;
|
|
102
103
|
this.signalMarkerLayer.definitionExpression = `signalId = '${e}'`;
|
|
103
104
|
const i = await this.signalMarkerLayer.queryFeatures(), t = i.features.length;
|
|
104
105
|
if (t > 0) {
|
|
105
106
|
const n = i.features[0].attributes.districtId || "", l = i.features[0].attributes.subDistrictId || "";
|
|
106
|
-
return await this.view
|
|
107
|
-
duration: this.hasGpu ? 1e3 : 0
|
|
108
|
-
}), { districtId: n, subDistrictId: l, count: t };
|
|
107
|
+
return await o.viewGoto(this.view, i.features), { districtId: n, subDistrictId: l, count: t };
|
|
109
108
|
} else
|
|
110
|
-
this.signalMarkerLayer.definitionExpression =
|
|
111
|
-
return { districtId:
|
|
109
|
+
this.signalMarkerLayer.definitionExpression = s;
|
|
110
|
+
return { districtId: r, subDistrictId: a, count: t };
|
|
112
111
|
}
|
|
113
|
-
filter(e
|
|
114
|
-
const s = `${
|
|
112
|
+
filter(e) {
|
|
113
|
+
const { id: r, type: a } = e, s = `${a === "district" ? "districtId" : "subDistrictId"} = '${r}'`;
|
|
115
114
|
this.signalClusterLayer.definitionExpression = s, this.signalMarkerLayer.definitionExpression = s, this.signalPictureLayer.definitionExpression = s;
|
|
116
115
|
}
|
|
117
116
|
resetFilter() {
|
|
@@ -120,5 +119,5 @@ class f {
|
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
export {
|
|
123
|
-
|
|
122
|
+
E as default
|
|
124
123
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IDistrictRoad, IFindSignalControlAreaParams, IResult } from '../../../types';
|
|
2
2
|
import DistrictController from './district-controller';
|
|
3
3
|
export default class SubDistrictRenderer {
|
|
4
4
|
private view;
|
|
5
|
-
private hasGpu;
|
|
6
5
|
private clickHandler;
|
|
7
6
|
private subDistrictPointLayer;
|
|
8
7
|
private subDistrictLineLayer;
|
|
9
|
-
|
|
10
|
-
constructor(view: __esri.MapView | __esri.SceneView
|
|
8
|
+
roadConnections: IDistrictRoad[];
|
|
9
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
11
10
|
showSubDistricts(controllers: DistrictController[]): Promise<void>;
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* 显示区控下的所有子区,用道路线表示
|
|
13
|
+
* @param id 区控ID
|
|
14
|
+
*/
|
|
15
|
+
showRoads(params: IFindSignalControlAreaParams): Promise<void>;
|
|
13
16
|
clearSubDistricts(): Promise<void>;
|
|
14
17
|
setVisible(visible: boolean): void;
|
|
15
18
|
/**
|
|
@@ -31,12 +34,16 @@ export default class SubDistrictRenderer {
|
|
|
31
34
|
* @param type 类型,district 或 subDistrict
|
|
32
35
|
* @param id
|
|
33
36
|
*/
|
|
34
|
-
filter(
|
|
37
|
+
filter(param: IFindSignalControlAreaParams): void;
|
|
35
38
|
/**
|
|
36
39
|
* 重置过滤器,显示所有子区
|
|
37
40
|
*/
|
|
38
41
|
resetFilter(): void;
|
|
39
42
|
private currentPointRenderer;
|
|
40
43
|
private currentLineRenderer;
|
|
44
|
+
/**
|
|
45
|
+
* 监听地图点击事件,进行子区高亮
|
|
46
|
+
* @param event
|
|
47
|
+
*/
|
|
41
48
|
private viewHitTest;
|
|
42
49
|
}
|