gisviewer-vue3-arcgis 1.0.85
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/README.md +103 -0
- package/es/index.d.ts +8 -0
- package/es/index.mjs +16 -0
- package/es/src/components.d.ts +9 -0
- package/es/src/gis-map/gis-map.vue.d.ts +91 -0
- package/es/src/gis-map/gis-map.vue.mjs +124 -0
- package/es/src/gis-map/gis-map.vue2.mjs +4 -0
- package/es/src/gis-map/index.d.ts +81 -0
- package/es/src/gis-map/index.mjs +7 -0
- package/es/src/gis-map/stores/appData.d.ts +3 -0
- package/es/src/gis-map/stores/appData.mjs +9 -0
- package/es/src/gis-map/stores/index.d.ts +7 -0
- package/es/src/gis-map/stores/index.mjs +10 -0
- package/es/src/gis-map/style/index.css +13 -0
- package/es/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/es/src/gis-map/utils/FlyToPoints.mjs +67 -0
- package/es/src/gis-map/utils/GreenWaveline.mjs +193 -0
- package/es/src/gis-map/utils/Layers.d.ts +31 -0
- package/es/src/gis-map/utils/Layers.mjs +99 -0
- package/es/src/gis-map/utils/common-utils.d.ts +65 -0
- package/es/src/gis-map/utils/common-utils.mjs +159 -0
- package/es/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +50 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +209 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +316 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +75 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +286 -0
- package/es/src/gis-map/utils/index.d.ts +21 -0
- package/es/src/gis-map/utils/index.mjs +23 -0
- package/es/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/es/src/gis-map/utils/map-initializer.mjs +248 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +271 -0
- package/es/src/gis-map/utils/overlay.d.ts +83 -0
- package/es/src/gis-map/utils/overlay.mjs +149 -0
- package/es/src/gis-map/utils/queue-length.d.ts +14 -0
- package/es/src/gis-map/utils/queue-length.mjs +83 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.mjs +169 -0
- package/es/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/sketchView.d.ts +209 -0
- package/es/src/gis-map/utils/sketchView.mjs +516 -0
- package/es/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/es/src/gis-map/utils/syncMapView.mjs +64 -0
- package/es/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/es/src/gis-map/utils/traffic-flow.mjs +308 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +4 -0
- package/es/src/types/index.d.ts +142 -0
- package/es/src/types/index.mjs +5 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +1 -0
- package/lib/src/components.d.ts +9 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +91 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -0
- package/lib/src/gis-map/gis-map.vue2.js +1 -0
- package/lib/src/gis-map/index.d.ts +81 -0
- package/lib/src/gis-map/index.js +1 -0
- package/lib/src/gis-map/stores/appData.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.js +1 -0
- package/lib/src/gis-map/stores/index.d.ts +7 -0
- package/lib/src/gis-map/stores/index.js +1 -0
- package/lib/src/gis-map/style/index.css +13 -0
- package/lib/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/lib/src/gis-map/utils/FlyToPoints.js +1 -0
- package/lib/src/gis-map/utils/GreenWaveline.js +1 -0
- package/lib/src/gis-map/utils/Layers.d.ts +31 -0
- package/lib/src/gis-map/utils/Layers.js +1 -0
- package/lib/src/gis-map/utils/common-utils.d.ts +65 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -0
- package/lib/src/gis-map/utils/index.d.ts +21 -0
- package/lib/src/gis-map/utils/index.js +1 -0
- package/lib/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/lib/src/gis-map/utils/map-initializer.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -0
- package/lib/src/gis-map/utils/overlay.d.ts +83 -0
- package/lib/src/gis-map/utils/overlay.js +1 -0
- package/lib/src/gis-map/utils/queue-length.d.ts +14 -0
- package/lib/src/gis-map/utils/queue-length.js +1 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.js +43 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/sketchView.d.ts +209 -0
- package/lib/src/gis-map/utils/sketchView.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/lib/src/gis-map/utils/syncMapView.js +1 -0
- package/lib/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/lib/src/gis-map/utils/traffic-flow.js +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/src/types/index.d.ts +142 -0
- package/lib/src/types/index.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EVehiclePlateState, ITraceRendererInterface, IVehicleTrack } from '../../../types';
|
|
2
|
+
export default class TraceLayerRenderer implements ITraceRendererInterface {
|
|
3
|
+
private view;
|
|
4
|
+
private readonly vehicleLayer;
|
|
5
|
+
private mapConfig;
|
|
6
|
+
constructor(view: __esri.MapView);
|
|
7
|
+
private showVehiclePlate;
|
|
8
|
+
private historyPositionMap;
|
|
9
|
+
private vehicleObjectMap;
|
|
10
|
+
addVehicles(objects: IVehicleTrack[]): void;
|
|
11
|
+
updateVehicles(objects: IVehicleTrack[]): void;
|
|
12
|
+
deleteVehicles(idList: string[]): void;
|
|
13
|
+
clearVehicles(): void;
|
|
14
|
+
updatePanelContent(contentType: EVehiclePlateState): void;
|
|
15
|
+
private render;
|
|
16
|
+
private updatePosition;
|
|
17
|
+
/**
|
|
18
|
+
* 基于轨迹数据创建cim符号,显示车辆图标和车牌号码
|
|
19
|
+
* @param vehTrack
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
private createCIMSymbol;
|
|
23
|
+
/**
|
|
24
|
+
* 根据车身颜色属性返回对应的车辆图标
|
|
25
|
+
* @param carColor
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
private getCarPic;
|
|
29
|
+
/**
|
|
30
|
+
* 根据号牌颜色属性获取填充色和背景色
|
|
31
|
+
* @param plateColor
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
private getPlateFontColor;
|
|
35
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import g from "@arcgis/core/Graphic";
|
|
2
|
+
import y from "@arcgis/core/layers/GraphicsLayer";
|
|
3
|
+
import d from "../../stores/index.mjs";
|
|
4
|
+
class v {
|
|
5
|
+
constructor(i) {
|
|
6
|
+
this.showVehiclePlate = !1, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i;
|
|
7
|
+
const e = d.useAppDataStore;
|
|
8
|
+
this.mapConfig = JSON.parse(JSON.stringify(e.mapConfig)), this.vehicleLayer = new y({
|
|
9
|
+
id: "vehicleLayer"
|
|
10
|
+
}), this.view.map.add(this.vehicleLayer), requestAnimationFrame(() => this.render());
|
|
11
|
+
}
|
|
12
|
+
addVehicles(i) {
|
|
13
|
+
const e = i.map((t) => {
|
|
14
|
+
const { crossId: o, ptcId: c, localTimestamp: a } = t, r = Number(t.x), n = Number(t.y), s = Number(t.heading), h = `${o}-${c}`;
|
|
15
|
+
this.historyPositionMap.set(h, [
|
|
16
|
+
{ pos: [r, n, 0], heading: s, time: a }
|
|
17
|
+
]);
|
|
18
|
+
const l = new g({
|
|
19
|
+
geometry: {
|
|
20
|
+
type: "point",
|
|
21
|
+
x: r,
|
|
22
|
+
y: n
|
|
23
|
+
},
|
|
24
|
+
attributes: {
|
|
25
|
+
...t
|
|
26
|
+
},
|
|
27
|
+
symbol: this.createCIMSymbol(t)
|
|
28
|
+
});
|
|
29
|
+
return l.visible = !1, this.vehicleObjectMap.set(h, {
|
|
30
|
+
graphic: l,
|
|
31
|
+
data: t
|
|
32
|
+
}), l;
|
|
33
|
+
});
|
|
34
|
+
this.vehicleLayer.addMany(e);
|
|
35
|
+
}
|
|
36
|
+
updateVehicles(i) {
|
|
37
|
+
const e = [];
|
|
38
|
+
i.forEach((t) => {
|
|
39
|
+
const { crossId: o, ptcId: c, localTimestamp: a } = t, r = Number(t.x), n = Number(t.y);
|
|
40
|
+
let s = Number(t.heading);
|
|
41
|
+
const h = `${o}-${c}`, l = this.vehicleObjectMap.get(h);
|
|
42
|
+
if (l) {
|
|
43
|
+
l.data = t;
|
|
44
|
+
const p = this.historyPositionMap.get(
|
|
45
|
+
h
|
|
46
|
+
), m = p[p.length - 1];
|
|
47
|
+
Math.abs(s - m.heading) >= 180 && (s > m.heading ? m.heading += 360 : s += 360), p.push({ pos: [r, n, 0], heading: s, time: a });
|
|
48
|
+
} else
|
|
49
|
+
e.push(t);
|
|
50
|
+
}), this.addVehicles(e);
|
|
51
|
+
}
|
|
52
|
+
deleteVehicles(i) {
|
|
53
|
+
i.forEach((e) => {
|
|
54
|
+
const t = this.vehicleObjectMap.get(e);
|
|
55
|
+
t && (this.vehicleLayer.remove(t.graphic), this.vehicleObjectMap.delete(e), this.historyPositionMap.delete(e));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
clearVehicles() {
|
|
59
|
+
this.vehicleLayer.removeAll(), this.vehicleObjectMap.clear(), this.historyPositionMap.clear();
|
|
60
|
+
}
|
|
61
|
+
updatePanelContent(i) {
|
|
62
|
+
console.log(i);
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
this.vehicleObjectMap.forEach((i, e) => {
|
|
66
|
+
this.updatePosition(e);
|
|
67
|
+
}), requestAnimationFrame(() => this.render());
|
|
68
|
+
}
|
|
69
|
+
updatePosition(i) {
|
|
70
|
+
const e = this.historyPositionMap.get(i), t = this.vehicleObjectMap.get(i);
|
|
71
|
+
if (!e || !t || e.length < 2)
|
|
72
|
+
return;
|
|
73
|
+
const o = Date.now();
|
|
74
|
+
t.graphic.visible = !0, t.segmentStartTime || (t.segmentStartTime = o, t.segmentTotalTime = e[1].time - e[0].time);
|
|
75
|
+
const c = o - t.segmentStartTime, a = Math.min(
|
|
76
|
+
1,
|
|
77
|
+
c / t.segmentTotalTime
|
|
78
|
+
);
|
|
79
|
+
if (a === 1)
|
|
80
|
+
if (e.shift(), e.length === 1) {
|
|
81
|
+
t.segmentStartTime = void 0, t.segmentTotalTime = void 0;
|
|
82
|
+
return;
|
|
83
|
+
} else
|
|
84
|
+
t.segmentStartTime = o, t.segmentTotalTime = e[1].time - e[0].time, Math.abs(
|
|
85
|
+
e[1].heading - e[0].heading
|
|
86
|
+
) >= 180 && (e[1].heading > e[0].heading ? e[0].heading += 360 : e[1].heading += 360), t.graphic.geometry = {
|
|
87
|
+
type: "point",
|
|
88
|
+
x: e[0].pos[0],
|
|
89
|
+
y: e[0].pos[1]
|
|
90
|
+
};
|
|
91
|
+
else {
|
|
92
|
+
const r = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a, n = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * a, s = e[0].heading + (e[1].heading - e[0].heading) * a;
|
|
93
|
+
t.graphic.geometry = {
|
|
94
|
+
type: "point",
|
|
95
|
+
x: r,
|
|
96
|
+
y: n
|
|
97
|
+
}, t.data.heading = s, t.graphic.symbol = this.createCIMSymbol(t.data);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 基于轨迹数据创建cim符号,显示车辆图标和车牌号码
|
|
102
|
+
* @param vehTrack
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
createCIMSymbol(i) {
|
|
106
|
+
const e = this.getPlateFontColor(i.plateColor);
|
|
107
|
+
return {
|
|
108
|
+
type: "cim",
|
|
109
|
+
data: {
|
|
110
|
+
type: "CIMSymbolReference",
|
|
111
|
+
primitiveOverrides: [
|
|
112
|
+
{
|
|
113
|
+
// 将textGraphic的TextString替换为graphic.attributes.showName
|
|
114
|
+
type: "CIMPrimitiveOverride",
|
|
115
|
+
primitiveName: "textGraphic",
|
|
116
|
+
propertyName: "TextString",
|
|
117
|
+
valueExpressionInfo: {
|
|
118
|
+
type: "CIMExpressionInfo",
|
|
119
|
+
title: "Custom",
|
|
120
|
+
expression: "$feature.showName",
|
|
121
|
+
returnType: "Default"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
symbol: {
|
|
126
|
+
type: "CIMPointSymbol",
|
|
127
|
+
symbolLayers: [
|
|
128
|
+
// 车辆号牌
|
|
129
|
+
{
|
|
130
|
+
type: "CIMVectorMarker",
|
|
131
|
+
enable: this.showVehiclePlate,
|
|
132
|
+
size: 32,
|
|
133
|
+
colorLocked: !0,
|
|
134
|
+
anchorPointUnits: "Relative",
|
|
135
|
+
frame: { xmin: -8, ymin: -8, xmax: 8, ymax: 8 },
|
|
136
|
+
markerGraphics: [
|
|
137
|
+
{
|
|
138
|
+
type: "CIMMarkerGraphic",
|
|
139
|
+
primitiveName: "textGraphic",
|
|
140
|
+
geometry: { x: 0, y: 0 },
|
|
141
|
+
symbol: {
|
|
142
|
+
type: "CIMTextSymbol",
|
|
143
|
+
height: 4,
|
|
144
|
+
horizontalAlignment: "Center",
|
|
145
|
+
offsetX: 0,
|
|
146
|
+
offsetY: 8,
|
|
147
|
+
haloSize: 1,
|
|
148
|
+
haloSymbol: {
|
|
149
|
+
type: "CIMPolygonSymbol",
|
|
150
|
+
symbolLayers: [
|
|
151
|
+
{
|
|
152
|
+
type: "CIMSolidFill",
|
|
153
|
+
enable: !0,
|
|
154
|
+
color: e.backgroundColor
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
symbol: {
|
|
159
|
+
type: "CIMPolygonSymbol",
|
|
160
|
+
symbolLayers: [
|
|
161
|
+
{
|
|
162
|
+
type: "CIMSolidFill",
|
|
163
|
+
enable: !0,
|
|
164
|
+
color: e.fillColor
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
verticalAlignment: "Center"
|
|
169
|
+
},
|
|
170
|
+
textString: ""
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
scaleSymbolsProportionally: !0,
|
|
174
|
+
respectFrame: !0
|
|
175
|
+
},
|
|
176
|
+
// 车辆图标
|
|
177
|
+
{
|
|
178
|
+
type: "CIMPictureMarker",
|
|
179
|
+
enable: !0,
|
|
180
|
+
anchorPoint: {
|
|
181
|
+
x: 0,
|
|
182
|
+
y: 0
|
|
183
|
+
},
|
|
184
|
+
anchorPointUnits: "Relative",
|
|
185
|
+
size: 30,
|
|
186
|
+
rotation: i.heading,
|
|
187
|
+
rotateClockwise: !0,
|
|
188
|
+
textureFilter: "Picture",
|
|
189
|
+
url: `${this.mapConfig.assetsRoot}Images/car/${this.getCarPic(
|
|
190
|
+
i.vehicleColor
|
|
191
|
+
)}`
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* 根据车身颜色属性返回对应的车辆图标
|
|
200
|
+
* @param carColor
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
getCarPic(i) {
|
|
204
|
+
if (this.view.zoom <= 15)
|
|
205
|
+
return "point.png";
|
|
206
|
+
let e = "grey";
|
|
207
|
+
switch (typeof i == "string" && (i = i.toLowerCase()), i) {
|
|
208
|
+
case "a":
|
|
209
|
+
case 1:
|
|
210
|
+
e = "white";
|
|
211
|
+
break;
|
|
212
|
+
case "b":
|
|
213
|
+
case 2:
|
|
214
|
+
e = "grey";
|
|
215
|
+
break;
|
|
216
|
+
case "c":
|
|
217
|
+
case 3:
|
|
218
|
+
e = "yellow";
|
|
219
|
+
break;
|
|
220
|
+
case "d":
|
|
221
|
+
case 4:
|
|
222
|
+
e = "pink";
|
|
223
|
+
break;
|
|
224
|
+
case "e":
|
|
225
|
+
case 5:
|
|
226
|
+
e = "red";
|
|
227
|
+
break;
|
|
228
|
+
case "f":
|
|
229
|
+
case 10:
|
|
230
|
+
e = "purple";
|
|
231
|
+
break;
|
|
232
|
+
case "g":
|
|
233
|
+
case 6:
|
|
234
|
+
e = "green";
|
|
235
|
+
break;
|
|
236
|
+
case "h":
|
|
237
|
+
case 7:
|
|
238
|
+
e = "blue";
|
|
239
|
+
break;
|
|
240
|
+
case "i":
|
|
241
|
+
case 8:
|
|
242
|
+
e = "brown";
|
|
243
|
+
break;
|
|
244
|
+
case "j":
|
|
245
|
+
case 9:
|
|
246
|
+
e = "black";
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
return e + ".png";
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* 根据号牌颜色属性获取填充色和背景色
|
|
253
|
+
* @param plateColor
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
getPlateFontColor(i) {
|
|
257
|
+
let e = [255, 255, 255, 255], t = [169, 169, 169, 255];
|
|
258
|
+
switch (i) {
|
|
259
|
+
case 0:
|
|
260
|
+
e = [0, 0, 0, 255], t = [255, 255, 255, 255];
|
|
261
|
+
break;
|
|
262
|
+
case 1:
|
|
263
|
+
e = [0, 0, 0, 255], t = [244, 164, 96, 255];
|
|
264
|
+
break;
|
|
265
|
+
case 2:
|
|
266
|
+
e = [255, 255, 255, 255], t = [65, 105, 225, 255];
|
|
267
|
+
break;
|
|
268
|
+
case 3:
|
|
269
|
+
e = [255, 255, 255, 255], t = [0, 0, 0, 255];
|
|
270
|
+
break;
|
|
271
|
+
case 15:
|
|
272
|
+
e = [244, 164, 96, 255], t = [0, 250, 154, 255];
|
|
273
|
+
break;
|
|
274
|
+
case 16:
|
|
275
|
+
e = [0, 0, 0, 255], t = [0, 250, 154, 255];
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
fillColor: e,
|
|
280
|
+
backgroundColor: t
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
v as default
|
|
286
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import FlyToPoints from './FlyToPoints';
|
|
2
|
+
import MapInitializer from './map-initializer';
|
|
3
|
+
import Overlay from './overlay';
|
|
4
|
+
import RoadConfigTool from './road-config-tool';
|
|
5
|
+
import SketchView from './sketchView';
|
|
6
|
+
import sketchViewTool from './sketchViewTool';
|
|
7
|
+
import GreenWaveLine from './GreenWaveline';
|
|
8
|
+
import BaseLayers from './Layers';
|
|
9
|
+
import SyncMapView from './syncMapView';
|
|
10
|
+
declare const MapUtils: {
|
|
11
|
+
MapInitializer: typeof MapInitializer;
|
|
12
|
+
RoadConfigTool: typeof RoadConfigTool;
|
|
13
|
+
FlyToPoints: typeof FlyToPoints;
|
|
14
|
+
Overlay: typeof Overlay;
|
|
15
|
+
SketchView: typeof SketchView;
|
|
16
|
+
sketchViewTool: typeof sketchViewTool;
|
|
17
|
+
SyncMapView: typeof SyncMapView;
|
|
18
|
+
GreenWaveLine: typeof GreenWaveLine;
|
|
19
|
+
BaseLayers: typeof BaseLayers;
|
|
20
|
+
};
|
|
21
|
+
export default MapUtils;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import o from "./FlyToPoints.mjs";
|
|
2
|
+
import r from "./map-initializer.mjs";
|
|
3
|
+
import i from "./overlay.mjs";
|
|
4
|
+
import m from "./road-config-tool/index.mjs";
|
|
5
|
+
import t from "./sketchView.mjs";
|
|
6
|
+
import e from "./sketchViewTool.mjs";
|
|
7
|
+
import p from "./GreenWaveline.mjs";
|
|
8
|
+
import a from "./Layers.mjs";
|
|
9
|
+
import f from "./syncMapView.mjs";
|
|
10
|
+
const d = {
|
|
11
|
+
MapInitializer: r,
|
|
12
|
+
RoadConfigTool: m,
|
|
13
|
+
FlyToPoints: o,
|
|
14
|
+
Overlay: i,
|
|
15
|
+
SketchView: t,
|
|
16
|
+
sketchViewTool: e,
|
|
17
|
+
SyncMapView: f,
|
|
18
|
+
GreenWaveLine: p,
|
|
19
|
+
BaseLayers: a
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
d as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import MapView from '@arcgis/core/views/MapView';
|
|
2
|
+
import SceneView from '@arcgis/core/views/SceneView';
|
|
3
|
+
import { ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
4
|
+
export default class MapInitializer {
|
|
5
|
+
private view;
|
|
6
|
+
private mapConfig;
|
|
7
|
+
/**
|
|
8
|
+
* 初始化地图
|
|
9
|
+
* @param params 容器
|
|
10
|
+
* @returns view
|
|
11
|
+
*/
|
|
12
|
+
initialize(params: {
|
|
13
|
+
container: HTMLElement;
|
|
14
|
+
markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
|
|
15
|
+
mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
|
|
16
|
+
}): Promise<MapView | SceneView>;
|
|
17
|
+
/**
|
|
18
|
+
* 设置地图中心点
|
|
19
|
+
* @param params
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
23
|
+
/**
|
|
24
|
+
* 在一定的高度,以一定的角度去观察某个坐标
|
|
25
|
+
* */
|
|
26
|
+
lookAt(params: ILookAtParams): Promise<void>;
|
|
27
|
+
setMapCamera(params: ISetMapCameraParams): Promise<IResult>;
|
|
28
|
+
private watchHandleMap;
|
|
29
|
+
private handleIndex;
|
|
30
|
+
/**
|
|
31
|
+
* 经纬度转像素坐标,在地图移动时回调
|
|
32
|
+
* */
|
|
33
|
+
requestCoordinateTransform(points: number[][], callback: (points: number[][]) => void): {
|
|
34
|
+
handle: number;
|
|
35
|
+
points: number[][];
|
|
36
|
+
};
|
|
37
|
+
private transformPoints;
|
|
38
|
+
/**
|
|
39
|
+
* 停止坐标转换回调
|
|
40
|
+
* */
|
|
41
|
+
cancelCoordinateTransform(handleIndex: number): void;
|
|
42
|
+
private zoomWatchHandle;
|
|
43
|
+
/**
|
|
44
|
+
* 设置地图zoom范围
|
|
45
|
+
* */
|
|
46
|
+
setMapZoomRange(zoomRange: {
|
|
47
|
+
min?: number;
|
|
48
|
+
max?: number;
|
|
49
|
+
}): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import b from "@arcgis/core/Basemap";
|
|
2
|
+
import M from "@arcgis/core/Map";
|
|
3
|
+
import d from "@arcgis/core/config";
|
|
4
|
+
import * as v from "@arcgis/core/core/reactiveUtils";
|
|
5
|
+
import { Point as P } from "@arcgis/core/geometry";
|
|
6
|
+
import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
|
|
7
|
+
import T from "@arcgis/core/layers/GeoJSONLayer";
|
|
8
|
+
import z from "@arcgis/core/layers/TileLayer";
|
|
9
|
+
import k from "@arcgis/core/layers/WebTileLayer";
|
|
10
|
+
import x from "@arcgis/core/views/MapView";
|
|
11
|
+
import W from "@arcgis/core/views/SceneView";
|
|
12
|
+
import S from "@turf/destination";
|
|
13
|
+
import * as L from "@turf/helpers";
|
|
14
|
+
import I from "../stores/index.mjs";
|
|
15
|
+
function u(m, e) {
|
|
16
|
+
return m.startsWith("http://") || m.startsWith("https://") ? m : e + m;
|
|
17
|
+
}
|
|
18
|
+
class j {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 初始化地图
|
|
24
|
+
* @param params 容器
|
|
25
|
+
* @returns view
|
|
26
|
+
*/
|
|
27
|
+
async initialize(e) {
|
|
28
|
+
const i = I.useAppDataStore, t = JSON.parse(JSON.stringify(i.mapConfig));
|
|
29
|
+
this.mapConfig = t;
|
|
30
|
+
const { container: a, markerClickCallback: c, mapClickCallback: w } = e;
|
|
31
|
+
d.assetsPath = `${t.assetsRoot}/ArcgisAssets`, d.fontsUrl = `${t.assetsRoot}/fonts`, d.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
|
|
32
|
+
const n = new M();
|
|
33
|
+
if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new x({
|
|
34
|
+
map: n,
|
|
35
|
+
container: a,
|
|
36
|
+
...t.mapOptions
|
|
37
|
+
}) : this.view = new W({
|
|
38
|
+
map: n,
|
|
39
|
+
container: a,
|
|
40
|
+
...t == null ? void 0 : t.mapOptions
|
|
41
|
+
}), this.view.on("click", async (s) => {
|
|
42
|
+
var g, y;
|
|
43
|
+
if (w) {
|
|
44
|
+
let o = s.mapPoint;
|
|
45
|
+
o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
|
|
46
|
+
o
|
|
47
|
+
)), w(
|
|
48
|
+
[o.x, o.y],
|
|
49
|
+
[s.screenPoint.x, s.screenPoint.y],
|
|
50
|
+
s
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (this.view.type === "3d") {
|
|
54
|
+
const o = this.view.camera;
|
|
55
|
+
if (this.view.spatialReference.isWebMercator) {
|
|
56
|
+
const l = f.webMercatorToGeographic(
|
|
57
|
+
o.position
|
|
58
|
+
), p = {
|
|
59
|
+
heading: o.heading,
|
|
60
|
+
tilt: o.tilt,
|
|
61
|
+
position: l.toJSON()
|
|
62
|
+
};
|
|
63
|
+
console.log(p), (g = navigator.clipboard) == null || g.writeText(JSON.stringify(p));
|
|
64
|
+
} else
|
|
65
|
+
console.log(o.toJSON());
|
|
66
|
+
} else {
|
|
67
|
+
let o = this.view.center;
|
|
68
|
+
this.view.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
|
|
69
|
+
o
|
|
70
|
+
)), console.log({
|
|
71
|
+
center: o.toJSON(),
|
|
72
|
+
zoom: this.view.zoom
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const h = (y = (await this.view.hitTest(s)).results) == null ? void 0 : y.filter(
|
|
76
|
+
(o) => o.type === "graphic"
|
|
77
|
+
);
|
|
78
|
+
h.length > 0 && h.forEach((o) => {
|
|
79
|
+
var p;
|
|
80
|
+
const l = o.graphic;
|
|
81
|
+
(p = l.attributes) != null && p.type && c && c(
|
|
82
|
+
l.attributes.type,
|
|
83
|
+
l.attributes.id,
|
|
84
|
+
l.attributes,
|
|
85
|
+
s
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
}), t != null && t.baseLayers ? t.baseLayers.forEach((s) => {
|
|
89
|
+
switch (s.type.toLowerCase()) {
|
|
90
|
+
case "webTile".toLowerCase(): {
|
|
91
|
+
const r = u(s.url, t.assetsRoot), h = new k({
|
|
92
|
+
urlTemplate: r,
|
|
93
|
+
...s.options
|
|
94
|
+
});
|
|
95
|
+
n.add(h);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "tile": {
|
|
99
|
+
const r = u(s.url, t.assetsRoot), h = new z({
|
|
100
|
+
url: r,
|
|
101
|
+
...s.options
|
|
102
|
+
});
|
|
103
|
+
n.add(h);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "arcgis": {
|
|
107
|
+
const r = new b(s.options);
|
|
108
|
+
n.basemap = r;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}) : n.basemap = new b({
|
|
113
|
+
style: {
|
|
114
|
+
id: "arcgis/dark-gray",
|
|
115
|
+
language: "zh-CN"
|
|
116
|
+
}
|
|
117
|
+
}), t != null && t.hdLayers) {
|
|
118
|
+
const s = t.hdLayers.map(
|
|
119
|
+
(r) => (
|
|
120
|
+
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
121
|
+
new T({
|
|
122
|
+
url: u(r.url, t.assetsRoot),
|
|
123
|
+
...r.options,
|
|
124
|
+
title: r.options.id
|
|
125
|
+
})
|
|
126
|
+
)
|
|
127
|
+
);
|
|
128
|
+
n.addMany(s);
|
|
129
|
+
}
|
|
130
|
+
return this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when(), this.view;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 设置地图中心点
|
|
134
|
+
* @param params
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
async setMapCenter(e) {
|
|
138
|
+
return this.view ? (e.center ? await this.view.goTo(
|
|
139
|
+
{
|
|
140
|
+
target: e.center,
|
|
141
|
+
zoom: e.zoom
|
|
142
|
+
},
|
|
143
|
+
{ duration: (e.duration || 0) * 1e3 }
|
|
144
|
+
) : e.camera && await this.view.goTo(e.camera, {
|
|
145
|
+
duration: (e.duration || 0) * 1e3
|
|
146
|
+
}), { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 在一定的高度,以一定的角度去观察某个坐标
|
|
150
|
+
* */
|
|
151
|
+
async lookAt(e) {
|
|
152
|
+
if (this.view.type === "2d")
|
|
153
|
+
return;
|
|
154
|
+
const i = e.tilt || 0, t = e.heading || 0;
|
|
155
|
+
if (i === 0)
|
|
156
|
+
await this.view.goTo(
|
|
157
|
+
{
|
|
158
|
+
position: {
|
|
159
|
+
x: e.center[0],
|
|
160
|
+
y: e.center[1],
|
|
161
|
+
z: e.height
|
|
162
|
+
},
|
|
163
|
+
heading: t,
|
|
164
|
+
tilt: 0
|
|
165
|
+
},
|
|
166
|
+
{ duration: (e.duration || 2) * 1e3 }
|
|
167
|
+
);
|
|
168
|
+
else {
|
|
169
|
+
const a = Math.tan(i * Math.PI / 180) * e.height, c = S(
|
|
170
|
+
L.point(e.center),
|
|
171
|
+
a,
|
|
172
|
+
180,
|
|
173
|
+
{
|
|
174
|
+
units: "meters"
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
await this.view.goTo(
|
|
178
|
+
{
|
|
179
|
+
position: {
|
|
180
|
+
x: c.geometry.coordinates[0],
|
|
181
|
+
y: c.geometry.coordinates[1],
|
|
182
|
+
z: e.height
|
|
183
|
+
},
|
|
184
|
+
heading: t,
|
|
185
|
+
tilt: i
|
|
186
|
+
},
|
|
187
|
+
{ duration: (e.duration || 2) * 1e3 }
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async setMapCamera(e) {
|
|
192
|
+
if (!this.view)
|
|
193
|
+
return { status: -1, message: "未初始化" };
|
|
194
|
+
const { crossId: i, duration: t = 0 } = e, { camera: a } = this.mapConfig;
|
|
195
|
+
return a ? a[i] ? (await this.view.goTo(
|
|
196
|
+
{
|
|
197
|
+
target: a.center,
|
|
198
|
+
zoom: e.zoom || 15
|
|
199
|
+
},
|
|
200
|
+
{ duration: t * 1e3 }
|
|
201
|
+
), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" } : { status: -1, message: "未配置camera" };
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 经纬度转像素坐标,在地图移动时回调
|
|
205
|
+
* */
|
|
206
|
+
requestCoordinateTransform(e, i) {
|
|
207
|
+
let t = 0;
|
|
208
|
+
const c = 1e3 / 30, w = v.watch(
|
|
209
|
+
() => this.view.center,
|
|
210
|
+
() => {
|
|
211
|
+
const n = this.transformPoints(e), s = Date.now();
|
|
212
|
+
s - t > c && (i(n), t = s);
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, w), { handle: this.handleIndex, points: this.transformPoints(e) };
|
|
216
|
+
}
|
|
217
|
+
transformPoints(e) {
|
|
218
|
+
return e.map((i) => {
|
|
219
|
+
const t = new P({
|
|
220
|
+
x: i[0],
|
|
221
|
+
y: i[1]
|
|
222
|
+
}), a = this.view.toScreen(t);
|
|
223
|
+
return [a.x, a.y];
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* 停止坐标转换回调
|
|
228
|
+
* */
|
|
229
|
+
cancelCoordinateTransform(e) {
|
|
230
|
+
const i = this.watchHandleMap.get(e);
|
|
231
|
+
i && (i.remove(), this.watchHandleMap.delete(e));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 设置地图zoom范围
|
|
235
|
+
* */
|
|
236
|
+
setMapZoomRange(e) {
|
|
237
|
+
const { min: i, max: t } = e;
|
|
238
|
+
!i && !t || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = v.watch(
|
|
239
|
+
() => this.view.zoom,
|
|
240
|
+
(a) => {
|
|
241
|
+
i && a <= i && (this.view.zoom = i), t && a >= t && (this.view.zoom = t);
|
|
242
|
+
}
|
|
243
|
+
));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
j as default
|
|
248
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import View from '@arcgis/core/views/View';
|
|
2
|
+
export default class OpenDriveRenderer {
|
|
3
|
+
private readonly view;
|
|
4
|
+
private laneLayer;
|
|
5
|
+
constructor(view: View);
|
|
6
|
+
showOpenDrive(server: string, projectName: string): Promise<void>;
|
|
7
|
+
private showRoad;
|
|
8
|
+
hideOpenDrive(): Promise<void>;
|
|
9
|
+
}
|