gisviewer-vue3-arcgis 1.0.253 → 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 +89 -72
- 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 +53 -37
- 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 +3 -3
- 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 +3 -3
- package/package.json +1 -1
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { Multipoint as
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
1
|
+
import L from "@arcgis/core/Basemap";
|
|
2
|
+
import v from "@arcgis/core/config";
|
|
3
|
+
import * as M from "@arcgis/core/core/reactiveUtils";
|
|
4
|
+
import { Multipoint as z, Polygon as k, Polyline as W, Point as T } from "@arcgis/core/geometry";
|
|
5
|
+
import * as b from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
6
|
+
import { webMercatorToGeographic as I } from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
7
|
+
import C from "@arcgis/core/Graphic";
|
|
8
|
+
import G from "@arcgis/core/layers/FeatureLayer";
|
|
7
9
|
import x from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import S from "@arcgis/core/layers/GroupLayer";
|
|
11
|
+
import H from "@arcgis/core/layers/IntegratedMesh3DTilesLayer";
|
|
12
|
+
import B from "@arcgis/core/layers/MapImageLayer";
|
|
13
|
+
import O from "@arcgis/core/layers/TileLayer";
|
|
12
14
|
import R from "@arcgis/core/layers/WebTileLayer";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
15
|
+
import E from "@arcgis/core/layers/WMSLayer";
|
|
16
|
+
import N from "@arcgis/core/Map";
|
|
17
|
+
import A from "@arcgis/core/views/MapView";
|
|
16
18
|
import U from "@arcgis/core/views/SceneView";
|
|
17
|
-
import
|
|
18
|
-
import * as
|
|
19
|
+
import V from "@turf/destination";
|
|
20
|
+
import * as j from "@turf/helpers";
|
|
21
|
+
import D from "@arcgis/core/layers/GraphicsLayer";
|
|
19
22
|
import J from "./custom-layer/custom-wmts-layer.mjs";
|
|
20
|
-
class
|
|
23
|
+
class me {
|
|
21
24
|
constructor() {
|
|
22
|
-
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
|
|
25
|
+
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null, this.detachmentLayerLoaded = !1;
|
|
23
26
|
}
|
|
24
27
|
processUrl(e) {
|
|
25
28
|
return e && (e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("{{") ? e.replace("{{geoServer}}", this.mapConfig.geoServer) : this.mapConfig.assetsRoot + e);
|
|
@@ -30,19 +33,19 @@ class ae {
|
|
|
30
33
|
* @returns view
|
|
31
34
|
*/
|
|
32
35
|
async initialize(e) {
|
|
33
|
-
var
|
|
36
|
+
var p, u, g, f;
|
|
34
37
|
this.mapConfig = e.mapConfig;
|
|
35
38
|
const { container: i, markerClickCallback: s, mapClickCallback: a } = e;
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
((
|
|
39
|
-
map:
|
|
39
|
+
v.assetsPath = `${this.mapConfig.assetsRoot}/ArcgisAssets`, v.fontsUrl = `${this.mapConfig.assetsRoot}/fonts`, v.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
40
|
+
const o = new N();
|
|
41
|
+
((p = this.mapConfig) == null ? void 0 : p.mapOptions.mode.toLowerCase()) === "2d" ? (this.view = new A({
|
|
42
|
+
map: o,
|
|
40
43
|
container: i,
|
|
41
44
|
...this.mapConfig.mapOptions
|
|
42
45
|
}), this.view.on("drag", (t) => {
|
|
43
46
|
t.button === 2 && t.stopPropagation();
|
|
44
47
|
})) : this.view = new U({
|
|
45
|
-
map:
|
|
48
|
+
map: o,
|
|
46
49
|
container: i,
|
|
47
50
|
environment: {
|
|
48
51
|
atmosphereEnabled: !0,
|
|
@@ -50,7 +53,7 @@ class ae {
|
|
|
50
53
|
type: "virtual"
|
|
51
54
|
}
|
|
52
55
|
},
|
|
53
|
-
...(
|
|
56
|
+
...(u = this.mapConfig) == null ? void 0 : u.mapOptions
|
|
54
57
|
}), this.view.popup.visibleElements = {
|
|
55
58
|
closeButton: !0,
|
|
56
59
|
collapseButton: !1,
|
|
@@ -60,69 +63,69 @@ class ae {
|
|
|
60
63
|
buttonEnabled: !1,
|
|
61
64
|
breakpoint: !1
|
|
62
65
|
}, this.view.on("click", async (t) => {
|
|
63
|
-
var h,
|
|
66
|
+
var h, y;
|
|
64
67
|
if (a) {
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
let n = t.mapPoint;
|
|
69
|
+
n.spatialReference.isWebMercator && (n = b.webMercatorToGeographic(
|
|
70
|
+
n
|
|
68
71
|
)), a(
|
|
69
|
-
[
|
|
72
|
+
[n.x, n.y],
|
|
70
73
|
[t.screenPoint.x, t.screenPoint.y],
|
|
71
74
|
t
|
|
72
75
|
);
|
|
73
76
|
}
|
|
74
77
|
if (this.view.type === "3d") {
|
|
75
|
-
const
|
|
78
|
+
const n = this.view.camera;
|
|
76
79
|
if (this.view.spatialReference.isWebMercator) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
),
|
|
80
|
-
heading:
|
|
81
|
-
tilt:
|
|
82
|
-
position:
|
|
80
|
+
const w = b.webMercatorToGeographic(
|
|
81
|
+
n.position
|
|
82
|
+
), d = {
|
|
83
|
+
heading: n.heading,
|
|
84
|
+
tilt: n.tilt,
|
|
85
|
+
position: w.toJSON()
|
|
83
86
|
};
|
|
84
|
-
console.log(
|
|
87
|
+
console.log(d), (h = navigator.clipboard) == null || h.writeText(JSON.stringify(d));
|
|
85
88
|
} else
|
|
86
|
-
console.log(
|
|
89
|
+
console.log(n.toJSON());
|
|
87
90
|
console.log(this.view.zoom, this.view.scale);
|
|
88
91
|
} else {
|
|
89
|
-
let
|
|
90
|
-
this.view.spatialReference.isWebMercator && (
|
|
91
|
-
|
|
92
|
+
let n = this.view.center;
|
|
93
|
+
this.view.spatialReference.isWebMercator && (n = b.webMercatorToGeographic(
|
|
94
|
+
n
|
|
92
95
|
)), console.log({
|
|
93
|
-
center:
|
|
96
|
+
center: n.toJSON(),
|
|
94
97
|
zoom: this.view.zoom,
|
|
95
98
|
scale: this.view.scale
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
|
-
const c = (
|
|
99
|
-
(
|
|
101
|
+
const c = (y = (await this.view.hitTest(t)).results) == null ? void 0 : y.filter(
|
|
102
|
+
(n) => n.type === "graphic"
|
|
100
103
|
);
|
|
101
|
-
c.length > 0 && c.forEach((
|
|
102
|
-
var
|
|
103
|
-
const
|
|
104
|
-
(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
c.length > 0 && c.forEach((n) => {
|
|
105
|
+
var d;
|
|
106
|
+
const w = n.graphic;
|
|
107
|
+
(d = w.attributes) != null && d.type && s && s(
|
|
108
|
+
w.attributes.type,
|
|
109
|
+
w.attributes.id,
|
|
110
|
+
w.attributes,
|
|
108
111
|
t
|
|
109
112
|
);
|
|
110
113
|
});
|
|
111
114
|
});
|
|
112
115
|
{
|
|
113
|
-
let t = 0,
|
|
116
|
+
let t = 0, r = !1;
|
|
114
117
|
this.view.on("pointer-move", async (c) => {
|
|
115
|
-
var
|
|
118
|
+
var y;
|
|
116
119
|
const h = performance.now();
|
|
117
|
-
if (!(
|
|
118
|
-
t = h,
|
|
120
|
+
if (!(r || h - t < 100)) {
|
|
121
|
+
t = h, r = !0;
|
|
119
122
|
try {
|
|
120
|
-
const
|
|
121
|
-
(
|
|
122
|
-
),
|
|
123
|
-
|
|
123
|
+
const w = (y = (await this.view.hitTest(c)).results) == null ? void 0 : y.some(
|
|
124
|
+
(P) => P.type === "graphic"
|
|
125
|
+
), d = this.view.container;
|
|
126
|
+
d && (d.style.cursor = w ? "pointer" : "default");
|
|
124
127
|
} finally {
|
|
125
|
-
|
|
128
|
+
r = !1;
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
});
|
|
@@ -130,106 +133,103 @@ class ae {
|
|
|
130
133
|
if (this.view.on("pointer-leave", () => {
|
|
131
134
|
const t = this.view.container;
|
|
132
135
|
t && (t.style.cursor = "default");
|
|
133
|
-
}), (
|
|
134
|
-
const
|
|
136
|
+
}), (g = this.mapConfig) != null && g.baseLayers ? this.mapConfig.baseLayers.forEach((t) => {
|
|
137
|
+
const r = this.processUrl(t.url);
|
|
135
138
|
let c = null;
|
|
136
139
|
switch (t.type.toLowerCase()) {
|
|
137
140
|
case "webTile".toLowerCase(): {
|
|
138
141
|
c = new R({
|
|
139
|
-
urlTemplate:
|
|
142
|
+
urlTemplate: r,
|
|
140
143
|
...t.options
|
|
141
144
|
});
|
|
142
145
|
break;
|
|
143
146
|
}
|
|
144
147
|
case "tile": {
|
|
145
|
-
c = new
|
|
146
|
-
url:
|
|
148
|
+
c = new O({
|
|
149
|
+
url: r,
|
|
147
150
|
...t.options
|
|
148
151
|
});
|
|
149
152
|
break;
|
|
150
153
|
}
|
|
151
154
|
case "customwmts".toLowerCase(): {
|
|
152
155
|
c = new J({
|
|
153
|
-
urlTemplate:
|
|
156
|
+
urlTemplate: r,
|
|
154
157
|
...t.options
|
|
155
158
|
});
|
|
156
159
|
break;
|
|
157
160
|
}
|
|
158
161
|
case "mapimage".toLowerCase(): {
|
|
159
|
-
c = new
|
|
160
|
-
url:
|
|
162
|
+
c = new B({
|
|
163
|
+
url: r,
|
|
161
164
|
...t.options
|
|
162
165
|
});
|
|
163
166
|
break;
|
|
164
167
|
}
|
|
165
168
|
case "arcgis": {
|
|
166
|
-
const h = new
|
|
167
|
-
|
|
169
|
+
const h = new L(t.options);
|
|
170
|
+
o.basemap = h;
|
|
168
171
|
break;
|
|
169
172
|
}
|
|
170
173
|
case "feature": {
|
|
171
|
-
c = new
|
|
174
|
+
c = new G({ url: r, ...t.options });
|
|
172
175
|
break;
|
|
173
176
|
}
|
|
174
177
|
case "3dtiles": {
|
|
175
|
-
c = new
|
|
176
|
-
url:
|
|
178
|
+
c = new H({
|
|
179
|
+
url: r,
|
|
177
180
|
...t.options
|
|
178
181
|
});
|
|
179
182
|
break;
|
|
180
183
|
}
|
|
181
184
|
case "wms": {
|
|
182
|
-
c = new
|
|
183
|
-
url:
|
|
185
|
+
c = new E({
|
|
186
|
+
url: r,
|
|
184
187
|
...t.options
|
|
185
188
|
});
|
|
186
189
|
break;
|
|
187
190
|
}
|
|
188
|
-
default:
|
|
189
|
-
console.warn(`不支持的图层类型: ${t.type}`);
|
|
190
|
-
break;
|
|
191
191
|
}
|
|
192
192
|
if (c)
|
|
193
193
|
if (t.group) {
|
|
194
|
-
let h =
|
|
195
|
-
h && h.type === "group" ? h.add(c) : (h = new
|
|
194
|
+
let h = o.findLayerById(t.group);
|
|
195
|
+
h && h.type === "group" ? h.add(c) : (h = new S({
|
|
196
196
|
id: t.group,
|
|
197
197
|
title: t.groupTitle,
|
|
198
198
|
visibilityMode: "inherited",
|
|
199
199
|
layers: [c],
|
|
200
200
|
visible: t.groupVisible !== !1
|
|
201
|
-
}),
|
|
201
|
+
}), o.add(h));
|
|
202
202
|
} else
|
|
203
|
-
|
|
204
|
-
}) :
|
|
203
|
+
o.add(c);
|
|
204
|
+
}) : o.basemap = new L({
|
|
205
205
|
style: {
|
|
206
206
|
id: "arcgis/light-gray",
|
|
207
207
|
language: "zh-CN"
|
|
208
208
|
}
|
|
209
|
-
}), (
|
|
209
|
+
}), (f = this.mapConfig) != null && f.hdLayers) {
|
|
210
210
|
const t = this.mapConfig.hdLayers.map(
|
|
211
|
-
(
|
|
211
|
+
(r) => (
|
|
212
212
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
213
213
|
new x({
|
|
214
|
-
url: this.processUrl(
|
|
215
|
-
...
|
|
216
|
-
title:
|
|
214
|
+
url: this.processUrl(r.url),
|
|
215
|
+
...r.options,
|
|
216
|
+
title: r.options.id
|
|
217
217
|
})
|
|
218
218
|
)
|
|
219
219
|
);
|
|
220
|
-
|
|
220
|
+
o.addMany(t);
|
|
221
221
|
}
|
|
222
222
|
this.view.ui.remove("attribution"), await this.view.when();
|
|
223
|
-
const
|
|
223
|
+
const l = this.mapConfig.camera;
|
|
224
224
|
let m;
|
|
225
225
|
if (this.view.type === "2d") {
|
|
226
226
|
let t = this.view.center;
|
|
227
|
-
this.view.spatialReference.isWebMercator && (t =
|
|
227
|
+
this.view.spatialReference.isWebMercator && (t = b.webMercatorToGeographic(
|
|
228
228
|
t
|
|
229
229
|
)), m = { center: [t.x, t.y], zoom: this.view.zoom };
|
|
230
230
|
} else {
|
|
231
231
|
let t = this.view.camera.position;
|
|
232
|
-
this.view.spatialReference.isWebMercator && (t =
|
|
232
|
+
this.view.spatialReference.isWebMercator && (t = b.webMercatorToGeographic(
|
|
233
233
|
t
|
|
234
234
|
)), m = {
|
|
235
235
|
position: t,
|
|
@@ -237,11 +237,16 @@ class ae {
|
|
|
237
237
|
tilt: this.view.camera.tilt
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
return
|
|
240
|
+
return l ? l.home = m : this.mapConfig.camera = { home: m }, this.view;
|
|
241
241
|
}
|
|
242
|
-
setLayerVisibility(e) {
|
|
243
|
-
const { id: i, visible: s } = e
|
|
244
|
-
|
|
242
|
+
async setLayerVisibility(e) {
|
|
243
|
+
const { id: i, visible: s } = e;
|
|
244
|
+
if (i === "shanghai_district")
|
|
245
|
+
return this.detachmentLayerLoaded ? this.detachmentLayer.visible = s : await this.loadDetachmentLayer(), { status: 0, message: "ok" };
|
|
246
|
+
{
|
|
247
|
+
const a = this.view.map.findLayerById(i);
|
|
248
|
+
return a ? (a.visible = s, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
249
|
+
}
|
|
245
250
|
}
|
|
246
251
|
/**
|
|
247
252
|
* 设置地图中心点
|
|
@@ -258,13 +263,13 @@ class ae {
|
|
|
258
263
|
e.target = new T(e.target);
|
|
259
264
|
break;
|
|
260
265
|
case "polyline":
|
|
261
|
-
e.target = new
|
|
266
|
+
e.target = new W(e.target);
|
|
262
267
|
break;
|
|
263
268
|
case "polygon":
|
|
264
|
-
e.target = new
|
|
269
|
+
e.target = new k(e.target);
|
|
265
270
|
break;
|
|
266
271
|
case "multipoint":
|
|
267
|
-
e.target = new
|
|
272
|
+
e.target = new z(e.target);
|
|
268
273
|
break;
|
|
269
274
|
}
|
|
270
275
|
await this.view.goTo(e, { duration: (e.duration || 0) * 1e3 });
|
|
@@ -295,8 +300,8 @@ class ae {
|
|
|
295
300
|
{ duration: (e.duration || 2) * 1e3 }
|
|
296
301
|
);
|
|
297
302
|
else {
|
|
298
|
-
const a = Math.tan(i * Math.PI / 180) * e.height,
|
|
299
|
-
|
|
303
|
+
const a = Math.tan(i * Math.PI / 180) * e.height, o = V(
|
|
304
|
+
j.point(e.center),
|
|
300
305
|
a,
|
|
301
306
|
s + 180,
|
|
302
307
|
{
|
|
@@ -306,8 +311,8 @@ class ae {
|
|
|
306
311
|
await this.view.goTo(
|
|
307
312
|
{
|
|
308
313
|
position: {
|
|
309
|
-
x:
|
|
310
|
-
y:
|
|
314
|
+
x: o.geometry.coordinates[0],
|
|
315
|
+
y: o.geometry.coordinates[1],
|
|
311
316
|
z: e.height
|
|
312
317
|
},
|
|
313
318
|
heading: s,
|
|
@@ -323,22 +328,22 @@ class ae {
|
|
|
323
328
|
const { name: i, duration: s = 0 } = e, { camera: a } = this.mapConfig;
|
|
324
329
|
if (!a)
|
|
325
330
|
return { status: -1, message: "未配置camera" };
|
|
326
|
-
const
|
|
327
|
-
return
|
|
331
|
+
const o = a[i];
|
|
332
|
+
return o ? (await this.view.goTo(o, { duration: s * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
|
|
328
333
|
}
|
|
329
334
|
/**
|
|
330
335
|
* 经纬度转像素坐标,在地图移动时回调
|
|
331
336
|
* */
|
|
332
337
|
requestCoordinateTransform(e, i) {
|
|
333
338
|
let s = 0;
|
|
334
|
-
const
|
|
339
|
+
const o = 1e3 / 30, l = M.watch(
|
|
335
340
|
() => this.view.center,
|
|
336
341
|
() => {
|
|
337
|
-
const m = this.transformPoints(e),
|
|
338
|
-
|
|
342
|
+
const m = this.transformPoints(e), p = Date.now();
|
|
343
|
+
p - s > o && (i(m), s = p);
|
|
339
344
|
}
|
|
340
345
|
);
|
|
341
|
-
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex,
|
|
346
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, l), { handle: this.handleIndex, points: this.transformPoints(e) };
|
|
342
347
|
}
|
|
343
348
|
transformPoints(e) {
|
|
344
349
|
return e.map((i) => {
|
|
@@ -361,14 +366,79 @@ class ae {
|
|
|
361
366
|
* */
|
|
362
367
|
setMapZoomRange(e) {
|
|
363
368
|
const { min: i, max: s } = e;
|
|
364
|
-
!i && !s || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle =
|
|
369
|
+
!i && !s || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = M.watch(
|
|
365
370
|
() => this.view.zoom,
|
|
366
371
|
(a) => {
|
|
367
372
|
i && a <= i && (this.view.zoom = i), s && a >= s && (this.view.zoom = s);
|
|
368
373
|
}
|
|
369
374
|
));
|
|
370
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* 加载支队图层
|
|
378
|
+
* 现场环境用url创建FeatureLayer有各种问题,
|
|
379
|
+
* 改为图层导出为json,用json创建Graphic,再将Graphic添加到FeatureLayer
|
|
380
|
+
*/
|
|
381
|
+
async loadDetachmentLayer() {
|
|
382
|
+
this.detachmentLayer = new D({
|
|
383
|
+
id: "detachmentLayer",
|
|
384
|
+
title: "支队图层",
|
|
385
|
+
effect: void 0
|
|
386
|
+
}), this.view.map.add(this.detachmentLayer);
|
|
387
|
+
const e = this.mapConfig.baseLayers;
|
|
388
|
+
if (!e)
|
|
389
|
+
return;
|
|
390
|
+
const i = e.find(
|
|
391
|
+
(s) => s.options.id === "shanghai_district"
|
|
392
|
+
);
|
|
393
|
+
if (i)
|
|
394
|
+
try {
|
|
395
|
+
const a = await (await fetch(
|
|
396
|
+
"/GisViewerAssets/ShangHai/Layers/district.json"
|
|
397
|
+
)).json(), o = [], { renderer: l, labelingInfo: m } = i.options;
|
|
398
|
+
a.features.forEach((p) => {
|
|
399
|
+
const u = p.attributes.ZD_NAME;
|
|
400
|
+
if (u !== "高架支队") {
|
|
401
|
+
let g = new k({
|
|
402
|
+
rings: p.geometry.rings
|
|
403
|
+
});
|
|
404
|
+
g = I(g);
|
|
405
|
+
const f = new C({
|
|
406
|
+
geometry: g,
|
|
407
|
+
attributes: p.attributes
|
|
408
|
+
});
|
|
409
|
+
if (l) {
|
|
410
|
+
if (l.type === "simple")
|
|
411
|
+
f.symbol = l.symbol;
|
|
412
|
+
else if (l.type === "unique-value") {
|
|
413
|
+
const t = f.getAttribute("OBJECTID"), r = l.uniqueValueInfos.find(
|
|
414
|
+
(c) => c.value == t
|
|
415
|
+
);
|
|
416
|
+
f.symbol = r ? r.symbol : l.defaultSymbol;
|
|
417
|
+
}
|
|
418
|
+
} else
|
|
419
|
+
f.symbol = {
|
|
420
|
+
type: "simple-fill",
|
|
421
|
+
color: [227, 237, 255, 0.4],
|
|
422
|
+
outline: {
|
|
423
|
+
color: [255, 195, 153],
|
|
424
|
+
width: 2
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
if (o.push(f), m && u !== "边防港航支队" && u !== "机场支队") {
|
|
428
|
+
const t = new C({
|
|
429
|
+
geometry: g.centroid,
|
|
430
|
+
symbol: { ...m.symbol, text: u }
|
|
431
|
+
});
|
|
432
|
+
o.push(t);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}), this.detachmentLayer.addMany(o), this.detachmentLayerLoaded = !0;
|
|
436
|
+
} catch (s) {
|
|
437
|
+
console.error("加载支队图层失败:", s);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
371
441
|
}
|
|
372
442
|
export {
|
|
373
|
-
|
|
443
|
+
me as default
|
|
374
444
|
};
|
|
@@ -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,145 @@
|
|
|
1
|
+
import s from "@arcgis/core/Graphic";
|
|
2
|
+
import a from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
class p {
|
|
4
|
+
constructor(r) {
|
|
5
|
+
this.crossGraphics = [], this.crossGraphicSymbol = {
|
|
6
|
+
type: "cim",
|
|
7
|
+
data: {
|
|
8
|
+
type: "CIMSymbolReference",
|
|
9
|
+
primitiveOverrides: [
|
|
10
|
+
{
|
|
11
|
+
type: "CIMPrimitiveOverride",
|
|
12
|
+
primitiveName: "textGraphic",
|
|
13
|
+
propertyName: "TextString",
|
|
14
|
+
valueExpressionInfo: {
|
|
15
|
+
type: "CIMExpressionInfo",
|
|
16
|
+
title: "Custom",
|
|
17
|
+
expression: 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
|
|
18
|
+
returnType: "Default"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
symbol: {
|
|
23
|
+
type: "CIMPointSymbol",
|
|
24
|
+
symbolLayers: [
|
|
25
|
+
{
|
|
26
|
+
type: "CIMVectorMarker",
|
|
27
|
+
size: 32,
|
|
28
|
+
colorLocked: !0,
|
|
29
|
+
anchorPointUnits: "Relative",
|
|
30
|
+
frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
|
|
31
|
+
markerGraphics: [
|
|
32
|
+
{
|
|
33
|
+
type: "CIMMarkerGraphic",
|
|
34
|
+
primitiveName: "textGraphic",
|
|
35
|
+
geometry: { x: 0, y: 0 },
|
|
36
|
+
symbol: {
|
|
37
|
+
type: "CIMTextSymbol",
|
|
38
|
+
height: 12,
|
|
39
|
+
horizontalAlignment: "Center",
|
|
40
|
+
offsetX: 0,
|
|
41
|
+
offsetY: 18,
|
|
42
|
+
haloSize: 1,
|
|
43
|
+
haloSymbol: {
|
|
44
|
+
type: "CIMPolygonSymbol",
|
|
45
|
+
symbolLayers: [
|
|
46
|
+
{
|
|
47
|
+
type: "CIMSolidFill",
|
|
48
|
+
enable: !0,
|
|
49
|
+
color: [255, 255, 255, 255]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
symbol: {
|
|
54
|
+
type: "CIMPolygonSymbol",
|
|
55
|
+
symbolLayers: [
|
|
56
|
+
{
|
|
57
|
+
type: "CIMSolidFill",
|
|
58
|
+
enable: !0,
|
|
59
|
+
color: [0, 0, 0, 255]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
verticalAlignment: "Center"
|
|
64
|
+
},
|
|
65
|
+
textString: ""
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
scaleSymbolsProportionally: !0,
|
|
69
|
+
respectFrame: !0
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "CIMPictureMarker",
|
|
73
|
+
enable: !0,
|
|
74
|
+
anchorPoint: {
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0
|
|
77
|
+
},
|
|
78
|
+
anchorPointUnits: "Relative",
|
|
79
|
+
size: 20,
|
|
80
|
+
rotateClockwise: !0,
|
|
81
|
+
textureFilter: "Picture",
|
|
82
|
+
url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, this.view = r, this.crossLayer = new a(), this.view.map.add(this.crossLayer);
|
|
88
|
+
}
|
|
89
|
+
async showCrosses(r) {
|
|
90
|
+
this.crossLayer.removeAll(), r.forEach((i) => {
|
|
91
|
+
i.signals.forEach((e) => {
|
|
92
|
+
const t = new s({
|
|
93
|
+
geometry: {
|
|
94
|
+
type: "point",
|
|
95
|
+
longitude: e.longitude,
|
|
96
|
+
latitude: e.latitude
|
|
97
|
+
},
|
|
98
|
+
symbol: this.crossGraphicSymbol,
|
|
99
|
+
attributes: {
|
|
100
|
+
id: e.id,
|
|
101
|
+
name: e.name,
|
|
102
|
+
signalId: e.signalId,
|
|
103
|
+
nodeId: e.nodeId || e.id,
|
|
104
|
+
districtId: i.id,
|
|
105
|
+
districtName: i.name,
|
|
106
|
+
subDistrictId: "",
|
|
107
|
+
subDistrictName: "",
|
|
108
|
+
isKey: e.isKey,
|
|
109
|
+
type: "signal",
|
|
110
|
+
selected: !0
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
this.crossGraphics.push(t);
|
|
114
|
+
}), i.subDistricts.forEach((e) => {
|
|
115
|
+
e.signals.forEach((t) => {
|
|
116
|
+
const o = new s({
|
|
117
|
+
geometry: {
|
|
118
|
+
type: "point",
|
|
119
|
+
longitude: t.longitude,
|
|
120
|
+
latitude: t.latitude
|
|
121
|
+
},
|
|
122
|
+
symbol: this.crossGraphicSymbol,
|
|
123
|
+
attributes: {
|
|
124
|
+
id: t.id,
|
|
125
|
+
name: t.name,
|
|
126
|
+
signalId: t.signalId,
|
|
127
|
+
nodeId: t.nodeId || t.id,
|
|
128
|
+
districtId: i.id,
|
|
129
|
+
districtName: i.name,
|
|
130
|
+
subDistrictId: e.id,
|
|
131
|
+
subDistrictName: e.name,
|
|
132
|
+
isKey: t.isKey,
|
|
133
|
+
type: "signal",
|
|
134
|
+
selected: !0
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
this.crossGraphics.push(o);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}), this.crossLayer.addMany(this.crossGraphics);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
p as default
|
|
145
|
+
};
|