@kimap/indoor-positioning-sdk-vue2 5.9.7 → 6.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimap/indoor-positioning-sdk-vue2",
3
- "version": "5.9.7",
3
+ "version": "6.0.0",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -133,12 +133,29 @@ SceneCore.prototype.setCameraPosition = function() {
133
133
  var origin = this.coordinateSystem.origin;
134
134
  var maxX = this.coordinateSystem.maxX;
135
135
  var maxY = this.coordinateSystem.maxY;
136
-
136
+
137
137
  var centerX = origin.x + maxX / 2;
138
138
  var centerZ = origin.z;
139
- var distance = Math.max(maxX, maxY) * 1.5;
140
-
141
- this.camera.position.set(centerX, distance, centerZ + distance * 0.5);
139
+ var maxSize = Math.max(maxX, maxY);
140
+
141
+ // 单模型默认相机参数:俯仰角45°,方位角-37.94°,基准距离9(拉近)
142
+ var pitchDeg = 45;
143
+ var azimuthDeg = -37.94;
144
+ var baseDistance = 9;
145
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
146
+
147
+ var pitchRad = pitchDeg * Math.PI / 180;
148
+ var azimuthRad = azimuthDeg * Math.PI / 180;
149
+ var cosPitch = Math.cos(pitchRad);
150
+ var sinPitch = Math.sin(pitchRad);
151
+ var cosAzimuth = Math.cos(azimuthRad);
152
+ var sinAzimuth = Math.sin(azimuthRad);
153
+
154
+ this.camera.position.set(
155
+ centerX + distance * sinAzimuth * cosPitch,
156
+ distance * sinPitch,
157
+ centerZ + distance * cosAzimuth * cosPitch
158
+ );
142
159
  this.camera.lookAt(centerX, 0, centerZ);
143
160
  };
144
161
 
@@ -488,9 +505,27 @@ SceneCore.prototype._adjustCameraToAllFloors = function() {
488
505
  box.getCenter(center);
489
506
  box.getSize(size);
490
507
  var maxSize = Math.max(size.x, size.z);
491
- var distance = maxSize * 2;
492
508
 
493
- this.camera.position.set(center.x, center.y + distance * 1.5, center.z + distance);
509
+ // ALL 多模型:与 Orbit 调试一致,调试里「俯仰角」= 极角 polar=acos(dy/dist)
510
+ // 本处 pitchDeg 为仰角(相对水平面),polar ≈ 90° - pitchDeg,故 polar≈60° 时取 pitchDeg≈30°。
511
+ // 参考 ALL 斜俯视、前侧方看整体:略抬高视角并留边距。
512
+ var pitchDeg = 30;
513
+ var azimuthDeg = -48;
514
+ var baseDistance = 13.2;
515
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
516
+
517
+ var pitchRad = pitchDeg * Math.PI / 180;
518
+ var azimuthRad = azimuthDeg * Math.PI / 180;
519
+ var cosPitch = Math.cos(pitchRad);
520
+ var sinPitch = Math.sin(pitchRad);
521
+ var cosAzimuth = Math.cos(azimuthRad);
522
+ var sinAzimuth = Math.sin(azimuthRad);
523
+
524
+ this.camera.position.set(
525
+ center.x + distance * sinAzimuth * cosPitch,
526
+ center.y + distance * sinPitch,
527
+ center.z + distance * cosAzimuth * cosPitch
528
+ );
494
529
  this.camera.lookAt(center);
495
530
  if (this.controls) {
496
531
  this.controls.target.copy(center);
@@ -527,10 +562,25 @@ SceneCore.prototype.adjustCameraToFloor = function(floorIndex) {
527
562
  box.getCenter(center);
528
563
  box.getSize(size);
529
564
  var maxSize = Math.max(size.x, size.z);
530
- var distance = maxSize * 1.5;
531
565
 
532
- // -60° 俯角(与 ALL -45° 区分,单楼层更俯视)
533
- this.camera.position.set(center.x, center.y - distance * 1.732, center.z + distance);
566
+ // 单模型相机参数:俯仰角45°,方位角-37.94°,基准距离9(拉近)
567
+ var pitchDeg = 45;
568
+ var azimuthDeg = -37.94;
569
+ var baseDistance = 9;
570
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
571
+
572
+ var pitchRad = pitchDeg * Math.PI / 180;
573
+ var azimuthRad = azimuthDeg * Math.PI / 180;
574
+ var cosPitch = Math.cos(pitchRad);
575
+ var sinPitch = Math.sin(pitchRad);
576
+ var cosAzimuth = Math.cos(azimuthRad);
577
+ var sinAzimuth = Math.sin(azimuthRad);
578
+
579
+ this.camera.position.set(
580
+ center.x + distance * sinAzimuth * cosPitch,
581
+ center.y + distance * sinPitch,
582
+ center.z + distance * cosAzimuth * cosPitch
583
+ );
534
584
  var lookAtTgt = new THREE.Vector3(center.x, center.y, center.z);
535
585
  this.camera.lookAt(lookAtTgt);
536
586
  if (this.controls) {
@@ -919,7 +969,7 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
919
969
  */
920
970
  SceneCore.prototype._adjustCameraToModel = function() {
921
971
  var self = this;
922
-
972
+
923
973
  try {
924
974
  var finalBox = new THREE.Box3().setFromObject(self.mapModel);
925
975
  var finalCenter = new THREE.Vector3();
@@ -929,12 +979,23 @@ SceneCore.prototype._adjustCameraToModel = function() {
929
979
  finalBox.getSize(finalSize);
930
980
  var maxSize = Math.max(finalSize.x, finalSize.z);
931
981
 
932
- var distance = maxSize * 1.5;
982
+ // 单模型相机参数:俯仰角45°,方位角-37.94°,基准距离9(拉近)
983
+ var pitchDeg = 45;
984
+ var azimuthDeg = -37.94;
985
+ var baseDistance = 9;
986
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
987
+
988
+ var pitchRad = pitchDeg * Math.PI / 180;
989
+ var azimuthRad = azimuthDeg * Math.PI / 180;
990
+ var cosPitch = Math.cos(pitchRad);
991
+ var sinPitch = Math.sin(pitchRad);
992
+ var cosAzimuth = Math.cos(azimuthRad);
993
+ var sinAzimuth = Math.sin(azimuthRad);
933
994
 
934
995
  self.camera.position.set(
935
- finalCenter.x,
936
- finalCenter.y + distance,
937
- finalCenter.z + distance * 0.5
996
+ finalCenter.x + distance * sinAzimuth * cosPitch,
997
+ finalCenter.y + distance * sinPitch,
998
+ finalCenter.z + distance * cosAzimuth * cosPitch
938
999
  );
939
1000
  self.camera.lookAt(finalCenter.x, finalCenter.y, finalCenter.z);
940
1001