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