gisviewer-vue3-arcgis 1.0.89 → 1.0.91
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 +4 -5
- package/es/src/gis-map/gis-map.vue.mjs +80 -80
- package/es/src/gis-map/index.d.ts +3 -4
- package/es/src/gis-map/utils/GreenWaveline.mjs +1 -1
- package/es/src/gis-map/utils/holo-flow/index.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +30 -19
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +56 -48
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +11 -7
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +49 -41
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +31 -17
- package/es/src/gis-map/utils/map-initializer.d.ts +2 -1
- package/es/src/gis-map/utils/map-initializer.mjs +135 -107
- package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
- package/es/src/gis-map/utils/traffic-flow.d.ts +14 -3
- package/es/src/gis-map/utils/traffic-flow.mjs +156 -130
- package/es/src/types/index.d.ts +14 -3
- package/lib/src/gis-map/gis-map.vue.d.ts +4 -5
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -4
- package/lib/src/gis-map/utils/GreenWaveline.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.d.ts +2 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
- package/lib/src/gis-map/utils/traffic-flow.d.ts +14 -3
- package/lib/src/gis-map/utils/traffic-flow.js +1 -1
- package/lib/src/types/index.d.ts +14 -3
- package/package.json +1 -1
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
class
|
|
1
|
+
import * as u from "@arcgis/core/views/3d/externalRenderers";
|
|
2
|
+
import T from "../../stores/index.mjs";
|
|
3
|
+
import f from "./trace-external-renderer.mjs";
|
|
4
|
+
import g from "./trace-layer-renderer.mjs";
|
|
5
|
+
class N {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
this.lastDataTime = 0, this.view = e;
|
|
8
|
-
const
|
|
9
|
-
this.mapConfig = JSON.parse(JSON.stringify(
|
|
8
|
+
const i = T.useAppDataStore;
|
|
9
|
+
this.mapConfig = JSON.parse(JSON.stringify(i.mapConfig)), e.type === "3d" ? (this.traceRenderer = new f(e), u.add(
|
|
10
10
|
e,
|
|
11
11
|
this.traceRenderer
|
|
12
|
-
)) : this.traceRenderer = new
|
|
12
|
+
)) : this.traceRenderer = new g(e);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* 处理全息流轨迹数据
|
|
16
16
|
* */
|
|
17
17
|
handleVehicleTraceData(e) {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
18
|
+
const i = new Date().getTime();
|
|
19
|
+
if (i - this.lastDataTime < 100)
|
|
20
20
|
return;
|
|
21
|
-
this.lastDataTime =
|
|
22
|
-
const { newVehList:
|
|
23
|
-
if (
|
|
24
|
-
for (const
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
this.lastDataTime = i;
|
|
22
|
+
const { newVehList: s, updateVehList: n, deleteVehList: o, jgsj: l } = e, a = e.crossId || "", h = [], r = [];
|
|
23
|
+
if (s && s.length > 0) {
|
|
24
|
+
for (const c of s) {
|
|
25
|
+
c.localTimestamp || (c.localTimestamp = l || i);
|
|
26
|
+
const t = this.buildVehicleTrackData(c, a);
|
|
27
|
+
t && h.push(t);
|
|
27
28
|
}
|
|
28
|
-
this.traceRenderer.addVehicles(
|
|
29
|
+
this.traceRenderer.addVehicles(h);
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
for (const
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
if (n && n.length > 0) {
|
|
32
|
+
for (const c of n) {
|
|
33
|
+
const t = this.buildVehicleTrackData(c, a);
|
|
34
|
+
t && r.push(t);
|
|
34
35
|
}
|
|
35
|
-
this.traceRenderer.updateVehicles(
|
|
36
|
+
this.traceRenderer.updateVehicles(r);
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
if (o && o.length > 0) {
|
|
39
|
+
const c = o.map(
|
|
40
|
+
(t) => a + "-" + (t.ptcId || t.vehno || t.vehNo)
|
|
40
41
|
);
|
|
41
|
-
this.traceRenderer.deleteVehicles(
|
|
42
|
+
this.traceRenderer.deleteVehicles(c);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
@@ -50,26 +51,33 @@ class b {
|
|
|
50
51
|
updatePanelContent(e) {
|
|
51
52
|
this.traceRenderer.updatePanelContent(e);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
toggleGroundVehicle(e) {
|
|
55
|
+
this.traceRenderer.toggleGroundVehicle(e);
|
|
56
|
+
}
|
|
57
|
+
toggleElevatedVehicle(e) {
|
|
58
|
+
this.traceRenderer.toggleElevatedVehicle(e);
|
|
59
|
+
}
|
|
60
|
+
buildVehicleTrackData(e, i) {
|
|
61
|
+
const p = e.longitude, s = e.latitude, n = e.ptcId, o = Number(e.ptcType), l = e.heading, a = Number(e.vehicleType), h = Number(e.vehicleColor), r = e.plateNo || e.plateno, c = Number(e.plateColor), t = e.timestamp, d = e.localTimestamp, m = String(e.roadLayer) || "1";
|
|
62
|
+
if (!(o < 0 || o > 8))
|
|
56
63
|
return {
|
|
57
|
-
ptcId:
|
|
58
|
-
crossId:
|
|
64
|
+
ptcId: n,
|
|
65
|
+
crossId: i,
|
|
59
66
|
x: p,
|
|
60
|
-
y:
|
|
61
|
-
ptcType:
|
|
67
|
+
y: s,
|
|
68
|
+
ptcType: o,
|
|
62
69
|
vehicleType: a,
|
|
63
|
-
heading:
|
|
64
|
-
vehicleColor:
|
|
65
|
-
showName:
|
|
66
|
-
plateNo:
|
|
67
|
-
plateColor:
|
|
68
|
-
timestamp:
|
|
69
|
-
localTimestamp:
|
|
70
|
+
heading: o === 2 ? -l : l,
|
|
71
|
+
vehicleColor: h,
|
|
72
|
+
showName: r && r !== "" && r !== "0" && r !== "000000" ? r : "",
|
|
73
|
+
plateNo: r,
|
|
74
|
+
plateColor: c,
|
|
75
|
+
timestamp: t,
|
|
76
|
+
localTimestamp: d,
|
|
77
|
+
roadLayer: m
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
}
|
|
73
81
|
export {
|
|
74
|
-
|
|
82
|
+
N as default
|
|
75
83
|
};
|
|
@@ -3,6 +3,8 @@ export default class TraceLayerRenderer implements ITraceRendererInterface {
|
|
|
3
3
|
private view;
|
|
4
4
|
private readonly vehicleLayer;
|
|
5
5
|
private mapConfig;
|
|
6
|
+
private showGroundVehicle;
|
|
7
|
+
private showElevatedVehicle;
|
|
6
8
|
constructor(view: __esri.MapView);
|
|
7
9
|
private showVehiclePlate;
|
|
8
10
|
private historyPositionMap;
|
|
@@ -12,6 +14,16 @@ export default class TraceLayerRenderer implements ITraceRendererInterface {
|
|
|
12
14
|
deleteVehicles(idList: string[]): void;
|
|
13
15
|
clearVehicles(): void;
|
|
14
16
|
updatePanelContent(contentType: EVehiclePlateState): void;
|
|
17
|
+
/**
|
|
18
|
+
* 设置地面车辆显示隐藏
|
|
19
|
+
* @param visible
|
|
20
|
+
*/
|
|
21
|
+
toggleGroundVehicle(visible: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* 设置高架车辆显示隐藏
|
|
24
|
+
* @param visible
|
|
25
|
+
*/
|
|
26
|
+
toggleElevatedVehicle(visible: boolean): void;
|
|
15
27
|
private render;
|
|
16
28
|
private updatePosition;
|
|
17
29
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import g from "@arcgis/core/Graphic";
|
|
2
2
|
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
3
3
|
import d from "../../stores/index.mjs";
|
|
4
|
-
class
|
|
4
|
+
class C {
|
|
5
5
|
constructor(i) {
|
|
6
|
-
this.showVehiclePlate = !1, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i;
|
|
6
|
+
this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.showVehiclePlate = !1, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i;
|
|
7
7
|
const e = d.useAppDataStore;
|
|
8
8
|
this.mapConfig = JSON.parse(JSON.stringify(e.mapConfig)), this.vehicleLayer = new y({
|
|
9
9
|
id: "vehicleLayer"
|
|
@@ -11,22 +11,22 @@ class v {
|
|
|
11
11
|
}
|
|
12
12
|
addVehicles(i) {
|
|
13
13
|
const e = i.map((t) => {
|
|
14
|
-
const { crossId: o, ptcId:
|
|
15
|
-
this.historyPositionMap.set(
|
|
16
|
-
{ pos: [
|
|
14
|
+
const { crossId: o, ptcId: h, localTimestamp: c } = t, a = Number(t.x), r = Number(t.y), s = Number(t.heading), n = `${o}-${h}`;
|
|
15
|
+
this.historyPositionMap.set(n, [
|
|
16
|
+
{ pos: [a, r, 0], heading: s, time: c }
|
|
17
17
|
]);
|
|
18
18
|
const l = new g({
|
|
19
19
|
geometry: {
|
|
20
20
|
type: "point",
|
|
21
|
-
x:
|
|
22
|
-
y:
|
|
21
|
+
x: a,
|
|
22
|
+
y: r
|
|
23
23
|
},
|
|
24
24
|
attributes: {
|
|
25
25
|
...t
|
|
26
26
|
},
|
|
27
27
|
symbol: this.createCIMSymbol(t)
|
|
28
28
|
});
|
|
29
|
-
return l.visible = !1, this.vehicleObjectMap.set(
|
|
29
|
+
return l.visible = !1, this.vehicleObjectMap.set(n, {
|
|
30
30
|
graphic: l,
|
|
31
31
|
data: t
|
|
32
32
|
}), l;
|
|
@@ -36,15 +36,15 @@ class v {
|
|
|
36
36
|
updateVehicles(i) {
|
|
37
37
|
const e = [];
|
|
38
38
|
i.forEach((t) => {
|
|
39
|
-
const { crossId: o, ptcId:
|
|
39
|
+
const { crossId: o, ptcId: h, localTimestamp: c } = t, a = Number(t.x), r = Number(t.y);
|
|
40
40
|
let s = Number(t.heading);
|
|
41
|
-
const
|
|
41
|
+
const n = `${o}-${h}`, l = this.vehicleObjectMap.get(n);
|
|
42
42
|
if (l) {
|
|
43
43
|
l.data = t;
|
|
44
44
|
const p = this.historyPositionMap.get(
|
|
45
|
-
|
|
45
|
+
n
|
|
46
46
|
), m = p[p.length - 1];
|
|
47
|
-
Math.abs(s - m.heading) >= 180 && (s > m.heading ? m.heading += 360 : s += 360), p.push({ pos: [
|
|
47
|
+
Math.abs(s - m.heading) >= 180 && (s > m.heading ? m.heading += 360 : s += 360), p.push({ pos: [a, r, 0], heading: s, time: c });
|
|
48
48
|
} else
|
|
49
49
|
e.push(t);
|
|
50
50
|
}), this.addVehicles(e);
|
|
@@ -61,6 +61,20 @@ class v {
|
|
|
61
61
|
updatePanelContent(i) {
|
|
62
62
|
console.log(i);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* 设置地面车辆显示隐藏
|
|
66
|
+
* @param visible
|
|
67
|
+
*/
|
|
68
|
+
toggleGroundVehicle(i) {
|
|
69
|
+
this.showGroundVehicle = i;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 设置高架车辆显示隐藏
|
|
73
|
+
* @param visible
|
|
74
|
+
*/
|
|
75
|
+
toggleElevatedVehicle(i) {
|
|
76
|
+
this.showElevatedVehicle = i;
|
|
77
|
+
}
|
|
64
78
|
render() {
|
|
65
79
|
this.vehicleObjectMap.forEach((i, e) => {
|
|
66
80
|
this.updatePosition(e);
|
|
@@ -71,7 +85,7 @@ class v {
|
|
|
71
85
|
if (!e || !t || e.length < 2)
|
|
72
86
|
return;
|
|
73
87
|
const o = Date.now();
|
|
74
|
-
t.graphic.visible =
|
|
88
|
+
(t.graphic.getAttribute("roadLayer") || "1") === "1" ? t.graphic.visible = this.showGroundVehicle : t.graphic.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = o, t.segmentTotalTime = e[1].time - e[0].time);
|
|
75
89
|
const c = o - t.segmentStartTime, a = Math.min(
|
|
76
90
|
1,
|
|
77
91
|
c / t.segmentTotalTime
|
|
@@ -89,12 +103,12 @@ class v {
|
|
|
89
103
|
y: e[0].pos[1]
|
|
90
104
|
};
|
|
91
105
|
else {
|
|
92
|
-
const r = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a,
|
|
106
|
+
const r = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a, s = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * a, n = e[0].heading + (e[1].heading - e[0].heading) * a;
|
|
93
107
|
t.graphic.geometry = {
|
|
94
108
|
type: "point",
|
|
95
109
|
x: r,
|
|
96
|
-
y:
|
|
97
|
-
}, t.data.heading =
|
|
110
|
+
y: s
|
|
111
|
+
}, t.data.heading = n, t.graphic.symbol = this.createCIMSymbol(t.data);
|
|
98
112
|
}
|
|
99
113
|
}
|
|
100
114
|
/**
|
|
@@ -282,5 +296,5 @@ class v {
|
|
|
282
296
|
}
|
|
283
297
|
}
|
|
284
298
|
export {
|
|
285
|
-
|
|
299
|
+
C as default
|
|
286
300
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MapView from '@arcgis/core/views/MapView';
|
|
2
2
|
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
-
import { ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
3
|
+
import { ILayerVisibleParams, ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
4
4
|
export default class MapInitializer {
|
|
5
5
|
private view;
|
|
6
6
|
private mapConfig;
|
|
@@ -14,6 +14,7 @@ export default class MapInitializer {
|
|
|
14
14
|
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
15
15
|
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
16
16
|
}): Promise<MapView | SceneView>;
|
|
17
|
+
setLayerVisibility(params: ILayerVisibleParams): IResult;
|
|
17
18
|
/**
|
|
18
19
|
* 设置地图中心点
|
|
19
20
|
* @param params
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import { Point as
|
|
1
|
+
import M from "@arcgis/core/Basemap";
|
|
2
|
+
import T from "@arcgis/core/Map";
|
|
3
|
+
import g from "@arcgis/core/config";
|
|
4
|
+
import * as P from "@arcgis/core/core/reactiveUtils";
|
|
5
|
+
import { Polygon as z, Polyline as W, Point as k } from "@arcgis/core/geometry";
|
|
6
6
|
import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
15
|
-
function
|
|
16
|
-
return m.startsWith("http://") || m.startsWith("https://") ? m :
|
|
7
|
+
import x from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
|
+
import L from "@arcgis/core/layers/TileLayer";
|
|
9
|
+
import R from "@arcgis/core/layers/WebTileLayer";
|
|
10
|
+
import S from "@arcgis/core/views/MapView";
|
|
11
|
+
import H from "@arcgis/core/views/SceneView";
|
|
12
|
+
import I from "@turf/destination";
|
|
13
|
+
import * as O from "@turf/helpers";
|
|
14
|
+
import G from "../stores/index.mjs";
|
|
15
|
+
function y(m, t) {
|
|
16
|
+
return m.startsWith("http://") || m.startsWith("https://") ? m : t + m;
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class Q {
|
|
19
19
|
constructor() {
|
|
20
20
|
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
|
|
21
21
|
}
|
|
@@ -24,27 +24,27 @@ class j {
|
|
|
24
24
|
* @param params 容器
|
|
25
25
|
* @returns view
|
|
26
26
|
*/
|
|
27
|
-
async initialize(
|
|
28
|
-
const i =
|
|
29
|
-
this.mapConfig =
|
|
30
|
-
const { container: a, markerClickCallback:
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
if ((
|
|
34
|
-
map:
|
|
27
|
+
async initialize(t) {
|
|
28
|
+
const i = G.useAppDataStore, e = JSON.parse(JSON.stringify(i.mapConfig));
|
|
29
|
+
this.mapConfig = e;
|
|
30
|
+
const { container: a, markerClickCallback: r, mapClickCallback: d } = t;
|
|
31
|
+
g.assetsPath = `${e.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${e.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
32
|
+
const c = new T();
|
|
33
|
+
if ((e == null ? void 0 : e.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new S({
|
|
34
|
+
map: c,
|
|
35
35
|
container: a,
|
|
36
|
-
...
|
|
37
|
-
}) : this.view = new
|
|
38
|
-
map:
|
|
36
|
+
...e.mapOptions
|
|
37
|
+
}) : this.view = new H({
|
|
38
|
+
map: c,
|
|
39
39
|
container: a,
|
|
40
|
-
...
|
|
40
|
+
...e == null ? void 0 : e.mapOptions
|
|
41
41
|
}), this.view.on("click", async (s) => {
|
|
42
|
-
var
|
|
43
|
-
if (
|
|
42
|
+
var b, v;
|
|
43
|
+
if (d) {
|
|
44
44
|
let o = s.mapPoint;
|
|
45
45
|
o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
|
|
46
46
|
o
|
|
47
|
-
)),
|
|
47
|
+
)), d(
|
|
48
48
|
[o.x, o.y],
|
|
49
49
|
[s.screenPoint.x, s.screenPoint.y],
|
|
50
50
|
s
|
|
@@ -55,12 +55,12 @@ class j {
|
|
|
55
55
|
if (this.view.spatialReference.isWebMercator) {
|
|
56
56
|
const l = f.webMercatorToGeographic(
|
|
57
57
|
o.position
|
|
58
|
-
),
|
|
58
|
+
), w = {
|
|
59
59
|
heading: o.heading,
|
|
60
60
|
tilt: o.tilt,
|
|
61
61
|
position: l.toJSON()
|
|
62
62
|
};
|
|
63
|
-
console.log(
|
|
63
|
+
console.log(w), (b = navigator.clipboard) == null || b.writeText(JSON.stringify(w));
|
|
64
64
|
} else
|
|
65
65
|
console.log(o.toJSON());
|
|
66
66
|
} else {
|
|
@@ -72,104 +72,135 @@ class j {
|
|
|
72
72
|
zoom: this.view.zoom
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
const h = (
|
|
75
|
+
const h = (v = (await this.view.hitTest(s)).results) == null ? void 0 : v.filter(
|
|
76
76
|
(o) => o.type === "graphic"
|
|
77
77
|
);
|
|
78
78
|
h.length > 0 && h.forEach((o) => {
|
|
79
|
-
var
|
|
79
|
+
var w;
|
|
80
80
|
const l = o.graphic;
|
|
81
|
-
(
|
|
81
|
+
(w = l.attributes) != null && w.type && r && r(
|
|
82
82
|
l.attributes.type,
|
|
83
83
|
l.attributes.id,
|
|
84
84
|
l.attributes,
|
|
85
85
|
s
|
|
86
86
|
);
|
|
87
87
|
});
|
|
88
|
-
}),
|
|
88
|
+
}), e != null && e.baseLayers ? e.baseLayers.forEach((s) => {
|
|
89
89
|
switch (s.type.toLowerCase()) {
|
|
90
90
|
case "webTile".toLowerCase(): {
|
|
91
|
-
const
|
|
92
|
-
urlTemplate:
|
|
91
|
+
const n = y(s.url, e.assetsRoot), h = new R({
|
|
92
|
+
urlTemplate: n,
|
|
93
93
|
...s.options
|
|
94
94
|
});
|
|
95
|
-
|
|
95
|
+
c.add(h);
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "tile": {
|
|
99
|
-
const
|
|
100
|
-
url:
|
|
99
|
+
const n = y(s.url, e.assetsRoot), h = new L({
|
|
100
|
+
url: n,
|
|
101
101
|
...s.options
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
c.add(h);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
case "arcgis": {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const n = new M(s.options);
|
|
108
|
+
c.basemap = n;
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
}) :
|
|
112
|
+
}) : c.basemap = new M({
|
|
113
113
|
style: {
|
|
114
114
|
id: "arcgis/dark-gray",
|
|
115
115
|
language: "zh-CN"
|
|
116
116
|
}
|
|
117
|
-
}),
|
|
118
|
-
const s =
|
|
119
|
-
(
|
|
117
|
+
}), e != null && e.hdLayers) {
|
|
118
|
+
const s = e.hdLayers.map(
|
|
119
|
+
(n) => (
|
|
120
120
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
121
|
-
new
|
|
122
|
-
url:
|
|
123
|
-
...
|
|
124
|
-
title:
|
|
121
|
+
new x({
|
|
122
|
+
url: y(n.url, e.assetsRoot),
|
|
123
|
+
...n.options,
|
|
124
|
+
title: n.options.id
|
|
125
125
|
})
|
|
126
126
|
)
|
|
127
127
|
);
|
|
128
|
-
|
|
128
|
+
c.addMany(s);
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
|
|
131
|
+
const p = this.mapConfig.camera;
|
|
132
|
+
let u;
|
|
133
|
+
if (this.view.type === "2d") {
|
|
134
|
+
let s = this.view.center;
|
|
135
|
+
this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
|
|
136
|
+
s
|
|
137
|
+
)), u = { center: [s.x, s.y], zoom: this.view.zoom };
|
|
138
|
+
} else {
|
|
139
|
+
let s = this.view.camera.position;
|
|
140
|
+
this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
|
|
141
|
+
s
|
|
142
|
+
)), u = {
|
|
143
|
+
position: s,
|
|
144
|
+
heading: this.view.camera.heading,
|
|
145
|
+
tilt: this.view.camera.tilt
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return p ? p.home = u : this.mapConfig.camera = { home: u }, this.view;
|
|
149
|
+
}
|
|
150
|
+
setLayerVisibility(t) {
|
|
151
|
+
const { id: i, visible: e } = t, a = this.view.map.findLayerById(i);
|
|
152
|
+
return a ? (a.visible = e, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
|
|
131
153
|
}
|
|
132
154
|
/**
|
|
133
155
|
* 设置地图中心点
|
|
134
156
|
* @param params
|
|
135
157
|
* @returns
|
|
136
158
|
*/
|
|
137
|
-
async setMapCenter(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
async setMapCenter(t) {
|
|
160
|
+
var i;
|
|
161
|
+
if (!this.view)
|
|
162
|
+
return { status: -1, message: "未初始化" };
|
|
163
|
+
if (t.center || t.target) {
|
|
164
|
+
switch ((i = t.target) == null ? void 0 : i.type) {
|
|
165
|
+
case "point":
|
|
166
|
+
t.target = new k(t.target);
|
|
167
|
+
break;
|
|
168
|
+
case "polyline":
|
|
169
|
+
t.target = new W(t.target);
|
|
170
|
+
break;
|
|
171
|
+
case "polygon":
|
|
172
|
+
t.target = new z(t.target);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
await this.view.goTo(t, { duration: (t.duration || 0) * 1e3 });
|
|
176
|
+
}
|
|
177
|
+
return { status: 0, message: "成功" };
|
|
147
178
|
}
|
|
148
179
|
/**
|
|
149
180
|
* 在一定的高度,以一定的角度去观察某个坐标
|
|
150
181
|
* */
|
|
151
|
-
async lookAt(
|
|
182
|
+
async lookAt(t) {
|
|
152
183
|
if (this.view.type === "2d")
|
|
153
184
|
return;
|
|
154
|
-
const i =
|
|
185
|
+
const i = t.tilt || 0, e = t.heading || 0;
|
|
155
186
|
if (i === 0)
|
|
156
187
|
await this.view.goTo(
|
|
157
188
|
{
|
|
158
189
|
position: {
|
|
159
|
-
x:
|
|
160
|
-
y:
|
|
161
|
-
z:
|
|
190
|
+
x: t.center[0],
|
|
191
|
+
y: t.center[1],
|
|
192
|
+
z: t.height
|
|
162
193
|
},
|
|
163
|
-
heading:
|
|
194
|
+
heading: e,
|
|
164
195
|
tilt: 0
|
|
165
196
|
},
|
|
166
|
-
{ duration: (
|
|
197
|
+
{ duration: (t.duration || 2) * 1e3 }
|
|
167
198
|
);
|
|
168
199
|
else {
|
|
169
|
-
const a = Math.tan(i * Math.PI / 180) *
|
|
170
|
-
|
|
200
|
+
const a = Math.tan(i * Math.PI / 180) * t.height, r = I(
|
|
201
|
+
O.point(t.center),
|
|
171
202
|
a,
|
|
172
|
-
|
|
203
|
+
e + 180,
|
|
173
204
|
{
|
|
174
205
|
units: "meters"
|
|
175
206
|
}
|
|
@@ -177,72 +208,69 @@ class j {
|
|
|
177
208
|
await this.view.goTo(
|
|
178
209
|
{
|
|
179
210
|
position: {
|
|
180
|
-
x:
|
|
181
|
-
y:
|
|
182
|
-
z:
|
|
211
|
+
x: r.geometry.coordinates[0],
|
|
212
|
+
y: r.geometry.coordinates[1],
|
|
213
|
+
z: t.height
|
|
183
214
|
},
|
|
184
|
-
heading:
|
|
215
|
+
heading: e,
|
|
185
216
|
tilt: i
|
|
186
217
|
},
|
|
187
|
-
{ duration: (
|
|
218
|
+
{ duration: (t.duration || 2) * 1e3 }
|
|
188
219
|
);
|
|
189
220
|
}
|
|
190
221
|
}
|
|
191
|
-
async setMapCamera(
|
|
222
|
+
async setMapCamera(t) {
|
|
192
223
|
if (!this.view)
|
|
193
224
|
return { status: -1, message: "未初始化" };
|
|
194
|
-
const {
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
{ duration: t * 1e3 }
|
|
201
|
-
), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" } : { status: -1, message: "未配置camera" };
|
|
225
|
+
const { name: i, duration: e = 0 } = t, { camera: a } = this.mapConfig;
|
|
226
|
+
if (!a)
|
|
227
|
+
return { status: -1, message: "未配置camera" };
|
|
228
|
+
const r = a[i];
|
|
229
|
+
return r ? (await this.view.goTo(r, { duration: e * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
|
|
202
230
|
}
|
|
203
231
|
/**
|
|
204
232
|
* 经纬度转像素坐标,在地图移动时回调
|
|
205
233
|
* */
|
|
206
|
-
requestCoordinateTransform(
|
|
207
|
-
let
|
|
208
|
-
const
|
|
234
|
+
requestCoordinateTransform(t, i) {
|
|
235
|
+
let e = 0;
|
|
236
|
+
const r = 1e3 / 30, d = P.watch(
|
|
209
237
|
() => this.view.center,
|
|
210
238
|
() => {
|
|
211
|
-
const
|
|
212
|
-
|
|
239
|
+
const c = this.transformPoints(t), p = Date.now();
|
|
240
|
+
p - e > r && (i(c), e = p);
|
|
213
241
|
}
|
|
214
242
|
);
|
|
215
|
-
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex,
|
|
243
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(t) };
|
|
216
244
|
}
|
|
217
|
-
transformPoints(
|
|
218
|
-
return
|
|
219
|
-
const
|
|
245
|
+
transformPoints(t) {
|
|
246
|
+
return t.map((i) => {
|
|
247
|
+
const e = new k({
|
|
220
248
|
x: i[0],
|
|
221
249
|
y: i[1]
|
|
222
|
-
}), a = this.view.toScreen(
|
|
250
|
+
}), a = this.view.toScreen(e);
|
|
223
251
|
return [a.x, a.y];
|
|
224
252
|
});
|
|
225
253
|
}
|
|
226
254
|
/**
|
|
227
255
|
* 停止坐标转换回调
|
|
228
256
|
* */
|
|
229
|
-
cancelCoordinateTransform(
|
|
230
|
-
const i = this.watchHandleMap.get(
|
|
231
|
-
i && (i.remove(), this.watchHandleMap.delete(
|
|
257
|
+
cancelCoordinateTransform(t) {
|
|
258
|
+
const i = this.watchHandleMap.get(t);
|
|
259
|
+
i && (i.remove(), this.watchHandleMap.delete(t));
|
|
232
260
|
}
|
|
233
261
|
/**
|
|
234
262
|
* 设置地图zoom范围
|
|
235
263
|
* */
|
|
236
|
-
setMapZoomRange(
|
|
237
|
-
const { min: i, max:
|
|
238
|
-
!i && !
|
|
264
|
+
setMapZoomRange(t) {
|
|
265
|
+
const { min: i, max: e } = t;
|
|
266
|
+
!i && !e || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = P.watch(
|
|
239
267
|
() => this.view.zoom,
|
|
240
268
|
(a) => {
|
|
241
|
-
i && a <= i && (this.view.zoom = i),
|
|
269
|
+
i && a <= i && (this.view.zoom = i), e && a >= e && (this.view.zoom = e);
|
|
242
270
|
}
|
|
243
271
|
));
|
|
244
272
|
}
|
|
245
273
|
}
|
|
246
274
|
export {
|
|
247
|
-
|
|
275
|
+
Q as default
|
|
248
276
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const GreenWavelineView: any;
|
|
2
|
+
export default GreenWavelineView;
|