@aibee/crc-bmap 0.8.45 → 0.8.46
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/lib/bmap.cjs.min.js +408 -401
- package/lib/bmap.esm.js +7310 -1296
- package/lib/bmap.esm.min.js +408 -401
- package/lib/bmap.min.js +408 -401
- package/lib/src/bmap.js +60 -54
- package/lib/src/context/OrbitControls.js +4 -1
- package/lib/src/context/context.js +54 -37
- package/lib/src/context/control.js +85 -85
- package/lib/src/elements/base-svg.js +5 -4
- package/lib/src/elements/floor.js +8 -0
- package/lib/src/elements/glb-model.js +14 -18
- package/lib/src/elements/graphic.js +18 -8
- package/lib/src/elements/ground-texture.js +41 -44
- package/lib/src/elements/heatmap.js +2 -1
- package/lib/src/elements/lane.js +5 -1
- package/lib/src/elements/merge-graphic.js +3 -28
- package/lib/src/elements/model.js +5 -9
- package/lib/src/elements/overlay.js +9 -7
- package/lib/src/elements/poi.js +55 -49
- package/lib/src/elements/poi2.js +52 -53
- package/lib/src/elements/shadow.js +3 -1
- package/lib/src/elements/svg-line.js +2 -0
- package/lib/src/elements/svg-polygon.js +1 -0
- package/lib/src/elements/text-texture.js +32 -36
- package/lib/src/elements/wall.js +3 -41
- package/lib/src/external/meshLine.js +17 -0
- package/lib/src/factory/img-texture.js +1 -0
- package/lib/src/factory/material.js +21 -51
- package/lib/src/factory/model.js +31 -33
- package/lib/src/factory/text-texture.js +17 -0
- package/lib/src/factory/unique-key.js +8 -0
- package/lib/src/layer/graphic-layer.js +1 -0
- package/lib/src/layer/parking-layer.d.ts +6 -0
- package/lib/src/layer/parking-layer.js +8 -0
- package/lib/src/layer/poi-layer.js +4 -1
- package/lib/src/layer/poi-layer2.js +2 -0
- package/lib/src/loader/AibeeLoader/index.js +230 -276
- package/lib/src/loader/AibeeLoader/layer.js +8 -6
- package/lib/src/loader/CrLoader/api/floor.js +45 -73
- package/lib/src/loader/CrLoader/index.js +88 -106
- package/lib/src/operations/hover/hover-helper.js +12 -2
- package/lib/src/operations/selection/selection.js +11 -1
- package/lib/src/plugins/car-inertial-position/car-inertial-position.js +9 -3
- package/lib/src/plugins/car-inertial-position/compass.js +20 -25
- package/lib/src/plugins/car-inertial-position/utils.js +3 -0
- package/lib/src/plugins/cr-nav-path/cr-nav-path.js +47 -55
- package/lib/src/plugins/cr-nav-path/cr-path.worker.js +4 -2
- package/lib/src/plugins/equipment/equipment.js +20 -22
- package/lib/src/plugins/mul-floor-navigation/mul-floor-navigation.js +63 -61
- package/lib/src/plugins/mul-floor-navigation/path.js +34 -30
- package/lib/src/plugins/mul-floor-navigation/start-model.js +2 -1
- package/lib/src/plugins/mul-floor-select/mul-floor-select.js +2 -1
- package/lib/src/plugins/mul-floors/mul-floors.js +1 -0
- package/lib/src/plugins/nav-path/nav-path.js +51 -59
- package/lib/src/plugins/nav-path/path.worker.js +4 -2
- package/lib/src/plugins/navigation/navigation.js +206 -214
- package/lib/src/plugins/navigation/path.js +34 -30
- package/lib/src/plugins/navigation/position-navigation.js +53 -53
- package/lib/src/plugins/navigation/start-rotate-helper-poi.js +18 -6
- package/lib/src/plugins/pdr-position/imu-position.js +13 -9
- package/lib/src/plugins/pdr-position/particle.js +4 -2
- package/lib/src/plugins/pdr-position/pdr.js +5 -4
- package/lib/src/plugins/pdr-position/position.js +5 -2
- package/lib/src/plugins/pdr-position/sensor.js +20 -25
- package/lib/src/plugins/select/select.js +11 -1
- package/lib/src/utils/camera-bound.js +3 -1
- package/lib/src/utils/color.js +8 -4
- package/lib/src/utils/coordinate.js +1 -0
- package/lib/src/utils/create.js +4 -2
- package/lib/src/utils/events.js +15 -4
- package/lib/src/utils/index-db.js +18 -11
- package/lib/src/utils/init-helper.js +7 -2
- package/lib/src/utils/obj-utils.js +3 -2
- package/lib/src/utils/os.js +1 -0
- package/lib/src/utils/path.js +15 -4
- package/lib/src/utils/promise.js +3 -1
- package/lib/src/utils/proxy.js +2 -1
- package/lib/src/utils/road.js +20 -14
- package/lib/src/utils/road2.js +60 -39
- package/lib/src/utils/rules.js +1 -0
- package/lib/src/utils/string.js +3 -1
- package/lib/src/utils/svg.js +12 -11
- package/lib/src/utils/taskQueue.js +29 -29
- package/lib/src/utils/timer.js +8 -0
- package/lib/src/utils/translate.js +3 -1
- package/lib/src/utils/tween.js +8 -0
- package/lib/src/utils/webworker.js +10 -9
- package/package.json +2 -1
package/lib/src/utils/path.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
2
|
+
import "core-js/modules/es.array.push.js";
|
|
1
3
|
import { Vector2 } from "three";
|
|
2
4
|
// @ts-ignore
|
|
3
5
|
import smooth from "chaikin-smooth";
|
|
@@ -9,7 +11,9 @@ export function getAngle(vec0, vec1) {
|
|
|
9
11
|
}
|
|
10
12
|
function averageStepLength(path) {
|
|
11
13
|
let sum = 0;
|
|
12
|
-
path.reduce((
|
|
14
|
+
path.reduce((param, param1)=>{
|
|
15
|
+
let [x0, y0] = param;
|
|
16
|
+
let [x1, y1] = param1;
|
|
13
17
|
sum += Math.sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2);
|
|
14
18
|
return [
|
|
15
19
|
x1,
|
|
@@ -18,7 +22,8 @@ function averageStepLength(path) {
|
|
|
18
22
|
});
|
|
19
23
|
return sum / path.length;
|
|
20
24
|
}
|
|
21
|
-
export function smoothPath(path, threshold
|
|
25
|
+
export function smoothPath(path, threshold) {
|
|
26
|
+
if (threshold === void 0) threshold = 0.25;
|
|
22
27
|
if (averageStepLength(path) < threshold) return path;
|
|
23
28
|
const result = smooth(path);
|
|
24
29
|
return smoothPath(result, threshold);
|
|
@@ -31,7 +36,12 @@ export function smoothPath(path, threshold = 0.25) {
|
|
|
31
36
|
* @param simplifyDistanceThreshold 简化时路径最短保留的距离, 默认为5
|
|
32
37
|
* @param maximumTurningDegree 简化时三点夹角认定为转弯的最大角度,默认为150
|
|
33
38
|
* @param smoothingDistance 平滑时使用的转角最大距离
|
|
34
|
-
*/ export function simplifyPath(path, ignoreFirst
|
|
39
|
+
*/ export function simplifyPath(path, ignoreFirst, smoothingOptimization, simplifyDistanceThreshold, maximumTurningDegree, smoothingDistance) {
|
|
40
|
+
if (ignoreFirst === void 0) ignoreFirst = false;
|
|
41
|
+
if (smoothingOptimization === void 0) smoothingOptimization = true;
|
|
42
|
+
if (simplifyDistanceThreshold === void 0) simplifyDistanceThreshold = 5;
|
|
43
|
+
if (maximumTurningDegree === void 0) maximumTurningDegree = 150;
|
|
44
|
+
if (smoothingDistance === void 0) smoothingDistance = 3;
|
|
35
45
|
const joints = [];
|
|
36
46
|
let firstIgnored = !ignoreFirst;
|
|
37
47
|
joints.push(path[0]);
|
|
@@ -92,7 +102,8 @@ export function smoothPath(path, threshold = 0.25) {
|
|
|
92
102
|
}
|
|
93
103
|
const checkedPath = [];
|
|
94
104
|
let lastCheckedPoint;
|
|
95
|
-
points.forEach((
|
|
105
|
+
points.forEach((param)=>{
|
|
106
|
+
let [x, y] = param;
|
|
96
107
|
if (!lastCheckedPoint) {
|
|
97
108
|
lastCheckedPoint = [
|
|
98
109
|
x,
|
package/lib/src/utils/promise.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* @param promise
|
|
4
4
|
* @param timeout
|
|
5
5
|
* @returns
|
|
6
|
-
*/
|
|
6
|
+
*/ import "core-js/modules/web.dom-collections.iterator.js";
|
|
7
|
+
import "core-js/modules/es.error.cause.js";
|
|
8
|
+
export function timeoutPromise(promise, timeout) {
|
|
7
9
|
return Promise.race([
|
|
8
10
|
promise,
|
|
9
11
|
new Promise((resolve, reject)=>{
|
package/lib/src/utils/proxy.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/es.reflect.to-string-tag.js";
|
|
1
2
|
export function proxyOptions(target, master) {
|
|
2
3
|
return new Proxy(target, {
|
|
3
4
|
get: (target, p, receiver)=>{
|
|
@@ -8,7 +9,7 @@ export function proxyOptions(target, master) {
|
|
|
8
9
|
const res = Reflect.set(target, p, newValue, receiver);
|
|
9
10
|
if (oldValue !== newValue) {
|
|
10
11
|
master.dispatchEvent({
|
|
11
|
-
type:
|
|
12
|
+
type: "change-" + p,
|
|
12
13
|
value: newValue
|
|
13
14
|
});
|
|
14
15
|
}
|
package/lib/src/utils/road.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
// 扶梯优先路网
|
|
5
5
|
// 直梯优先路网
|
|
6
6
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
7
|
+
import "core-js/modules/es.array.push.js";
|
|
8
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
9
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
7
10
|
import Graph from "node-dijkstra";
|
|
8
11
|
import { getLength, getPathLength } from "./coordinate";
|
|
9
12
|
const SPLIT_FLG = "___";
|
|
@@ -14,9 +17,9 @@ export class RoadNetwork {
|
|
|
14
17
|
if (roadInfo.length) {
|
|
15
18
|
roadInfo.forEach((floorRoadInfo)=>{
|
|
16
19
|
floorRoadInfo.points.forEach((point)=>{
|
|
17
|
-
const pointKey =
|
|
20
|
+
const pointKey = "" + floorRoadInfo.floor + SPLIT_FLG + point.id;
|
|
18
21
|
this.pointMap.set(pointKey, point);
|
|
19
|
-
this.nodeMap.set(
|
|
22
|
+
this.nodeMap.set("" + point.floor + SPLIT_FLG + point.nodeId, pointKey);
|
|
20
23
|
// 直梯
|
|
21
24
|
if (point.type === "straightLadder") {
|
|
22
25
|
const arr = this.straightLadderMap.get(point.name) || [];
|
|
@@ -55,8 +58,8 @@ export class RoadNetwork {
|
|
|
55
58
|
});
|
|
56
59
|
floorRoadInfo.lines.filter((item)=>item.direction !== "no").forEach((item)=>{
|
|
57
60
|
var _this_pointMap_get, _this_pointMap_get1;
|
|
58
|
-
const fromKey =
|
|
59
|
-
const toKey =
|
|
61
|
+
const fromKey = "" + floorRoadInfo.floor + SPLIT_FLG + item.from;
|
|
62
|
+
const toKey = "" + floorRoadInfo.floor + SPLIT_FLG + item.to;
|
|
60
63
|
const fromCds = (_this_pointMap_get = this.pointMap.get(fromKey)) == null ? void 0 : _this_pointMap_get.cds;
|
|
61
64
|
const toCds = (_this_pointMap_get1 = this.pointMap.get(toKey)) == null ? void 0 : _this_pointMap_get1.cds;
|
|
62
65
|
if ((fromCds == null ? void 0 : fromCds.length) && (toCds == null ? void 0 : toCds.length)) {
|
|
@@ -73,7 +76,8 @@ export class RoadNetwork {
|
|
|
73
76
|
this.initStraightLadderRoute();
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
addLineItem(start, end, distance, lineMap
|
|
79
|
+
addLineItem(start, end, distance, lineMap) {
|
|
80
|
+
if (lineMap === void 0) lineMap = this.lineMap;
|
|
77
81
|
const map = lineMap.get(start) || new Map();
|
|
78
82
|
map.set(end, distance);
|
|
79
83
|
lineMap.set(start, map);
|
|
@@ -89,16 +93,17 @@ export class RoadNetwork {
|
|
|
89
93
|
[
|
|
90
94
|
...this.straightLadderMap,
|
|
91
95
|
...this.staircaseMap
|
|
92
|
-
].forEach((
|
|
96
|
+
].forEach((param)=>{
|
|
97
|
+
let [_, value] = param;
|
|
93
98
|
if (value.length < 2) {
|
|
94
99
|
return;
|
|
95
100
|
}
|
|
96
101
|
for(let i = 0; i < value.length; i++){
|
|
97
|
-
const fromKey =
|
|
102
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
98
103
|
for(let j = 0; j < value.length; j++){
|
|
99
104
|
if (i !== j) {
|
|
100
105
|
var _this_pointMap_get, _this_pointMap_get1;
|
|
101
|
-
const toKey =
|
|
106
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
102
107
|
const fromCds = (_this_pointMap_get = this.pointMap.get(fromKey)) == null ? void 0 : _this_pointMap_get.cds;
|
|
103
108
|
const toCds = (_this_pointMap_get1 = this.pointMap.get(toKey)) == null ? void 0 : _this_pointMap_get1.cds;
|
|
104
109
|
if ((fromCds == null ? void 0 : fromCds.length) && (toCds == null ? void 0 : toCds.length)) {
|
|
@@ -120,8 +125,8 @@ export class RoadNetwork {
|
|
|
120
125
|
this.escalatorMap.forEach((value, _)=>{
|
|
121
126
|
if (value.start && value.end) {
|
|
122
127
|
var _this_pointMap_get, _this_pointMap_get1;
|
|
123
|
-
const fromKey =
|
|
124
|
-
const toKey =
|
|
128
|
+
const fromKey = "" + value.start.floor + SPLIT_FLG + value.start.id;
|
|
129
|
+
const toKey = "" + value.end.floor + SPLIT_FLG + value.end.id;
|
|
125
130
|
const fromCds = (_this_pointMap_get = this.pointMap.get(fromKey)) == null ? void 0 : _this_pointMap_get.cds;
|
|
126
131
|
const toCds = (_this_pointMap_get1 = this.pointMap.get(toKey)) == null ? void 0 : _this_pointMap_get1.cds;
|
|
127
132
|
if ((fromCds == null ? void 0 : fromCds.length) && (toCds == null ? void 0 : toCds.length)) {
|
|
@@ -179,7 +184,7 @@ export class RoadNetwork {
|
|
|
179
184
|
transformStart(start) {
|
|
180
185
|
var _start_coord;
|
|
181
186
|
if (start.nodeId) {
|
|
182
|
-
const pointKey = this.nodeMap.get(
|
|
187
|
+
const pointKey = this.nodeMap.get("" + start.floor + SPLIT_FLG + start.nodeId);
|
|
183
188
|
if (pointKey) {
|
|
184
189
|
const [floor, id] = pointKey.split(SPLIT_FLG);
|
|
185
190
|
return {
|
|
@@ -236,7 +241,8 @@ export class RoadNetwork {
|
|
|
236
241
|
* @param end 终点
|
|
237
242
|
* @param type '' 最短路径 escalator 扶梯优先 straightLadder 直梯优先
|
|
238
243
|
* @returns
|
|
239
|
-
*/ getPath(start, end, type
|
|
244
|
+
*/ getPath(start, end, type) {
|
|
245
|
+
if (type === void 0) type = "";
|
|
240
246
|
if (!this.checkStart(start)) {
|
|
241
247
|
return "start-error";
|
|
242
248
|
}
|
|
@@ -298,8 +304,8 @@ export class RoadNetwork {
|
|
|
298
304
|
}
|
|
299
305
|
// 从路网中规划路线
|
|
300
306
|
getRoutePath(start, end, route) {
|
|
301
|
-
const startPointId =
|
|
302
|
-
const endPointId =
|
|
307
|
+
const startPointId = "" + start.floor + SPLIT_FLG + start.id;
|
|
308
|
+
const endPointId = "" + end.floor + SPLIT_FLG + end.id;
|
|
303
309
|
const paths = route.path(startPointId, endPointId);
|
|
304
310
|
if (!paths) {
|
|
305
311
|
return null;
|
package/lib/src/utils/road2.js
CHANGED
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
// 直梯优先路网
|
|
6
6
|
// 正向车辆路网
|
|
7
7
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
8
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
9
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
10
|
+
import "core-js/modules/es.array.push.js";
|
|
11
|
+
import "core-js/modules/es.set.difference.v2.js";
|
|
12
|
+
import "core-js/modules/es.set.intersection.v2.js";
|
|
13
|
+
import "core-js/modules/es.set.is-disjoint-from.v2.js";
|
|
14
|
+
import "core-js/modules/es.set.is-subset-of.v2.js";
|
|
15
|
+
import "core-js/modules/es.set.is-superset-of.v2.js";
|
|
16
|
+
import "core-js/modules/es.set.symmetric-difference.v2.js";
|
|
17
|
+
import "core-js/modules/es.set.union.v2.js";
|
|
18
|
+
import "core-js/modules/es.array.flat.js";
|
|
19
|
+
import "core-js/modules/es.array.unscopables.flat.js";
|
|
8
20
|
import Graph from "node-dijkstra";
|
|
9
21
|
import { getLength, getPathLength } from "./coordinate";
|
|
10
22
|
import { cloneDeep, isNil } from "lodash";
|
|
@@ -63,8 +75,8 @@ export class RoadNetwork2 {
|
|
|
63
75
|
}).forEach((point)=>{
|
|
64
76
|
// 后台修改了floor之后,路网数据里不会同步修改,这里做一个兼容
|
|
65
77
|
point.floor = floorRoadInfo.floor;
|
|
66
|
-
const pointKey =
|
|
67
|
-
this.nodeMap.set(
|
|
78
|
+
const pointKey = "" + floorRoadInfo.floor + SPLIT_FLG + point.id;
|
|
79
|
+
this.nodeMap.set("" + floorRoadInfo.floor + SPLIT_FLG + point.nodeId, "" + floorRoadInfo.floor + SPLIT_FLG + (point.relatedId || point.id));
|
|
68
80
|
this.pointMap.set(pointKey, point);
|
|
69
81
|
if (this.isFacilityByType(point.type)) {
|
|
70
82
|
const facility = this.facilities.find((item)=>item.id === +point.targetId);
|
|
@@ -166,12 +178,12 @@ export class RoadNetwork2 {
|
|
|
166
178
|
}
|
|
167
179
|
}
|
|
168
180
|
if (point.type === "parkingSpace") {
|
|
169
|
-
this.parkingMap.set(
|
|
181
|
+
this.parkingMap.set("" + floorRoadInfo.floor + SPLIT_FLG + point.name, point);
|
|
170
182
|
}
|
|
171
183
|
});
|
|
172
184
|
(floorRoadInfo.lines || []).forEach((item)=>{
|
|
173
|
-
const fromKey =
|
|
174
|
-
const toKey =
|
|
185
|
+
const fromKey = "" + floorRoadInfo.floor + SPLIT_FLG + item.from;
|
|
186
|
+
const toKey = "" + floorRoadInfo.floor + SPLIT_FLG + item.to;
|
|
175
187
|
const fromPoint = this.pointMap.get(fromKey);
|
|
176
188
|
const toPoint = this.pointMap.get(toKey);
|
|
177
189
|
if (!fromPoint || !toPoint) {
|
|
@@ -233,13 +245,13 @@ export class RoadNetwork2 {
|
|
|
233
245
|
* 在添加通行设施时,如果是有权限的跳过
|
|
234
246
|
* 在处理完设施点之后,先给设施添加到权限表里
|
|
235
247
|
*/ getPermissionMap(permission) {
|
|
236
|
-
if (!this[
|
|
248
|
+
if (!this["permission_" + permission]) {
|
|
237
249
|
// 暂存的需要权限的线
|
|
238
250
|
// 线的格式 fromKey toKey distance type
|
|
239
251
|
// type: straightLadder staircase escalator ramp
|
|
240
|
-
this[
|
|
252
|
+
this["permission_" + permission] = new Set();
|
|
241
253
|
}
|
|
242
|
-
return this[
|
|
254
|
+
return this["permission_" + permission];
|
|
243
255
|
}
|
|
244
256
|
setPermissionLine(fromKey, toKey, permission, distance, type) {
|
|
245
257
|
const set = this.getPermissionMap(permission);
|
|
@@ -258,14 +270,14 @@ export class RoadNetwork2 {
|
|
|
258
270
|
return;
|
|
259
271
|
}
|
|
260
272
|
for(let i = 0; i < value.length; i++){
|
|
261
|
-
const fromKey =
|
|
273
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
262
274
|
const fromPoint = this.pointMap.get(fromKey);
|
|
263
275
|
if (!fromPoint) {
|
|
264
276
|
continue;
|
|
265
277
|
}
|
|
266
278
|
for(let j = 0; j < value.length; j++){
|
|
267
279
|
if (i !== j) {
|
|
268
|
-
const toKey =
|
|
280
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
269
281
|
const toPoint = this.pointMap.get(toKey);
|
|
270
282
|
if (!toPoint) {
|
|
271
283
|
continue;
|
|
@@ -286,14 +298,14 @@ export class RoadNetwork2 {
|
|
|
286
298
|
return;
|
|
287
299
|
}
|
|
288
300
|
for(let i = 0; i < value.length; i++){
|
|
289
|
-
const fromKey =
|
|
301
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
290
302
|
const fromPoint = this.pointMap.get(fromKey);
|
|
291
303
|
if (!fromPoint) {
|
|
292
304
|
continue;
|
|
293
305
|
}
|
|
294
306
|
for(let j = 0; j < value.length; j++){
|
|
295
307
|
if (i !== j) {
|
|
296
|
-
const toKey =
|
|
308
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
297
309
|
const toPoint = this.pointMap.get(toKey);
|
|
298
310
|
if (!toPoint) {
|
|
299
311
|
continue;
|
|
@@ -312,8 +324,8 @@ export class RoadNetwork2 {
|
|
|
312
324
|
this.escalatorMap.forEach((escalatorArray, _)=>{
|
|
313
325
|
escalatorArray.forEach((value)=>{
|
|
314
326
|
if (value.start && value.end) {
|
|
315
|
-
const fromKey =
|
|
316
|
-
const toKey =
|
|
327
|
+
const fromKey = "" + value.start.floor + SPLIT_FLG + value.start.id;
|
|
328
|
+
const toKey = "" + value.end.floor + SPLIT_FLG + value.end.id;
|
|
317
329
|
const fromPoint = this.pointMap.get(fromKey);
|
|
318
330
|
const toPoint = this.pointMap.get(toKey);
|
|
319
331
|
if (fromPoint && toPoint) {
|
|
@@ -331,8 +343,8 @@ export class RoadNetwork2 {
|
|
|
331
343
|
this.rampMap.forEach((rampArray, _)=>{
|
|
332
344
|
rampArray.forEach((value)=>{
|
|
333
345
|
if (value.start && value.end) {
|
|
334
|
-
const fromKey =
|
|
335
|
-
const toKey =
|
|
346
|
+
const fromKey = "" + value.start.floor + SPLIT_FLG + value.start.id;
|
|
347
|
+
const toKey = "" + value.end.floor + SPLIT_FLG + value.end.id;
|
|
336
348
|
const fromPoint = this.pointMap.get(fromKey);
|
|
337
349
|
const toPoint = this.pointMap.get(toKey);
|
|
338
350
|
if (fromPoint && toPoint) {
|
|
@@ -353,14 +365,14 @@ export class RoadNetwork2 {
|
|
|
353
365
|
return;
|
|
354
366
|
}
|
|
355
367
|
for(let i = 0; i < value.length; i++){
|
|
356
|
-
const fromKey =
|
|
368
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
357
369
|
const fromPoint = this.pointMap.get(fromKey);
|
|
358
370
|
if (!fromPoint) {
|
|
359
371
|
continue;
|
|
360
372
|
}
|
|
361
373
|
for(let j = 0; j < value.length; j++){
|
|
362
374
|
if (i !== j) {
|
|
363
|
-
const toKey =
|
|
375
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
364
376
|
const toPoint = this.pointMap.get(toKey);
|
|
365
377
|
if (!toPoint) {
|
|
366
378
|
continue;
|
|
@@ -391,7 +403,8 @@ export class RoadNetwork2 {
|
|
|
391
403
|
}
|
|
392
404
|
});
|
|
393
405
|
}
|
|
394
|
-
addLineItem(start, end, distance, lineMap
|
|
406
|
+
addLineItem(start, end, distance, lineMap) {
|
|
407
|
+
if (lineMap === void 0) lineMap = this.lineMap;
|
|
395
408
|
const map = lineMap.get(start) || new Map();
|
|
396
409
|
map.set(end, distance);
|
|
397
410
|
lineMap.set(start, map);
|
|
@@ -407,19 +420,20 @@ export class RoadNetwork2 {
|
|
|
407
420
|
[
|
|
408
421
|
...this.straightLadderMap,
|
|
409
422
|
...this.staircaseMap
|
|
410
|
-
].forEach((
|
|
423
|
+
].forEach((param)=>{
|
|
424
|
+
let [_, value] = param;
|
|
411
425
|
if (value.length < 2) {
|
|
412
426
|
return;
|
|
413
427
|
}
|
|
414
428
|
for(let i = 0; i < value.length; i++){
|
|
415
|
-
const fromKey =
|
|
429
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
416
430
|
const fromPoint = this.pointMap.get(fromKey);
|
|
417
431
|
if (!fromPoint || fromPoint.permission) {
|
|
418
432
|
continue;
|
|
419
433
|
}
|
|
420
434
|
for(let j = 0; j < value.length; j++){
|
|
421
435
|
if (i !== j) {
|
|
422
|
-
const toKey =
|
|
436
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
423
437
|
const toPoint = this.pointMap.get(toKey);
|
|
424
438
|
if (!toPoint || toPoint.permission) {
|
|
425
439
|
continue;
|
|
@@ -441,8 +455,8 @@ export class RoadNetwork2 {
|
|
|
441
455
|
this.escalatorMap.forEach((escalatorArray, _)=>{
|
|
442
456
|
escalatorArray.forEach((value)=>{
|
|
443
457
|
if (value.start && value.end) {
|
|
444
|
-
const fromKey =
|
|
445
|
-
const toKey =
|
|
458
|
+
const fromKey = "" + value.start.floor + SPLIT_FLG + value.start.id;
|
|
459
|
+
const toKey = "" + value.end.floor + SPLIT_FLG + value.end.id;
|
|
446
460
|
const fromPoint = this.pointMap.get(fromKey);
|
|
447
461
|
const toPoint = this.pointMap.get(toKey);
|
|
448
462
|
if (fromPoint && toPoint && !fromPoint.permission && !toPoint.permission) {
|
|
@@ -459,14 +473,14 @@ export class RoadNetwork2 {
|
|
|
459
473
|
return;
|
|
460
474
|
}
|
|
461
475
|
for(let i = 0; i < value.length; i++){
|
|
462
|
-
const fromKey =
|
|
476
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
463
477
|
const fromPoint = this.pointMap.get(fromKey);
|
|
464
478
|
if (!fromPoint || fromPoint.permission) {
|
|
465
479
|
continue;
|
|
466
480
|
}
|
|
467
481
|
for(let j = 0; j < value.length; j++){
|
|
468
482
|
if (i !== j) {
|
|
469
|
-
const toKey =
|
|
483
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
470
484
|
const toPoint = this.pointMap.get(toKey);
|
|
471
485
|
if (!toPoint || toPoint.permission) {
|
|
472
486
|
continue;
|
|
@@ -512,8 +526,8 @@ export class RoadNetwork2 {
|
|
|
512
526
|
this.rampMap.forEach((rampArray, _)=>{
|
|
513
527
|
rampArray.forEach((value)=>{
|
|
514
528
|
if (value.start && value.end) {
|
|
515
|
-
const fromKey =
|
|
516
|
-
const toKey =
|
|
529
|
+
const fromKey = "" + value.start.floor + SPLIT_FLG + value.start.id;
|
|
530
|
+
const toKey = "" + value.end.floor + SPLIT_FLG + value.end.id;
|
|
517
531
|
const fromPoint = this.pointMap.get(fromKey);
|
|
518
532
|
const toPoint = this.pointMap.get(toKey);
|
|
519
533
|
if (fromPoint && toPoint && !fromPoint.permission && !toPoint.permission) {
|
|
@@ -530,14 +544,14 @@ export class RoadNetwork2 {
|
|
|
530
544
|
return;
|
|
531
545
|
}
|
|
532
546
|
for(let i = 0; i < value.length; i++){
|
|
533
|
-
const fromKey =
|
|
547
|
+
const fromKey = "" + value[i].floor + SPLIT_FLG + value[i].id;
|
|
534
548
|
const fromPoint = this.pointMap.get(fromKey);
|
|
535
549
|
if (!fromPoint || fromPoint.permission) {
|
|
536
550
|
continue;
|
|
537
551
|
}
|
|
538
552
|
for(let j = 0; j < value.length; j++){
|
|
539
553
|
if (i !== j) {
|
|
540
|
-
const toKey =
|
|
554
|
+
const toKey = "" + value[j].floor + SPLIT_FLG + value[j].id;
|
|
541
555
|
const toPoint = this.pointMap.get(toKey);
|
|
542
556
|
if (!toPoint || toPoint.permission) {
|
|
543
557
|
continue;
|
|
@@ -570,7 +584,7 @@ export class RoadNetwork2 {
|
|
|
570
584
|
transformStart(start) {
|
|
571
585
|
var _start_coord;
|
|
572
586
|
if (start.nodeId) {
|
|
573
|
-
const pointKey = this.nodeMap.get(
|
|
587
|
+
const pointKey = this.nodeMap.get("" + start.floor + SPLIT_FLG + start.nodeId);
|
|
574
588
|
if (pointKey) {
|
|
575
589
|
const [floor, id] = pointKey.split(SPLIT_FLG);
|
|
576
590
|
return {
|
|
@@ -610,7 +624,7 @@ export class RoadNetwork2 {
|
|
|
610
624
|
if (end.floor) {
|
|
611
625
|
if (end.parkingSpace) {
|
|
612
626
|
// 根据车位号找
|
|
613
|
-
const point = this.parkingMap.get(
|
|
627
|
+
const point = this.parkingMap.get("" + end.floor + SPLIT_FLG + end.parkingSpace);
|
|
614
628
|
if (point) {
|
|
615
629
|
return {
|
|
616
630
|
floor: end.floor,
|
|
@@ -625,7 +639,7 @@ export class RoadNetwork2 {
|
|
|
625
639
|
}
|
|
626
640
|
if (end.facility) {
|
|
627
641
|
const facilityIds = this.facilities.filter((item)=>+item.type_id === +end.facility).map((item)=>item.id);
|
|
628
|
-
const facilityPoints = facilityIds.map((item)=>this.facilityMap.get(
|
|
642
|
+
const facilityPoints = facilityIds.map((item)=>this.facilityMap.get("" + item)).flat(2);
|
|
629
643
|
if (facilityPoints == null ? void 0 : facilityPoints.length) {
|
|
630
644
|
return {
|
|
631
645
|
floor: end.floor,
|
|
@@ -643,7 +657,8 @@ export class RoadNetwork2 {
|
|
|
643
657
|
* @param permission 0 无权限 1 通行卡
|
|
644
658
|
* @param travelDirection 行驶方向 从Y轴正方向的顺时针角度
|
|
645
659
|
* @returns
|
|
646
|
-
*/ getPath(start, end, type
|
|
660
|
+
*/ getPath(start, end, type, permission, travelDirection) {
|
|
661
|
+
if (type === void 0) type = "";
|
|
647
662
|
if (!this.checkStart(start)) {
|
|
648
663
|
return "start-error";
|
|
649
664
|
}
|
|
@@ -679,7 +694,7 @@ export class RoadNetwork2 {
|
|
|
679
694
|
} else if (transformedEnd.facility) {
|
|
680
695
|
// 寻找最近的设施 如果传入了目的地楼层,只找对应楼层的设施
|
|
681
696
|
const facilityIds = this.facilities.filter((item)=>+item.type_id === +end.facility).map((item)=>item.id);
|
|
682
|
-
const facilityPoints = facilityIds.map((item)=>this.facilityMap.get(
|
|
697
|
+
const facilityPoints = facilityIds.map((item)=>this.facilityMap.get("" + item)).flat(2).filter((item)=>item).filter((item)=>{
|
|
683
698
|
if (transformedEnd.floor) {
|
|
684
699
|
return item.floor === transformedEnd.floor;
|
|
685
700
|
} else {
|
|
@@ -709,8 +724,8 @@ export class RoadNetwork2 {
|
|
|
709
724
|
}
|
|
710
725
|
// 从路网中规划路线
|
|
711
726
|
getRoutePath(start, end, route) {
|
|
712
|
-
const startPointId =
|
|
713
|
-
const endPointId =
|
|
727
|
+
const startPointId = "" + start.floor + SPLIT_FLG + start.id;
|
|
728
|
+
const endPointId = "" + end.floor + SPLIT_FLG + end.id;
|
|
714
729
|
const paths = route.path(startPointId, endPointId);
|
|
715
730
|
if (!paths) {
|
|
716
731
|
return null;
|
|
@@ -890,7 +905,7 @@ export class RoadNetwork2 {
|
|
|
890
905
|
map.set(key, distance);
|
|
891
906
|
});
|
|
892
907
|
};
|
|
893
|
-
const startPointId =
|
|
908
|
+
const startPointId = "" + start.floor + SPLIT_FLG + start.id;
|
|
894
909
|
if (!isNil(travelDirection)) {
|
|
895
910
|
// 如果有方向,要把起点位置的非行进方向的其他点删掉,规划完路线之后在加回去
|
|
896
911
|
const nextPoints = this.forwardLineMap.get(startPointId);
|
|
@@ -913,7 +928,13 @@ export class RoadNetwork2 {
|
|
|
913
928
|
pointAngle.set(key, angleY);
|
|
914
929
|
}
|
|
915
930
|
});
|
|
916
|
-
const lessThan60Keys = Array.from(pointAngle).filter((
|
|
931
|
+
const lessThan60Keys = Array.from(pointAngle).filter((param)=>{
|
|
932
|
+
let [key, value] = param;
|
|
933
|
+
return Math.abs(value - travelDirection) <= 60;
|
|
934
|
+
}).map((param)=>{
|
|
935
|
+
let [key] = param;
|
|
936
|
+
return key;
|
|
937
|
+
});
|
|
917
938
|
if (lessThan60Keys.length) {
|
|
918
939
|
// 删除其他大于60度的点
|
|
919
940
|
lessThan60Keys.forEach((key)=>pointAngle.delete(key));
|
package/lib/src/utils/rules.js
CHANGED
package/lib/src/utils/string.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* 驼峰转下划线
|
|
3
3
|
* @param str
|
|
4
4
|
* @returns
|
|
5
|
-
*/
|
|
5
|
+
*/ import "core-js/modules/es.string.replace.js";
|
|
6
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
7
|
+
export function convertToSnakeCase(str) {
|
|
6
8
|
return str.replace(/[A-Z]/g, (match)=>'_' + match.toLowerCase()).replace(/^_/, '');
|
|
7
9
|
}
|
package/lib/src/utils/svg.js
CHANGED
|
@@ -13,7 +13,8 @@ export function createSvgElement(tag) {
|
|
|
13
13
|
/**
|
|
14
14
|
* 创建圆点
|
|
15
15
|
* @param radius
|
|
16
|
-
*/ export function createCircle(radius
|
|
16
|
+
*/ export function createCircle(radius, fill) {
|
|
17
|
+
if (radius === void 0) radius = "2";
|
|
17
18
|
const circle = createSvgElement("circle");
|
|
18
19
|
circle.setAttribute("r", radius);
|
|
19
20
|
circle.setAttribute("fill", fill);
|
|
@@ -38,22 +39,22 @@ export function createSvgElement(tag) {
|
|
|
38
39
|
return rect;
|
|
39
40
|
}
|
|
40
41
|
export function setCirclePosition(circle, x, y) {
|
|
41
|
-
circle.setAttribute('cx',
|
|
42
|
-
circle.setAttribute('cy',
|
|
42
|
+
circle.setAttribute('cx', "" + x);
|
|
43
|
+
circle.setAttribute('cy', "" + y);
|
|
43
44
|
}
|
|
44
45
|
export function setLineStartEnd(line, start, end) {
|
|
45
46
|
if (start) {
|
|
46
|
-
line.setAttribute("x1",
|
|
47
|
-
line.setAttribute("y1",
|
|
47
|
+
line.setAttribute("x1", "" + start.x);
|
|
48
|
+
line.setAttribute("y1", "" + start.y);
|
|
48
49
|
}
|
|
49
50
|
if (end) {
|
|
50
|
-
line.setAttribute("x2",
|
|
51
|
-
line.setAttribute("y2",
|
|
51
|
+
line.setAttribute("x2", "" + end.x);
|
|
52
|
+
line.setAttribute("y2", "" + end.y);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
export function setRectPosition(rect, x, y, w, h) {
|
|
55
|
-
rect.setAttribute('x',
|
|
56
|
-
rect.setAttribute('y',
|
|
57
|
-
rect.setAttribute('width',
|
|
58
|
-
rect.setAttribute('height',
|
|
56
|
+
rect.setAttribute('x', "" + x);
|
|
57
|
+
rect.setAttribute('y', "" + y);
|
|
58
|
+
rect.setAttribute('width', "" + w);
|
|
59
|
+
rect.setAttribute('height', "" + h);
|
|
59
60
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
3
|
+
import "core-js/modules/es.array.push.js";
|
|
4
|
+
import "core-js/modules/es.string.replace.js";
|
|
5
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
3
6
|
import { isNil } from "lodash";
|
|
4
7
|
import { EventDispatcher } from "three";
|
|
5
8
|
class TaskQueue extends EventDispatcher {
|
|
@@ -70,7 +73,7 @@ class TaskQueue extends EventDispatcher {
|
|
|
70
73
|
}
|
|
71
74
|
const index = this._getIndexByTid(id);
|
|
72
75
|
if (index === -1) {
|
|
73
|
-
console.warn(
|
|
76
|
+
console.warn("[TaskQueue] 没有找到id=" + id + "的任务");
|
|
74
77
|
return false;
|
|
75
78
|
}
|
|
76
79
|
const $task = this._createTask(task);
|
|
@@ -97,7 +100,7 @@ class TaskQueue extends EventDispatcher {
|
|
|
97
100
|
*/ remove(id) {
|
|
98
101
|
const index = this._getIndexByTid(id);
|
|
99
102
|
if (index === -1) {
|
|
100
|
-
console.warn(
|
|
103
|
+
console.warn("[TaskQueue] remove方法传入的id:" + id + "找不到对应的task");
|
|
101
104
|
return false;
|
|
102
105
|
}
|
|
103
106
|
this._task.splice(index, 1);
|
|
@@ -123,32 +126,29 @@ class TaskQueue extends EventDispatcher {
|
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
128
|
* 从任务队列中的第一个任务开始执行
|
|
126
|
-
*/ exec() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
});
|
|
150
|
-
return _this.exec();
|
|
151
|
-
})();
|
|
129
|
+
*/ async exec() {
|
|
130
|
+
if (!this.started || !this._task.length) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
const $task = this._task.shift();
|
|
134
|
+
this.activeTask = $task;
|
|
135
|
+
this.dispatchEvent({
|
|
136
|
+
type: "active-task-start",
|
|
137
|
+
task: $task
|
|
138
|
+
});
|
|
139
|
+
let res;
|
|
140
|
+
try {
|
|
141
|
+
res = await $task.run();
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.warn("[task run err]", e, $task);
|
|
144
|
+
}
|
|
145
|
+
this.activeTask = null;
|
|
146
|
+
this.dispatchEvent({
|
|
147
|
+
type: "active-task-end",
|
|
148
|
+
task: $task,
|
|
149
|
+
res
|
|
150
|
+
});
|
|
151
|
+
return this.exec();
|
|
152
152
|
}
|
|
153
153
|
constructor(start = true){
|
|
154
154
|
super(), // 任务队列
|
package/lib/src/utils/timer.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import "core-js/modules/es.set.difference.v2.js";
|
|
2
|
+
import "core-js/modules/es.set.intersection.v2.js";
|
|
3
|
+
import "core-js/modules/es.set.is-disjoint-from.v2.js";
|
|
4
|
+
import "core-js/modules/es.set.is-subset-of.v2.js";
|
|
5
|
+
import "core-js/modules/es.set.is-superset-of.v2.js";
|
|
6
|
+
import "core-js/modules/es.set.symmetric-difference.v2.js";
|
|
7
|
+
import "core-js/modules/es.set.union.v2.js";
|
|
8
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
1
9
|
/**
|
|
2
10
|
* 任务管理器
|
|
3
11
|
* 在类销毁的时候,要清除所有的异步定时器
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import "core-js/modules/es.json.stringify.js";
|
|
2
|
+
export function transformGraphicData(data, center, baseIndex) {
|
|
3
|
+
if (baseIndex === void 0) baseIndex = 0;
|
|
2
4
|
data.forEach((item)=>{
|
|
3
5
|
item.geometry.coords = JSON.parse(JSON.stringify(item.geometry.cds));
|
|
4
6
|
if (item.geometry.type === "polygon") {
|