gisviewer-vue3-arcgis 1.0.254 → 1.0.255
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/gis-map.vue.d.ts +3 -1
- package/es/src/gis-map/gis-map.vue.mjs +175 -173
- package/es/src/gis-map/index.d.ts +3 -1
- package/es/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
- package/es/src/gis-map/utils/dbscan-cluster/index.mjs +42 -36
- package/es/src/gis-map/utils/map-initializer.d.ts +10 -1
- package/es/src/gis-map/utils/map-initializer.mjs +181 -111
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +145 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +51 -35
- package/es/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
- package/es/src/gis-map/utils/signal-control-area/show-area.mjs +63 -105
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.d.ts +1 -1
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +5 -5
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +84 -83
- package/es/src/types/index.d.ts +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -1
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -1
- package/lib/src/gis-map/utils/dbscan-cluster/index.d.ts +4 -2
- package/lib/src/gis-map/utils/dbscan-cluster/index.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +10 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.d.ts +9 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.d.ts +3 -8
- 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 +1 -1
- 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.js +1 -1
- package/lib/src/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as
|
|
1
|
+
import m from "@arcgis/core/Graphic";
|
|
2
|
+
import v from "@arcgis/core/layers/FeatureLayer";
|
|
3
|
+
import D from "../common-utils.mjs";
|
|
4
|
+
import { subDistrictPointLayerOptions as I, subDistrictLineLayerOptions as g } from "./layer-symbol.mjs";
|
|
5
5
|
class C {
|
|
6
|
-
constructor(
|
|
7
|
-
this.roadConnections = [], this.view =
|
|
6
|
+
constructor(i) {
|
|
7
|
+
this.roadConnections = [], this.view = i, this.subDistrictPointLayer = new v(
|
|
8
8
|
I
|
|
9
|
-
), this.subDistrictPointLayer.spatialReference =
|
|
10
|
-
|
|
11
|
-
), this.subDistrictLineLayer.spatialReference =
|
|
9
|
+
), this.subDistrictPointLayer.spatialReference = i.spatialReference, this.subDistrictPointLayer.popupEnabled = !0, this.subDistrictLineLayer = new v(
|
|
10
|
+
g
|
|
11
|
+
), this.subDistrictLineLayer.spatialReference = i.spatialReference, this.subDistrictLineLayer.popupEnabled = !0, this.view.map.addMany([
|
|
12
12
|
this.subDistrictLineLayer,
|
|
13
13
|
this.subDistrictPointLayer
|
|
14
14
|
]);
|
|
15
15
|
}
|
|
16
|
-
async showSubDistricts(
|
|
17
|
-
|
|
16
|
+
async showSubDistricts(i) {
|
|
17
|
+
var a;
|
|
18
|
+
console.log(i), await this.clearSubDistricts(), (a = this.clickHandler) == null || a.remove(), this.clickHandler = this.view.on("click", this.viewHitTest.bind(this));
|
|
18
19
|
let s = 0;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
value:
|
|
23
|
-
label:
|
|
20
|
+
const e = [], r = [];
|
|
21
|
+
i.forEach((t) => {
|
|
22
|
+
t.roadConnections.length > 0 && this.roadConnections.push(...t.roadConnections), r.push({
|
|
23
|
+
value: t.id,
|
|
24
|
+
label: t.name,
|
|
24
25
|
symbol: {
|
|
25
26
|
type: "simple-marker",
|
|
26
27
|
style: "circle",
|
|
27
|
-
color: [...
|
|
28
|
+
color: [...t.areaColor, 0.8],
|
|
28
29
|
size: "8px",
|
|
29
30
|
outline: {
|
|
30
|
-
color: [...
|
|
31
|
+
color: [...t.areaColor],
|
|
31
32
|
width: 4
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
}),
|
|
35
|
-
const
|
|
35
|
+
}), t.signals.forEach((n) => {
|
|
36
|
+
const d = new m({
|
|
36
37
|
geometry: {
|
|
37
38
|
type: "point",
|
|
38
|
-
longitude:
|
|
39
|
-
latitude:
|
|
39
|
+
longitude: n.longitude,
|
|
40
|
+
latitude: n.latitude
|
|
40
41
|
},
|
|
41
42
|
attributes: {
|
|
42
43
|
ObjectID: s++,
|
|
43
|
-
id:
|
|
44
|
-
name:
|
|
45
|
-
subDistrictId:
|
|
46
|
-
subDistrictName:
|
|
47
|
-
districtId:
|
|
48
|
-
districtName:
|
|
49
|
-
signalCount:
|
|
50
|
-
color:
|
|
44
|
+
id: n.nodeId,
|
|
45
|
+
name: n.name,
|
|
46
|
+
subDistrictId: t.id,
|
|
47
|
+
subDistrictName: t.name,
|
|
48
|
+
districtId: t.parentId,
|
|
49
|
+
districtName: t.parentName,
|
|
50
|
+
signalCount: t.signalCount,
|
|
51
|
+
color: t.areaColor.join(","),
|
|
51
52
|
type: "subDistrict"
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
|
|
55
|
+
e.push(d);
|
|
55
56
|
});
|
|
56
57
|
}), this.subDistrictPointLayer.renderer = {
|
|
57
58
|
type: "unique-value",
|
|
@@ -96,42 +97,42 @@ class C {
|
|
|
96
97
|
}
|
|
97
98
|
]
|
|
98
99
|
}, this.currentPointRenderer = this.subDistrictPointLayer.renderer.clone(), await this.subDistrictPointLayer.applyEdits({
|
|
99
|
-
addFeatures:
|
|
100
|
-
});
|
|
100
|
+
addFeatures: e
|
|
101
|
+
}), await D.viewGoto(this.view, e);
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* 显示区控下的所有子区,用道路线表示
|
|
104
105
|
* @param id 区控ID
|
|
105
106
|
*/
|
|
106
|
-
async showRoads(
|
|
107
|
-
const { type: s, id:
|
|
108
|
-
r.where = `${
|
|
109
|
-
const
|
|
107
|
+
async showRoads(i) {
|
|
108
|
+
const { type: s, id: e } = i, r = this.subDistrictPointLayer.createQuery(), a = s === "district" ? "districtId" : "subDistrictId";
|
|
109
|
+
r.where = `${a} = '${e}'`;
|
|
110
|
+
const t = await this.subDistrictPointLayer.queryFeatures(
|
|
110
111
|
r
|
|
111
112
|
), n = /* @__PURE__ */ new Map();
|
|
112
|
-
|
|
113
|
+
t.features.forEach((u) => {
|
|
113
114
|
var y;
|
|
114
115
|
const {
|
|
115
116
|
subDistrictId: o,
|
|
116
117
|
color: c,
|
|
117
|
-
id:
|
|
118
|
-
districtName:
|
|
119
|
-
subDistrictName:
|
|
118
|
+
id: p,
|
|
119
|
+
districtName: h,
|
|
120
|
+
subDistrictName: L,
|
|
120
121
|
signalCount: b
|
|
121
122
|
} = u.attributes;
|
|
122
123
|
n.has(o) || n.set(o, {
|
|
123
124
|
color: c,
|
|
124
125
|
signalIds: [],
|
|
125
|
-
districtName:
|
|
126
|
-
subDistrictName:
|
|
126
|
+
districtName: h,
|
|
127
|
+
subDistrictName: L,
|
|
127
128
|
signalCount: b
|
|
128
|
-
}), (y = n.get(o)) == null || y.signalIds.push(
|
|
129
|
+
}), (y = n.get(o)) == null || y.signalIds.push(p);
|
|
129
130
|
});
|
|
130
|
-
const
|
|
131
|
+
const d = [], f = [];
|
|
131
132
|
for (const u of n) {
|
|
132
133
|
let o = 0;
|
|
133
134
|
const c = u[0];
|
|
134
|
-
|
|
135
|
+
d.push({
|
|
135
136
|
value: c,
|
|
136
137
|
symbol: {
|
|
137
138
|
type: "simple-line",
|
|
@@ -140,11 +141,11 @@ class C {
|
|
|
140
141
|
style: "solid"
|
|
141
142
|
}
|
|
142
143
|
});
|
|
143
|
-
const { districtName:
|
|
144
|
+
const { districtName: p, subDistrictName: h, signalIds: L, signalCount: b } = u[1];
|
|
144
145
|
this.roadConnections.filter(
|
|
145
146
|
(l) => l.subDistrictId === c
|
|
146
147
|
).forEach((l) => {
|
|
147
|
-
const w = new
|
|
148
|
+
const w = new m({
|
|
148
149
|
geometry: {
|
|
149
150
|
type: "polyline",
|
|
150
151
|
paths: l.coordinates
|
|
@@ -154,13 +155,13 @@ class C {
|
|
|
154
155
|
id: l.id,
|
|
155
156
|
districtId: l.districtId,
|
|
156
157
|
subDistrictId: c,
|
|
157
|
-
subDistrictName:
|
|
158
|
-
districtName:
|
|
158
|
+
subDistrictName: h,
|
|
159
|
+
districtName: p,
|
|
159
160
|
signalCount: b,
|
|
160
161
|
color: u[1].color
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
|
|
164
|
+
f.push(w);
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
this.subDistrictLineLayer.renderer = {
|
|
@@ -173,7 +174,7 @@ class C {
|
|
|
173
174
|
style: "solid"
|
|
174
175
|
},
|
|
175
176
|
defaultLabel: "其他子区",
|
|
176
|
-
uniqueValueInfos:
|
|
177
|
+
uniqueValueInfos: d,
|
|
177
178
|
visualVariables: [
|
|
178
179
|
{
|
|
179
180
|
type: "size",
|
|
@@ -203,56 +204,56 @@ class C {
|
|
|
203
204
|
}
|
|
204
205
|
]
|
|
205
206
|
}, this.currentLineRenderer = this.subDistrictLineLayer.renderer.clone(), await this.subDistrictLineLayer.applyEdits({
|
|
206
|
-
addFeatures:
|
|
207
|
+
addFeatures: f
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
async clearSubDistricts() {
|
|
210
|
-
var
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
deleteFeatures:
|
|
211
|
+
var e;
|
|
212
|
+
const i = await this.subDistrictPointLayer.queryFeatures();
|
|
213
|
+
i.features.length > 0 && await this.subDistrictPointLayer.applyEdits({
|
|
214
|
+
deleteFeatures: i.features
|
|
214
215
|
}), this.subDistrictPointLayer.definitionExpression = "1=1";
|
|
215
216
|
const s = await this.subDistrictLineLayer.queryFeatures();
|
|
216
217
|
s.features.length > 0 && await this.subDistrictLineLayer.applyEdits({
|
|
217
218
|
deleteFeatures: s.features
|
|
218
|
-
}), this.subDistrictLineLayer.definitionExpression = "1=1", (
|
|
219
|
+
}), this.subDistrictLineLayer.definitionExpression = "1=1", (e = this.clickHandler) == null || e.remove();
|
|
219
220
|
}
|
|
220
|
-
setVisible(
|
|
221
|
-
this.subDistrictPointLayer.visible =
|
|
221
|
+
setVisible(i) {
|
|
222
|
+
this.subDistrictPointLayer.visible = i, this.subDistrictLineLayer.visible = i;
|
|
222
223
|
}
|
|
223
224
|
/**
|
|
224
225
|
* 定位子区
|
|
225
226
|
* @param id 子区ID
|
|
226
227
|
*/
|
|
227
|
-
async locateSubDistrict(
|
|
228
|
+
async locateSubDistrict(i) {
|
|
228
229
|
const s = this.subDistrictPointLayer.createQuery();
|
|
229
|
-
s.where = `subDistrictId = '${
|
|
230
|
-
const
|
|
231
|
-
return
|
|
230
|
+
s.where = `subDistrictId = '${i}'`, s.returnGeometry = !0;
|
|
231
|
+
const e = await this.subDistrictPointLayer.queryFeatures(s);
|
|
232
|
+
return e.features.length > 0 ? (await D.viewGoto(this.view, e.features, !1), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
|
|
232
233
|
}
|
|
233
234
|
/**
|
|
234
235
|
* 高亮子区, 其他子区隐藏
|
|
235
236
|
* @param id 子区ID
|
|
236
237
|
* @return 返回高亮子区的数量以及区控id
|
|
237
238
|
*/
|
|
238
|
-
async highlightSubDistrict(
|
|
239
|
+
async highlightSubDistrict(i) {
|
|
239
240
|
let s = "";
|
|
240
|
-
const
|
|
241
|
-
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${
|
|
242
|
-
const r = await this.subDistrictPointLayer.queryFeatures(),
|
|
243
|
-
return
|
|
241
|
+
const e = this.subDistrictPointLayer.definitionExpression;
|
|
242
|
+
this.subDistrictPointLayer.definitionExpression = `subDistrictId = '${i.id}'`;
|
|
243
|
+
const r = await this.subDistrictPointLayer.queryFeatures(), a = r.features.length;
|
|
244
|
+
return a > 0 ? (this.subDistrictLineLayer.definitionExpression = `subDistrictId = '${i.id}'`, s = r.features[0].attributes.districtId, await D.viewGoto(
|
|
244
245
|
this.view,
|
|
245
246
|
r.features,
|
|
246
|
-
|
|
247
|
-
)) : this.subDistrictPointLayer.definitionExpression =
|
|
247
|
+
i.needZoom !== !1
|
|
248
|
+
)) : this.subDistrictPointLayer.definitionExpression = e, { count: a, parentId: s };
|
|
248
249
|
}
|
|
249
250
|
/**
|
|
250
251
|
* 按照区控、子区id显示子区
|
|
251
252
|
* @param type 类型,district 或 subDistrict
|
|
252
253
|
* @param id
|
|
253
254
|
*/
|
|
254
|
-
filter(
|
|
255
|
-
const { type: s, id:
|
|
255
|
+
filter(i) {
|
|
256
|
+
const { type: s, id: e } = i, r = `${s === "district" ? "districtId" : "subDistrictId"} = '${e}'`;
|
|
256
257
|
this.subDistrictPointLayer.definitionExpression = r, this.subDistrictLineLayer.definitionExpression = r;
|
|
257
258
|
}
|
|
258
259
|
/**
|
|
@@ -265,17 +266,17 @@ class C {
|
|
|
265
266
|
* 监听地图点击事件,进行子区高亮
|
|
266
267
|
* @param event
|
|
267
268
|
*/
|
|
268
|
-
async viewHitTest(
|
|
269
|
+
async viewHitTest(i) {
|
|
269
270
|
var r;
|
|
270
|
-
const
|
|
271
|
+
const e = (r = (await this.view.hitTest(i, {
|
|
271
272
|
include: [this.subDistrictPointLayer, this.subDistrictLineLayer]
|
|
272
273
|
})).results) == null ? void 0 : r.filter(
|
|
273
|
-
(
|
|
274
|
+
(a) => a.type === "graphic"
|
|
274
275
|
);
|
|
275
|
-
if (
|
|
276
|
+
if (e.length === 0)
|
|
276
277
|
console.time("resetRenderer"), this.subDistrictPointLayer.renderer = this.currentPointRenderer, this.subDistrictLineLayer.renderer = this.currentLineRenderer;
|
|
277
278
|
else {
|
|
278
|
-
const
|
|
279
|
+
const a = e[0].graphic, t = a.attributes.color.split(",").map(Number);
|
|
279
280
|
this.subDistrictPointLayer.renderer = {
|
|
280
281
|
type: "unique-value",
|
|
281
282
|
field: "subDistrictId",
|
|
@@ -292,14 +293,14 @@ class C {
|
|
|
292
293
|
defaultLabel: "其他子区",
|
|
293
294
|
uniqueValueInfos: [
|
|
294
295
|
{
|
|
295
|
-
value:
|
|
296
|
+
value: a.attributes.subDistrictId,
|
|
296
297
|
symbol: {
|
|
297
298
|
type: "simple-marker",
|
|
298
299
|
style: "circle",
|
|
299
|
-
color: [...
|
|
300
|
+
color: [...t, 0.8],
|
|
300
301
|
size: "8px",
|
|
301
302
|
outline: {
|
|
302
|
-
color:
|
|
303
|
+
color: t,
|
|
303
304
|
width: 4
|
|
304
305
|
}
|
|
305
306
|
}
|
|
@@ -345,11 +346,11 @@ class C {
|
|
|
345
346
|
defaultLabel: "其他子区",
|
|
346
347
|
uniqueValueInfos: [
|
|
347
348
|
{
|
|
348
|
-
value:
|
|
349
|
+
value: a.attributes.subDistrictId,
|
|
349
350
|
symbol: {
|
|
350
351
|
type: "simple-line",
|
|
351
352
|
style: "solid",
|
|
352
|
-
color:
|
|
353
|
+
color: a.attributes.color.split(",").map(Number),
|
|
353
354
|
width: "8px"
|
|
354
355
|
}
|
|
355
356
|
}
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
86
86
|
zoom: number;
|
|
87
87
|
}) => import("../types").IResult;
|
|
88
88
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
89
|
-
setLayerVisibility: (params: ILayerVisibleParams) => import("../types").IResult
|
|
89
|
+
setLayerVisibility: (params: ILayerVisibleParams) => Promise<import("../types").IResult>;
|
|
90
90
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
91
91
|
handle: number;
|
|
92
92
|
points: number[][];
|
|
@@ -143,6 +143,8 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
143
143
|
message: string;
|
|
144
144
|
}>;
|
|
145
145
|
showSignalControlArea: (params: IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
|
|
146
|
+
showDistrictArea: (params: IShowSignalControlAreaParams) => Promise<void>;
|
|
147
|
+
showSubDistrictArea: (params: IShowSignalControlAreaParams) => Promise<void>;
|
|
146
148
|
clearSignalControlArea: () => Promise<import("../types").IResult>;
|
|
147
149
|
setSignalControlAreaVisibility: (params: ILayerVisibleParams) => import("../types").IResult;
|
|
148
150
|
locateSignalControlArea: (params: IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),T=require("./stores/index.js");require("./style/index.css");const ct=require("./utils/dbscan-cluster/index.js"),lt=require("./utils/detect-gpu.js"),ut=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),dt=require("./utils/holo-flow/index.js"),mt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),pt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),gt=require("./utils/police-jurisdiction.js"),ft=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),yt=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),wt=require("./utils/traffic-flow.js"),vt={class:"gis-viewer"},St={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},ht=s.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=s.ref(null);let n,p,l,i,r,o,f,t,u,a,g,w,b,y;const A=s.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=s.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const O=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};lt.default(),s.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(A.value=!A.value)});const e=s.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new pt.default,V.mapInitializer=p,n=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,it)=>{S("markerClick",m,D,L,it)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=n.zoom??(n.scale?B(n.scale):void 0);typeof h=="number"&&O(h);const ot=n.zoom!==void 0?n.watch("zoom",m=>{O(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&O(B(m))});v=()=>ot.remove(),r=new dt.default(n,_),await r.init(),S("mapLoaded")}),s.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),r.clearHoloTrace(),r.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=s.computed(()=>n),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{r.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(n)),l.showLaneNumber(e)),ne=()=>{l==null||l.clearLaneNumber()},ae=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),se=async()=>{},oe=async(e,d)=>{i||(i=new wt.default(n)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{r.handleVehicleTraceData(e)},le=()=>{r.clearHoloTrace()},ue=e=>{r.setInterpolate(e)},de=async e=>{await r.handleSignalData(e)},me=async e=>{await r.initializeLampGroup(e)},pe=e=>{r.handleUniSignalData(e)},ge=()=>{r.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),r==null||r.toggleTrafficInfo(e)},ye=e=>{r==null||r.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),r==null||r.toggleTrafficObject(e)},k=e=>{r==null||r.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(n)),o.addOverlays(e)),Se=async e=>(y||(y=new ct.default(n)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(n)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Ae=e=>o==null?void 0:o.removeOverlaysByType(e),Oe=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new ft.default(n)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ne=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},He=async e=>(a||(a=new q.default(n)),await a.showSignalControlArea(e)),Ge=async e=>(a||(a=new q.default(n)),await a.showDistrict(e)),Ze=async e=>(a||(a=new q.default(n)),await a.showSubDistrict(e)),We=async()=>await(a==null?void 0:a.clearSignalControlArea()),je=e=>a==null?void 0:a.setLayerVisibility(e),Je=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Qe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ue=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Ke=e=>(u||(u=new yt.default(n)),u.showSubSignalControlArea(e)),Fe=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},Ye=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},Re=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},$e=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},et=e=>(g||(g=new x.default(n)),g.addGreenWaveBand(e)),tt=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},nt=async e=>(g||(g=new x.default(n)),await g.showGreenWaveBand(e)),at=async e=>(w||(w=new gt.default(n)),await w.showJurisdiction(e)),rt=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},st=async e=>(b||(b=new ut.default(n)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Ae,removeOverlaysById:Oe,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ne,initializeAreaTool:ae,calCrossIndicatorArea:re,calRoadIndicatorArea:se,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:Pe,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,getSumoInfo:ze,splitOpenDriveLane:Ee,clearSplitOpenDriveLane:Ne,showSignalControlArea:He,showDistrictArea:Ge,showSubDistrictArea:Ze,clearSignalControlArea:We,setSignalControlAreaVisibility:je,locateSignalControlArea:Je,highlightSignalControlArea:Qe,resetHighlightSignalControlArea:Ue,showSubSignalControlArea:Ke,editSubSignalControlArea:Fe,stopEditSubSignalControlArea:Xe,selectSubSignalControlAreaCross:Ye,unselectSubSignalControlAreaCross:Re,changeSubSignalControlAreaBorderVisibility:$e,addGreenWaveBand:et,stopAddGreenWaveBand:tt,showGreenWaveBand:nt,showPoliceArea:at,clearPoliceArea:rt,setEdpassLayerVisibility:st}),(e,d)=>(s.openBlock(),s.createElementBlock("div",vt,[s.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[s.withDirectives(s.createElementVNode("div",St,[s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),s.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),s.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[s.vShow,A.value]])],512),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(_,(c,h)=>(s.openBlock(),s.createBlock(mt.default,{key:h,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=ht;
|
|
@@ -70,7 +70,7 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
70
70
|
zoom: number;
|
|
71
71
|
}) => import("../types").IResult;
|
|
72
72
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
73
|
-
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult
|
|
73
|
+
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => Promise<import("../types").IResult>;
|
|
74
74
|
requestCoordinateTransform: (points: number[][], callback: (points: number[][]) => void) => {
|
|
75
75
|
handle: number;
|
|
76
76
|
points: number[][];
|
|
@@ -127,6 +127,8 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
127
127
|
message: string;
|
|
128
128
|
}>;
|
|
129
129
|
showSignalControlArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<import("../types").IResult>;
|
|
130
|
+
showDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
|
|
131
|
+
showSubDistrictArea: (params: import("../types").IShowSignalControlAreaParams) => Promise<void>;
|
|
130
132
|
clearSignalControlArea: () => Promise<import("../types").IResult>;
|
|
131
133
|
setSignalControlAreaVisibility: (params: import("../types").ILayerVisibleParams) => import("../types").IResult;
|
|
132
134
|
locateSignalControlArea: (params: import("../types").IFindSignalControlAreaParams) => Promise<import("../types").IResult>;
|
|
@@ -2,8 +2,10 @@ import { IClusterPointParams } from 'packages/components/src/types';
|
|
|
2
2
|
export default class DbscanCluster {
|
|
3
3
|
private view;
|
|
4
4
|
private clusterLayer;
|
|
5
|
-
private maxClusterSymbolSize;
|
|
6
|
-
private minClusterSymbolSize;
|
|
5
|
+
private readonly maxClusterSymbolSize;
|
|
6
|
+
private readonly minClusterSymbolSize;
|
|
7
|
+
private readonly clusterRadius;
|
|
8
|
+
private readonly minClusterPoints;
|
|
7
9
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
8
10
|
private zoomWatchHandle;
|
|
9
11
|
private locations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@arcgis/core/core/reactiveUtils"),m=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),C=require("@arcgis/core/layers/GraphicsLayer");function g(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>c[r]})}}return t.default=c,Object.freeze(t)}const x=g(b);class S{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new C,this.view.map.add(this.clusterLayer)}locationToScreen(){this.locations.forEach(t=>{const r=this.view.toScreen(new m.Point({x:t.x,y:t.y}));t.properties.screenX=r.x,t.properties.screenY=r.y})}addClusterPoints(t){var s;this.locations=t.points,this.clusterMarkUrl=((s=t.clusterSymbol)==null?void 0:s.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=x.watch(()=>this.view.zoom,()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const r=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(r)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let r=Number.MIN_VALUE,s=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(s=Math.min(s,e.count),r=Math.max(r,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=s===r?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-s)/(r-s)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const l=(e.count.toString().length*8+6)/2,u=new y({geometry:new m.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:i,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:i,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(u)}else e.items.forEach(i=>{const o=new y({geometry:new m.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,r){return this.locations.filter(s=>s.id===t.id||s.visited?!1:this.getDistance(t,s)<=r)}getDistance(t,r){return Math.sqrt(Math.pow(t.properties.screenX-r.properties.screenX,2)+Math.pow(t.properties.screenY-r.properties.screenY,2))}createClusters(t){const r={},s=[];for(let i=0;i<t.length;i++){const o=t[i];o.clusterId===void 0||o.clusterId===-1?s.push(o):(r[o.clusterId]||(r[o.clusterId]=[]),r[o.clusterId].push(o))}const e=Object.keys(r).map((i,o)=>{const n=r[Number(i)],l=n.length,u=n.reduce((a,h)=>a+h.x,0),d=n.reduce((a,h)=>a+h.y,0),f=u/l,p=d/l;return{id:Number(i),items:n,count:l,center:{x:f,y:p}}});return s.length>0&&e.push({id:-1,items:s,count:s.length,center:null}),e}doPixelCluster(t,r){let s=0;this.locations.forEach(e=>{e.visited=!1,e.clusterId=void 0});for(let e=0;e<this.locations.length;e++){const i=this.locations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<r?i.clusterId=-1:(o.forEach(n=>{n.visited=!0,n.clusterId=s}),i.clusterId=s,s++)}return this.createClusters(this.locations)}}exports.default=S;
|
|
@@ -16,7 +16,7 @@ export default class MapInitializer {
|
|
|
16
16
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
17
17
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
18
18
|
}): Promise<MapView | SceneView>;
|
|
19
|
-
setLayerVisibility(params: ILayerVisibleParams): IResult
|
|
19
|
+
setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
|
|
20
20
|
/**
|
|
21
21
|
* 设置地图中心点
|
|
22
22
|
* @param params
|
|
@@ -53,4 +53,13 @@ export default class MapInitializer {
|
|
|
53
53
|
min?: number;
|
|
54
54
|
max?: number;
|
|
55
55
|
}): void;
|
|
56
|
+
/** 支队图层 */
|
|
57
|
+
private detachmentLayer;
|
|
58
|
+
private detachmentLayerLoaded;
|
|
59
|
+
/**
|
|
60
|
+
* 加载支队图层
|
|
61
|
+
* 现场环境用url创建FeatureLayer有各种问题,
|
|
62
|
+
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
63
|
+
*/
|
|
64
|
+
private loadDetachmentLayer;
|
|
56
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("@arcgis/core/Basemap"),M=require("@arcgis/core/config"),W=require("@arcgis/core/core/reactiveUtils"),b=require("@arcgis/core/geometry"),C=require("@arcgis/core/geometry/support/webMercatorUtils"),T=require("@arcgis/core/Graphic"),I=require("@arcgis/core/layers/FeatureLayer"),G=require("@arcgis/core/layers/GeoJSONLayer"),O=require("@arcgis/core/layers/GroupLayer"),S=require("@arcgis/core/layers/IntegratedMesh3DTilesLayer"),x=require("@arcgis/core/layers/MapImageLayer"),_=require("@arcgis/core/layers/TileLayer"),j=require("@arcgis/core/layers/WebTileLayer"),H=require("@arcgis/core/layers/WMSLayer"),B=require("@arcgis/core/Map"),N=require("@arcgis/core/views/MapView"),R=require("@arcgis/core/views/SceneView"),E=require("@turf/destination"),U=require("@turf/helpers"),A=require("@arcgis/core/layers/GraphicsLayer"),D=require("./custom-layer/custom-wmts-layer.js");function k(y){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const i in y)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(y,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>y[i]})}}return e.default=y,Object.freeze(e)}const q=k(W),L=k(C),V=k(U);class J{constructor(){this.mapConfig={},this.watchHandleMap=new Map,this.handleIndex=0,this.zoomWatchHandle=null,this.detachmentLayerLoaded=!1}processUrl(e){return e&&(e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("{{")?e.replace("{{geoServer}}",this.mapConfig.geoServer):this.mapConfig.assetsRoot+e)}async initialize(e){var p,w,g,m;this.mapConfig=e.mapConfig;const{container:i,markerClickCallback:s,mapClickCallback:o}=e;M.assetsPath=`${this.mapConfig.assetsRoot}/ArcgisAssets`,M.fontsUrl=`${this.mapConfig.assetsRoot}/fonts`,M.apiKey="AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";const a=new B;((p=this.mapConfig)==null?void 0:p.mapOptions.mode.toLowerCase())==="2d"?(this.view=new N({map:a,container:i,...this.mapConfig.mapOptions}),this.view.on("drag",t=>{t.button===2&&t.stopPropagation()})):this.view=new R({map:a,container:i,environment:{atmosphereEnabled:!0,lighting:{type:"virtual"}},...(w=this.mapConfig)==null?void 0:w.mapOptions}),this.view.popup.visibleElements={closeButton:!0,collapseButton:!1,actionBar:!1,featureNavigation:!0},this.view.popup.dockOptions={buttonEnabled:!1,breakpoint:!1},this.view.on("click",async t=>{var l,v;if(o){let n=t.mapPoint;n.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),o([n.x,n.y],[t.screenPoint.x,t.screenPoint.y],t)}if(this.view.type==="3d"){const n=this.view.camera;if(this.view.spatialReference.isWebMercator){const d=L.webMercatorToGeographic(n.position),f={heading:n.heading,tilt:n.tilt,position:d.toJSON()};console.log(f),(l=navigator.clipboard)==null||l.writeText(JSON.stringify(f))}else console.log(n.toJSON());console.log(this.view.zoom,this.view.scale)}else{let n=this.view.center;this.view.spatialReference.isWebMercator&&(n=L.webMercatorToGeographic(n)),console.log({center:n.toJSON(),zoom:this.view.zoom,scale:this.view.scale})}const c=(v=(await this.view.hitTest(t)).results)==null?void 0:v.filter(n=>n.type==="graphic");c.length>0&&c.forEach(n=>{var f;const d=n.graphic;(f=d.attributes)!=null&&f.type&&s&&s(d.attributes.type,d.attributes.id,d.attributes,t)})});{let t=0,r=!1;this.view.on("pointer-move",async c=>{var v;const l=performance.now();if(!(r||l-t<100)){t=l,r=!0;try{const d=(v=(await this.view.hitTest(c)).results)==null?void 0:v.some(z=>z.type==="graphic"),f=this.view.container;f&&(f.style.cursor=d?"pointer":"default")}finally{r=!1}}})}if(this.view.on("pointer-leave",()=>{const t=this.view.container;t&&(t.style.cursor="default")}),(g=this.mapConfig)!=null&&g.baseLayers?this.mapConfig.baseLayers.forEach(t=>{const r=this.processUrl(t.url);let c=null;switch(t.type.toLowerCase()){case"webTile".toLowerCase():{c=new j({urlTemplate:r,...t.options});break}case"tile":{c=new _({url:r,...t.options});break}case"customwmts".toLowerCase():{c=new D.default({urlTemplate:r,...t.options});break}case"mapimage".toLowerCase():{c=new x({url:r,...t.options});break}case"arcgis":{const l=new P(t.options);a.basemap=l;break}case"feature":{c=new I({url:r,...t.options});break}case"3dtiles":{c=new S({url:r,...t.options});break}case"wms":{c=new H({url:r,...t.options});break}}if(c)if(t.group){let l=a.findLayerById(t.group);l&&l.type==="group"?l.add(c):(l=new O({id:t.group,title:t.groupTitle,visibilityMode:"inherited",layers:[c],visible:t.groupVisible!==!1}),a.add(l))}else a.add(c)}):a.basemap=new P({style:{id:"arcgis/light-gray",language:"zh-CN"}}),(m=this.mapConfig)!=null&&m.hdLayers){const t=this.mapConfig.hdLayers.map(r=>new G({url:this.processUrl(r.url),...r.options,title:r.options.id}));a.addMany(t)}this.view.ui.remove("attribution"),await this.view.when();const h=this.mapConfig.camera;let u;if(this.view.type==="2d"){let t=this.view.center;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={center:[t.x,t.y],zoom:this.view.zoom}}else{let t=this.view.camera.position;this.view.spatialReference.isWebMercator&&(t=L.webMercatorToGeographic(t)),u={position:t,heading:this.view.camera.heading,tilt:this.view.camera.tilt}}return h?h.home=u:this.mapConfig.camera={home:u},this.view}async setLayerVisibility(e){const{id:i,visible:s}=e;if(i==="shanghai_district")return this.detachmentLayerLoaded?this.detachmentLayer.visible=s:await this.loadDetachmentLayer(),{status:0,message:"ok"};{const o=this.view.map.findLayerById(i);return o?(o.visible=s,{status:0,message:"ok"}):{status:-1,message:"未找到图层"}}}async setMapCenter(e){var i;if(!this.view)return{status:-1,message:"未初始化"};if(e.center||e.target){switch((i=e.target)==null?void 0:i.type.toLowerCase()){case"point":e.target=new b.Point(e.target);break;case"polyline":e.target=new b.Polyline(e.target);break;case"polygon":e.target=new b.Polygon(e.target);break;case"multipoint":e.target=new b.Multipoint(e.target);break}await this.view.goTo(e,{duration:(e.duration||0)*1e3})}return{status:0,message:"成功"}}setMapZoom(e){return this.view?(this.view.zoom=e.zoom,{status:0,message:"成功"}):{status:-1,message:"未初始化"}}async lookAt(e){if(this.view.type==="2d")return;const i=e.tilt||0,s=e.heading||0;if(i===0)await this.view.goTo({position:{x:e.center[0],y:e.center[1],z:e.height},heading:s,tilt:0},{duration:(e.duration||2)*1e3});else{const o=Math.tan(i*Math.PI/180)*e.height,a=E(V.point(e.center),o,s+180,{units:"meters"});await this.view.goTo({position:{x:a.geometry.coordinates[0],y:a.geometry.coordinates[1],z:e.height},heading:s,tilt:i},{duration:(e.duration||2)*1e3})}}async setMapCamera(e){if(!this.view)return{status:-1,message:"未初始化"};const{name:i,duration:s=0}=e,{camera:o}=this.mapConfig;if(!o)return{status:-1,message:"未配置camera"};const a=o[i];return a?(await this.view.goTo(a,{duration:s*1e3}),{status:0,message:"成功"}):{status:-1,message:"未配置camera"}}requestCoordinateTransform(e,i){let s=0;const a=1e3/30,h=q.watch(()=>this.view.center,()=>{const u=this.transformPoints(e),p=Date.now();p-s>a&&(i(u),s=p)});return this.handleIndex++,this.watchHandleMap.set(this.handleIndex,h),{handle:this.handleIndex,points:this.transformPoints(e)}}transformPoints(e){return e.map(i=>{const s=new b.Point({x:i[0],y:i[1]}),o=this.view.toScreen(s);return[o.x,o.y]})}cancelCoordinateTransform(e){const i=this.watchHandleMap.get(e);i&&(i.remove(),this.watchHandleMap.delete(e))}setMapZoomRange(e){const{min:i,max:s}=e;!i&&!s||(this.zoomWatchHandle&&this.zoomWatchHandle.remove(),this.zoomWatchHandle=q.watch(()=>this.view.zoom,o=>{i&&o<=i&&(this.view.zoom=i),s&&o>=s&&(this.view.zoom=s)}))}async loadDetachmentLayer(){this.detachmentLayer=new A({id:"detachmentLayer",title:"支队图层",effect:void 0}),this.view.map.add(this.detachmentLayer);const e=this.mapConfig.baseLayers;if(!e)return;const i=e.find(s=>s.options.id==="shanghai_district");if(i)try{const o=await(await fetch("/GisViewerAssets/ShangHai/Layers/district.json")).json(),a=[],{renderer:h,labelingInfo:u}=i.options;o.features.forEach(p=>{const w=p.attributes.ZD_NAME;if(w!=="高架支队"){let g=new b.Polygon({rings:p.geometry.rings});g=C.webMercatorToGeographic(g);const m=new T({geometry:g,attributes:p.attributes});if(h){if(h.type==="simple")m.symbol=h.symbol;else if(h.type==="unique-value"){const t=m.getAttribute("OBJECTID"),r=h.uniqueValueInfos.find(c=>c.value==t);m.symbol=r?r.symbol:h.defaultSymbol}}else m.symbol={type:"simple-fill",color:[227,237,255,.4],outline:{color:[255,195,153],width:2}};if(a.push(m),u&&w!=="边防港航支队"&&w!=="机场支队"){const t=new T({geometry:g.centroid,symbol:{...u.symbol,text:w}});a.push(t)}}}),this.detachmentLayer.addMany(a),this.detachmentLayerLoaded=!0}catch(s){console.error("加载支队图层失败:",s);return}}}exports.default=J;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import DistrictController from './district-controller';
|
|
2
|
+
export default class CrossRenderer {
|
|
3
|
+
private view;
|
|
4
|
+
private crossLayer;
|
|
5
|
+
private crossGraphics;
|
|
6
|
+
private crossGraphicSymbol;
|
|
7
|
+
constructor(view: __esri.MapView | __esri.SceneView);
|
|
8
|
+
showCrosses(controllers: DistrictController[]): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@arcgis/core/Graphic"),a=require("@arcgis/core/layers/GraphicsLayer");class c{constructor(s){this.crossGraphics=[],this.crossGraphicSymbol={type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:32,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:18,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}},this.view=s,this.crossLayer=new a,this.view.map.add(this.crossLayer)}async showCrosses(s){this.crossLayer.removeAll(),s.forEach(i=>{i.signals.forEach(e=>{const t=new r({geometry:{type:"point",longitude:e.longitude,latitude:e.latitude},symbol:this.crossGraphicSymbol,attributes:{id:e.id,name:e.name,signalId:e.signalId,nodeId:e.nodeId||e.id,districtId:i.id,districtName:i.name,subDistrictId:"",subDistrictName:"",isKey:e.isKey,type:"signal",selected:!0}});this.crossGraphics.push(t)}),i.subDistricts.forEach(e=>{e.signals.forEach(t=>{const o=new r({geometry:{type:"point",longitude:t.longitude,latitude:t.latitude},symbol:this.crossGraphicSymbol,attributes:{id:t.id,name:t.name,signalId:t.signalId,nodeId:t.nodeId||t.id,districtId:i.id,districtName:i.name,subDistrictId:e.id,subDistrictName:e.name,isKey:t.isKey,type:"signal",selected:!0}});this.crossGraphics.push(o)})})}),this.crossLayer.addMany(this.crossGraphics)}}exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("pako"),h=require("../common-utils.js");class d{constructor(o,s){if(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]),o.mapConnectList)try{const t=o.mapConnectList,i=new Uint8Array(window.atob(t).split("").map(e=>e.charCodeAt(0))),n=c.inflate(i,{to:"string"}),a=JSON.parse(n);this.roadConnections.push(...a.map(e=>({id:e.roadsectId,coordinates:JSON.parse(e.geomData).coordinates,districtId:this.parentId,subDistrictId:this.id})))}catch(t){console.error("解压子区路段连接信息失败:",t)}console.log(o);for(const t of o.children)if(t.children){const i=new d(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 n=t.mapConnectList,a=new Uint8Array(window.atob(n).split("").map(r=>r.charCodeAt(0))),e=c.inflate(a,{to:"string"}),l=JSON.parse(e);i.roadConnections.push(...l.map(r=>({id:r.roadsectId,coordinates:JSON.parse(r.geomData).coordinates,districtId:i.parentId,subDistrictId:i.id})))}catch(n){console.error("解压子区路段连接信息失败:",n)}}else if(h.default.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++}}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 n=this.cyrb53(o);s=((n&16711680)>>16)%200,t=((n&65280)>>8)%200,i=(n&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 n=0,a;n<o.length;n++)a=o.charCodeAt(n),t=Math.imul(t^a,2654435761),i=Math.imul(i^a,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)}}exports.default=d;
|
|
@@ -2,11 +2,10 @@ import { IFindSignalControlAreaParams, ILayerVisibleParams, IResult, IShowSignal
|
|
|
2
2
|
export default class SignalControlAreaController1 {
|
|
3
3
|
private view;
|
|
4
4
|
/** 支队图层 */
|
|
5
|
-
private detachmentLayer;
|
|
6
|
-
private detachmentLayerLoaded;
|
|
7
5
|
private districtRenderer;
|
|
8
6
|
private subDistrictRenderer;
|
|
9
7
|
private signalRenderer;
|
|
8
|
+
private crossRenderer;
|
|
10
9
|
private mapConfig;
|
|
11
10
|
constructor(view: __esri.MapView | __esri.SceneView);
|
|
12
11
|
/**
|
|
@@ -15,6 +14,8 @@ export default class SignalControlAreaController1 {
|
|
|
15
14
|
* @returns
|
|
16
15
|
*/
|
|
17
16
|
showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
|
|
17
|
+
showDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
18
|
+
showSubDistrict(params: IShowSignalControlAreaParams): Promise<void>;
|
|
18
19
|
/**
|
|
19
20
|
* 清空区控、子区、信号机
|
|
20
21
|
* @returns
|
|
@@ -49,10 +50,4 @@ export default class SignalControlAreaController1 {
|
|
|
49
50
|
status: number;
|
|
50
51
|
message: string;
|
|
51
52
|
}>;
|
|
52
|
-
/**
|
|
53
|
-
* 加载支队图层
|
|
54
|
-
* 现场环境用url创建FeatureLayer有各种问题,
|
|
55
|
-
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
56
|
-
*/
|
|
57
|
-
private loadDetachmentLayer;
|
|
58
53
|
}
|