@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
@@ -1,95 +1,67 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
1
  /**
3
2
  * 请求楼栋地面
4
- */ export function loadBuildingGround(_, config) {
5
- return _loadBuildingGround.apply(this, arguments);
6
- }
7
- function _loadBuildingGround() {
8
- _loadBuildingGround = _async_to_generator(function*({ brand, project }, config) {
9
- const { apiDomain, apiPath: { floorRange }, apiInfo } = config;
10
- const url = `${apiDomain}${floorRange}?brand=${brand}&project=${project}&phase=${project}&building=${project}`;
11
- const data = yield fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>{
12
- const data = (res || [])[0];
13
- if (data) {
14
- data.info = JSON.parse(data.info);
15
- }
16
- return data;
17
- });
3
+ */ export async function loadBuildingGround(param, config) {
4
+ let { brand, project } = param;
5
+ const { apiDomain, apiPath: { floorRange }, apiInfo } = config;
6
+ const url = "" + apiDomain + floorRange + "?brand=" + brand + "&project=" + project + "&phase=" + project + "&building=" + project;
7
+ const data = await fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>{
8
+ const data = (res || [])[0];
9
+ if (data) {
10
+ data.info = JSON.parse(data.info);
11
+ }
18
12
  return data;
19
13
  });
20
- return _loadBuildingGround.apply(this, arguments);
14
+ return data;
21
15
  }
22
16
  /**
23
17
  * 加载图元
24
18
  * @param param0
25
19
  * @param config
26
20
  * @returns
27
- */ export function loadGraphics(_, config) {
28
- return _loadGraphics.apply(this, arguments);
29
- }
30
- function _loadGraphics() {
31
- _loadGraphics = _async_to_generator(function*({ brand, project, floor, ts, resource_type_list }, config) {
32
- const { apiDomain, apiPath: { floorGraphic }, apiInfo } = config;
33
- const url = `${apiDomain}${floorGraphic}?brand=${brand}&project=${project}&phase=${project}&building=${project}&floor=${floor}&ts=${ts}&resource_type_list=${resource_type_list}`;
34
- const data = yield fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>{
35
- (res || []).map((item)=>item.info = JSON.parse(item.info));
36
- return res || [];
37
- });
38
- return data;
21
+ */ export async function loadGraphics(param, config) {
22
+ let { brand, project, floor, ts, resource_type_list } = param;
23
+ const { apiDomain, apiPath: { floorGraphic }, apiInfo } = config;
24
+ const url = "" + apiDomain + floorGraphic + "?brand=" + brand + "&project=" + project + "&phase=" + project + "&building=" + project + "&floor=" + floor + "&ts=" + ts + "&resource_type_list=" + resource_type_list;
25
+ const data = await fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>{
26
+ (res || []).map((item)=>item.info = JSON.parse(item.info));
27
+ return res || [];
39
28
  });
40
- return _loadGraphics.apply(this, arguments);
29
+ return data;
41
30
  }
42
31
  /**
43
32
  * 加载外部街道
44
33
  * @param param0
45
34
  * @param config
46
35
  * @returns
47
- */ export function loadExternalStreet(_, config) {
48
- return _loadExternalStreet.apply(this, arguments);
49
- }
50
- function _loadExternalStreet() {
51
- _loadExternalStreet = _async_to_generator(function*({ project, floor }, config) {
52
- const { apiDomain, apiInfo } = config;
53
- const url = `${apiDomain}/api/inception-map/external_street/get?projectCode=${project}&floorCode=${floor}`;
54
- const data = yield fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>JSON.parse(res[0].streetInfo || "{}")).then((res)=>{
55
- if (res.fileId) {
56
- return downloadFileToJson(res.fileId, config);
57
- } else {
58
- return null;
59
- }
60
- });
61
- return data;
62
- });
63
- return _loadExternalStreet.apply(this, arguments);
64
- }
65
- function downloadFileToBlob(fileId, config) {
66
- return _downloadFileToBlob.apply(this, arguments);
67
- }
68
- function _downloadFileToBlob() {
69
- _downloadFileToBlob = _async_to_generator(function*(fileId, config) {
70
- const { apiDomain, apiInfo } = config;
71
- return fetch(`${apiDomain}/api/inception-map/file/getFileStream?fileId=${fileId}`, apiInfo).then((res)=>res.blob());
36
+ */ export async function loadExternalStreet(param, config) {
37
+ let { project, floor } = param;
38
+ const { apiDomain, apiInfo } = config;
39
+ const url = apiDomain + "/api/inception-map/external_street/get?projectCode=" + project + "&floorCode=" + floor;
40
+ const data = await fetch(url, apiInfo).then((res)=>res.json()).then((res)=>res.data).then((res)=>JSON.parse(res[0].streetInfo || "{}")).then((res)=>{
41
+ if (res.fileId) {
42
+ return downloadFileToJson(res.fileId, config);
43
+ } else {
44
+ return null;
45
+ }
72
46
  });
73
- return _downloadFileToBlob.apply(this, arguments);
47
+ return data;
74
48
  }
75
- function downloadFileToJson(fileId, config) {
76
- return _downloadFileToJson.apply(this, arguments);
49
+ async function downloadFileToBlob(fileId, config) {
50
+ const { apiDomain, apiInfo } = config;
51
+ return fetch(apiDomain + "/api/inception-map/file/getFileStream?fileId=" + fileId, apiInfo).then((res)=>res.blob());
77
52
  }
78
- function _downloadFileToJson() {
79
- _downloadFileToJson = _async_to_generator(function*(fileId, config) {
80
- const { apiDomain, apiInfo } = config;
81
- return fetch(`${apiDomain}/api/inception-map/file/getFileStream?fileId=${fileId}`, apiInfo).then((res)=>res.arrayBuffer()).then((arrayBuffer)=>{
82
- // ArrayBuffer 转换为字符串
83
- const decoder = new TextDecoder('utf-8');
84
- const text = decoder.decode(arrayBuffer);
85
- // 将字符串解析为 JSON
86
- if (text) {
87
- const jsonData = JSON.parse(text);
88
- return jsonData;
89
- } else {
90
- return null;
91
- }
92
- });
53
+ async function downloadFileToJson(fileId, config) {
54
+ const { apiDomain, apiInfo } = config;
55
+ return fetch(apiDomain + "/api/inception-map/file/getFileStream?fileId=" + fileId, apiInfo).then((res)=>res.arrayBuffer()).then((arrayBuffer)=>{
56
+ // ArrayBuffer 转换为字符串
57
+ const decoder = new TextDecoder('utf-8');
58
+ const text = decoder.decode(arrayBuffer);
59
+ // 将字符串解析为 JSON
60
+ if (text) {
61
+ const jsonData = JSON.parse(text);
62
+ return jsonData;
63
+ } else {
64
+ return null;
65
+ }
93
66
  });
94
- return _downloadFileToJson.apply(this, arguments);
95
67
  }
@@ -1,48 +1,43 @@
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
3
  import { loadBuildingGround, loadGraphics } from "./api";
4
4
  import { Floor } from "../../elements";
5
5
  import { generatorKeyByObj, HooksName, transformGraphicData } from "../../utils";
6
6
  export class CrLoader {
7
- load(query) {
8
- var _this = this;
9
- return _async_to_generator(function*() {
10
- const cacheKey = generatorKeyByObj(query);
11
- if (_this.cacheData.has(cacheKey)) {
12
- return _this.cacheData.get(cacheKey);
13
- }
14
- const [, data] = yield Promise.all([
15
- _this.loadBuildGround(query),
16
- loadGraphics(query, _this.bmap.config)
17
- ]);
18
- const lenKey = generatorKeyByObj({
19
- floor: query.floor,
20
- ts: query.ts
21
- });
22
- transformGraphicData(data.map((item)=>item.info), _this.bmap.buildingCenter, _this.floorDataLengthMap.get(lenKey) || 0);
23
- data.forEach((item)=>item.info.transformToBuildingGround = false);
24
- _this.cacheData.set(cacheKey, data);
25
- const len = _this.floorDataLengthMap.get(lenKey) || 0;
26
- _this.floorDataLengthMap.set(lenKey, len + data.length);
27
- _this.loadExternalStreet(query);
28
- return data;
29
- })();
7
+ async load(query) {
8
+ const cacheKey = generatorKeyByObj(query);
9
+ if (this.cacheData.has(cacheKey)) {
10
+ return this.cacheData.get(cacheKey);
11
+ }
12
+ const [, data] = await Promise.all([
13
+ this.loadBuildGround(query),
14
+ loadGraphics(query, this.bmap.config)
15
+ ]);
16
+ const lenKey = generatorKeyByObj({
17
+ floor: query.floor,
18
+ ts: query.ts
19
+ });
20
+ transformGraphicData(data.map((item)=>item.info), this.bmap.buildingCenter, this.floorDataLengthMap.get(lenKey) || 0);
21
+ data.forEach((item)=>item.info.transformToBuildingGround = false);
22
+ this.cacheData.set(cacheKey, data);
23
+ const len = this.floorDataLengthMap.get(lenKey) || 0;
24
+ this.floorDataLengthMap.set(lenKey, len + data.length);
25
+ this.loadExternalStreet(query);
26
+ return data;
30
27
  }
31
28
  /**
32
29
  * 加载外部街道
33
- */ loadExternalStreet(query) {
34
- return _async_to_generator(function*() {
35
- // const key = `project=${query.project}&floor=${query.floor}`
36
- // if (this.externalStreetMap.has(key)) {
37
- // return this.externalStreetMap.get(key)!
38
- // } else {
39
- // const res = await loadExternalStreet({ project: query.project, floor: query.floor }, this.bmap.config)
40
- // if (res) {
41
- // // TODO
42
- // }
43
- // console.log(res)
44
- // }
45
- })();
30
+ */ async loadExternalStreet(query) {
31
+ // const key = `project=${query.project}&floor=${query.floor}`
32
+ // if (this.externalStreetMap.has(key)) {
33
+ // return this.externalStreetMap.get(key)!
34
+ // } else {
35
+ // const res = await loadExternalStreet({ project: query.project, floor: query.floor }, this.bmap.config)
36
+ // if (res) {
37
+ // // TODO
38
+ // }
39
+ // console.log(res)
40
+ // }
46
41
  }
47
42
  switchFloorByData(data, floor) {
48
43
  if (!data.length) {
@@ -110,79 +105,66 @@ export class CrLoader {
110
105
  const graphicMap = floor.userData.graphicMap || new Map();
111
106
  return data.filter((graphic)=>!graphicMap.has(graphic.element_uuid));
112
107
  }
113
- switchFloorByStoreData(query, floor) {
114
- var _this = this;
115
- return _async_to_generator(function*() {
116
- const storeData = yield _this.load(_extends({}, query, {
117
- resource_type_list: "6"
118
- }));
119
- const filterData = _this.filterData(storeData, floor);
120
- _this.switchFloorByData(filterData, floor);
121
- })();
108
+ async switchFloorByStoreData(query, floor) {
109
+ const storeData = await this.load(_extends({}, query, {
110
+ resource_type_list: "6"
111
+ }));
112
+ const filterData = this.filterData(storeData, floor);
113
+ this.switchFloorByData(filterData, floor);
122
114
  }
123
- switchFloorByOtherData(query, floor) {
124
- var _this = this;
125
- return _async_to_generator(function*() {
126
- const otherData = yield _this.load(_extends({}, query, {
127
- resource_type_list: "1,2,3,4"
128
- }));
129
- const filterData = _this.filterData(otherData, floor);
130
- _this.switchFloorByData(filterData, floor);
131
- })();
115
+ async switchFloorByOtherData(query, floor) {
116
+ const otherData = await this.load(_extends({}, query, {
117
+ resource_type_list: "1,2,3,4"
118
+ }));
119
+ const filterData = this.filterData(otherData, floor);
120
+ this.switchFloorByData(filterData, floor);
132
121
  }
133
- loadBuildGround({ brand, project }) {
134
- var _this = this;
135
- return _async_to_generator(function*() {
136
- const data = yield _this.loadBuildingGround({
137
- brand,
138
- project
139
- });
140
- _this.bmap.currentBuildGround = data;
141
- _this.bmap.changeBuildingCenter(data, {
142
- brand,
143
- project
144
- });
145
- return _this.bmap.currentBuildGround;
146
- })();
122
+ async loadBuildGround(param) {
123
+ let { brand, project } = param;
124
+ const data = await this.loadBuildingGround({
125
+ brand,
126
+ project
127
+ });
128
+ this.bmap.currentBuildGround = data;
129
+ this.bmap.changeBuildingCenter(data, {
130
+ brand,
131
+ project
132
+ });
133
+ return this.bmap.currentBuildGround;
147
134
  }
148
- loadBuildingGround({ brand, project }) {
149
- var _this = this;
150
- return _async_to_generator(function*() {
151
- const key = generatorKeyByObj({
152
- brand,
153
- project
154
- });
155
- if (_this.buildingGroundMap.has(key)) {
156
- const data = _this.buildingGroundMap.get(key);
157
- return data;
158
- }
159
- const promise = loadBuildingGround({
160
- brand,
161
- project
162
- }, _this.bmap.config).then((data)=>{
163
- _this.buildingGroundMap.set(key, data);
164
- return data;
165
- });
166
- _this.buildingGroundMap.set(key, promise);
167
- return promise;
168
- })();
135
+ async loadBuildingGround(param) {
136
+ let { brand, project } = param;
137
+ const key = generatorKeyByObj({
138
+ brand,
139
+ project
140
+ });
141
+ if (this.buildingGroundMap.has(key)) {
142
+ const data = this.buildingGroundMap.get(key);
143
+ return data;
144
+ }
145
+ const promise = loadBuildingGround({
146
+ brand,
147
+ project
148
+ }, this.bmap.config).then((data)=>{
149
+ this.buildingGroundMap.set(key, data);
150
+ return data;
151
+ });
152
+ this.buildingGroundMap.set(key, promise);
153
+ return promise;
169
154
  }
170
- switchFloor(query) {
171
- var _this = this;
172
- return _async_to_generator(function*() {
173
- const floor = new Floor(_this.bmap.context);
174
- floor.userData.graphicMap = new Map();
175
- floor.name = query.floor;
176
- try {
177
- yield Promise.all([
178
- _this.switchFloorByStoreData(query, floor),
179
- _this.switchFloorByOtherData(query, floor)
180
- ]);
181
- } catch (e) {
182
- console.log(e);
183
- }
184
- return floor;
185
- })();
155
+ async switchFloor(query) {
156
+ const floor = new Floor(this.bmap.context);
157
+ floor.userData.graphicMap = new Map();
158
+ floor.name = query.floor;
159
+ try {
160
+ await Promise.all([
161
+ this.switchFloorByStoreData(query, floor),
162
+ this.switchFloorByOtherData(query, floor)
163
+ ]);
164
+ } catch (e) {
165
+ console.log(e);
166
+ }
167
+ return floor;
186
168
  }
187
169
  dispose() {
188
170
  this.cacheData.clear();
@@ -1,8 +1,17 @@
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 { Poi, Poi2 } from "../../elements";
2
10
  import { EventDispatcher, Vector2 } from "three";
3
11
  import { Timer } from "../../utils";
4
12
  export class HoverHelper extends EventDispatcher {
5
- handleHoverGraphicsChange(graphics = this.curGraphics) {
13
+ handleHoverGraphicsChange(graphics) {
14
+ if (graphics === void 0) graphics = this.curGraphics;
6
15
  this.dispatchEvent({
7
16
  type: 'hover-change',
8
17
  graphics: Array.from(graphics)
@@ -25,7 +34,8 @@ export class HoverHelper extends EventDispatcher {
25
34
  this.timer.dispose();
26
35
  }
27
36
  constructor(context){
28
- super(), this.context = context, this.curGraphics = new Set(), this.timer = new Timer(), this.graphicTimerMap = new Map(), this.onPointerMove = ({ graphics, pois, e })=>{
37
+ super(), this.context = context, this.curGraphics = new Set(), this.timer = new Timer(), this.graphicTimerMap = new Map(), this.onPointerMove = (param)=>{
38
+ let { graphics, pois, e } = param;
29
39
  const poiGraphics = pois.map((item)=>{
30
40
  var _this_context_currentFloor;
31
41
  return (_this_context_currentFloor = this.context.currentFloor) == null ? void 0 : _this_context_currentFloor.graphicLayer.graphicMap.get(item.options.id);
@@ -1,3 +1,12 @@
1
+ import "core-js/modules/web.dom-collections.iterator.js";
2
+ import "core-js/modules/es.set.difference.v2.js";
3
+ import "core-js/modules/es.set.intersection.v2.js";
4
+ import "core-js/modules/es.set.is-disjoint-from.v2.js";
5
+ import "core-js/modules/es.set.is-subset-of.v2.js";
6
+ import "core-js/modules/es.set.is-superset-of.v2.js";
7
+ import "core-js/modules/es.set.symmetric-difference.v2.js";
8
+ import "core-js/modules/es.set.union.v2.js";
9
+ import "core-js/modules/es.array.push.js";
1
10
  import { EventDispatcher } from "three";
2
11
  import { BoxSelection } from "./box-selection";
3
12
  import { isControl, isMac } from "../../utils";
@@ -108,7 +117,8 @@ export class Selection extends EventDispatcher {
108
117
  if (isControl(e.key)) {
109
118
  this.disableBoxSelection();
110
119
  }
111
- }, this.onBoxSelected = ({ list })=>{
120
+ }, this.onBoxSelected = (param)=>{
121
+ let { list } = param;
112
122
  this._list.clear();
113
123
  list.forEach((item)=>{
114
124
  this._list.add(item);
@@ -1,11 +1,17 @@
1
+ /**
2
+ * 定位结果有三种:视觉定位结果、beacon定位结果、pdr定位结果
3
+ * 以 pdr 定位为主要流程,以视觉结果和beacon结果为校准,其中主视觉定位,beacon是在长期无视觉情况下才会采用的
4
+ * 以视觉定位结果计算角度、速度,通过卡尔曼滤波平滑速度和角度的变化
5
+ * 什么时候通过视觉、蓝牙校准pdr的结果???
6
+ */
1
7
  import { EventDispatcher } from "three";
2
- import { Compass } from "./compass";
3
8
  import { Timer } from "../../utils";
9
+ import { KalmanFilter } from "./kalman-filter";
4
10
  export interface CarPosition {
5
11
  position: [number, number];
6
12
  time: number;
7
13
  clientTime: number;
8
- type: "vision" | "beacon";
14
+ type: "vision" | "beacon" | "pdr";
9
15
  }
10
16
  export interface CarPosInfo {
11
17
  success: boolean;
@@ -14,25 +20,51 @@ export interface CarPosInfo {
14
20
  speed: number;
15
21
  }
16
22
  interface CarInertialPositionEventMap {
17
- 'change-compass': {
23
+ "change-compass": {
18
24
  value: number;
19
25
  };
20
- 'change-pos': {
26
+ "change-position-compass": {
27
+ value: number;
28
+ };
29
+ "change-pos": {
21
30
  value: CarPosInfo;
22
31
  };
23
32
  }
24
33
  export declare class CarInertialPosition extends EventDispatcher<CarInertialPositionEventMap> {
25
34
  history: CarPosition[];
26
- compass: Compass;
27
- compassAngle: number;
35
+ visionHistory: CarPosition[];
36
+ speed: number;
37
+ angle: null | number;
28
38
  timer: Timer;
29
39
  positionTimer: number | null;
30
- autoCleanTimer: number | null;
40
+ speedFilter: KalmanFilter;
41
+ visionExcessesCount: number;
42
+ beaconExcessesCount: number;
43
+ angleExcessesCount: number;
44
+ pathAngle: number;
31
45
  constructor();
32
- startCompass(): void;
33
- setPosition(position: CarPosition['position'], time: number, duration: number): void;
34
- setBeaconPosition(position: CarPosition['position'], time: number, duration: number): void;
46
+ setPathAngle(angle: number): void;
47
+ changeSpeed(): void;
48
+ changeAngle(histories?: CarPosition[]): void;
49
+ setAngle(angle: number, dispatch?: boolean): void;
50
+ /**
51
+ * 添加视觉结果
52
+ * @param position
53
+ * @param time
54
+ * @param duration
55
+ * @returns
56
+ */
57
+ setPosition(position: CarPosition["position"], time: number, duration: number): void;
58
+ resetPdrPosition(): void;
59
+ /**
60
+ * 获取 最后一个视觉坐标在加了pdr惯性的坐标
61
+ */
62
+ getLastVisionPdrPos(): CarPosition | null;
63
+ private _setVisionHistoryForAngle;
64
+ addHistory(data: CarPosition): void;
65
+ setBeaconPosition(position: CarPosition["position"], time: number, duration: number): void;
35
66
  startPositionTimer(): void;
67
+ changePosition(from?: string): void;
36
68
  getPosition(from: string): CarPosInfo;
37
69
  dispose(): void;
38
70
  }