gisviewer-vue3-arcgis 1.0.149 → 1.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/utils/map-initializer.mjs +43 -35
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -1
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +259 -247
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +12 -15
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import y from "@arcgis/core/Basemap";
|
|
2
2
|
import g from "@arcgis/core/config";
|
|
3
3
|
import * as M from "@arcgis/core/core/reactiveUtils";
|
|
4
|
-
import { Polygon as
|
|
4
|
+
import { Polygon as P, Polyline as W, Point as k } from "@arcgis/core/geometry";
|
|
5
5
|
import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
6
6
|
import z from "@arcgis/core/layers/GeoJSONLayer";
|
|
7
7
|
import x from "@arcgis/core/layers/TileLayer";
|
|
8
8
|
import L from "@arcgis/core/layers/WebTileLayer";
|
|
9
9
|
import S from "@arcgis/core/Map";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
10
|
+
import O from "@arcgis/core/views/MapView";
|
|
11
|
+
import R from "@arcgis/core/views/SceneView";
|
|
12
|
+
import C from "@turf/destination";
|
|
13
|
+
import * as H from "@turf/helpers";
|
|
14
|
+
import I from "../stores/index.mjs";
|
|
15
15
|
import G from "./custom-layer/custom-wmts-layer.mjs";
|
|
16
|
-
function
|
|
16
|
+
function T(l, e) {
|
|
17
17
|
return l && (l.startsWith("http://") || l.startsWith("https://") ? l : e + l);
|
|
18
18
|
}
|
|
19
19
|
class F {
|
|
@@ -26,16 +26,16 @@ class F {
|
|
|
26
26
|
* @returns view
|
|
27
27
|
*/
|
|
28
28
|
async initialize(e) {
|
|
29
|
-
const i =
|
|
29
|
+
const i = I.useAppDataStore, t = JSON.parse(JSON.stringify(i.mapConfig));
|
|
30
30
|
this.mapConfig = t;
|
|
31
31
|
const { container: a, markerClickCallback: r, mapClickCallback: d } = e;
|
|
32
32
|
g.assetsPath = `${t.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${t.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
33
33
|
const n = new S();
|
|
34
|
-
if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new
|
|
34
|
+
if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new O({
|
|
35
35
|
map: n,
|
|
36
36
|
container: a,
|
|
37
37
|
...t.mapOptions
|
|
38
|
-
}) : this.view = new
|
|
38
|
+
}) : this.view = new R({
|
|
39
39
|
map: n,
|
|
40
40
|
container: a,
|
|
41
41
|
environment: {
|
|
@@ -45,8 +45,16 @@ class F {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
...t == null ? void 0 : t.mapOptions
|
|
48
|
-
}), this.view.
|
|
49
|
-
|
|
48
|
+
}), this.view.popup.visibleElements = {
|
|
49
|
+
closeButton: !0,
|
|
50
|
+
collapseButton: !1,
|
|
51
|
+
actionBar: !1,
|
|
52
|
+
featureNavigation: !1
|
|
53
|
+
}, this.view.popup.dockOptions = {
|
|
54
|
+
buttonEnabled: !1,
|
|
55
|
+
breakpoint: !1
|
|
56
|
+
}, this.view.on("click", async (s) => {
|
|
57
|
+
var v, b;
|
|
50
58
|
if (d) {
|
|
51
59
|
let o = s.mapPoint;
|
|
52
60
|
o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
|
|
@@ -60,14 +68,14 @@ class F {
|
|
|
60
68
|
if (this.view.type === "3d") {
|
|
61
69
|
const o = this.view.camera;
|
|
62
70
|
if (this.view.spatialReference.isWebMercator) {
|
|
63
|
-
const
|
|
71
|
+
const p = f.webMercatorToGeographic(
|
|
64
72
|
o.position
|
|
65
73
|
), w = {
|
|
66
74
|
heading: o.heading,
|
|
67
75
|
tilt: o.tilt,
|
|
68
|
-
position:
|
|
76
|
+
position: p.toJSON()
|
|
69
77
|
};
|
|
70
|
-
console.log(w), (
|
|
78
|
+
console.log(w), (v = navigator.clipboard) == null || v.writeText(JSON.stringify(w));
|
|
71
79
|
} else
|
|
72
80
|
console.log(o.toJSON());
|
|
73
81
|
console.log(this.view.zoom, this.view.scale);
|
|
@@ -81,21 +89,21 @@ class F {
|
|
|
81
89
|
scale: this.view.scale
|
|
82
90
|
});
|
|
83
91
|
}
|
|
84
|
-
const c = (
|
|
92
|
+
const c = (b = (await this.view.hitTest(s)).results) == null ? void 0 : b.filter(
|
|
85
93
|
(o) => o.type === "graphic"
|
|
86
94
|
);
|
|
87
95
|
c.length > 0 && c.forEach((o) => {
|
|
88
96
|
var w;
|
|
89
|
-
const
|
|
90
|
-
(w =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
const p = o.graphic;
|
|
98
|
+
(w = p.attributes) != null && w.type && r && r(
|
|
99
|
+
p.attributes.type,
|
|
100
|
+
p.attributes.id,
|
|
101
|
+
p.attributes,
|
|
94
102
|
s
|
|
95
103
|
);
|
|
96
104
|
});
|
|
97
105
|
}), t != null && t.baseLayers ? t.baseLayers.forEach((s) => {
|
|
98
|
-
const h =
|
|
106
|
+
const h = T(s.url, t.assetsRoot);
|
|
99
107
|
switch (s.type.toLowerCase()) {
|
|
100
108
|
case "webTile".toLowerCase(): {
|
|
101
109
|
const c = new L({
|
|
@@ -122,12 +130,12 @@ class F {
|
|
|
122
130
|
break;
|
|
123
131
|
}
|
|
124
132
|
case "arcgis": {
|
|
125
|
-
const c = new
|
|
133
|
+
const c = new y(s.options);
|
|
126
134
|
n.basemap = c;
|
|
127
135
|
break;
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
|
-
}) : n.basemap = new
|
|
138
|
+
}) : n.basemap = new y({
|
|
131
139
|
style: {
|
|
132
140
|
id: "arcgis/light-gray",
|
|
133
141
|
language: "zh-CN"
|
|
@@ -137,7 +145,7 @@ class F {
|
|
|
137
145
|
(h) => (
|
|
138
146
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
139
147
|
new z({
|
|
140
|
-
url:
|
|
148
|
+
url: T(h.url, t.assetsRoot),
|
|
141
149
|
...h.options,
|
|
142
150
|
title: h.options.id
|
|
143
151
|
})
|
|
@@ -146,7 +154,7 @@ class F {
|
|
|
146
154
|
n.addMany(s);
|
|
147
155
|
}
|
|
148
156
|
this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
|
|
149
|
-
const
|
|
157
|
+
const m = this.mapConfig.camera;
|
|
150
158
|
let u;
|
|
151
159
|
if (this.view.type === "2d") {
|
|
152
160
|
let s = this.view.center;
|
|
@@ -163,7 +171,7 @@ class F {
|
|
|
163
171
|
tilt: this.view.camera.tilt
|
|
164
172
|
};
|
|
165
173
|
}
|
|
166
|
-
return
|
|
174
|
+
return m ? m.home = u : this.mapConfig.camera = { home: u }, this.view;
|
|
167
175
|
}
|
|
168
176
|
setLayerVisibility(e) {
|
|
169
177
|
const { id: i, visible: t } = e, a = this.view.map.findLayerById(i);
|
|
@@ -181,13 +189,13 @@ class F {
|
|
|
181
189
|
if (e.center || e.target) {
|
|
182
190
|
switch ((i = e.target) == null ? void 0 : i.type) {
|
|
183
191
|
case "point":
|
|
184
|
-
e.target = new
|
|
192
|
+
e.target = new k(e.target);
|
|
185
193
|
break;
|
|
186
194
|
case "polyline":
|
|
187
195
|
e.target = new W(e.target);
|
|
188
196
|
break;
|
|
189
197
|
case "polygon":
|
|
190
|
-
e.target = new
|
|
198
|
+
e.target = new P(e.target);
|
|
191
199
|
break;
|
|
192
200
|
}
|
|
193
201
|
await this.view.goTo(e, { duration: (e.duration || 0) * 1e3 });
|
|
@@ -215,8 +223,8 @@ class F {
|
|
|
215
223
|
{ duration: (e.duration || 2) * 1e3 }
|
|
216
224
|
);
|
|
217
225
|
else {
|
|
218
|
-
const a = Math.tan(i * Math.PI / 180) * e.height, r =
|
|
219
|
-
|
|
226
|
+
const a = Math.tan(i * Math.PI / 180) * e.height, r = C(
|
|
227
|
+
H.point(e.center),
|
|
220
228
|
a,
|
|
221
229
|
t + 180,
|
|
222
230
|
{
|
|
@@ -254,15 +262,15 @@ class F {
|
|
|
254
262
|
const r = 1e3 / 30, d = M.watch(
|
|
255
263
|
() => this.view.center,
|
|
256
264
|
() => {
|
|
257
|
-
const n = this.transformPoints(e),
|
|
258
|
-
|
|
265
|
+
const n = this.transformPoints(e), m = Date.now();
|
|
266
|
+
m - t > r && (i(n), t = m);
|
|
259
267
|
}
|
|
260
268
|
);
|
|
261
269
|
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
|
|
262
270
|
}
|
|
263
271
|
transformPoints(e) {
|
|
264
272
|
return e.map((i) => {
|
|
265
|
-
const t = new
|
|
273
|
+
const t = new k({
|
|
266
274
|
x: i[0],
|
|
267
275
|
y: i[1]
|
|
268
276
|
}), a = this.view.toScreen(t);
|
|
@@ -48,9 +48,9 @@ export default class OpenDriveRenderer {
|
|
|
48
48
|
*/
|
|
49
49
|
private showJunction;
|
|
50
50
|
private currentSectionCode;
|
|
51
|
+
private selectedSectionIds;
|
|
51
52
|
private currentJunctionId;
|
|
52
53
|
private hitGraphic;
|
|
53
|
-
private highlightGraphic;
|
|
54
54
|
/**
|
|
55
55
|
* 监听鼠标移动事件,高亮显示鼠标所在路段和路口
|
|
56
56
|
*/
|