@aibee/crc-bmap 0.0.115 → 0.0.116
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 +3691 -5
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +325 -75
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +5 -5
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +4 -4
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/elements/floor.d.ts +2 -0
- package/lib/src/elements/glb-model.d.ts +21 -0
- package/lib/src/elements/ground-texture.d.ts +6 -6
- package/lib/src/elements/index.d.ts +2 -0
- package/lib/src/elements/lane.d.ts +38 -0
- package/lib/src/factory/material.d.ts +8 -0
- package/lib/src/loader/AibeeLoader/type.d.ts +16 -8
- package/lib/src/loader/AibeeLoader/utils.d.ts +5 -2
- package/lib/src/types/index.d.ts +2 -0
- package/lib/src/utils/index-db.d.ts +1 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -454,7 +454,7 @@ var require_Graph = __commonJS({
|
|
|
454
454
|
});
|
|
455
455
|
|
|
456
456
|
// src/bmap.ts
|
|
457
|
-
import { EventDispatcher as EventDispatcher7, Vector3 as
|
|
457
|
+
import { EventDispatcher as EventDispatcher7, Vector3 as Vector318 } from "three";
|
|
458
458
|
|
|
459
459
|
// src/utils/timer.ts
|
|
460
460
|
var Timer = class {
|
|
@@ -527,11 +527,14 @@ import {
|
|
|
527
527
|
DirectionalLight,
|
|
528
528
|
AmbientLight,
|
|
529
529
|
Path,
|
|
530
|
-
Vector2
|
|
530
|
+
Vector2,
|
|
531
|
+
AxesHelper
|
|
531
532
|
} from "three";
|
|
532
533
|
import { MapControls } from "three/examples/jsm/controls/MapControls";
|
|
533
534
|
function initScene() {
|
|
534
535
|
const scene = new Scene();
|
|
536
|
+
const axes = new AxesHelper(1e3);
|
|
537
|
+
scene.add(axes);
|
|
535
538
|
scene.background = new Color(16777215);
|
|
536
539
|
return scene;
|
|
537
540
|
}
|
|
@@ -1619,10 +1622,10 @@ function toWebWorker(obj) {
|
|
|
1619
1622
|
import {
|
|
1620
1623
|
EventDispatcher as EventDispatcher6,
|
|
1621
1624
|
Box2,
|
|
1622
|
-
Vector3 as
|
|
1623
|
-
Vector2 as
|
|
1625
|
+
Vector3 as Vector317,
|
|
1626
|
+
Vector2 as Vector26,
|
|
1624
1627
|
Raycaster as Raycaster3,
|
|
1625
|
-
Box3 as
|
|
1628
|
+
Box3 as Box39,
|
|
1626
1629
|
Color as Color5,
|
|
1627
1630
|
AmbientLight as AmbientLight2
|
|
1628
1631
|
} from "three";
|
|
@@ -2953,10 +2956,14 @@ var Floor = class extends Object3D8 {
|
|
|
2953
2956
|
this.poiLayer = new PoiLayer(this.context);
|
|
2954
2957
|
this.wallLayer = new Layer(this.context);
|
|
2955
2958
|
this.textureLayer = new Layer(this.context);
|
|
2959
|
+
this.glbModelLayer = new Layer(this.context);
|
|
2960
|
+
this.laneLayer = new Layer(this.context);
|
|
2956
2961
|
this.groundUpper.add(this.graphicLayer);
|
|
2957
2962
|
this.groundUpper.add(this.poiLayer);
|
|
2958
2963
|
this.groundUpper.add(this.wallLayer);
|
|
2959
2964
|
this.groundUpper.add(this.textureLayer);
|
|
2965
|
+
this.groundUpper.add(this.glbModelLayer);
|
|
2966
|
+
this.groundUpper.add(this.laneLayer);
|
|
2960
2967
|
this.add(this.groundUpper);
|
|
2961
2968
|
this.add(this.models);
|
|
2962
2969
|
}
|
|
@@ -2964,6 +2971,8 @@ var Floor = class extends Object3D8 {
|
|
|
2964
2971
|
poiLayer;
|
|
2965
2972
|
wallLayer;
|
|
2966
2973
|
textureLayer;
|
|
2974
|
+
glbModelLayer;
|
|
2975
|
+
laneLayer;
|
|
2967
2976
|
grounds = /* @__PURE__ */ new Set();
|
|
2968
2977
|
shadow = new Shadow();
|
|
2969
2978
|
heatmap;
|
|
@@ -3051,6 +3060,8 @@ var Floor = class extends Object3D8 {
|
|
|
3051
3060
|
this.poiLayer.dispose();
|
|
3052
3061
|
this.wallLayer.dispose();
|
|
3053
3062
|
this.textureLayer.dispose();
|
|
3063
|
+
this.glbModelLayer.dispose();
|
|
3064
|
+
this.laneLayer.dispose();
|
|
3054
3065
|
this.grounds.forEach((ground) => ground.dispose());
|
|
3055
3066
|
this.heatmap?.dispose();
|
|
3056
3067
|
this.groundUpper.clear();
|
|
@@ -3553,17 +3564,16 @@ var Wall = class extends Object3D9 {
|
|
|
3553
3564
|
};
|
|
3554
3565
|
|
|
3555
3566
|
// src/elements/ground-texture.ts
|
|
3556
|
-
import {
|
|
3567
|
+
import { ExtrudeGeometry as ExtrudeGeometry3, Mesh as Mesh5, Object3D as Object3D10 } from "three";
|
|
3557
3568
|
var defaultOptions4 = {
|
|
3558
3569
|
uuid: "",
|
|
3559
|
-
|
|
3570
|
+
iconUrl: "",
|
|
3560
3571
|
name: "",
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
width: 0,
|
|
3572
|
+
secondRotate: 0,
|
|
3573
|
+
airHeight: 0,
|
|
3574
|
+
deltaHeight: 0,
|
|
3565
3575
|
height: 0,
|
|
3566
|
-
|
|
3576
|
+
geometry: { cds: [], type: "polygon", coords: [], curveCpt: [], curveIndex: [] },
|
|
3567
3577
|
opacity: 1,
|
|
3568
3578
|
visible: true
|
|
3569
3579
|
};
|
|
@@ -3580,16 +3590,24 @@ var GroundTexture = class extends Object3D10 {
|
|
|
3580
3590
|
options;
|
|
3581
3591
|
mesh;
|
|
3582
3592
|
async init() {
|
|
3583
|
-
const {
|
|
3584
|
-
const
|
|
3593
|
+
const { deltaHeight, airHeight, geometry, iconUrl, opacity } = this.options;
|
|
3594
|
+
const shape = initShape(
|
|
3595
|
+
geometry.coords[0],
|
|
3596
|
+
geometry.coords.slice(1)
|
|
3597
|
+
);
|
|
3598
|
+
const extrudeGeometry = new ExtrudeGeometry3(shape, {
|
|
3599
|
+
steps: 1,
|
|
3600
|
+
bevelEnabled: false,
|
|
3601
|
+
depth: 0,
|
|
3602
|
+
curveSegments: 4
|
|
3603
|
+
});
|
|
3585
3604
|
const planeMaterial = await this.context.materialFactory.createGroundTextureMaterial({
|
|
3586
|
-
url,
|
|
3605
|
+
url: iconUrl,
|
|
3587
3606
|
opacity
|
|
3588
3607
|
});
|
|
3589
|
-
const mesh = new Mesh5(
|
|
3608
|
+
const mesh = new Mesh5(extrudeGeometry, planeMaterial);
|
|
3590
3609
|
this.mesh = mesh;
|
|
3591
|
-
this.mesh.position.
|
|
3592
|
-
mesh.setRotationFromEuler(new Euler(angleX, angleY, angleZ));
|
|
3610
|
+
this.mesh.position.z = airHeight + deltaHeight;
|
|
3593
3611
|
this.add(mesh);
|
|
3594
3612
|
}
|
|
3595
3613
|
dispose() {
|
|
@@ -3598,6 +3616,178 @@ var GroundTexture = class extends Object3D10 {
|
|
|
3598
3616
|
}
|
|
3599
3617
|
};
|
|
3600
3618
|
|
|
3619
|
+
// src/elements/glb-model.ts
|
|
3620
|
+
import { Box3 as Box37, Object3D as Object3D11, Vector3 as Vector312 } from "three";
|
|
3621
|
+
var defaultGlbOptions = {
|
|
3622
|
+
url: "",
|
|
3623
|
+
geometry: { type: "polygon", cds: [], coords: [], curveCpt: [], curveIndex: [] },
|
|
3624
|
+
id: "",
|
|
3625
|
+
width: 0,
|
|
3626
|
+
rotate: 1,
|
|
3627
|
+
airHeight: 1,
|
|
3628
|
+
deltaHeight: 0
|
|
3629
|
+
};
|
|
3630
|
+
var GlbModel = class extends Object3D11 {
|
|
3631
|
+
constructor(context, options) {
|
|
3632
|
+
super();
|
|
3633
|
+
this.context = context;
|
|
3634
|
+
this.options = Object.assign({}, defaultGlbOptions, options);
|
|
3635
|
+
this.loadModel();
|
|
3636
|
+
}
|
|
3637
|
+
model = null;
|
|
3638
|
+
options;
|
|
3639
|
+
async loadModel() {
|
|
3640
|
+
const object = await loadModel(this.options.url);
|
|
3641
|
+
object.scene.rotation.set(Math.PI / 2, Math.PI / 2, 0);
|
|
3642
|
+
const box = new Box37().setFromObject(object.scene);
|
|
3643
|
+
const size = box.getSize(new Vector312());
|
|
3644
|
+
const max = Math.max(size.x, size.y);
|
|
3645
|
+
const scale = this.options.width / max;
|
|
3646
|
+
this.scale.set(scale, scale, scale);
|
|
3647
|
+
this.add(object.scene);
|
|
3648
|
+
this.position.copy(box.getCenter(new Vector312()));
|
|
3649
|
+
this.position.z += this.options.airHeight + this.options.deltaHeight;
|
|
3650
|
+
this.model = object;
|
|
3651
|
+
}
|
|
3652
|
+
dispose() {
|
|
3653
|
+
dispose(this);
|
|
3654
|
+
this.model = null;
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3657
|
+
|
|
3658
|
+
// src/elements/lane.ts
|
|
3659
|
+
import { BufferGeometry as BufferGeometry3, ExtrudeGeometry as ExtrudeGeometry4, LineSegments as LineSegments3, Mesh as Mesh6, Object3D as Object3D12, Vector3 as Vector313 } from "three";
|
|
3660
|
+
import { mergeGeometries as mergeGeometries2 } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
3661
|
+
import { Line2 } from "three/examples/jsm/lines/line2";
|
|
3662
|
+
import { LineGeometry } from "three/examples/jsm/lines/lineGeometry";
|
|
3663
|
+
var Lane = class extends Object3D12 {
|
|
3664
|
+
constructor(context, options) {
|
|
3665
|
+
super();
|
|
3666
|
+
this.context = context;
|
|
3667
|
+
this.options = options;
|
|
3668
|
+
if (!options.length) {
|
|
3669
|
+
return;
|
|
3670
|
+
}
|
|
3671
|
+
this.init();
|
|
3672
|
+
}
|
|
3673
|
+
geometry;
|
|
3674
|
+
material;
|
|
3675
|
+
lineMaterial;
|
|
3676
|
+
lineGeometry;
|
|
3677
|
+
Mesh;
|
|
3678
|
+
LineMesh;
|
|
3679
|
+
initGeometry() {
|
|
3680
|
+
const geometries = this.options.map((option) => {
|
|
3681
|
+
const shape = initShape(
|
|
3682
|
+
option.geometry.coords[0],
|
|
3683
|
+
option.geometry.coords.slice(1)
|
|
3684
|
+
);
|
|
3685
|
+
const geometry = new ExtrudeGeometry4(shape, {
|
|
3686
|
+
steps: 1,
|
|
3687
|
+
bevelEnabled: false,
|
|
3688
|
+
depth: 0,
|
|
3689
|
+
curveSegments: 4
|
|
3690
|
+
});
|
|
3691
|
+
return geometry;
|
|
3692
|
+
});
|
|
3693
|
+
this.geometry = mergeGeometries2(geometries);
|
|
3694
|
+
}
|
|
3695
|
+
initMaterial() {
|
|
3696
|
+
const { fillColor, fillOpacity } = this.options[0];
|
|
3697
|
+
const material = this.context.materialFactory.createMeshBasicMaterial({
|
|
3698
|
+
color: fillColor,
|
|
3699
|
+
opacity: fillOpacity
|
|
3700
|
+
});
|
|
3701
|
+
this.material = material;
|
|
3702
|
+
return material;
|
|
3703
|
+
}
|
|
3704
|
+
initLineMaterial() {
|
|
3705
|
+
const { strokeColor, strokeOpacity } = this.options[0];
|
|
3706
|
+
const lineMaterial = this.context.materialFactory.createLineMaterial({
|
|
3707
|
+
color: strokeColor,
|
|
3708
|
+
opacity: strokeOpacity
|
|
3709
|
+
});
|
|
3710
|
+
this.lineMaterial = lineMaterial;
|
|
3711
|
+
return lineMaterial;
|
|
3712
|
+
}
|
|
3713
|
+
getBorderPoints(option) {
|
|
3714
|
+
const { deltaHeight, geometry } = option;
|
|
3715
|
+
const points = [];
|
|
3716
|
+
const _height = deltaHeight || 0;
|
|
3717
|
+
const { coords } = geometry;
|
|
3718
|
+
for (let j = 0; j < coords.length; j++) {
|
|
3719
|
+
const curCds = coords[j];
|
|
3720
|
+
for (let i = 0; i < curCds.length; i++) {
|
|
3721
|
+
const cur = curCds[i];
|
|
3722
|
+
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
3723
|
+
points.push(new Vector313(cur[0], cur[1], _height));
|
|
3724
|
+
points.push(new Vector313(next[0], next[1], _height));
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
return points;
|
|
3728
|
+
}
|
|
3729
|
+
initDoubleLine() {
|
|
3730
|
+
const options = this.options.filter((option) => option.double && option.geometry.otherCoords?.[1]?.length);
|
|
3731
|
+
if (!options.length) {
|
|
3732
|
+
return;
|
|
3733
|
+
}
|
|
3734
|
+
const group = options.reduce((obj, cur) => {
|
|
3735
|
+
const key = `${cur.secondColor}-${cur.dashed}`;
|
|
3736
|
+
if (obj[key]) {
|
|
3737
|
+
obj[key].push(cur);
|
|
3738
|
+
}
|
|
3739
|
+
if (!obj[key]) {
|
|
3740
|
+
obj[key] = [cur];
|
|
3741
|
+
}
|
|
3742
|
+
return obj;
|
|
3743
|
+
}, {});
|
|
3744
|
+
Object.values(group).map((options2) => {
|
|
3745
|
+
const material = this.context.materialFactory.createLine2MaterialMap({
|
|
3746
|
+
color: options2[0].secondColor,
|
|
3747
|
+
width: 0.2,
|
|
3748
|
+
dashed: options2[0].dashed
|
|
3749
|
+
});
|
|
3750
|
+
options2.map((option) => {
|
|
3751
|
+
const geometry = new LineGeometry();
|
|
3752
|
+
const vec = option.geometry.otherCoords[1].map((item) => [...item, 0]).flat(2);
|
|
3753
|
+
geometry.setPositions(vec);
|
|
3754
|
+
const line = new Line2(geometry, material);
|
|
3755
|
+
line.computeLineDistances();
|
|
3756
|
+
line.position.z += 1e-4;
|
|
3757
|
+
this.add(line);
|
|
3758
|
+
});
|
|
3759
|
+
});
|
|
3760
|
+
}
|
|
3761
|
+
initLineGeometry() {
|
|
3762
|
+
const geometries = this.options.map((option) => {
|
|
3763
|
+
const points = this.getBorderPoints(option);
|
|
3764
|
+
return new BufferGeometry3().setFromPoints(points);
|
|
3765
|
+
});
|
|
3766
|
+
this.lineGeometry = mergeGeometries2(geometries);
|
|
3767
|
+
}
|
|
3768
|
+
createBorder() {
|
|
3769
|
+
const line = new LineSegments3(this.lineGeometry, this.lineMaterial);
|
|
3770
|
+
this.LineMesh = line;
|
|
3771
|
+
this.add(line);
|
|
3772
|
+
return line;
|
|
3773
|
+
}
|
|
3774
|
+
init() {
|
|
3775
|
+
this.initGeometry();
|
|
3776
|
+
this.initMaterial();
|
|
3777
|
+
const mesh = new Mesh6(this.geometry, this.material);
|
|
3778
|
+
this.add(mesh);
|
|
3779
|
+
this.initLineMaterial();
|
|
3780
|
+
this.initLineGeometry();
|
|
3781
|
+
this.createBorder();
|
|
3782
|
+
this.initDoubleLine();
|
|
3783
|
+
}
|
|
3784
|
+
dispose() {
|
|
3785
|
+
this.geometry?.dispose();
|
|
3786
|
+
this.lineGeometry?.dispose();
|
|
3787
|
+
this.clear();
|
|
3788
|
+
}
|
|
3789
|
+
};
|
|
3790
|
+
|
|
3601
3791
|
// src/operations/selection/box-selection.ts
|
|
3602
3792
|
import { Frustum } from "three";
|
|
3603
3793
|
var BoxSelection = class extends BaseSvg {
|
|
@@ -3956,13 +4146,15 @@ var HoverHelper = class extends EventDispatcher5 {
|
|
|
3956
4146
|
};
|
|
3957
4147
|
|
|
3958
4148
|
// src/factory/material.ts
|
|
4149
|
+
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
|
|
3959
4150
|
import {
|
|
3960
4151
|
Color as Color4,
|
|
3961
|
-
LineBasicMaterial as
|
|
4152
|
+
LineBasicMaterial as LineBasicMaterial4,
|
|
3962
4153
|
MeshStandardMaterial as MeshStandardMaterial2,
|
|
3963
|
-
MeshBasicMaterial as
|
|
4154
|
+
MeshBasicMaterial as MeshBasicMaterial6,
|
|
3964
4155
|
ShaderMaterial as ShaderMaterial2,
|
|
3965
|
-
DoubleSide as DoubleSide4
|
|
4156
|
+
DoubleSide as DoubleSide4,
|
|
4157
|
+
Vector2 as Vector25
|
|
3966
4158
|
} from "three";
|
|
3967
4159
|
function vectorToString(vector) {
|
|
3968
4160
|
return `${vector.x}-${vector.y}-${vector.z}`;
|
|
@@ -3976,6 +4168,7 @@ var MaterialFactory = class {
|
|
|
3976
4168
|
meshBasicMaterialMap = /* @__PURE__ */ new Map();
|
|
3977
4169
|
shaderMaterialMap = /* @__PURE__ */ new Map();
|
|
3978
4170
|
groundTextureMaterialMap = /* @__PURE__ */ new Map();
|
|
4171
|
+
line2MaterialMap = /* @__PURE__ */ new Map();
|
|
3979
4172
|
generateLineMaterialKey({ color, opacity }) {
|
|
3980
4173
|
return `${color}-${opacity}`;
|
|
3981
4174
|
}
|
|
@@ -3984,7 +4177,7 @@ var MaterialFactory = class {
|
|
|
3984
4177
|
if (this.lineMaterialMap.has(key)) {
|
|
3985
4178
|
return this.lineMaterialMap.get(key);
|
|
3986
4179
|
}
|
|
3987
|
-
const lineMaterial = new
|
|
4180
|
+
const lineMaterial = new LineBasicMaterial4({
|
|
3988
4181
|
color: new Color4(color).convertLinearToSRGB(),
|
|
3989
4182
|
transparent: true,
|
|
3990
4183
|
opacity
|
|
@@ -4012,7 +4205,7 @@ var MaterialFactory = class {
|
|
|
4012
4205
|
if (this.meshBasicMaterialMap.has(key)) {
|
|
4013
4206
|
return this.meshBasicMaterialMap.get(key);
|
|
4014
4207
|
}
|
|
4015
|
-
const material = new
|
|
4208
|
+
const material = new MeshBasicMaterial6({
|
|
4016
4209
|
color,
|
|
4017
4210
|
transparent: true,
|
|
4018
4211
|
opacity,
|
|
@@ -4115,7 +4308,7 @@ var MaterialFactory = class {
|
|
|
4115
4308
|
return this.groundTextureMaterialMap.get(key);
|
|
4116
4309
|
}
|
|
4117
4310
|
const texture = await this.context.textureFactory.getTexture(url);
|
|
4118
|
-
const material = new
|
|
4311
|
+
const material = new MeshBasicMaterial6({
|
|
4119
4312
|
map: texture,
|
|
4120
4313
|
transparent: true,
|
|
4121
4314
|
opacity
|
|
@@ -4123,6 +4316,24 @@ var MaterialFactory = class {
|
|
|
4123
4316
|
this.groundTextureMaterialMap.set(key, material);
|
|
4124
4317
|
return material;
|
|
4125
4318
|
}
|
|
4319
|
+
createLine2MaterialMap({ color, width, dashed }) {
|
|
4320
|
+
const key = `${color}-${width}-${dashed}`;
|
|
4321
|
+
if (this.line2MaterialMap.has(key)) {
|
|
4322
|
+
return this.line2MaterialMap.get(key);
|
|
4323
|
+
}
|
|
4324
|
+
const material = new LineMaterial({
|
|
4325
|
+
color: parseInt(color.slice(1), 16),
|
|
4326
|
+
dashed,
|
|
4327
|
+
linewidth: width,
|
|
4328
|
+
worldUnits: true,
|
|
4329
|
+
dashSize: 1,
|
|
4330
|
+
gapSize: 3,
|
|
4331
|
+
dashScale: 1,
|
|
4332
|
+
resolution: new Vector25(this.context.clientSize.width, this.context.clientSize.height)
|
|
4333
|
+
});
|
|
4334
|
+
this.line2MaterialMap.set(key, material);
|
|
4335
|
+
return material;
|
|
4336
|
+
}
|
|
4126
4337
|
dispose() {
|
|
4127
4338
|
this.lineMaterialMap.forEach((val, _) => {
|
|
4128
4339
|
val.dispose();
|
|
@@ -4145,11 +4356,15 @@ var MaterialFactory = class {
|
|
|
4145
4356
|
val.map?.dispose();
|
|
4146
4357
|
});
|
|
4147
4358
|
this.groundTextureMaterialMap.clear();
|
|
4359
|
+
this.line2MaterialMap.forEach((val, _) => {
|
|
4360
|
+
val.dispose();
|
|
4361
|
+
});
|
|
4362
|
+
this.line2MaterialMap.clear();
|
|
4148
4363
|
}
|
|
4149
4364
|
};
|
|
4150
4365
|
|
|
4151
4366
|
// src/utils/camera-bound.ts
|
|
4152
|
-
import { Box3 as
|
|
4367
|
+
import { Box3 as Box38, Vector3 as Vector316 } from "three";
|
|
4153
4368
|
var CameraBound = class {
|
|
4154
4369
|
constructor(context) {
|
|
4155
4370
|
this.context = context;
|
|
@@ -4157,9 +4372,9 @@ var CameraBound = class {
|
|
|
4157
4372
|
this.changePrevCamera();
|
|
4158
4373
|
}
|
|
4159
4374
|
prevCamera = {
|
|
4160
|
-
position: new
|
|
4375
|
+
position: new Vector316(),
|
|
4161
4376
|
zoom: 1,
|
|
4162
|
-
target: new
|
|
4377
|
+
target: new Vector316()
|
|
4163
4378
|
};
|
|
4164
4379
|
enable = true;
|
|
4165
4380
|
setEnable(enable) {
|
|
@@ -4196,13 +4411,13 @@ var CameraBound = class {
|
|
|
4196
4411
|
if (!floors.length) {
|
|
4197
4412
|
return null;
|
|
4198
4413
|
}
|
|
4199
|
-
const box = new
|
|
4414
|
+
const box = new Box38().setFromObject(this.context.scene);
|
|
4200
4415
|
const { camera, clientSize: { width: w, height: h } } = this.context;
|
|
4201
4416
|
const { min, max } = box;
|
|
4202
4417
|
const lb = vector3ToDevice(min, camera, w, h);
|
|
4203
4418
|
const rt = vector3ToDevice(max, camera, w, h);
|
|
4204
|
-
const lt = vector3ToDevice(new
|
|
4205
|
-
const rb = vector3ToDevice(new
|
|
4419
|
+
const lt = vector3ToDevice(new Vector316(min.x, max.y, max.z), camera, w, h);
|
|
4420
|
+
const rb = vector3ToDevice(new Vector316(max.x, min.y, min.z), camera, w, h);
|
|
4206
4421
|
const left = Math.min(lb.x, rt.x, lt.x, rb.x);
|
|
4207
4422
|
const right = Math.max(lb.x, rt.x, lt.x, rb.x);
|
|
4208
4423
|
const top = Math.min(lb.y, rt.y, lt.y, rb.y);
|
|
@@ -4332,7 +4547,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
4332
4547
|
/**
|
|
4333
4548
|
* 获取两个点之间的像素数
|
|
4334
4549
|
*/
|
|
4335
|
-
getRatio(point1 = new
|
|
4550
|
+
getRatio(point1 = new Vector317(0, 0, 0), point22 = new Vector317(100, 0, 0)) {
|
|
4336
4551
|
const { clientWidth, clientHeight } = this.container;
|
|
4337
4552
|
const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight);
|
|
4338
4553
|
const device2 = vector3ToDevice(point22, this.camera, clientWidth, clientHeight);
|
|
@@ -4393,7 +4608,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
4393
4608
|
* @returns
|
|
4394
4609
|
*/
|
|
4395
4610
|
getGraphicsByDeviceXy(x, y) {
|
|
4396
|
-
const point3 = new
|
|
4611
|
+
const point3 = new Vector26();
|
|
4397
4612
|
point3.x = x / this.clientSize.width * 2 - 1;
|
|
4398
4613
|
point3.y = y / this.clientSize.height * -2 + 1;
|
|
4399
4614
|
const raycaster = new Raycaster3();
|
|
@@ -4533,7 +4748,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
4533
4748
|
);
|
|
4534
4749
|
}
|
|
4535
4750
|
getCameraLookAt() {
|
|
4536
|
-
return new
|
|
4751
|
+
return new Vector317().subVectors(this.control.target, this.camera.position);
|
|
4537
4752
|
}
|
|
4538
4753
|
/**
|
|
4539
4754
|
* 按照一个中心点设置相机的放大缩小
|
|
@@ -4585,28 +4800,28 @@ var Context = class extends EventDispatcher6 {
|
|
|
4585
4800
|
if (force2DView) {
|
|
4586
4801
|
this.setPolarAngle(0, 0);
|
|
4587
4802
|
}
|
|
4588
|
-
const boundingBox = new
|
|
4803
|
+
const boundingBox = new Box39().setFromObject(object);
|
|
4589
4804
|
this.setPolarAngle(polar, 0);
|
|
4590
4805
|
const { max, min } = boundingBox;
|
|
4591
|
-
const leftTop = new
|
|
4592
|
-
const rightTop = new
|
|
4593
|
-
const rightBottom = new
|
|
4594
|
-
const leftBottom = new
|
|
4806
|
+
const leftTop = new Vector317(min.x, max.y, max.z);
|
|
4807
|
+
const rightTop = new Vector317(max.x, max.y, max.z);
|
|
4808
|
+
const rightBottom = new Vector317(max.x, min.y, min.z);
|
|
4809
|
+
const leftBottom = new Vector317(min.x, min.y, min.z);
|
|
4595
4810
|
const leftTop2d = vector3ToDevice(leftTop, this.camera, width, height);
|
|
4596
4811
|
const rightTop2d = vector3ToDevice(rightTop, this.camera, width, height);
|
|
4597
4812
|
const leftBottom2d = vector3ToDevice(leftBottom, this.camera, width, height);
|
|
4598
4813
|
const rightBottom2d = vector3ToDevice(rightBottom, this.camera, width, height);
|
|
4599
4814
|
const boundingBox2d = new Box2().setFromPoints([
|
|
4600
|
-
new
|
|
4601
|
-
new
|
|
4602
|
-
new
|
|
4603
|
-
new
|
|
4815
|
+
new Vector26(leftTop2d.x, leftTop2d.y),
|
|
4816
|
+
new Vector26(rightTop2d.x, rightTop2d.y),
|
|
4817
|
+
new Vector26(leftBottom2d.x, leftBottom2d.y),
|
|
4818
|
+
new Vector26(rightBottom2d.x, rightBottom2d.y)
|
|
4604
4819
|
]);
|
|
4605
|
-
const size = boundingBox2d.getSize(new
|
|
4820
|
+
const size = boundingBox2d.getSize(new Vector26());
|
|
4606
4821
|
const xScale = (width - right - left) / size.x;
|
|
4607
4822
|
const yScale = (height - top - bottom) / size.y;
|
|
4608
4823
|
const scale = Math.min(xScale, yScale);
|
|
4609
|
-
const center2 = new
|
|
4824
|
+
const center2 = new Vector317((max.x + min.x) / 2, (max.y + min.y) / 2, (max.z + min.z) / 2);
|
|
4610
4825
|
return { zoom: scale * this.camera.zoom, center: center2 };
|
|
4611
4826
|
}
|
|
4612
4827
|
/**
|
|
@@ -5157,7 +5372,7 @@ var BMap = class extends EventDispatcher7 {
|
|
|
5157
5372
|
} = this.context;
|
|
5158
5373
|
const device = vector3ToDevice(position, camera, width, height);
|
|
5159
5374
|
const offsetX = device.x - width / 2;
|
|
5160
|
-
const v3 = new
|
|
5375
|
+
const v3 = new Vector318();
|
|
5161
5376
|
v3.setFromMatrixColumn(this.context.camera.matrix, 0);
|
|
5162
5377
|
v3.normalize();
|
|
5163
5378
|
v3.multiplyScalar(offsetX / this.context.camera.zoom);
|
|
@@ -5530,32 +5745,32 @@ function Worker2() {
|
|
|
5530
5745
|
|
|
5531
5746
|
// src/plugins/navigation/path.ts
|
|
5532
5747
|
import {
|
|
5533
|
-
Mesh as
|
|
5534
|
-
Object3D as
|
|
5748
|
+
Mesh as Mesh7,
|
|
5749
|
+
Object3D as Object3D15,
|
|
5535
5750
|
TextureLoader as TextureLoader2,
|
|
5536
5751
|
Color as Color7,
|
|
5537
|
-
Vector2 as
|
|
5538
|
-
Vector3 as
|
|
5752
|
+
Vector2 as Vector28,
|
|
5753
|
+
Vector3 as Vector320,
|
|
5539
5754
|
NormalBlending,
|
|
5540
5755
|
RepeatWrapping
|
|
5541
5756
|
} from "three";
|
|
5542
5757
|
|
|
5543
5758
|
// src/external/meshLine.js
|
|
5544
5759
|
import {
|
|
5545
|
-
BufferGeometry as
|
|
5760
|
+
BufferGeometry as BufferGeometry4,
|
|
5546
5761
|
Matrix4,
|
|
5547
|
-
Vector3 as
|
|
5762
|
+
Vector3 as Vector319,
|
|
5548
5763
|
Ray as Ray2,
|
|
5549
5764
|
Sphere,
|
|
5550
|
-
LineSegments as
|
|
5765
|
+
LineSegments as LineSegments4,
|
|
5551
5766
|
BufferAttribute,
|
|
5552
5767
|
ShaderChunk,
|
|
5553
5768
|
ShaderMaterial as ShaderMaterial3,
|
|
5554
5769
|
UniformsLib,
|
|
5555
5770
|
Color as Color6,
|
|
5556
|
-
Vector2 as
|
|
5771
|
+
Vector2 as Vector27
|
|
5557
5772
|
} from "three";
|
|
5558
|
-
var MeshLine = class extends
|
|
5773
|
+
var MeshLine = class extends BufferGeometry4 {
|
|
5559
5774
|
constructor() {
|
|
5560
5775
|
super();
|
|
5561
5776
|
this.isMeshLine = true;
|
|
@@ -5624,7 +5839,7 @@ MeshLine.prototype.setPoints = function(points, wcb) {
|
|
|
5624
5839
|
this.widthCallback = wcb;
|
|
5625
5840
|
this.positions = [];
|
|
5626
5841
|
this.counters = [];
|
|
5627
|
-
if (points.length && points[0] instanceof
|
|
5842
|
+
if (points.length && points[0] instanceof Vector319) {
|
|
5628
5843
|
for (var j = 0; j < points.length; j++) {
|
|
5629
5844
|
var p = points[j];
|
|
5630
5845
|
var c = j / points.length;
|
|
@@ -5648,7 +5863,7 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
5648
5863
|
var inverseMatrix = new Matrix4();
|
|
5649
5864
|
var ray = new Ray2();
|
|
5650
5865
|
var sphere = new Sphere();
|
|
5651
|
-
var interRay = new
|
|
5866
|
+
var interRay = new Vector319();
|
|
5652
5867
|
var geometry = this.geometry;
|
|
5653
5868
|
if (!geometry.boundingSphere) geometry.computeBoundingSphere();
|
|
5654
5869
|
sphere.copy(geometry.boundingSphere);
|
|
@@ -5658,10 +5873,10 @@ function MeshLineRaycast(raycaster, intersects) {
|
|
|
5658
5873
|
}
|
|
5659
5874
|
inverseMatrix.copy(this.matrixWorld).invert();
|
|
5660
5875
|
ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);
|
|
5661
|
-
var vStart = new
|
|
5662
|
-
var vEnd = new
|
|
5663
|
-
var interSegment = new
|
|
5664
|
-
var step = this instanceof
|
|
5876
|
+
var vStart = new Vector319();
|
|
5877
|
+
var vEnd = new Vector319();
|
|
5878
|
+
var interSegment = new Vector319();
|
|
5879
|
+
var step = this instanceof LineSegments4 ? 2 : 1;
|
|
5665
5880
|
var index = geometry.index;
|
|
5666
5881
|
var attributes = geometry.attributes;
|
|
5667
5882
|
if (index !== null) {
|
|
@@ -5714,8 +5929,8 @@ MeshLine.prototype.getDistance = function(i) {
|
|
|
5714
5929
|
let maxLength = 0;
|
|
5715
5930
|
for (let k = 0; k < i; k++) {
|
|
5716
5931
|
const index = 6 * k;
|
|
5717
|
-
const p0 = new
|
|
5718
|
-
const p1 = new
|
|
5932
|
+
const p0 = new Vector319(this.positions[index], this.positions[index + 1], this.positions[index + 2]);
|
|
5933
|
+
const p1 = new Vector319(this.positions[index + 6], this.positions[index + 7], this.positions[index + 8]);
|
|
5719
5934
|
const distance = p0.distanceTo(p1);
|
|
5720
5935
|
maxLength += distance;
|
|
5721
5936
|
}
|
|
@@ -5983,7 +6198,7 @@ var MeshLineMaterial = class extends ShaderMaterial3 {
|
|
|
5983
6198
|
useAlphaMap: { value: 0 },
|
|
5984
6199
|
color: { value: new Color6(16777215) },
|
|
5985
6200
|
opacity: { value: 1 },
|
|
5986
|
-
resolution: { value: new
|
|
6201
|
+
resolution: { value: new Vector27(1, 1) },
|
|
5987
6202
|
sizeAttenuation: { value: 1 },
|
|
5988
6203
|
dashArray: { value: 0 },
|
|
5989
6204
|
dashOffset: { value: 0 },
|
|
@@ -5991,7 +6206,7 @@ var MeshLineMaterial = class extends ShaderMaterial3 {
|
|
|
5991
6206
|
useDash: { value: 0 },
|
|
5992
6207
|
visibility: { value: 1 },
|
|
5993
6208
|
alphaTest: { value: 0 },
|
|
5994
|
-
repeat: { value: new
|
|
6209
|
+
repeat: { value: new Vector27(1, 1) }
|
|
5995
6210
|
}),
|
|
5996
6211
|
vertexShader: ShaderChunk.meshline_vert,
|
|
5997
6212
|
fragmentShader: ShaderChunk.meshline_frag
|
|
@@ -6178,7 +6393,7 @@ var defaultConfig2 = {
|
|
|
6178
6393
|
lineWidth: 8,
|
|
6179
6394
|
color: 16777215
|
|
6180
6395
|
};
|
|
6181
|
-
var Path2 = class extends
|
|
6396
|
+
var Path2 = class extends Object3D15 {
|
|
6182
6397
|
constructor(navigation, config) {
|
|
6183
6398
|
super();
|
|
6184
6399
|
this.navigation = navigation;
|
|
@@ -6227,7 +6442,7 @@ var Path2 = class extends Object3D13 {
|
|
|
6227
6442
|
}
|
|
6228
6443
|
} = this;
|
|
6229
6444
|
const screenPoints = points.map(
|
|
6230
|
-
([x, y]) => vector3ToDevice(new
|
|
6445
|
+
([x, y]) => vector3ToDevice(new Vector320(x, y, 0), camera, width, height)
|
|
6231
6446
|
).map(({ x, y }) => [x, y]);
|
|
6232
6447
|
const pointLength = getPathLength(screenPoints);
|
|
6233
6448
|
return pointLength / 32;
|
|
@@ -6237,7 +6452,7 @@ var Path2 = class extends Object3D13 {
|
|
|
6237
6452
|
return;
|
|
6238
6453
|
}
|
|
6239
6454
|
const repeat = this.getRepeat();
|
|
6240
|
-
this.material.repeat = new
|
|
6455
|
+
this.material.repeat = new Vector28(repeat, 1);
|
|
6241
6456
|
}
|
|
6242
6457
|
loadTexture(url) {
|
|
6243
6458
|
return new Promise((r, j) => {
|
|
@@ -6272,7 +6487,7 @@ var Path2 = class extends Object3D13 {
|
|
|
6272
6487
|
useMap: true,
|
|
6273
6488
|
color: new Color7(this.config.color),
|
|
6274
6489
|
transparent: true,
|
|
6275
|
-
resolution: new
|
|
6490
|
+
resolution: new Vector28(
|
|
6276
6491
|
this.navigation.bmap.context.clientSize.width,
|
|
6277
6492
|
this.navigation.bmap.context.clientSize.height
|
|
6278
6493
|
),
|
|
@@ -6281,9 +6496,9 @@ var Path2 = class extends Object3D13 {
|
|
|
6281
6496
|
lineWidth: this.config.lineWidth * 2,
|
|
6282
6497
|
map: this.texture,
|
|
6283
6498
|
blending: NormalBlending,
|
|
6284
|
-
repeat: new
|
|
6499
|
+
repeat: new Vector28(this.getRepeat(), 1)
|
|
6285
6500
|
});
|
|
6286
|
-
const mesh = this.mesh = new
|
|
6501
|
+
const mesh = this.mesh = new Mesh7(lineGeometry, material);
|
|
6287
6502
|
this.add(mesh);
|
|
6288
6503
|
return mesh;
|
|
6289
6504
|
}
|
|
@@ -6776,6 +6991,10 @@ function createStore(storeName, db = _db) {
|
|
|
6776
6991
|
db.createObjectStore(storeName, { keyPath: "key" });
|
|
6777
6992
|
}
|
|
6778
6993
|
}
|
|
6994
|
+
function closeDb() {
|
|
6995
|
+
_db?.close();
|
|
6996
|
+
_db = null;
|
|
6997
|
+
}
|
|
6779
6998
|
|
|
6780
6999
|
// src/loader/AibeeLoader/zstd.worker.ts
|
|
6781
7000
|
function Worker3() {
|
|
@@ -6785,9 +7004,7 @@ function Worker3() {
|
|
|
6785
7004
|
// src/loader/AibeeLoader/utils.ts
|
|
6786
7005
|
function transformGraphicData(data, center2, baseIndex = 0) {
|
|
6787
7006
|
data.forEach((item) => {
|
|
6788
|
-
item.geometry.coords = JSON.parse(
|
|
6789
|
-
JSON.stringify(item.geometry.cds)
|
|
6790
|
-
);
|
|
7007
|
+
item.geometry.coords = JSON.parse(JSON.stringify(item.geometry.cds));
|
|
6791
7008
|
if (item.geometry.type === "polygon") {
|
|
6792
7009
|
item.geometry.coords.map((cds) => {
|
|
6793
7010
|
if (Array.isArray(cds)) {
|
|
@@ -6797,6 +7014,11 @@ function transformGraphicData(data, center2, baseIndex = 0) {
|
|
|
6797
7014
|
});
|
|
6798
7015
|
}
|
|
6799
7016
|
});
|
|
7017
|
+
if (item.geometry.otherCds) {
|
|
7018
|
+
item.geometry.otherCoords = item.geometry.otherCds.map(
|
|
7019
|
+
(cds) => cds.map((item2) => translatePosToCenter(item2, center2))
|
|
7020
|
+
);
|
|
7021
|
+
}
|
|
6800
7022
|
} else {
|
|
6801
7023
|
item.geometry.coords = translatePosToCenter(item.geometry.cds, center2);
|
|
6802
7024
|
}
|
|
@@ -6908,20 +7130,45 @@ var AibeeLoader = class {
|
|
|
6908
7130
|
});
|
|
6909
7131
|
break;
|
|
6910
7132
|
case "lane":
|
|
7133
|
+
transformGraphicData(layer.elements, center2);
|
|
7134
|
+
const laneGroup = layer.elements.reduce((obj, options) => {
|
|
7135
|
+
const { fillColor, fillOpacity, strokeColor, strokeOpacity } = options;
|
|
7136
|
+
const key = `${fillColor}-${fillOpacity}-${strokeColor}-${strokeOpacity}`;
|
|
7137
|
+
if (obj[key]) {
|
|
7138
|
+
obj[key].push(options);
|
|
7139
|
+
} else {
|
|
7140
|
+
obj[key] = [options];
|
|
7141
|
+
}
|
|
7142
|
+
return obj;
|
|
7143
|
+
}, {});
|
|
7144
|
+
Object.values(laneGroup).forEach((optionArray) => {
|
|
7145
|
+
const lane = new Lane(this.bmap.context, optionArray);
|
|
7146
|
+
floor.laneLayer.add(lane);
|
|
7147
|
+
});
|
|
6911
7148
|
break;
|
|
6912
7149
|
case "texture2d":
|
|
6913
7150
|
case "texture3d":
|
|
7151
|
+
transformGraphicData(layer.elements, center2);
|
|
6914
7152
|
layer.elements.forEach((options) => {
|
|
6915
|
-
options.center = translatePosToCenter(options.center, center2);
|
|
6916
7153
|
const texture = new GroundTexture(this.bmap.context, options);
|
|
6917
7154
|
floor.textureLayer.add(texture);
|
|
6918
7155
|
});
|
|
6919
7156
|
break;
|
|
6920
7157
|
case "glb":
|
|
7158
|
+
transformGraphicData(layer.elements, center2);
|
|
7159
|
+
layer.elements.forEach((options) => {
|
|
7160
|
+
const model = new GlbModel(this.bmap.context, {
|
|
7161
|
+
...options,
|
|
7162
|
+
url: options.secondUrl,
|
|
7163
|
+
rotate: options.secondRotate,
|
|
7164
|
+
width: options.secondWidth
|
|
7165
|
+
});
|
|
7166
|
+
floor.glbModelLayer.add(model);
|
|
7167
|
+
});
|
|
6921
7168
|
break;
|
|
6922
7169
|
case "store":
|
|
6923
7170
|
layer.elements.map((options) => {
|
|
6924
|
-
const pos = translatePosToCenter(options.
|
|
7171
|
+
const pos = translatePosToCenter([options.center_x, options.center_y], center2);
|
|
6925
7172
|
floor.poiLayer.createPoi({
|
|
6926
7173
|
icon: options.poi_info.icon,
|
|
6927
7174
|
texts: [{ text: options.store_name || options.poi_info.name }],
|
|
@@ -6971,6 +7218,7 @@ var AibeeLoader = class {
|
|
|
6971
7218
|
}
|
|
6972
7219
|
dispose() {
|
|
6973
7220
|
this.clear();
|
|
7221
|
+
closeDb();
|
|
6974
7222
|
}
|
|
6975
7223
|
};
|
|
6976
7224
|
export {
|
|
@@ -6981,12 +7229,14 @@ export {
|
|
|
6981
7229
|
Equipment,
|
|
6982
7230
|
Events,
|
|
6983
7231
|
Floor,
|
|
7232
|
+
GlbModel,
|
|
6984
7233
|
Graphic,
|
|
6985
7234
|
GraphicLayer,
|
|
6986
7235
|
GroundTexture,
|
|
6987
7236
|
HeatmapElement,
|
|
6988
7237
|
HooksName,
|
|
6989
7238
|
HoverHelper,
|
|
7239
|
+
Lane,
|
|
6990
7240
|
Layer,
|
|
6991
7241
|
MapTypePolar,
|
|
6992
7242
|
Model,
|