@aibee/crc-bmap 0.8.44 → 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.
Files changed (96) hide show
  1. package/lib/bmap.cjs.min.js +408 -401
  2. package/lib/bmap.esm.js +7644 -1526
  3. package/lib/bmap.esm.min.js +408 -401
  4. package/lib/bmap.min.js +408 -401
  5. package/lib/src/bmap.js +60 -54
  6. package/lib/src/context/OrbitControls.js +4 -1
  7. package/lib/src/context/context.js +54 -37
  8. package/lib/src/context/control.js +85 -83
  9. package/lib/src/context/scene.js +1 -0
  10. package/lib/src/elements/base-svg.js +5 -4
  11. package/lib/src/elements/floor.js +8 -0
  12. package/lib/src/elements/glb-model.js +14 -18
  13. package/lib/src/elements/graphic.js +18 -8
  14. package/lib/src/elements/ground-texture.js +41 -44
  15. package/lib/src/elements/heatmap.js +2 -1
  16. package/lib/src/elements/lane.js +5 -1
  17. package/lib/src/elements/merge-graphic.js +3 -28
  18. package/lib/src/elements/model.js +5 -9
  19. package/lib/src/elements/overlay.js +9 -7
  20. package/lib/src/elements/poi.js +55 -49
  21. package/lib/src/elements/poi2.js +52 -53
  22. package/lib/src/elements/shadow.js +3 -1
  23. package/lib/src/elements/svg-line.js +2 -0
  24. package/lib/src/elements/svg-polygon.js +1 -0
  25. package/lib/src/elements/text-texture.js +32 -36
  26. package/lib/src/elements/wall.js +3 -41
  27. package/lib/src/external/meshLine.js +17 -0
  28. package/lib/src/factory/img-texture.js +1 -0
  29. package/lib/src/factory/material.js +21 -51
  30. package/lib/src/factory/model.js +31 -33
  31. package/lib/src/factory/text-texture.js +17 -0
  32. package/lib/src/factory/unique-key.js +8 -0
  33. package/lib/src/layer/graphic-layer.js +1 -0
  34. package/lib/src/layer/parking-layer.d.ts +6 -0
  35. package/lib/src/layer/parking-layer.js +8 -0
  36. package/lib/src/layer/poi-layer.js +4 -1
  37. package/lib/src/layer/poi-layer2.js +2 -0
  38. package/lib/src/loader/AibeeLoader/index.js +230 -276
  39. package/lib/src/loader/AibeeLoader/layer.js +8 -6
  40. package/lib/src/loader/CrLoader/api/floor.js +45 -73
  41. package/lib/src/loader/CrLoader/index.js +88 -106
  42. package/lib/src/operations/hover/hover-helper.js +12 -2
  43. package/lib/src/operations/selection/selection.js +11 -1
  44. package/lib/src/plugins/car-inertial-position/car-inertial-position.d.ts +42 -10
  45. package/lib/src/plugins/car-inertial-position/car-inertial-position.js +285 -67
  46. package/lib/src/plugins/car-inertial-position/compass.d.ts +4 -5
  47. package/lib/src/plugins/car-inertial-position/compass.js +43 -38
  48. package/lib/src/plugins/car-inertial-position/kalman-filter.d.ts +14 -0
  49. package/lib/src/plugins/car-inertial-position/kalman-filter.js +30 -0
  50. package/lib/src/plugins/car-inertial-position/utils.d.ts +1 -1
  51. package/lib/src/plugins/car-inertial-position/utils.js +8 -5
  52. package/lib/src/plugins/cr-nav-path/cr-nav-path.js +47 -55
  53. package/lib/src/plugins/cr-nav-path/cr-path.worker.js +4 -2
  54. package/lib/src/plugins/equipment/equipment.js +20 -22
  55. package/lib/src/plugins/mul-floor-navigation/mul-floor-navigation.js +63 -61
  56. package/lib/src/plugins/mul-floor-navigation/path.js +34 -30
  57. package/lib/src/plugins/mul-floor-navigation/start-model.js +2 -1
  58. package/lib/src/plugins/mul-floor-select/mul-floor-select.js +2 -1
  59. package/lib/src/plugins/mul-floors/mul-floors.js +1 -0
  60. package/lib/src/plugins/nav-path/nav-path.js +51 -59
  61. package/lib/src/plugins/nav-path/path.worker.js +4 -2
  62. package/lib/src/plugins/navigation/navigation.d.ts +5 -0
  63. package/lib/src/plugins/navigation/navigation.js +240 -217
  64. package/lib/src/plugins/navigation/path.js +34 -30
  65. package/lib/src/plugins/navigation/position-navigation.d.ts +4 -0
  66. package/lib/src/plugins/navigation/position-navigation.js +96 -79
  67. package/lib/src/plugins/navigation/start-rotate-helper-poi.js +18 -6
  68. package/lib/src/plugins/pdr-position/imu-position.js +13 -9
  69. package/lib/src/plugins/pdr-position/particle.js +4 -2
  70. package/lib/src/plugins/pdr-position/pdr.js +5 -4
  71. package/lib/src/plugins/pdr-position/position.js +5 -2
  72. package/lib/src/plugins/pdr-position/sensor.js +20 -25
  73. package/lib/src/plugins/select/select.js +11 -1
  74. package/lib/src/utils/camera-bound.js +3 -1
  75. package/lib/src/utils/color.js +8 -4
  76. package/lib/src/utils/coordinate.js +1 -0
  77. package/lib/src/utils/create.js +4 -2
  78. package/lib/src/utils/events.js +15 -4
  79. package/lib/src/utils/index-db.js +18 -11
  80. package/lib/src/utils/init-helper.js +7 -2
  81. package/lib/src/utils/obj-utils.js +3 -2
  82. package/lib/src/utils/os.js +1 -0
  83. package/lib/src/utils/path.js +15 -4
  84. package/lib/src/utils/promise.js +3 -1
  85. package/lib/src/utils/proxy.js +2 -1
  86. package/lib/src/utils/road.js +20 -14
  87. package/lib/src/utils/road2.js +60 -39
  88. package/lib/src/utils/rules.js +1 -0
  89. package/lib/src/utils/string.js +3 -1
  90. package/lib/src/utils/svg.js +12 -11
  91. package/lib/src/utils/taskQueue.js +29 -29
  92. package/lib/src/utils/timer.js +8 -1
  93. package/lib/src/utils/translate.js +3 -1
  94. package/lib/src/utils/tween.js +8 -0
  95. package/lib/src/utils/webworker.js +10 -9
  96. package/package.json +2 -1
@@ -13,7 +13,8 @@ export function createSvgElement(tag) {
13
13
  /**
14
14
  * 创建圆点
15
15
  * @param radius
16
- */ export function createCircle(radius = "2", fill) {
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', `${x}`);
42
- circle.setAttribute('cy', `${y}`);
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", `${start.x}`);
47
- line.setAttribute("y1", `${start.y}`);
47
+ line.setAttribute("x1", "" + start.x);
48
+ line.setAttribute("y1", "" + start.y);
48
49
  }
49
50
  if (end) {
50
- line.setAttribute("x2", `${end.x}`);
51
- line.setAttribute("y2", `${end.y}`);
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', `${x}`);
56
- rect.setAttribute('y', `${y}`);
57
- rect.setAttribute('width', `${w}`);
58
- rect.setAttribute('height', `${h}`);
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(`[TaskQueue] 没有找到id=${id}的任务`);
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(`[TaskQueue] remove方法传入的id:${id}找不到对应的task`);
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
- var _this = this;
128
- return _async_to_generator(function*() {
129
- if (!_this.started || !_this._task.length) {
130
- return false;
131
- }
132
- const $task = _this._task.shift();
133
- _this.activeTask = $task;
134
- _this.dispatchEvent({
135
- type: "active-task-start",
136
- task: $task
137
- });
138
- let res;
139
- try {
140
- res = yield $task.run();
141
- } catch (e) {
142
- console.warn("[task run err]", e, $task);
143
- }
144
- _this.activeTask = null;
145
- _this.dispatchEvent({
146
- type: "active-task-end",
147
- task: $task,
148
- res
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(), // 任务队列
@@ -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
  * 在类销毁的时候,要清除所有的异步定时器
@@ -28,7 +36,6 @@
28
36
  }
29
37
  setInterval(fn, wait) {
30
38
  const timer = window.setInterval(()=>{
31
- this.tasks.interval.delete(timer);
32
39
  fn();
33
40
  }, wait);
34
41
  this.tasks.interval.add(timer);
@@ -1,4 +1,6 @@
1
- export function transformGraphicData(data, center, baseIndex = 0) {
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") {
@@ -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
  import { Group } from '@tweenjs/tween.js';
2
10
  export class TweenUtil {
3
11
  update() {
@@ -1,4 +1,3 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
1
  import { UniqueKeyFactory } from "../factory/unique-key";
3
2
  import { convertToSnakeCase } from "./string";
4
3
  /**
@@ -9,8 +8,9 @@ import { convertToSnakeCase } from "./string";
9
8
  */ export function triggerWorker(worker, type, data) {
10
9
  return new Promise((resolve, reject)=>{
11
10
  const key = UniqueKeyFactory.genUniqueKey();
12
- const onMessage = ({ data })=>{
13
- if (data.type === `${type}_result` && data.key === key) {
11
+ const onMessage = (param)=>{
12
+ let { data } = param;
13
+ if (data.type === "" + type + "_result" && data.key === key) {
14
14
  UniqueKeyFactory.removeKey(key);
15
15
  self.removeEventListener("message", onMessage);
16
16
  if (data.error) {
@@ -35,30 +35,31 @@ export function toWebWorker(obj) {
35
35
  events[convertToSnakeCase(key.slice(2))] = obj[key];
36
36
  }
37
37
  }
38
- const onMessage = /*#__PURE__*/ _async_to_generator(function*({ data }) {
38
+ const onMessage = async (param)=>{
39
+ let { data } = param;
39
40
  if (events[data.type]) {
40
41
  try {
41
- const result = yield events[data.type](data.data);
42
+ const result = await events[data.type](data.data);
42
43
  self.postMessage({
43
- type: `${data.type}_result`,
44
+ type: "" + data.type + "_result",
44
45
  key: data.key,
45
46
  data: result
46
47
  });
47
48
  } catch (e) {
48
49
  self.postMessage({
49
- type: `${data.type}_result`,
50
+ type: "" + data.type + "_result",
50
51
  key: data.key,
51
52
  error: e
52
53
  });
53
54
  }
54
55
  } else {
55
56
  self.postMessage({
56
- type: `${data.type}_result`,
57
+ type: "" + data.type + "_result",
57
58
  key: data.key,
58
59
  error: "no_event"
59
60
  });
60
61
  }
61
- });
62
+ };
62
63
  self.addEventListener("message", onMessage);
63
64
  return ()=>{
64
65
  self.removeEventListener("message", onMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.8.44",
3
+ "version": "0.8.46",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.js",
@@ -51,6 +51,7 @@
51
51
  "@tweenjs/tween.js": "^21.0.0",
52
52
  "@types/three": "^0.169.0",
53
53
  "chaikin-smooth": "^1.0.4",
54
+ "core-js": "^3.39.0",
54
55
  "hotkeys-js": "^3.12.0",
55
56
  "lodash": "^4.17.21",
56
57
  "mathjs": "^13.1.1",