gisviewer-vue3-arcgis 1.0.266 → 1.0.267
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 +9 -2
- package/es/src/gis-map/gis-map.vue.mjs +184 -181
- package/es/src/gis-map/index.d.ts +7 -1
- package/es/src/gis-map/utils/map-initializer.mjs +86 -79
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +101 -45
- package/es/src/gis-map/utils/signal-control-area/{show-area.d.ts → signal-area-controller.d.ts} +3 -0
- package/es/src/gis-map/utils/signal-control-area/{show-area.mjs → signal-area-controller.mjs} +11 -11
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +24 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +193 -0
- package/es/src/types/index.d.ts +15 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +9 -2
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +7 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area/{show-area.d.ts → signal-area-controller.d.ts} +3 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.d.ts +24 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/types/index.d.ts +15 -0
- package/package.json +1 -1
- package/lib/src/gis-map/utils/signal-control-area/show-area.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import L from "@arcgis/core/Basemap";
|
|
2
2
|
import v from "@arcgis/core/config";
|
|
3
3
|
import * as M from "@arcgis/core/core/reactiveUtils";
|
|
4
|
-
import { Multipoint as
|
|
4
|
+
import { Multipoint as W, Polygon as k, Polyline as I, Point as T } from "@arcgis/core/geometry";
|
|
5
5
|
import * as b from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
6
|
-
import { webMercatorToGeographic as
|
|
6
|
+
import { webMercatorToGeographic as G } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
7
7
|
import C from "@arcgis/core/Graphic";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import x from "@arcgis/core/layers/FeatureLayer";
|
|
9
|
+
import P from "@arcgis/core/layers/GeoJSONLayer";
|
|
10
10
|
import S from "@arcgis/core/layers/GroupLayer";
|
|
11
11
|
import H from "@arcgis/core/layers/IntegratedMesh3DTilesLayer";
|
|
12
12
|
import B from "@arcgis/core/layers/MapImageLayer";
|
|
@@ -15,9 +15,9 @@ import R from "@arcgis/core/layers/WebTileLayer";
|
|
|
15
15
|
import E from "@arcgis/core/layers/WMSLayer";
|
|
16
16
|
import N from "@arcgis/core/Map";
|
|
17
17
|
import A from "@arcgis/core/views/MapView";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import * as
|
|
18
|
+
import j from "@arcgis/core/views/SceneView";
|
|
19
|
+
import U from "@turf/destination";
|
|
20
|
+
import * as V from "@turf/helpers";
|
|
21
21
|
import D from "@arcgis/core/layers/GraphicsLayer";
|
|
22
22
|
import J from "./custom-layer/custom-wmts-layer.mjs";
|
|
23
23
|
class me {
|
|
@@ -35,7 +35,7 @@ class me {
|
|
|
35
35
|
async initialize(e) {
|
|
36
36
|
var p, u, g, f;
|
|
37
37
|
this.mapConfig = e.mapConfig;
|
|
38
|
-
const { container: i, markerClickCallback: s, mapClickCallback:
|
|
38
|
+
const { container: i, markerClickCallback: s, mapClickCallback: r } = e;
|
|
39
39
|
v.assetsPath = `${this.mapConfig.assetsRoot}/ArcgisAssets`, v.fontsUrl = `${this.mapConfig.assetsRoot}/fonts`, v.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
40
40
|
const o = new N();
|
|
41
41
|
((p = this.mapConfig) == null ? void 0 : p.mapOptions.mode.toLowerCase()) === "2d" ? (this.view = new A({
|
|
@@ -44,7 +44,7 @@ class me {
|
|
|
44
44
|
...this.mapConfig.mapOptions
|
|
45
45
|
}), this.view.on("drag", (t) => {
|
|
46
46
|
t.button === 2 && t.stopPropagation();
|
|
47
|
-
})) : this.view = new
|
|
47
|
+
})) : this.view = new j({
|
|
48
48
|
map: o,
|
|
49
49
|
container: i,
|
|
50
50
|
environment: {
|
|
@@ -64,46 +64,46 @@ class me {
|
|
|
64
64
|
breakpoint: !1
|
|
65
65
|
}, this.view.on("click", async (t) => {
|
|
66
66
|
var h, y;
|
|
67
|
-
if (
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)),
|
|
72
|
-
[
|
|
67
|
+
if (r) {
|
|
68
|
+
let c = t.mapPoint;
|
|
69
|
+
c.spatialReference.isWebMercator && (c = b.webMercatorToGeographic(
|
|
70
|
+
c
|
|
71
|
+
)), r(
|
|
72
|
+
[c.x, c.y],
|
|
73
73
|
[t.screenPoint.x, t.screenPoint.y],
|
|
74
74
|
t
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
if (this.view.type === "3d") {
|
|
78
|
-
const
|
|
78
|
+
const c = this.view.camera;
|
|
79
79
|
if (this.view.spatialReference.isWebMercator) {
|
|
80
80
|
const w = b.webMercatorToGeographic(
|
|
81
|
-
|
|
81
|
+
c.position
|
|
82
82
|
), d = {
|
|
83
|
-
heading:
|
|
84
|
-
tilt:
|
|
83
|
+
heading: c.heading,
|
|
84
|
+
tilt: c.tilt,
|
|
85
85
|
position: w.toJSON()
|
|
86
86
|
};
|
|
87
87
|
console.log(d), (h = navigator.clipboard) == null || h.writeText(JSON.stringify(d));
|
|
88
88
|
} else
|
|
89
|
-
console.log(
|
|
89
|
+
console.log(c.toJSON());
|
|
90
90
|
console.log(this.view.zoom, this.view.scale);
|
|
91
91
|
} else {
|
|
92
|
-
let
|
|
93
|
-
this.view.spatialReference.isWebMercator && (
|
|
94
|
-
|
|
92
|
+
let c = this.view.center;
|
|
93
|
+
this.view.spatialReference.isWebMercator && (c = b.webMercatorToGeographic(
|
|
94
|
+
c
|
|
95
95
|
)), console.log({
|
|
96
|
-
center:
|
|
96
|
+
center: c.toJSON(),
|
|
97
97
|
zoom: this.view.zoom,
|
|
98
98
|
scale: this.view.scale
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
const
|
|
102
|
-
(
|
|
101
|
+
const n = (y = (await this.view.hitTest(t)).results) == null ? void 0 : y.filter(
|
|
102
|
+
(c) => c.type === "graphic"
|
|
103
103
|
);
|
|
104
|
-
|
|
104
|
+
n.length > 0 && n.forEach((c) => {
|
|
105
105
|
var d;
|
|
106
|
-
const w =
|
|
106
|
+
const w = c.graphic;
|
|
107
107
|
(d = w.attributes) != null && d.type && s && s(
|
|
108
108
|
w.attributes.type,
|
|
109
109
|
w.attributes.id,
|
|
@@ -113,19 +113,19 @@ class me {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
{
|
|
116
|
-
let t = 0,
|
|
117
|
-
this.view.on("pointer-move", async (
|
|
116
|
+
let t = 0, a = !1;
|
|
117
|
+
this.view.on("pointer-move", async (n) => {
|
|
118
118
|
var y;
|
|
119
119
|
const h = performance.now();
|
|
120
|
-
if (!(
|
|
121
|
-
t = h,
|
|
120
|
+
if (!(a || h - t < 100)) {
|
|
121
|
+
t = h, a = !0;
|
|
122
122
|
try {
|
|
123
|
-
const w = (y = (await this.view.hitTest(
|
|
124
|
-
(
|
|
123
|
+
const w = (y = (await this.view.hitTest(n)).results) == null ? void 0 : y.some(
|
|
124
|
+
(z) => z.type === "graphic"
|
|
125
125
|
), d = this.view.container;
|
|
126
126
|
d && (d.style.cursor = w ? "pointer" : "default");
|
|
127
127
|
} finally {
|
|
128
|
-
|
|
128
|
+
a = !1;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
});
|
|
@@ -134,33 +134,33 @@ class me {
|
|
|
134
134
|
const t = this.view.container;
|
|
135
135
|
t && (t.style.cursor = "default");
|
|
136
136
|
}), (g = this.mapConfig) != null && g.baseLayers ? this.mapConfig.baseLayers.forEach((t) => {
|
|
137
|
-
const
|
|
138
|
-
let
|
|
137
|
+
const a = this.processUrl(t.url);
|
|
138
|
+
let n = null;
|
|
139
139
|
switch (t.type.toLowerCase()) {
|
|
140
140
|
case "webTile".toLowerCase(): {
|
|
141
|
-
|
|
142
|
-
urlTemplate:
|
|
141
|
+
n = new R({
|
|
142
|
+
urlTemplate: a,
|
|
143
143
|
...t.options
|
|
144
144
|
});
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
147
|
case "tile": {
|
|
148
|
-
|
|
149
|
-
url:
|
|
148
|
+
n = new O({
|
|
149
|
+
url: a,
|
|
150
150
|
...t.options
|
|
151
151
|
});
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
case "customwmts".toLowerCase(): {
|
|
155
|
-
|
|
156
|
-
urlTemplate:
|
|
155
|
+
n = new J({
|
|
156
|
+
urlTemplate: a,
|
|
157
157
|
...t.options
|
|
158
158
|
});
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
161
|
case "mapimage".toLowerCase(): {
|
|
162
|
-
|
|
163
|
-
url:
|
|
162
|
+
n = new B({
|
|
163
|
+
url: a,
|
|
164
164
|
...t.options
|
|
165
165
|
});
|
|
166
166
|
break;
|
|
@@ -171,36 +171,43 @@ class me {
|
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
case "feature": {
|
|
174
|
-
|
|
174
|
+
n = new x({ url: a, ...t.options });
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
case "3dtiles": {
|
|
178
|
-
|
|
179
|
-
url:
|
|
178
|
+
n = new H({
|
|
179
|
+
url: a,
|
|
180
180
|
...t.options
|
|
181
181
|
});
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case "wms": {
|
|
185
|
-
|
|
186
|
-
url:
|
|
185
|
+
n = new E({
|
|
186
|
+
url: a,
|
|
187
|
+
...t.options
|
|
188
|
+
});
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
case "geojson": {
|
|
192
|
+
n = new P({
|
|
193
|
+
url: a,
|
|
187
194
|
...t.options
|
|
188
195
|
});
|
|
189
196
|
break;
|
|
190
197
|
}
|
|
191
198
|
}
|
|
192
|
-
if (
|
|
199
|
+
if (n)
|
|
193
200
|
if (t.group) {
|
|
194
201
|
let h = o.findLayerById(t.group);
|
|
195
|
-
h && h.type === "group" ? h.add(
|
|
202
|
+
h && h.type === "group" ? h.add(n) : (h = new S({
|
|
196
203
|
id: t.group,
|
|
197
204
|
title: t.groupTitle,
|
|
198
205
|
visibilityMode: "inherited",
|
|
199
|
-
layers: [
|
|
206
|
+
layers: [n],
|
|
200
207
|
visible: t.groupVisible !== !1
|
|
201
208
|
}), o.add(h));
|
|
202
209
|
} else
|
|
203
|
-
o.add(
|
|
210
|
+
o.add(n);
|
|
204
211
|
}) : o.basemap = new L({
|
|
205
212
|
style: {
|
|
206
213
|
id: "arcgis/light-gray",
|
|
@@ -208,12 +215,12 @@ class me {
|
|
|
208
215
|
}
|
|
209
216
|
}), (f = this.mapConfig) != null && f.hdLayers) {
|
|
210
217
|
const t = this.mapConfig.hdLayers.map(
|
|
211
|
-
(
|
|
218
|
+
(a) => (
|
|
212
219
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
213
|
-
new
|
|
214
|
-
url: this.processUrl(
|
|
215
|
-
...
|
|
216
|
-
title:
|
|
220
|
+
new P({
|
|
221
|
+
url: this.processUrl(a.url),
|
|
222
|
+
...a.options,
|
|
223
|
+
title: a.options.id
|
|
217
224
|
})
|
|
218
225
|
)
|
|
219
226
|
);
|
|
@@ -244,8 +251,8 @@ class me {
|
|
|
244
251
|
if (i === "shanghai_district")
|
|
245
252
|
return !this.detachmentLayerLoaded && e.visible ? await this.loadDetachmentLayer() : this.detachmentLayer && (this.detachmentLayer.visible = s), { status: 0, message: "ok" };
|
|
246
253
|
{
|
|
247
|
-
const
|
|
248
|
-
return
|
|
254
|
+
const r = this.view.map.findLayerById(i);
|
|
255
|
+
return r ? (r.visible = s, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
249
256
|
}
|
|
250
257
|
}
|
|
251
258
|
/**
|
|
@@ -263,13 +270,13 @@ class me {
|
|
|
263
270
|
e.target = new T(e.target);
|
|
264
271
|
break;
|
|
265
272
|
case "polyline":
|
|
266
|
-
e.target = new
|
|
273
|
+
e.target = new I(e.target);
|
|
267
274
|
break;
|
|
268
275
|
case "polygon":
|
|
269
276
|
e.target = new k(e.target);
|
|
270
277
|
break;
|
|
271
278
|
case "multipoint":
|
|
272
|
-
e.target = new
|
|
279
|
+
e.target = new W(e.target);
|
|
273
280
|
break;
|
|
274
281
|
}
|
|
275
282
|
await this.view.goTo(e, { duration: (e.duration || 0) * 1e3 });
|
|
@@ -300,9 +307,9 @@ class me {
|
|
|
300
307
|
{ duration: (e.duration || 2) * 1e3 }
|
|
301
308
|
);
|
|
302
309
|
else {
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
310
|
+
const r = Math.tan(i * Math.PI / 180) * e.height, o = U(
|
|
311
|
+
V.point(e.center),
|
|
312
|
+
r,
|
|
306
313
|
s + 180,
|
|
307
314
|
{
|
|
308
315
|
units: "meters"
|
|
@@ -325,10 +332,10 @@ class me {
|
|
|
325
332
|
async setMapCamera(e) {
|
|
326
333
|
if (!this.view)
|
|
327
334
|
return { status: -1, message: "未初始化" };
|
|
328
|
-
const { name: i, duration: s = 0 } = e, { camera:
|
|
329
|
-
if (!
|
|
335
|
+
const { name: i, duration: s = 0 } = e, { camera: r } = this.mapConfig;
|
|
336
|
+
if (!r)
|
|
330
337
|
return { status: -1, message: "未配置camera" };
|
|
331
|
-
const o =
|
|
338
|
+
const o = r[i];
|
|
332
339
|
return o ? (await this.view.goTo(o, { duration: s * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
|
|
333
340
|
}
|
|
334
341
|
/**
|
|
@@ -350,8 +357,8 @@ class me {
|
|
|
350
357
|
const s = new T({
|
|
351
358
|
x: i[0],
|
|
352
359
|
y: i[1]
|
|
353
|
-
}),
|
|
354
|
-
return [
|
|
360
|
+
}), r = this.view.toScreen(s);
|
|
361
|
+
return [r.x, r.y];
|
|
355
362
|
});
|
|
356
363
|
}
|
|
357
364
|
/**
|
|
@@ -368,8 +375,8 @@ class me {
|
|
|
368
375
|
const { min: i, max: s } = e;
|
|
369
376
|
!i && !s || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = M.watch(
|
|
370
377
|
() => this.view.zoom,
|
|
371
|
-
(
|
|
372
|
-
i &&
|
|
378
|
+
(r) => {
|
|
379
|
+
i && r <= i && (this.view.zoom = i), s && r >= s && (this.view.zoom = s);
|
|
373
380
|
}
|
|
374
381
|
));
|
|
375
382
|
}
|
|
@@ -392,16 +399,16 @@ class me {
|
|
|
392
399
|
);
|
|
393
400
|
if (i)
|
|
394
401
|
try {
|
|
395
|
-
const
|
|
402
|
+
const r = await (await fetch(
|
|
396
403
|
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
397
404
|
)).json(), o = [], { renderer: l, labelingInfo: m } = i.options;
|
|
398
|
-
|
|
405
|
+
r.features.forEach((p) => {
|
|
399
406
|
const u = p.attributes.ZD_NAME;
|
|
400
407
|
if (u !== "高架支队") {
|
|
401
408
|
let g = new k({
|
|
402
409
|
rings: p.geometry.rings
|
|
403
410
|
});
|
|
404
|
-
g =
|
|
411
|
+
g = G(g);
|
|
405
412
|
const f = new C({
|
|
406
413
|
geometry: g,
|
|
407
414
|
attributes: p.attributes
|
|
@@ -410,10 +417,10 @@ class me {
|
|
|
410
417
|
if (l.type === "simple")
|
|
411
418
|
f.symbol = l.symbol;
|
|
412
419
|
else if (l.type === "unique-value") {
|
|
413
|
-
const t = f.getAttribute("OBJECTID"),
|
|
414
|
-
(
|
|
420
|
+
const t = f.getAttribute("OBJECTID"), a = l.uniqueValueInfos.find(
|
|
421
|
+
(n) => n.value == t
|
|
415
422
|
);
|
|
416
|
-
f.symbol =
|
|
423
|
+
f.symbol = a ? a.symbol : l.defaultSymbol;
|
|
417
424
|
}
|
|
418
425
|
} else
|
|
419
426
|
f.symbol = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point as h } from "@arcgis/core/geometry";
|
|
2
2
|
import u from "@arcgis/core/Graphic";
|
|
3
|
-
import
|
|
4
|
-
class
|
|
3
|
+
import p from "@arcgis/core/layers/GraphicsLayer";
|
|
4
|
+
class x {
|
|
5
5
|
constructor(e) {
|
|
6
6
|
this.crossGraphicSymbol = {
|
|
7
7
|
type: "cim",
|
|
@@ -85,26 +85,28 @@ class C {
|
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
}, this.locations = [], this.clusteredLocations = [], this.filteredLocations = [], this.currentShowMode = "scatter", this.symbolScale = 5e3, this.oldScale = 0, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.view = e, this.crossLayer = new
|
|
88
|
+
}, this.locations = [], this.clusteredLocations = [], this.filteredLocations = [], this.currentShowMode = "scatter", this.symbolScale = 5e3, this.oldScale = 0, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.view = e, this.crossLayer = new p(), this.view.map.add(this.crossLayer), this.oldScale = e.scale;
|
|
89
89
|
}
|
|
90
90
|
async addCrosses(e) {
|
|
91
91
|
e.forEach((t) => {
|
|
92
|
-
t.signals.forEach((
|
|
93
|
-
|
|
94
|
-
id:
|
|
95
|
-
x:
|
|
96
|
-
y:
|
|
92
|
+
t.signals.forEach((i) => {
|
|
93
|
+
i.longitude && i.latitude && !isNaN(i.longitude) && !isNaN(i.latitude) && this.locations.push({
|
|
94
|
+
id: i.id,
|
|
95
|
+
x: i.longitude,
|
|
96
|
+
y: i.latitude,
|
|
97
97
|
visited: !1,
|
|
98
98
|
filtered: !1,
|
|
99
99
|
clusterId: void 0,
|
|
100
100
|
properties: {
|
|
101
|
-
...
|
|
101
|
+
...i,
|
|
102
102
|
districtId: t.id,
|
|
103
|
-
|
|
103
|
+
districtName: t.name,
|
|
104
|
+
subDistrictId: "",
|
|
105
|
+
subDistrictName: ""
|
|
104
106
|
}
|
|
105
107
|
});
|
|
106
|
-
}), t.subDistricts.forEach((
|
|
107
|
-
|
|
108
|
+
}), t.subDistricts.forEach((i) => {
|
|
109
|
+
i.signals.forEach((s) => {
|
|
108
110
|
s.longitude && s.latitude && !isNaN(s.longitude) && !isNaN(s.latitude) && this.locations.push({
|
|
109
111
|
id: s.id,
|
|
110
112
|
x: s.longitude,
|
|
@@ -115,7 +117,9 @@ class C {
|
|
|
115
117
|
properties: {
|
|
116
118
|
...s,
|
|
117
119
|
districtId: t.id,
|
|
118
|
-
|
|
120
|
+
districtName: t.name,
|
|
121
|
+
subDistrictId: i.id,
|
|
122
|
+
subDistrictName: i.name
|
|
119
123
|
}
|
|
120
124
|
});
|
|
121
125
|
});
|
|
@@ -137,7 +141,7 @@ class C {
|
|
|
137
141
|
*/
|
|
138
142
|
clearCrosses() {
|
|
139
143
|
var e;
|
|
140
|
-
|
|
144
|
+
this.crossLayer.removeAll(), this.locations = [], this.clusteredLocations = [], (e = this.zoomWatchHandle) == null || e.remove();
|
|
141
145
|
}
|
|
142
146
|
/**
|
|
143
147
|
* 更新散点符号
|
|
@@ -174,16 +178,42 @@ class C {
|
|
|
174
178
|
const e = [];
|
|
175
179
|
this.locations.forEach((t) => {
|
|
176
180
|
if (!t.filtered) {
|
|
177
|
-
const
|
|
181
|
+
const i = new u({
|
|
178
182
|
geometry: {
|
|
179
183
|
type: "point",
|
|
180
184
|
longitude: t.x,
|
|
181
185
|
latitude: t.y
|
|
182
186
|
},
|
|
183
187
|
symbol: this.getCrossSymbol(t.properties),
|
|
184
|
-
attributes: t.properties
|
|
188
|
+
attributes: t.properties,
|
|
189
|
+
popupTemplate: {
|
|
190
|
+
title: "{name}信号机",
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "fields",
|
|
194
|
+
fieldInfos: [
|
|
195
|
+
{
|
|
196
|
+
fieldName: "signalId",
|
|
197
|
+
label: "信号机编号"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
fieldName: "nodeId",
|
|
201
|
+
label: "路口编号"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
fieldName: "districtName",
|
|
205
|
+
label: "区控名称"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
fieldName: "subDistrictName",
|
|
209
|
+
label: "子区名称"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
}
|
|
185
215
|
});
|
|
186
|
-
e.push(
|
|
216
|
+
e.push(i);
|
|
187
217
|
}
|
|
188
218
|
}), this.crossLayer.addMany(e);
|
|
189
219
|
}
|
|
@@ -196,17 +226,17 @@ class C {
|
|
|
196
226
|
filter(e) {
|
|
197
227
|
this.locations.forEach((t) => {
|
|
198
228
|
if (e.type === "district")
|
|
199
|
-
t.filtered = t.properties.districtId
|
|
229
|
+
t.filtered = t.properties.districtId !== e.id;
|
|
200
230
|
else if (e.type === "subDistrict")
|
|
201
|
-
t.filtered = t.properties.subDistrictId
|
|
202
|
-
else if (e.type === "signal" && (t.filtered = t.id
|
|
231
|
+
t.filtered = t.properties.subDistrictId !== e.id;
|
|
232
|
+
else if (e.type === "signal" && (t.filtered = t.id !== e.id, t.filtered))
|
|
203
233
|
return t.properties;
|
|
204
234
|
});
|
|
205
235
|
}
|
|
206
236
|
resetFilter() {
|
|
207
237
|
this.locations.forEach((e) => {
|
|
208
238
|
e.filtered = !1;
|
|
209
|
-
});
|
|
239
|
+
}), this.currentShowMode === "scatter" ? this.showScatter() : this.currentShowMode === "cluster" && this.showCluster();
|
|
210
240
|
}
|
|
211
241
|
/**
|
|
212
242
|
* 根据当前比例尺更新路口符号
|
|
@@ -330,7 +360,7 @@ class C {
|
|
|
330
360
|
* @returns
|
|
331
361
|
*/
|
|
332
362
|
getNeighbors(e, t) {
|
|
333
|
-
return this.clusteredLocations.filter((
|
|
363
|
+
return this.clusteredLocations.filter((i) => i.id === e.id || i.visited ? !1 : this.getDistance(e, i) <= t);
|
|
334
364
|
}
|
|
335
365
|
/**
|
|
336
366
|
* 两点间的像素距离
|
|
@@ -352,24 +382,24 @@ class C {
|
|
|
352
382
|
const e = {}, t = [];
|
|
353
383
|
for (const s of this.clusteredLocations)
|
|
354
384
|
s.clusterId === void 0 || s.clusterId === -1 ? t.push(s) : (e[s.clusterId] || (e[s.clusterId] = []), e[s.clusterId].push(s));
|
|
355
|
-
const
|
|
356
|
-
const o = e[Number(s)], a = o.length, l = o.reduce((n,
|
|
385
|
+
const i = Object.keys(e).map((s, r) => {
|
|
386
|
+
const o = e[Number(s)], a = o.length, l = o.reduce((n, m) => n + m.x, 0), c = o.reduce((n, m) => n + m.y, 0), y = l / a, d = c / a;
|
|
357
387
|
return {
|
|
358
388
|
id: Number(s),
|
|
359
389
|
items: o,
|
|
360
390
|
count: a,
|
|
361
391
|
center: {
|
|
362
|
-
x:
|
|
363
|
-
y:
|
|
392
|
+
x: y,
|
|
393
|
+
y: d
|
|
364
394
|
}
|
|
365
395
|
};
|
|
366
396
|
});
|
|
367
|
-
return t.length > 0 &&
|
|
397
|
+
return t.length > 0 && i.push({
|
|
368
398
|
id: -1,
|
|
369
399
|
items: t,
|
|
370
400
|
count: t.length,
|
|
371
401
|
center: null
|
|
372
|
-
}),
|
|
402
|
+
}), i;
|
|
373
403
|
}
|
|
374
404
|
/**
|
|
375
405
|
* 按照像素距离聚类
|
|
@@ -380,13 +410,13 @@ class C {
|
|
|
380
410
|
*/
|
|
381
411
|
doPixelCluster(e) {
|
|
382
412
|
let t = 0;
|
|
383
|
-
for (let
|
|
384
|
-
const s = this.clusteredLocations[
|
|
413
|
+
for (let i = 0; i < this.clusteredLocations.length; i++) {
|
|
414
|
+
const s = this.clusteredLocations[i];
|
|
385
415
|
if (s.visited)
|
|
386
416
|
continue;
|
|
387
417
|
s.visited = !0;
|
|
388
|
-
const
|
|
389
|
-
|
|
418
|
+
const r = this.getNeighbors(s, e);
|
|
419
|
+
r.length < this.minClusterPoints ? s.clusterId = -1 : (r.forEach((o) => {
|
|
390
420
|
o.visited = !0, o.clusterId = t;
|
|
391
421
|
}), s.clusterId = t, t++);
|
|
392
422
|
}
|
|
@@ -394,13 +424,13 @@ class C {
|
|
|
394
424
|
}
|
|
395
425
|
showClusterResult(e) {
|
|
396
426
|
this.crossLayer.removeAll();
|
|
397
|
-
let t = Number.MIN_VALUE,
|
|
427
|
+
let t = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
398
428
|
e.forEach((s) => {
|
|
399
|
-
s.count > 1 && (
|
|
429
|
+
s.count > 1 && (i = Math.min(i, s.count), t = Math.max(t, s.count));
|
|
400
430
|
}), e.forEach((s) => {
|
|
401
431
|
if (s.id !== -1) {
|
|
402
|
-
let
|
|
403
|
-
|
|
432
|
+
let r = i === t ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (s.count - i) / (t - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
|
|
433
|
+
r *= 0.75;
|
|
404
434
|
const l = (s.count.toString().length * 8 + 6) / 2, c = new u({
|
|
405
435
|
geometry: new h({ x: s.center.x, y: s.center.y }),
|
|
406
436
|
attributes: {
|
|
@@ -430,7 +460,7 @@ class C {
|
|
|
430
460
|
// 聚合数量
|
|
431
461
|
{
|
|
432
462
|
type: "CIMVectorMarker",
|
|
433
|
-
size:
|
|
463
|
+
size: r,
|
|
434
464
|
colorLocked: !0,
|
|
435
465
|
anchorPointUnits: "Relative",
|
|
436
466
|
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
@@ -504,7 +534,7 @@ class C {
|
|
|
504
534
|
y: 0
|
|
505
535
|
},
|
|
506
536
|
anchorPointUnits: "Relative",
|
|
507
|
-
size:
|
|
537
|
+
size: r,
|
|
508
538
|
rotateClockwise: !0,
|
|
509
539
|
textureFilter: "Picture",
|
|
510
540
|
url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
|
|
@@ -516,16 +546,42 @@ class C {
|
|
|
516
546
|
});
|
|
517
547
|
this.crossLayer.add(c);
|
|
518
548
|
} else
|
|
519
|
-
s.items.forEach((
|
|
549
|
+
s.items.forEach((r) => {
|
|
520
550
|
const o = new u({
|
|
521
|
-
geometry: new h({ x:
|
|
551
|
+
geometry: new h({ x: r.x, y: r.y }),
|
|
522
552
|
attributes: {
|
|
523
|
-
...
|
|
524
|
-
...
|
|
553
|
+
...r,
|
|
554
|
+
...r.properties,
|
|
525
555
|
type: "clusterPoint",
|
|
526
|
-
id:
|
|
556
|
+
id: r.id
|
|
527
557
|
},
|
|
528
|
-
symbol: this.crossGraphicSymbol
|
|
558
|
+
symbol: this.crossGraphicSymbol,
|
|
559
|
+
popupTemplate: {
|
|
560
|
+
title: "{name}信号机",
|
|
561
|
+
content: [
|
|
562
|
+
{
|
|
563
|
+
type: "fields",
|
|
564
|
+
fieldInfos: [
|
|
565
|
+
{
|
|
566
|
+
fieldName: "signalId",
|
|
567
|
+
label: "信号机编号"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
fieldName: "nodeId",
|
|
571
|
+
label: "路口编号"
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
fieldName: "districtName",
|
|
575
|
+
label: "区控名称"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
fieldName: "subDistrictName",
|
|
579
|
+
label: "子区名称"
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}
|
|
529
585
|
});
|
|
530
586
|
this.crossLayer.add(o);
|
|
531
587
|
});
|
|
@@ -533,5 +589,5 @@ class C {
|
|
|
533
589
|
}
|
|
534
590
|
}
|
|
535
591
|
export {
|
|
536
|
-
|
|
592
|
+
x as default
|
|
537
593
|
};
|