@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.
Files changed (88) hide show
  1. package/lib/bmap.cjs.min.js +408 -401
  2. package/lib/bmap.esm.js +7310 -1296
  3. package/lib/bmap.esm.min.js +408 -401
  4. package/lib/bmap.min.js +408 -401
  5. package/lib/src/bmap.js +60 -54
  6. package/lib/src/context/OrbitControls.js +4 -1
  7. package/lib/src/context/context.js +54 -37
  8. package/lib/src/context/control.js +85 -85
  9. package/lib/src/elements/base-svg.js +5 -4
  10. package/lib/src/elements/floor.js +8 -0
  11. package/lib/src/elements/glb-model.js +14 -18
  12. package/lib/src/elements/graphic.js +18 -8
  13. package/lib/src/elements/ground-texture.js +41 -44
  14. package/lib/src/elements/heatmap.js +2 -1
  15. package/lib/src/elements/lane.js +5 -1
  16. package/lib/src/elements/merge-graphic.js +3 -28
  17. package/lib/src/elements/model.js +5 -9
  18. package/lib/src/elements/overlay.js +9 -7
  19. package/lib/src/elements/poi.js +55 -49
  20. package/lib/src/elements/poi2.js +52 -53
  21. package/lib/src/elements/shadow.js +3 -1
  22. package/lib/src/elements/svg-line.js +2 -0
  23. package/lib/src/elements/svg-polygon.js +1 -0
  24. package/lib/src/elements/text-texture.js +32 -36
  25. package/lib/src/elements/wall.js +3 -41
  26. package/lib/src/external/meshLine.js +17 -0
  27. package/lib/src/factory/img-texture.js +1 -0
  28. package/lib/src/factory/material.js +21 -51
  29. package/lib/src/factory/model.js +31 -33
  30. package/lib/src/factory/text-texture.js +17 -0
  31. package/lib/src/factory/unique-key.js +8 -0
  32. package/lib/src/layer/graphic-layer.js +1 -0
  33. package/lib/src/layer/parking-layer.d.ts +6 -0
  34. package/lib/src/layer/parking-layer.js +8 -0
  35. package/lib/src/layer/poi-layer.js +4 -1
  36. package/lib/src/layer/poi-layer2.js +2 -0
  37. package/lib/src/loader/AibeeLoader/index.js +230 -276
  38. package/lib/src/loader/AibeeLoader/layer.js +8 -6
  39. package/lib/src/loader/CrLoader/api/floor.js +45 -73
  40. package/lib/src/loader/CrLoader/index.js +88 -106
  41. package/lib/src/operations/hover/hover-helper.js +12 -2
  42. package/lib/src/operations/selection/selection.js +11 -1
  43. package/lib/src/plugins/car-inertial-position/car-inertial-position.js +9 -3
  44. package/lib/src/plugins/car-inertial-position/compass.js +20 -25
  45. package/lib/src/plugins/car-inertial-position/utils.js +3 -0
  46. package/lib/src/plugins/cr-nav-path/cr-nav-path.js +47 -55
  47. package/lib/src/plugins/cr-nav-path/cr-path.worker.js +4 -2
  48. package/lib/src/plugins/equipment/equipment.js +20 -22
  49. package/lib/src/plugins/mul-floor-navigation/mul-floor-navigation.js +63 -61
  50. package/lib/src/plugins/mul-floor-navigation/path.js +34 -30
  51. package/lib/src/plugins/mul-floor-navigation/start-model.js +2 -1
  52. package/lib/src/plugins/mul-floor-select/mul-floor-select.js +2 -1
  53. package/lib/src/plugins/mul-floors/mul-floors.js +1 -0
  54. package/lib/src/plugins/nav-path/nav-path.js +51 -59
  55. package/lib/src/plugins/nav-path/path.worker.js +4 -2
  56. package/lib/src/plugins/navigation/navigation.js +206 -214
  57. package/lib/src/plugins/navigation/path.js +34 -30
  58. package/lib/src/plugins/navigation/position-navigation.js +53 -53
  59. package/lib/src/plugins/navigation/start-rotate-helper-poi.js +18 -6
  60. package/lib/src/plugins/pdr-position/imu-position.js +13 -9
  61. package/lib/src/plugins/pdr-position/particle.js +4 -2
  62. package/lib/src/plugins/pdr-position/pdr.js +5 -4
  63. package/lib/src/plugins/pdr-position/position.js +5 -2
  64. package/lib/src/plugins/pdr-position/sensor.js +20 -25
  65. package/lib/src/plugins/select/select.js +11 -1
  66. package/lib/src/utils/camera-bound.js +3 -1
  67. package/lib/src/utils/color.js +8 -4
  68. package/lib/src/utils/coordinate.js +1 -0
  69. package/lib/src/utils/create.js +4 -2
  70. package/lib/src/utils/events.js +15 -4
  71. package/lib/src/utils/index-db.js +18 -11
  72. package/lib/src/utils/init-helper.js +7 -2
  73. package/lib/src/utils/obj-utils.js +3 -2
  74. package/lib/src/utils/os.js +1 -0
  75. package/lib/src/utils/path.js +15 -4
  76. package/lib/src/utils/promise.js +3 -1
  77. package/lib/src/utils/proxy.js +2 -1
  78. package/lib/src/utils/road.js +20 -14
  79. package/lib/src/utils/road2.js +60 -39
  80. package/lib/src/utils/rules.js +1 -0
  81. package/lib/src/utils/string.js +3 -1
  82. package/lib/src/utils/svg.js +12 -11
  83. package/lib/src/utils/taskQueue.js +29 -29
  84. package/lib/src/utils/timer.js +8 -0
  85. package/lib/src/utils/translate.js +3 -1
  86. package/lib/src/utils/tween.js +8 -0
  87. package/lib/src/utils/webworker.js +10 -9
  88. package/package.json +2 -1
@@ -1,5 +1,4 @@
1
1
  // poi2 Sprite 渲染poi
2
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
3
2
  import { _ as _extends } from "@swc/helpers/_/_extends";
4
3
  import { proxyOptions } from "../utils";
5
4
  import { Box2, Object3D, Sprite, SpriteMaterial, Vector2 } from "three";
@@ -56,22 +55,23 @@ export class Poi2 extends Object3D {
56
55
  }
57
56
  registryEvent() {
58
57
  this.context.addEventListener("control-zoom-change", this._initScale);
59
- var _this = this;
60
- this.addEventListener("change-icon", /*#__PURE__*/ _async_to_generator(function*({ value }) {
61
- if (_this._initIconPromise) {
62
- yield _this._initIconPromise;
58
+ this.addEventListener("change-icon", async (param)=>{
59
+ let { value } = param;
60
+ if (this._initIconPromise) {
61
+ await this._initIconPromise;
63
62
  }
64
- if (_this.spriteIcon) {
65
- _this.remove(_this.spriteIcon);
66
- _this.spriteIcon = undefined;
63
+ if (this.spriteIcon) {
64
+ this.remove(this.spriteIcon);
65
+ this.spriteIcon = undefined;
67
66
  }
68
- yield _this.initIcon();
69
- _this.initSize();
70
- _this._initScale({
71
- zoom: _this.context.camera.zoom
67
+ await this.initIcon();
68
+ this.initSize();
69
+ this._initScale({
70
+ zoom: this.context.camera.zoom
72
71
  });
73
- }));
74
- this.addEventListener("change-text", ({ value })=>{
72
+ });
73
+ this.addEventListener("change-text", (param)=>{
74
+ let { value } = param;
75
75
  if (this.spriteText) {
76
76
  this.remove(this.spriteText);
77
77
  this.spriteText = undefined;
@@ -82,7 +82,8 @@ export class Poi2 extends Object3D {
82
82
  zoom: this.context.camera.zoom
83
83
  });
84
84
  });
85
- this.addEventListener("change-text_font_size", ({ value })=>{
85
+ this.addEventListener("change-text_font_size", (param)=>{
86
+ let { value } = param;
86
87
  if (this.spriteText) {
87
88
  this.remove(this.spriteText);
88
89
  this.spriteText = undefined;
@@ -93,19 +94,22 @@ export class Poi2 extends Object3D {
93
94
  zoom: this.context.camera.zoom
94
95
  });
95
96
  });
96
- this.addEventListener("change-icon_rotate", ({ value })=>{
97
+ this.addEventListener("change-icon_rotate", (param)=>{
98
+ let { value } = param;
97
99
  if (this.spriteIcon) {
98
100
  this.spriteIcon.material.rotation = value / 180 * Math.PI;
99
101
  }
100
102
  });
101
- this.addEventListener("change-icon_size", ({ value })=>{
103
+ this.addEventListener("change-icon_size", (param)=>{
104
+ let { value } = param;
102
105
  if (this.spriteIcon) {
103
106
  this._initScale({
104
107
  zoom: this.context.camera.zoom
105
108
  });
106
109
  }
107
110
  });
108
- this.addEventListener("change-depth_test", ({ value })=>{
111
+ this.addEventListener("change-depth_test", (param)=>{
112
+ let { value } = param;
109
113
  if (this.spriteIcon) {
110
114
  this.spriteIcon.material.depthTest = value;
111
115
  }
@@ -120,30 +124,27 @@ export class Poi2 extends Object3D {
120
124
  getPosition() {
121
125
  return this.position;
122
126
  }
123
- initIcon() {
124
- var _this = this;
125
- return _async_to_generator(function*() {
126
- if (_this.options.icon) {
127
- return _this._initIconPromise = new Promise(/*#__PURE__*/ _async_to_generator(function*(resolve) {
128
- const texture = yield ImgTextureFactory.getTextureByUrl(_this.options.icon);
129
- const spriteIcon = new Sprite(new SpriteMaterial({
130
- map: texture,
131
- transparent: true,
132
- alphaTest: 0.2,
133
- depthTest: _this.options.depth_test,
134
- rotation: _this.options.icon_rotate / 180 * Math.PI
135
- }));
136
- spriteIcon.visible = false;
137
- spriteIcon.renderOrder = 100000 + _this.options.level;
138
- texture.needsUpdate = true;
139
- _this.add(spriteIcon);
140
- _this.spriteIcon = spriteIcon;
141
- resolve(spriteIcon);
142
- })).then(()=>{
143
- _this._initIconPromise = null;
144
- });
145
- }
146
- })();
127
+ async initIcon() {
128
+ if (this.options.icon) {
129
+ return this._initIconPromise = new Promise(async (resolve)=>{
130
+ const texture = await ImgTextureFactory.getTextureByUrl(this.options.icon);
131
+ const spriteIcon = new Sprite(new SpriteMaterial({
132
+ map: texture,
133
+ transparent: true,
134
+ alphaTest: 0.2,
135
+ depthTest: this.options.depth_test,
136
+ rotation: this.options.icon_rotate / 180 * Math.PI
137
+ }));
138
+ spriteIcon.visible = false;
139
+ spriteIcon.renderOrder = 100000 + this.options.level;
140
+ texture.needsUpdate = true;
141
+ this.add(spriteIcon);
142
+ this.spriteIcon = spriteIcon;
143
+ resolve(spriteIcon);
144
+ }).then(()=>{
145
+ this._initIconPromise = null;
146
+ });
147
+ }
147
148
  }
148
149
  initText() {
149
150
  if (this.options.text) {
@@ -189,16 +190,13 @@ export class Poi2 extends Object3D {
189
190
  (_this_spriteIcon = this.spriteIcon) == null ? void 0 : _this_spriteIcon.center.set(0.5, iconCenterY);
190
191
  (_this_spriteText = this.spriteText) == null ? void 0 : _this_spriteText.center.set(0.5, textCenterY);
191
192
  }
192
- init() {
193
- var _this = this;
194
- return _async_to_generator(function*() {
195
- yield _this.initIcon();
196
- _this.initText();
197
- _this.initSize();
198
- _this._initScale({
199
- zoom: _this.context.camera.zoom
200
- });
201
- })();
193
+ async init() {
194
+ await this.initIcon();
195
+ this.initText();
196
+ this.initSize();
197
+ this._initScale({
198
+ zoom: this.context.camera.zoom
199
+ });
202
200
  }
203
201
  resetZ() {
204
202
  const dz = this.deltaZ;
@@ -266,7 +264,8 @@ export class Poi2 extends Object3D {
266
264
  this.spriteIcon = undefined;
267
265
  }
268
266
  constructor(context, options){
269
- super(), this.context = context, this.textAspect = 1, this.box = new Box2(), this._initIconPromise = null, this._initScale = ({ zoom })=>{
267
+ super(), this.context = context, this.textAspect = 1, this.box = new Box2(), this._initIconPromise = null, this._initScale = (param)=>{
268
+ let { zoom } = param;
270
269
  if (this.spriteText) {
271
270
  const scaleText = this.textHeight / zoom;
272
271
  this.spriteText.scale.set(this.textAspect * scaleText, scaleText, 0.1);
@@ -26,7 +26,9 @@ export class Shadow extends Object3D {
26
26
  this.directionalLight.position.set(-position.x / 2, -position.y / 2, 100);
27
27
  }
28
28
  // 创建平面白色
29
- initPlane(width = 1000, height = 1000) {
29
+ initPlane(width, height) {
30
+ if (width === void 0) width = 1000;
31
+ if (height === void 0) height = 1000;
30
32
  const geometry = new PlaneGeometry(width, height);
31
33
  const material = new ShadowMaterial({
32
34
  transparent: true,
@@ -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 { setCirclePosition, createCircle, createLine, setLineStartEnd } from '../utils';
2
4
  import { BaseSvg } from './base-svg';
3
5
  export class SvgLine extends BaseSvg {
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/es.array.push.js";
1
2
  import { BaseSvg } from "./base-svg";
2
3
  import { setCirclePosition, setLineStartEnd, createLine, createCircle } from '../utils';
3
4
  export class SvgPolygon extends BaseSvg {
@@ -1,5 +1,4 @@
1
1
  // 文字贴图
2
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
3
2
  import { _ as _extends } from "@swc/helpers/_/_extends";
4
3
  import { hexToRgb } from "../utils";
5
4
  import { DoubleSide, Matrix4, Mesh, MeshBasicMaterial, Object3D, PlaneGeometry } from "three";
@@ -27,43 +26,40 @@ export const defaultTextTextureOptions = {
27
26
  center_y: 0
28
27
  };
29
28
  export class TextTexture extends Object3D {
30
- init() {
31
- var _this = this;
32
- return _async_to_generator(function*() {
33
- const textures = _this.options.map((options)=>{
34
- return TextTextureFactory.getTextureByText(options.texts[0], {
35
- fillStyle: hexToRgb(options.fillColor, options.fillOpacity),
36
- strokeStyle: hexToRgb(options.strokeColor, options.strokeOpacity),
37
- lineWidth: 6,
38
- font: "54px sans-serif"
39
- });
29
+ async init() {
30
+ const textures = this.options.map((options)=>{
31
+ return TextTextureFactory.getTextureByText(options.texts[0], {
32
+ fillStyle: hexToRgb(options.fillColor, options.fillOpacity),
33
+ strokeStyle: hexToRgb(options.strokeColor, options.strokeOpacity),
34
+ lineWidth: 6,
35
+ font: "54px sans-serif"
40
36
  });
41
- const geometries = textures.map((item, index)=>{
42
- const options = _this.options[index];
43
- const { width, height } = item.image;
44
- const aspect = width / height;
45
- const secondWidth = options.secondHeight * aspect;
46
- const geometry = new PlaneGeometry(secondWidth, options.secondHeight);
47
- const matrix = new Matrix4().makeTranslation(options.center_x, options.center_y, options.airHeight + options.deltaHeight + options.height).multiply(new Matrix4().makeRotationZ(options.secondRotate));
48
- geometry.applyMatrix4(matrix);
49
- return geometry;
37
+ });
38
+ const geometries = textures.map((item, index)=>{
39
+ const options = this.options[index];
40
+ const { width, height } = item.image;
41
+ const aspect = width / height;
42
+ const secondWidth = options.secondHeight * aspect;
43
+ const geometry = new PlaneGeometry(secondWidth, options.secondHeight);
44
+ const matrix = new Matrix4().makeTranslation(options.center_x, options.center_y, options.airHeight + options.deltaHeight + options.height).multiply(new Matrix4().makeRotationZ(options.secondRotate));
45
+ geometry.applyMatrix4(matrix);
46
+ return geometry;
47
+ });
48
+ const geometry = mergeGeometries(geometries, true);
49
+ geometries.forEach((geometry)=>geometry.dispose());
50
+ const materials = textures.map((texture)=>{
51
+ const material = new MeshBasicMaterial({
52
+ map: texture,
53
+ alphaTest: 1.0,
54
+ side: DoubleSide
50
55
  });
51
- const geometry = mergeGeometries(geometries, true);
52
- geometries.forEach((geometry)=>geometry.dispose());
53
- const materials = textures.map((texture)=>{
54
- const material = new MeshBasicMaterial({
55
- map: texture,
56
- alphaTest: 1.0,
57
- side: DoubleSide
58
- });
59
- texture.needsUpdate = true;
60
- return material;
61
- });
62
- const mesh = new Mesh(geometry, materials);
63
- _this.mesh = mesh;
64
- _this.position.z += 0.04;
65
- _this.add(mesh);
66
- })();
56
+ texture.needsUpdate = true;
57
+ return material;
58
+ });
59
+ const mesh = new Mesh(geometry, materials);
60
+ this.mesh = mesh;
61
+ this.position.z += 0.04;
62
+ this.add(mesh);
67
63
  }
68
64
  dispose() {
69
65
  var _this_mesh, _this_mesh1;
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/es.array.push.js";
1
2
  import { BufferGeometry, Color, ExtrudeGeometry, LineSegments, Mesh, Object3D, ShaderMaterial, Vector3 } from "three";
2
3
  import { darkenColor, initShape } from "../utils";
3
4
  import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils";
@@ -20,47 +21,8 @@ export class Wall extends Object3D {
20
21
  }
21
22
  initMaterial() {
22
23
  // 自定义的 ShaderMaterial
23
- const vertexShader = `
24
- varying vec3 vPosition; // 用于传递顶点的位置给片段着色器
25
- uniform float maxZ; // 声明一个uniform变量
26
- uniform vec3 uColor;
27
- uniform vec3 uColor2;
28
- uniform float uOpacity;
29
-
30
- void main() {
31
- vPosition = position; // 向片段着色器传递位置
32
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
33
- }
34
- `;
35
- const fragmentShader = `
36
- varying vec3 vPosition; // 接收顶点位置
37
- uniform float maxZ;
38
- uniform float minZ;
39
- uniform vec3 uColor;
40
- uniform vec3 uGradualColor1;
41
- uniform vec3 uGradualColor2;
42
- uniform float uOpacity;
43
-
44
- float random() {
45
- return fract(sin(gl_FragCoord.x * 12.9898 + gl_FragCoord.y * 78.233) * 43758.5453) * 0.1;
46
- }
47
-
48
- void main() {
49
- // 判断当前顶点是否为顶面
50
- if (vPosition.z >= maxZ) {
51
- gl_FragColor = vec4(uColor, uOpacity); //(顶面颜色)
52
- } else {
53
- float z = maxZ - minZ; // 墙的高度,分成三个部分
54
- float step = z / 3.0;
55
- float firstZ = maxZ - step;
56
- float secondZ = minZ + step;
57
- float currentZ = vPosition.z - minZ;
58
- float t = currentZ / z;
59
- vec3 vColor = mix(uGradualColor1, uGradualColor2, 1.0 - t);
60
- gl_FragColor = vec4(vColor, uOpacity); // 其他面颜色)
61
- }
62
- }
63
- `;
24
+ const vertexShader = " \n varying vec3 vPosition; // 用于传递顶点的位置给片段着色器\n uniform float maxZ; // 声明一个uniform变量\n uniform vec3 uColor;\n uniform vec3 uColor2; \n uniform float uOpacity; \n\n void main() { \n vPosition = position; // 向片段着色器传递位置 \n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); \n } \n ";
25
+ const fragmentShader = " \n varying vec3 vPosition; // 接收顶点位置\n uniform float maxZ;\n uniform float minZ;\n uniform vec3 uColor;\n uniform vec3 uGradualColor1;\n uniform vec3 uGradualColor2;\n uniform float uOpacity;\n\n float random() { \n return fract(sin(gl_FragCoord.x * 12.9898 + gl_FragCoord.y * 78.233) * 43758.5453) * 0.1; \n } \n\n void main() { \n // 判断当前顶点是否为顶面 \n if (vPosition.z >= maxZ) { \n gl_FragColor = vec4(uColor, uOpacity); //(顶面颜色) \n } else {\n float z = maxZ - minZ; // 墙的高度,分成三个部分\n float step = z / 3.0;\n float firstZ = maxZ - step;\n float secondZ = minZ + step;\n float currentZ = vPosition.z - minZ;\n float t = currentZ / z;\n vec3 vColor = mix(uGradualColor1, uGradualColor2, 1.0 - t);\n gl_FragColor = vec4(vColor, uOpacity); // 其他面颜色) \n } \n } \n ";
64
26
  let maxZ = -Infinity; // 初始化为负无穷
65
27
  let minZ = Infinity;
66
28
  const positionAttribute = this.geometry.getAttribute("position");
@@ -1,3 +1,20 @@
1
+ import "core-js/modules/es.typed-array.float32-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.array.push.js";
17
+ import "core-js/modules/es.typed-array.uint16-array.js";
1
18
  import { BufferGeometry, Matrix4, Vector3, Ray, Sphere, LineSegments, BufferAttribute, ShaderChunk, ShaderMaterial, UniformsLib, Color, Vector2 } from "three";
2
19
  class MeshLine extends BufferGeometry {
3
20
  constructor(){
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/web.dom-collections.iterator.js";
1
2
  import { LinearFilter, RGBAFormat, TextureLoader } from "three";
2
3
  export class ImgTextureFactory {
3
4
  static getTextureByUrl(url) {
@@ -1,13 +1,16 @@
1
+ import "core-js/modules/web.dom-collections.iterator.js";
1
2
  import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
2
3
  import { Color, LineBasicMaterial, MeshStandardMaterial, MeshBasicMaterial, ShaderMaterial, DoubleSide } from "three";
3
4
  function vectorToString(vector) {
4
- return `${vector.x}-${vector.y}-${vector.z}`;
5
+ return vector.x + "-" + vector.y + "-" + vector.z;
5
6
  }
6
7
  export class MaterialFactory {
7
- static generateLineMaterialKey({ color, opacity }) {
8
- return `${color}-${opacity}`;
8
+ static generateLineMaterialKey(param) {
9
+ let { color, opacity } = param;
10
+ return color + "-" + opacity;
9
11
  }
10
- static createLineMaterial({ color, opacity }) {
12
+ static createLineMaterial(param) {
13
+ let { color, opacity } = param;
11
14
  const key = this.generateLineMaterialKey({
12
15
  color,
13
16
  opacity
@@ -23,8 +26,9 @@ export class MaterialFactory {
23
26
  this.lineMaterialMap.set(key, lineMaterial);
24
27
  return lineMaterial;
25
28
  }
26
- static createMeshStandardMaterial({ color, opacity }) {
27
- const key = `${color}-${opacity}`;
29
+ static createMeshStandardMaterial(param) {
30
+ let { color, opacity } = param;
31
+ const key = color + "-" + opacity;
28
32
  if (this.meshStandardMaterialMap.has(key)) {
29
33
  return this.meshStandardMaterialMap.get(key);
30
34
  }
@@ -38,8 +42,9 @@ export class MaterialFactory {
38
42
  this.meshStandardMaterialMap.set(key, material);
39
43
  return material;
40
44
  }
41
- static createMeshBasicMaterial({ color, opacity }) {
42
- const key = `${color}-${opacity}`;
45
+ static createMeshBasicMaterial(param) {
46
+ let { color, opacity } = param;
47
+ const key = color + "-" + opacity;
43
48
  if (this.meshBasicMaterialMap.has(key)) {
44
49
  return this.meshBasicMaterialMap.get(key);
45
50
  }
@@ -52,51 +57,15 @@ export class MaterialFactory {
52
57
  this.meshBasicMaterialMap.set(key, material);
53
58
  return material;
54
59
  }
55
- static createShaderMaterial({ gradualColor, center, maxValue, opacity, direction, max, min }) {
56
- const key = `${gradualColor.toString()}-${vectorToString(center)}-${maxValue}-${opacity}-${vectorToString(direction)}`;
60
+ static createShaderMaterial(param) {
61
+ let { gradualColor, center, maxValue, opacity, direction, max, min } = param;
62
+ const key = gradualColor.toString() + "-" + vectorToString(center) + "-" + maxValue + "-" + opacity + "-" + vectorToString(direction);
57
63
  if (this.shaderMaterialMap.has(key)) {
58
64
  return this.shaderMaterialMap.get(key);
59
65
  }
60
66
  // 自定义着色器代码
61
- const vertexShader = `
62
- uniform vec3 uColor;
63
- uniform vec3 uGradualColor;
64
- uniform vec3 center;
65
- uniform vec3 uDirection;
66
- uniform vec3 uMax;
67
- uniform vec3 uMin;
68
- uniform float maxValue;
69
- varying vec3 vColor;
70
-
71
- void main() {
72
- vec3 lineVec = uMax - uMin; // 线段AB的方向向量
73
- vec3 AP = position - uMin; // 向量AP
74
- float t = dot(AP, lineVec) / dot(lineVec, lineVec); // 参数t
75
- t = clamp(t, 0.0, 1.0); // 限制t在[0, 1]范围内,确保最短距离在线段AB上
76
-
77
- vec3 closestPoint = uMin + t * lineVec; // 最短距离点的位置
78
- vec3 vecAP = closestPoint - uMin; // 向量AP'
79
- float distance = length(vecAP);
80
- float maxLen = length(lineVec);
81
-
82
- // vec3 direction = normalize(uDirection);
83
- // float gradient = dot(normalize(normal), normalize(uDirection));
84
- // vec3 currentPosition = position - center;
85
- // float colorFactor = (dot(direction, currentPosition) / maxValue) * 0.5 + 0.5;
86
- float colorFactor = distance / maxLen;
87
-
88
- vColor = mix(uColor, uGradualColor, 1.0 - t);
89
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
90
- }
91
- `;
92
- const fragmentShader = `
93
- varying vec3 vColor;
94
- uniform float opacity;
95
-
96
- void main() {
97
- gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
98
- }
99
- `;
67
+ const vertexShader = "\n uniform vec3 uColor;\n uniform vec3 uGradualColor;\n uniform vec3 center;\n uniform vec3 uDirection;\n uniform vec3 uMax;\n uniform vec3 uMin;\n uniform float maxValue;\n varying vec3 vColor; \n\n void main() {\n vec3 lineVec = uMax - uMin; // 线段AB的方向向量\n vec3 AP = position - uMin; // 向量AP\n float t = dot(AP, lineVec) / dot(lineVec, lineVec); // 参数t\n t = clamp(t, 0.0, 1.0); // 限制t在[0, 1]范围内,确保最短距离在线段AB上\n \n vec3 closestPoint = uMin + t * lineVec; // 最短距离点的位置\n vec3 vecAP = closestPoint - uMin; // 向量AP'\n float distance = length(vecAP);\n float maxLen = length(lineVec);\n\n // vec3 direction = normalize(uDirection);\n // float gradient = dot(normalize(normal), normalize(uDirection));\n // vec3 currentPosition = position - center;\n // float colorFactor = (dot(direction, currentPosition) / maxValue) * 0.5 + 0.5;\n float colorFactor = distance / maxLen;\n\n vColor = mix(uColor, uGradualColor, 1.0 - t);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ";
68
+ const fragmentShader = "\n varying vec3 vColor;\n uniform float opacity;\n\n void main() {\n gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);\n }\n ";
100
69
  // 创建自定义ShaderMaterial
101
70
  const material = new ShaderMaterial({
102
71
  uniforms: {
@@ -132,8 +101,9 @@ export class MaterialFactory {
132
101
  this.shaderMaterialMap.set(key, material);
133
102
  return material;
134
103
  }
135
- static createLine2MaterialMap({ color, width, dashed, resolution }) {
136
- const key = `${color}-${width}-${dashed}-${resolution.x}-${resolution.y}`;
104
+ static createLine2MaterialMap(param) {
105
+ let { color, width, dashed, resolution } = param;
106
+ const key = color + "-" + width + "-" + dashed + "-" + resolution.x + "-" + resolution.y;
137
107
  if (this.line2MaterialMap.has(key)) {
138
108
  return this.line2MaterialMap.get(key);
139
109
  }
@@ -1,42 +1,40 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
1
  import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import "core-js/modules/web.dom-collections.iterator.js";
3
3
  import { dispose } from '../utils';
4
4
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
5
5
  export class ModelFactory {
6
- static loadModel(url, useCache = true) {
7
- var _this = this;
8
- return _async_to_generator(function*() {
9
- if (!useCache) {
10
- return new Promise((resolve, reject)=>{
11
- _this.loader.load(url, resolve, undefined, reject);
12
- });
13
- } else {
14
- if (_this.modelMap.has(url)) {
15
- const p = _this.modelMap.get(url);
16
- if (p instanceof Promise) {
17
- p.then((gltf)=>_extends({}, gltf, {
18
- scene: gltf.scene.clone()
19
- }));
20
- } else {
21
- return _extends({}, p, {
22
- scene: p.scene.clone()
23
- });
24
- }
25
- }
26
- const p = new Promise((resolve, reject)=>{
27
- _this.loader.load(url, (gltf)=>{
28
- _this.modelMap.set(url, gltf);
29
- resolve(gltf);
30
- }, undefined, reject);
31
- });
32
- _this.modelMap.set(url, p);
33
- return p.then((gltf)=>{
34
- return _extends({}, gltf, {
35
- scene: gltf.scene.clone()
6
+ static async loadModel(url, useCache) {
7
+ if (useCache === void 0) useCache = true;
8
+ if (!useCache) {
9
+ return new Promise((resolve, reject)=>{
10
+ this.loader.load(url, resolve, undefined, reject);
11
+ });
12
+ } else {
13
+ if (this.modelMap.has(url)) {
14
+ const p = this.modelMap.get(url);
15
+ if (p instanceof Promise) {
16
+ p.then((gltf)=>_extends({}, gltf, {
17
+ scene: gltf.scene.clone()
18
+ }));
19
+ } else {
20
+ return _extends({}, p, {
21
+ scene: p.scene.clone()
36
22
  });
37
- });
23
+ }
38
24
  }
39
- })();
25
+ const p = new Promise((resolve, reject)=>{
26
+ this.loader.load(url, (gltf)=>{
27
+ this.modelMap.set(url, gltf);
28
+ resolve(gltf);
29
+ }, undefined, reject);
30
+ });
31
+ this.modelMap.set(url, p);
32
+ return p.then((gltf)=>{
33
+ return _extends({}, gltf, {
34
+ scene: gltf.scene.clone()
35
+ });
36
+ });
37
+ }
40
38
  }
41
39
  static dispose() {
42
40
  this.modelMap.forEach((model)=>{
@@ -1,4 +1,21 @@
1
1
  import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import "core-js/modules/es.typed-array.uint8-array.js";
3
+ import "core-js/modules/es.typed-array.at.js";
4
+ import "core-js/modules/es.typed-array.fill.js";
5
+ import "core-js/modules/es.typed-array.find-last.js";
6
+ import "core-js/modules/es.typed-array.find-last-index.js";
7
+ import "core-js/modules/es.typed-array.set.js";
8
+ import "core-js/modules/es.typed-array.sort.js";
9
+ import "core-js/modules/es.typed-array.to-reversed.js";
10
+ import "core-js/modules/es.typed-array.to-sorted.js";
11
+ import "core-js/modules/es.typed-array.with.js";
12
+ import "core-js/modules/es.array-buffer.constructor.js";
13
+ import "core-js/modules/es.array-buffer.slice.js";
14
+ import "core-js/modules/es.array-buffer.detached.js";
15
+ import "core-js/modules/es.array-buffer.transfer.js";
16
+ import "core-js/modules/es.array-buffer.transfer-to-fixed-length.js";
17
+ import "core-js/modules/es.typed-array.from.js";
18
+ import "core-js/modules/web.dom-collections.iterator.js";
2
19
  import { DataTexture, LinearFilter, RGBAFormat } from "three";
3
20
  import { generatorKeyByObj, hasChinese } from "../utils";
4
21
  export class TextTextureFactory {
@@ -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
  export class UniqueKeyFactory {
2
10
  static createKey() {
3
11
  return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/web.dom-collections.iterator.js";
1
2
  import { Graphic } from "../elements";
2
3
  import { Box3, Vector3 } from "three";
3
4
  import { Layer } from "./layer";
@@ -0,0 +1,6 @@
1
+ import { Layer } from "./layer";
2
+ export declare class ParkingLayer extends Layer {
3
+ createParkings(): void;
4
+ changeParkingColor(): void;
5
+ dispose(): void;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { Layer } from "./layer";
2
+ export class ParkingLayer extends Layer {
3
+ createParkings() {}
4
+ changeParkingColor() {}
5
+ dispose() {
6
+ super.dispose();
7
+ }
8
+ }
@@ -1,9 +1,12 @@
1
+ import "core-js/modules/es.array.unshift.js";
2
+ import "core-js/modules/es.array.push.js";
1
3
  import { Poi } from "../elements";
2
4
  import { Layer } from "./layer";
3
5
  import { debounce } from 'lodash';
4
6
  import { Timer } from "../utils";
5
7
  export class PoiLayer extends Layer {
6
- clear(force = false) {
8
+ clear(force) {
9
+ if (force === void 0) force = false;
7
10
  this.pois.forEach((item)=>{
8
11
  if (item.options.built_in && !force) {
9
12
  return;
@@ -1,3 +1,5 @@
1
+ import "core-js/modules/es.array.unshift.js";
2
+ import "core-js/modules/es.array.push.js";
1
3
  import { Floor, Poi2 } from "../elements";
2
4
  import { Layer } from "./layer";
3
5
  import { debounce } from "lodash";