gisviewer-vue3-arcgis 1.0.150 → 1.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/utils/common-utils.d.ts +4 -0
- package/es/src/gis-map/utils/common-utils.mjs +16 -13
- 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 +231 -222
- package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +9 -8
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +84 -84
- package/lib/src/gis-map/utils/common-utils.d.ts +4 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -1
- 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/district-controller.js +1 -1
- package/lib/src/gis-map/utils/signal-control-area-controller/index.js +1 -1
- package/package.json +1 -1
|
@@ -79,4 +79,8 @@ export default class CommonUtils {
|
|
|
79
79
|
static transformPointProjection(point: number[]): number[];
|
|
80
80
|
static pointsEqual(point1: number[], point2: number[]): boolean;
|
|
81
81
|
static getExtensionLine(pt1: number[], pt2: number[], distance: number): turf.Position;
|
|
82
|
+
static isCoordinateValid(coordinate: {
|
|
83
|
+
latitude: number;
|
|
84
|
+
longitude: number;
|
|
85
|
+
}): boolean;
|
|
82
86
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Point as
|
|
1
|
+
import { Point as d, Polyline as f } from "@arcgis/core/geometry";
|
|
2
2
|
import * as g from "@arcgis/core/geometry/geometryEngineAsync";
|
|
3
3
|
import * as y from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import p from "@turf/bearing";
|
|
5
|
+
import u from "@turf/destination";
|
|
6
6
|
import * as a from "@turf/helpers";
|
|
7
|
-
import
|
|
7
|
+
import O from "pako";
|
|
8
8
|
import h from "proj4";
|
|
9
9
|
class i {
|
|
10
10
|
/**
|
|
@@ -15,10 +15,10 @@ class i {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
static destinationWithPoint(t, e, n) {
|
|
18
|
-
const r = a.point([t.x, t.y]), s =
|
|
18
|
+
const r = a.point([t.x, t.y]), s = u(r, n, e, {
|
|
19
19
|
units: "meters"
|
|
20
20
|
});
|
|
21
|
-
return new
|
|
21
|
+
return new d({
|
|
22
22
|
x: s.geometry.coordinates[0],
|
|
23
23
|
y: s.geometry.coordinates[1]
|
|
24
24
|
});
|
|
@@ -30,7 +30,7 @@ class i {
|
|
|
30
30
|
*/
|
|
31
31
|
static angleOfLine(t) {
|
|
32
32
|
const e = t.paths[0], n = a.point(e[0]), r = a.point(e[e.length - 1]);
|
|
33
|
-
return
|
|
33
|
+
return p(n, r);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* 在头尾两个方向上延长折线
|
|
@@ -38,14 +38,14 @@ class i {
|
|
|
38
38
|
* @param distance
|
|
39
39
|
*/
|
|
40
40
|
static extendLineInTowDir(t, e) {
|
|
41
|
-
const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o =
|
|
41
|
+
const n = t.paths[0], r = a.point(n[0]), s = a.point(n[1]), o = p(s, r), c = u(r, e, o, {
|
|
42
42
|
units: "meters"
|
|
43
|
-
}),
|
|
43
|
+
}), l = o > 0 ? o - 180 : o + 180, P = u(s, e, l, {
|
|
44
44
|
units: "meters"
|
|
45
45
|
});
|
|
46
46
|
return new f({
|
|
47
47
|
paths: [
|
|
48
|
-
[c.geometry.coordinates,
|
|
48
|
+
[c.geometry.coordinates, P.geometry.coordinates]
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -149,7 +149,7 @@ class i {
|
|
|
149
149
|
e.push(o.charCodeAt(0));
|
|
150
150
|
}
|
|
151
151
|
const r = new Uint8Array(e);
|
|
152
|
-
return
|
|
152
|
+
return O.inflate(r, { to: "string" });
|
|
153
153
|
} catch {
|
|
154
154
|
console.log(`非压缩内容: ${t}`);
|
|
155
155
|
}
|
|
@@ -212,8 +212,11 @@ class i {
|
|
|
212
212
|
return Math.abs(t[0] - e[0]) < Number.EPSILON && Math.abs(t[1] - e[1]) < Number.EPSILON;
|
|
213
213
|
}
|
|
214
214
|
static getExtensionLine(t, e, n) {
|
|
215
|
-
const r = a.point(t), s = a.point(e), o =
|
|
216
|
-
return
|
|
215
|
+
const r = a.point(t), s = a.point(e), o = p(r, s);
|
|
216
|
+
return u(s, n, o, { units: "meters" }).geometry.coordinates;
|
|
217
|
+
}
|
|
218
|
+
static isCoordinateValid(t) {
|
|
219
|
+
return t.latitude !== void 0 && t.longitude !== void 0 && !isNaN(t.latitude) && !isNaN(t.longitude) && t.latitude !== 0 && t.longitude !== 0;
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
222
|
export {
|
|
@@ -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
|
*/
|