@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
|
@@ -1,5 +1,7 @@
|
|
|
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/es.array.unshift.js";
|
|
3
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
4
|
+
import "core-js/modules/es.array.push.js";
|
|
3
5
|
import { EventDispatcher, Vector2 } from "three";
|
|
4
6
|
import { calc_angle, calc_direction, distancePointToSegment, getLength, getPathLength, getPointEdgeIndex, getPosByPathDistance, PathDirection, Timer, TweenUtil } from "../../utils";
|
|
5
7
|
import { Tween } from "@tweenjs/tween.js";
|
|
@@ -157,57 +159,54 @@ export class PositionNavigation extends EventDispatcher {
|
|
|
157
159
|
this.paused = false;
|
|
158
160
|
this.startCurRouteSimulation();
|
|
159
161
|
}
|
|
160
|
-
startCurRouteSimulation() {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}).start();
|
|
209
|
-
});
|
|
210
|
-
})();
|
|
162
|
+
async startCurRouteSimulation() {
|
|
163
|
+
const { curRoutePath } = this;
|
|
164
|
+
if (!curRoutePath) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (this.simulationTween) {
|
|
168
|
+
this.tweenUtil.remove(this.simulationTween);
|
|
169
|
+
}
|
|
170
|
+
const arr = [];
|
|
171
|
+
return new Promise((resolve)=>{
|
|
172
|
+
const path = [
|
|
173
|
+
this.position,
|
|
174
|
+
...this.curRoutePathPoints.slice(this.pointIndex + 1)
|
|
175
|
+
];
|
|
176
|
+
const distance = this.getCurRouteRemainDistance();
|
|
177
|
+
const time = distance / this.options.simulationSpeed;
|
|
178
|
+
const onUpdate = this.throttleUpdatePosition = throttle((v)=>{
|
|
179
|
+
const pos = getPosByPathDistance(path, v.distance);
|
|
180
|
+
if (!pos) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
arr.push({
|
|
184
|
+
floor: curRoutePath.floor,
|
|
185
|
+
pos
|
|
186
|
+
});
|
|
187
|
+
this.toPosition(curRoutePath.floor, pos);
|
|
188
|
+
}, 100);
|
|
189
|
+
const tween = this.simulationTween = new Tween({
|
|
190
|
+
distance: 0
|
|
191
|
+
}, this.tweenUtil.group).to({
|
|
192
|
+
distance
|
|
193
|
+
}, time * 1000).onUpdate(onUpdate).onComplete(()=>{
|
|
194
|
+
this.tweenUtil.remove(tween);
|
|
195
|
+
onUpdate.flush();
|
|
196
|
+
onUpdate.cancel();
|
|
197
|
+
if (this.routeIndex + 1 < this.paths.length) {
|
|
198
|
+
this.routeIndex++;
|
|
199
|
+
this.position = this.paths[this.routeIndex].points[0];
|
|
200
|
+
this.pointIndex = 0;
|
|
201
|
+
setTimeout(()=>{
|
|
202
|
+
resolve(this.startCurRouteSimulation());
|
|
203
|
+
}, 3000);
|
|
204
|
+
} else {
|
|
205
|
+
resolve(true);
|
|
206
|
+
console.log(arr, this.routeIndex, this.paths);
|
|
207
|
+
}
|
|
208
|
+
}).start();
|
|
209
|
+
});
|
|
211
210
|
}
|
|
212
211
|
changeSimulationSpeed(speed) {
|
|
213
212
|
this.options.simulationSpeed = speed;
|
|
@@ -373,7 +372,8 @@ export class PositionNavigation extends EventDispatcher {
|
|
|
373
372
|
] // 当前吸附后的位置
|
|
374
373
|
, this.routeIndex = 0 // 当前位置所在路线下标
|
|
375
374
|
, this.pointIndex = 0 // 当前位置在当前路线段所在的下标
|
|
376
|
-
, this.paths = [], this.timer = new Timer(), this.resetTimer = null, this.tweenUtil = new TweenUtil(), this.paused = false, this.onAddPaths = (
|
|
375
|
+
, this.paths = [], this.timer = new Timer(), this.resetTimer = null, this.tweenUtil = new TweenUtil(), this.paused = false, this.onAddPaths = (param)=>{
|
|
376
|
+
let { paths } = param;
|
|
377
377
|
this.paths = paths;
|
|
378
378
|
this.resetStatus(paths);
|
|
379
379
|
// this.emitNavigationStatus()
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
+
import "core-js/modules/es.typed-array.uint8-array.js";
|
|
2
|
+
import "core-js/modules/es.typed-array.at.js";
|
|
3
|
+
import "core-js/modules/es.typed-array.fill.js";
|
|
4
|
+
import "core-js/modules/es.typed-array.find-last.js";
|
|
5
|
+
import "core-js/modules/es.typed-array.find-last-index.js";
|
|
6
|
+
import "core-js/modules/es.typed-array.set.js";
|
|
7
|
+
import "core-js/modules/es.typed-array.sort.js";
|
|
8
|
+
import "core-js/modules/es.typed-array.to-reversed.js";
|
|
9
|
+
import "core-js/modules/es.typed-array.to-sorted.js";
|
|
10
|
+
import "core-js/modules/es.typed-array.with.js";
|
|
11
|
+
import "core-js/modules/es.array-buffer.constructor.js";
|
|
12
|
+
import "core-js/modules/es.array-buffer.slice.js";
|
|
13
|
+
import "core-js/modules/es.array-buffer.detached.js";
|
|
14
|
+
import "core-js/modules/es.array-buffer.transfer.js";
|
|
15
|
+
import "core-js/modules/es.array-buffer.transfer-to-fixed-length.js";
|
|
16
|
+
import "core-js/modules/es.typed-array.from.js";
|
|
17
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
1
18
|
import { DataTexture, LinearFilter, RGBAFormat, Sprite, SpriteMaterial } from "three";
|
|
2
19
|
import { Poi2 } from "../../elements";
|
|
3
20
|
export class StartRotateHelperPoi extends Poi2 {
|
|
4
21
|
addDebug() {
|
|
5
|
-
StartRotateHelperPoi.canvas.style.cssText =
|
|
6
|
-
position: fixed;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
z-index: 9999;
|
|
10
|
-
`;
|
|
22
|
+
StartRotateHelperPoi.canvas.style.cssText = "\n position: fixed;\n top: 0;\n left: 0;\n z-index: 9999;\n ";
|
|
11
23
|
document.body.appendChild(StartRotateHelperPoi.canvas);
|
|
12
24
|
}
|
|
13
25
|
setAngle(angle) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// import * as math from "mathjs";
|
|
2
|
+
import "core-js/modules/es.array.push.js";
|
|
3
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
2
4
|
export class ImuPosition {
|
|
3
5
|
init() {
|
|
4
6
|
this.fre = 100; // IMU init frequency, dynamic adjust
|
|
@@ -59,15 +61,17 @@ export class ImuPosition {
|
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
63
|
* Set PDR init pose.
|
|
62
|
-
*/ setInitPose(pose
|
|
63
|
-
0
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
*/ setInitPose(pose) {
|
|
65
|
+
if (pose === void 0) pose = [
|
|
66
|
+
0,
|
|
67
|
+
0
|
|
68
|
+
];
|
|
66
69
|
this.last_px = pose[0];
|
|
67
70
|
this.last_py = pose[1];
|
|
68
|
-
console.info(
|
|
71
|
+
console.info("pdr init pos: " + this.last_px + ", " + this.last_py);
|
|
69
72
|
}
|
|
70
|
-
setInitYaw(yaw
|
|
73
|
+
setInitYaw(yaw) {
|
|
74
|
+
if (yaw === void 0) yaw = 0;
|
|
71
75
|
this.last_yaw = yaw;
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
@@ -168,7 +172,7 @@ export class ImuPosition {
|
|
|
168
172
|
*/ imuFreUpdate() {
|
|
169
173
|
if (this.accH_time_fifo.length > 2) {
|
|
170
174
|
if (this.accH_time_fifo[this.accH_time_fifo.length - 1] - this.accH_time_fifo[this.accH_time_fifo.length - 2] < 0 || this.accH_time_fifo[this.accH_time_fifo.length - 1] - this.accH_time_fifo[this.accH_time_fifo.length - 2] > 10 || this.accH_time_fifo[this.accH_time_fifo.length - 1] === this.accH_time_fifo[0]) {
|
|
171
|
-
console.warn(
|
|
175
|
+
console.warn("pdr reset last one time " + this.accH_time_fifo[this.accH_time_fifo.length - 1] + " last two time " + this.accH_time_fifo[this.accH_time_fifo.length - 2]);
|
|
172
176
|
this.reset();
|
|
173
177
|
}
|
|
174
178
|
}
|
|
@@ -177,10 +181,10 @@ export class ImuPosition {
|
|
|
177
181
|
if (Math.abs(this.fre - new_fre) > 8) {
|
|
178
182
|
this.fre = Math.round((new_fre - 3) / 10.0) * 10; // update imu fre
|
|
179
183
|
if (this.fre <= 10 || this.fre >= 100) {
|
|
180
|
-
console.warn(
|
|
184
|
+
console.warn("Frequency Error " + this.fre);
|
|
181
185
|
this.fre = 100;
|
|
182
186
|
}
|
|
183
|
-
console.debug(
|
|
187
|
+
console.debug("Frequency change to " + this.fre);
|
|
184
188
|
this.accH_fifo_len = Math.floor(1 * this.fre) + 1;
|
|
185
189
|
}
|
|
186
190
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/es.array.push.js";
|
|
2
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
1
3
|
import { euclideanDist, gaussLikelihood, limitYaw } from "./utils";
|
|
2
4
|
import { reshape, multiply } from 'mathjs';
|
|
3
5
|
class ParticleFilter {
|
|
@@ -182,11 +184,11 @@ class ParticleFilter {
|
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
186
|
initParticlesByCompass(compass) {
|
|
185
|
-
console.log(
|
|
187
|
+
console.log("Init compass: " + compass);
|
|
186
188
|
let yaw_compass = 360 - compass;
|
|
187
189
|
yaw_compass += this.delta_yaw;
|
|
188
190
|
yaw_compass = limitYaw(yaw_compass);
|
|
189
|
-
console.log(
|
|
191
|
+
console.log("Init Yaw: " + yaw_compass);
|
|
190
192
|
for(let index = 0; index < this.NumParticle; index++){
|
|
191
193
|
const yaw_noise = (2 * Math.random() - 1) * this.initial_yaw_uncertainty;
|
|
192
194
|
this.particleX[2][index] = yaw_compass + yaw_noise;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import "core-js/modules/es.array.push.js";
|
|
2
3
|
import { SENSOR_TYPE } from "./enum";
|
|
3
4
|
import { ParticleFilter } from "./particle";
|
|
4
5
|
import { wgs84ToWebMercator, euclideanDist } from "./utils"; // Assuming these exist
|
|
@@ -66,16 +67,16 @@ export class PositioningSystem {
|
|
|
66
67
|
if (gps_pos) {
|
|
67
68
|
this.particleFilter.initParticlesByPos(gps_pos.x, gps_pos.y, ()=>true);
|
|
68
69
|
this.last_pos_time = time;
|
|
69
|
-
console.log(
|
|
70
|
+
console.log("init Pos by gps success time " + time);
|
|
70
71
|
this.cacheSensorData.length = 0;
|
|
71
72
|
} else {
|
|
72
|
-
console.log(
|
|
73
|
+
console.log("init Pos by gps fail time " + time);
|
|
73
74
|
}
|
|
74
75
|
} else if (!this.particleFilter.getYawInitFlag() && data_type === SENSOR_TYPE.COMPASS) {
|
|
75
76
|
const compass = data;
|
|
76
77
|
this.particleFilter.initParticlesByCompass(compass);
|
|
77
78
|
this.particleFilter.setLastCompassTime(time);
|
|
78
|
-
console.log(
|
|
79
|
+
console.log("init yaw by compass success time " + time);
|
|
79
80
|
}
|
|
80
81
|
if (success) {
|
|
81
82
|
this.last_pos_time = time;
|
|
@@ -126,7 +127,7 @@ export class PositioningSystem {
|
|
|
126
127
|
if (type === "gps" ? accuracy && dist > accuracy || dist > this.GpsMaxEstimateErr : dist > this.MaxEstimateErr) {
|
|
127
128
|
this.outTrustRegionNum += 1;
|
|
128
129
|
if (this.outTrustRegionNum >= this.TrustNum) {
|
|
129
|
-
console.info(
|
|
130
|
+
console.info("超出可信区域,重置粒子过滤器到: " + pos.x + ", " + pos.y);
|
|
130
131
|
this.particleFilter.setPosInitFlag(false);
|
|
131
132
|
this.particleFilter.setYawInitFlag(false);
|
|
132
133
|
this.outTrustRegionNum = 0;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
1
2
|
import { EventDispatcher } from "three";
|
|
2
3
|
import { PositioningSystem } from "./pdr";
|
|
3
4
|
import { Sensor } from "./sensor";
|
|
@@ -8,7 +9,8 @@ export class PdrPosition extends EventDispatcher {
|
|
|
8
9
|
}
|
|
9
10
|
start() {
|
|
10
11
|
this.sensor.start();
|
|
11
|
-
this.sensor.addEventListener("add-data-item", (
|
|
12
|
+
this.sensor.addEventListener("add-data-item", (param)=>{
|
|
13
|
+
let { item } = param;
|
|
12
14
|
this.getPositionBySensorItem(item, !this._pause);
|
|
13
15
|
});
|
|
14
16
|
}
|
|
@@ -18,7 +20,8 @@ export class PdrPosition extends EventDispatcher {
|
|
|
18
20
|
continue() {
|
|
19
21
|
this._pause = false;
|
|
20
22
|
}
|
|
21
|
-
getPositionBySensorItem(data, dispatch
|
|
23
|
+
getPositionBySensorItem(data, dispatch) {
|
|
24
|
+
if (dispatch === void 0) dispatch = true;
|
|
22
25
|
const [success, x, y] = this.pdr.pfFusionPDRiBeacon(data);
|
|
23
26
|
if (success && dispatch) {
|
|
24
27
|
this.dispatchEvent({
|
|
@@ -1,5 +1,5 @@
|
|
|
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/es.array.push.js";
|
|
3
3
|
import { cloneDeep, isNil, throttle } from "lodash";
|
|
4
4
|
import { isIphone, Timer } from "../../utils";
|
|
5
5
|
import { EventDispatcher } from "three";
|
|
@@ -76,32 +76,27 @@ export class Sensor extends EventDispatcher {
|
|
|
76
76
|
enableHighAccuracy: true
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
checkSensor() {
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
deviceOrientation
|
|
85
|
-
};
|
|
86
|
-
})();
|
|
79
|
+
async checkSensor() {
|
|
80
|
+
const deviceOrientation = await this.checkDeviceOrientation();
|
|
81
|
+
return {
|
|
82
|
+
deviceOrientation
|
|
83
|
+
};
|
|
87
84
|
}
|
|
88
|
-
checkDeviceOrientation() {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
85
|
+
async checkDeviceOrientation() {
|
|
86
|
+
var _window_DeviceOrientationEvent;
|
|
87
|
+
if (!isIphone) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (typeof window.DeviceOrientationEvent !== 'undefined' && typeof ((_window_DeviceOrientationEvent = window.DeviceOrientationEvent) == null ? void 0 : _window_DeviceOrientationEvent.requestPermission) === 'function') {
|
|
91
|
+
try {
|
|
92
|
+
var _window_DeviceOrientationEvent1;
|
|
93
|
+
const permission = await ((_window_DeviceOrientationEvent1 = window.DeviceOrientationEvent) == null ? void 0 : _window_DeviceOrientationEvent1.requestPermission());
|
|
94
|
+
return permission === 'granted';
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return false;
|
|
102
97
|
}
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
105
100
|
}
|
|
106
101
|
stop() {
|
|
107
102
|
window.removeEventListener('devicemotion', this.handleAcceleration, false);
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
3
|
+
import "core-js/modules/es.set.difference.v2.js";
|
|
4
|
+
import "core-js/modules/es.set.intersection.v2.js";
|
|
5
|
+
import "core-js/modules/es.set.is-disjoint-from.v2.js";
|
|
6
|
+
import "core-js/modules/es.set.is-subset-of.v2.js";
|
|
7
|
+
import "core-js/modules/es.set.is-superset-of.v2.js";
|
|
8
|
+
import "core-js/modules/es.set.symmetric-difference.v2.js";
|
|
9
|
+
import "core-js/modules/es.set.union.v2.js";
|
|
10
|
+
import "core-js/modules/es.array.push.js";
|
|
2
11
|
import { Plugin } from "../base";
|
|
3
12
|
import { BoxSelection } from "./box-selection";
|
|
4
13
|
import { isControl, isMac } from "../../utils";
|
|
@@ -126,7 +135,8 @@ export class BMapSelect extends Plugin {
|
|
|
126
135
|
if (isControl(e.key)) {
|
|
127
136
|
this.disableBoxSelection();
|
|
128
137
|
}
|
|
129
|
-
}, this.onBoxSelected = (
|
|
138
|
+
}, this.onBoxSelected = (param)=>{
|
|
139
|
+
let { list } = param;
|
|
130
140
|
this._list.clear();
|
|
131
141
|
this._poiList.clear();
|
|
132
142
|
list.forEach((item)=>{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
1
2
|
import { Box3, Vector3 } from "three";
|
|
2
3
|
import { vector3ToDevice } from "./coordinate";
|
|
3
4
|
import { Floor } from "../elements";
|
|
@@ -61,7 +62,8 @@ export class CameraBound {
|
|
|
61
62
|
* 检测地图是不是在显示范围
|
|
62
63
|
* @param param0
|
|
63
64
|
* @returns
|
|
64
|
-
*/ checkDistanceToScreenEdge(
|
|
65
|
+
*/ checkDistanceToScreenEdge(param) {
|
|
66
|
+
let { left, right, top, bottom } = param;
|
|
65
67
|
const { width, height } = this.context.clientSize;
|
|
66
68
|
const [pt, pr, pb, pl] = this.context.config.cameraBound.padding;
|
|
67
69
|
// 判断右边是不是超出 true 没有超出
|
package/lib/src/utils/color.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import "core-js/modules/es.string.replace.js";
|
|
2
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
3
|
+
import "core-js/modules/es.string.trim.js";
|
|
1
4
|
export function strToNumber(str) {
|
|
2
5
|
return parseInt(str.replace("#", "0x"), 16);
|
|
3
6
|
}
|
|
@@ -16,10 +19,11 @@ export function strToNumber(str) {
|
|
|
16
19
|
let newG = Math.round(g * alpha);
|
|
17
20
|
let newB = Math.round(b * alpha);
|
|
18
21
|
// 将新的RGB数值转换为16进制格式
|
|
19
|
-
let newHexColor =
|
|
22
|
+
let newHexColor = "#" + (1 << 24 | newR << 16 | newG << 8 | newB).toString(16).slice(1);
|
|
20
23
|
return newHexColor;
|
|
21
24
|
}
|
|
22
|
-
export function darkenColor(hexColor, factor
|
|
25
|
+
export function darkenColor(hexColor, factor) {
|
|
26
|
+
if (factor === void 0) factor = 0.85;
|
|
23
27
|
let r;
|
|
24
28
|
let g;
|
|
25
29
|
let b;
|
|
@@ -52,8 +56,8 @@ export function hexToRgb(hex, opacity) {
|
|
|
52
56
|
const b = parseInt(hex.substring(4, 6), 16);
|
|
53
57
|
// 如果提供了opacity,构造RGBA格式
|
|
54
58
|
if (opacity !== undefined) {
|
|
55
|
-
return
|
|
59
|
+
return "rgba(" + r + ", " + g + ", " + b + ", " + opacity + ")";
|
|
56
60
|
}
|
|
57
61
|
// 默认返回RGB格式
|
|
58
|
-
return
|
|
62
|
+
return "rgb(" + r + ", " + g + ", " + b + ")";
|
|
59
63
|
}
|
package/lib/src/utils/create.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BoxGeometry, BufferGeometry, Line, LineBasicMaterial, Mesh } from "three";
|
|
2
|
-
export function createThreeLine(points, color
|
|
2
|
+
export function createThreeLine(points, color) {
|
|
3
|
+
if (color === void 0) color = 0xff0000;
|
|
3
4
|
const material = new LineBasicMaterial({
|
|
4
5
|
color: color
|
|
5
6
|
});
|
|
@@ -7,7 +8,8 @@ export function createThreeLine(points, color = 0xff0000) {
|
|
|
7
8
|
const line = new Line(geometry, material);
|
|
8
9
|
return line;
|
|
9
10
|
}
|
|
10
|
-
export function createThreeBox(pos, color
|
|
11
|
+
export function createThreeBox(pos, color) {
|
|
12
|
+
if (color === void 0) color = 0xff0000;
|
|
11
13
|
const material = new LineBasicMaterial({
|
|
12
14
|
color: color
|
|
13
15
|
});
|
package/lib/src/utils/events.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
|
const oncePrefix = '__once__';
|
|
2
10
|
export class Events {
|
|
3
11
|
on(type, callback) {
|
|
@@ -12,7 +20,7 @@ export class Events {
|
|
|
12
20
|
}
|
|
13
21
|
once(type, callback) {
|
|
14
22
|
if (typeof callback !== 'function') return undefined;
|
|
15
|
-
const event =
|
|
23
|
+
const event = "" + oncePrefix + type;
|
|
16
24
|
const events = this.events.get(event);
|
|
17
25
|
if (events) {
|
|
18
26
|
return events.add(callback);
|
|
@@ -23,7 +31,7 @@ export class Events {
|
|
|
23
31
|
}
|
|
24
32
|
off(type, callback) {
|
|
25
33
|
const events = this.events.get(type);
|
|
26
|
-
const onceEvents = this.events.get(
|
|
34
|
+
const onceEvents = this.events.get("" + oncePrefix + type);
|
|
27
35
|
if (!events && !onceEvents) {
|
|
28
36
|
return;
|
|
29
37
|
}
|
|
@@ -41,9 +49,12 @@ export class Events {
|
|
|
41
49
|
offAll() {
|
|
42
50
|
this.events.clear();
|
|
43
51
|
}
|
|
44
|
-
emit(type
|
|
52
|
+
emit(type) {
|
|
53
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
54
|
+
args[_key - 1] = arguments[_key];
|
|
55
|
+
}
|
|
45
56
|
const events = this.events.get(type);
|
|
46
|
-
const onceEvents = this.events.get(
|
|
57
|
+
const onceEvents = this.events.get("" + oncePrefix + type);
|
|
47
58
|
if (!events && !onceEvents) {
|
|
48
59
|
return;
|
|
49
60
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
1
|
let _db;
|
|
3
2
|
/**
|
|
4
3
|
* 获取indexDb连接
|
|
5
4
|
* @param database
|
|
6
5
|
* @returns
|
|
7
|
-
*/ export function createDb(database
|
|
6
|
+
*/ export function createDb(database, version) {
|
|
7
|
+
if (database === void 0) database = "aibee_map";
|
|
8
|
+
if (version === void 0) version = 1;
|
|
8
9
|
return new Promise((resolve, reject)=>{
|
|
9
10
|
if (_db) {
|
|
10
11
|
return resolve({
|
|
@@ -40,7 +41,8 @@ let _db;
|
|
|
40
41
|
* @param key
|
|
41
42
|
* @param db
|
|
42
43
|
* @returns
|
|
43
|
-
*/ export function get(storeName, key, db
|
|
44
|
+
*/ export function get(storeName, key, db) {
|
|
45
|
+
if (db === void 0) db = _db;
|
|
44
46
|
return new Promise((resolve, reject)=>{
|
|
45
47
|
if (!db) {
|
|
46
48
|
reject("没有db");
|
|
@@ -69,13 +71,14 @@ let _db;
|
|
|
69
71
|
* @param value
|
|
70
72
|
* @param db
|
|
71
73
|
* @returns
|
|
72
|
-
*/ export function set(storeName, key, value, db
|
|
74
|
+
*/ export function set(storeName, key, value, db) {
|
|
75
|
+
if (db === void 0) db = _db;
|
|
73
76
|
return new Promise((resolve, reject)=>{
|
|
74
77
|
if (!db) {
|
|
75
78
|
reject("没有db");
|
|
76
79
|
}
|
|
77
|
-
return new Promise(
|
|
78
|
-
const has =
|
|
80
|
+
return new Promise(async (resolve, reject)=>{
|
|
81
|
+
const has = await get(storeName, key);
|
|
79
82
|
const objectStore = db.transaction([
|
|
80
83
|
storeName
|
|
81
84
|
], "readwrite").objectStore(storeName);
|
|
@@ -92,7 +95,7 @@ let _db;
|
|
|
92
95
|
request.onerror = function(event) {
|
|
93
96
|
reject(event);
|
|
94
97
|
};
|
|
95
|
-
})
|
|
98
|
+
});
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
/**
|
|
@@ -100,7 +103,8 @@ let _db;
|
|
|
100
103
|
* @param storeName
|
|
101
104
|
* @param db
|
|
102
105
|
* @returns
|
|
103
|
-
*/ export function createStore(storeName, db
|
|
106
|
+
*/ export function createStore(storeName, db) {
|
|
107
|
+
if (db === void 0) db = _db;
|
|
104
108
|
if (!db) {
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
@@ -116,7 +120,8 @@ let _db;
|
|
|
116
120
|
* @param key
|
|
117
121
|
* @param db
|
|
118
122
|
* @returns
|
|
119
|
-
*/ export function remove(storeName, key, db
|
|
123
|
+
*/ export function remove(storeName, key, db) {
|
|
124
|
+
if (db === void 0) db = _db;
|
|
120
125
|
return new Promise((resolve, reject)=>{
|
|
121
126
|
if (!db) {
|
|
122
127
|
reject("没有db");
|
|
@@ -142,7 +147,8 @@ let _db;
|
|
|
142
147
|
* @param value
|
|
143
148
|
* @param db
|
|
144
149
|
* @returns
|
|
145
|
-
*/ export function update(storeName, key, value, db
|
|
150
|
+
*/ export function update(storeName, key, value, db) {
|
|
151
|
+
if (db === void 0) db = _db;
|
|
146
152
|
return new Promise((resolve, reject)=>{
|
|
147
153
|
if (!db) {
|
|
148
154
|
reject("没有db");
|
|
@@ -164,7 +170,8 @@ let _db;
|
|
|
164
170
|
});
|
|
165
171
|
});
|
|
166
172
|
}
|
|
167
|
-
export function closeDb(db
|
|
173
|
+
export function closeDb(db) {
|
|
174
|
+
if (db === void 0) db = _db;
|
|
168
175
|
db == null ? void 0 : db.close();
|
|
169
176
|
_db = null;
|
|
170
177
|
}
|
|
@@ -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 { Shape, Group, DirectionalLight, AmbientLight, Path, Vector2 } from "three";
|
|
2
4
|
export function initLight() {
|
|
3
5
|
const lights = new Group();
|
|
@@ -11,7 +13,8 @@ export function initLight() {
|
|
|
11
13
|
lights.add(ambientLight);
|
|
12
14
|
return lights;
|
|
13
15
|
}
|
|
14
|
-
export function initShape(path, holePath
|
|
16
|
+
export function initShape(path, holePath) {
|
|
17
|
+
if (holePath === void 0) holePath = [];
|
|
15
18
|
const shape = new Shape(path.map((item)=>new Vector2(...item)));
|
|
16
19
|
if (holePath.length) {
|
|
17
20
|
holePath.forEach((cur)=>{
|
|
@@ -21,7 +24,9 @@ export function initShape(path, holePath = []) {
|
|
|
21
24
|
}
|
|
22
25
|
return shape;
|
|
23
26
|
}
|
|
24
|
-
export function initDirectionalLight(color
|
|
27
|
+
export function initDirectionalLight(color, intensity) {
|
|
28
|
+
if (color === void 0) color = 0xffffff;
|
|
29
|
+
if (intensity === void 0) intensity = 1;
|
|
25
30
|
const directionalLight = new DirectionalLight(color, intensity);
|
|
26
31
|
directionalLight.castShadow = true;
|
|
27
32
|
directionalLight.shadow.radius = 8;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* 生成对象的key
|
|
3
3
|
* @param obj
|
|
4
4
|
* @returns
|
|
5
|
-
*/
|
|
6
|
-
|
|
5
|
+
*/ import "core-js/modules/es.array.sort.js";
|
|
6
|
+
export function generatorKeyByObj(obj) {
|
|
7
|
+
return Object.keys(obj).sort().map((key)=>key + "=" + obj[key]).join("&");
|
|
7
8
|
}
|
package/lib/src/utils/os.js
CHANGED