@kimap/indoor-positioning-sdk-vue2 6.1.1 → 6.1.2

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": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -790,10 +790,6 @@ KimapSDK.prototype.showAllFloors = function() {
790
790
  // 相机动画飞到 ALL 外景视角(参考正式版 _zoomToShowAllFloors)
791
791
  this._zoomToShowAllFloors();
792
792
 
793
- // 渲染 ALL 模式周边建筑物(带淡入效果)
794
- this.core._addAllModeBuildings();
795
- this._fadeInAllModeBuildings(600);
796
-
797
793
  this._currentShowingFloorIndex = -1; // ALL 状态
798
794
  this._currentMode = 'all';
799
795
  };
@@ -902,57 +898,6 @@ KimapSDK.prototype._animateCamera = function(target, duration, onComplete) {
902
898
  animate();
903
899
  };
904
900
 
905
- /**
906
- * 淡入 ALL 模式建筑物(带透明度动画)
907
- * @param {number} duration - 动画时长 ms
908
- * @private
909
- */
910
- KimapSDK.prototype._fadeInAllModeBuildings = function(duration) {
911
- var self = this;
912
- if (!this.core._allModeBuildings || this.core._allModeBuildings.length === 0) return;
913
-
914
- // 初始透明度设为0
915
- this.core._allModeBuildings.forEach(function(mesh) {
916
- if (mesh.material) {
917
- mesh.material.transparent = true;
918
- if (mesh.material.opacity !== undefined) {
919
- mesh.material.opacity = 0;
920
- }
921
- }
922
- });
923
-
924
- var startTime = performance.now();
925
-
926
- function fadeAnimate() {
927
- var elapsed = performance.now() - startTime;
928
- var progress = Math.min(elapsed / duration, 1);
929
-
930
- self.core._allModeBuildings.forEach(function(mesh) {
931
- if (mesh.material) {
932
- var name = mesh.name || '';
933
- // 窗户和窗户边框
934
- if (name.startsWith('__build__win_')) {
935
- mesh.material.opacity = 0.35 * progress; // 窗户柔和淡蓝色
936
- } else if (name.startsWith('__build__winframe_')) {
937
- mesh.material.opacity = 0.6 * progress; // 窗户边框
938
- } else if (name.startsWith('__build__edges')) {
939
- mesh.material.opacity = 0.8 * progress; // 建筑物描边
940
- } else if (name.startsWith('__build__tip')) {
941
- mesh.material.opacity = progress; // 顶部标记
942
- } else {
943
- mesh.material.opacity = 0.25 * progress; // 建筑物主体
944
- }
945
- }
946
- });
947
-
948
- if (progress < 1) {
949
- requestAnimationFrame(fadeAnimate);
950
- }
951
- }
952
-
953
- fadeAnimate();
954
- };
955
-
956
901
  /**
957
902
  * 多楼层:是否正在显示所有楼层
958
903
  * @public
@@ -580,199 +580,8 @@ SceneCore.prototype._adjustCameraToAllFloors = function() {
580
580
  * @private
581
581
  */
582
582
  SceneCore.prototype._addAllModeBuildings = function() {
583
- this._removeAllModeBuildings();
584
-
585
- try {
586
- // 收集所有属于真实模型的 Mesh(排除地面/网格/辅助物/已添加的建筑物)
587
- var excludeNames = ['__build__'];
588
- var allMeshes = [];
589
- this.scene.traverse(function(child) {
590
- if (!child.isMesh) return;
591
- // 排除非模型物体:地面网格等
592
- if (child.name && child.name.startsWith('__build__')) return;
593
- // 排除 GridHelper / AxisHelper 等辅助器(它们 isMesh === true 但无 geometry)
594
- if (!child.geometry) return;
595
- // 排除尺寸为0的物体
596
- if (child.geometry.parameters && child.geometry.parameters.width === 0) return;
597
- allMeshes.push(child);
598
- });
599
-
600
- if (allMeshes.length === 0) {
601
- console.warn('_addAllModeBuildings: scene 中无有效模型 Mesh,跳过');
602
- return;
603
- }
604
-
605
- var box = new THREE.Box3();
606
- allMeshes.forEach(function(mesh) { box.expandByObject(mesh); });
607
- // 用 .min / .max 属性而非 .getMin() / .getMax()(兼容旧版 THREE.js)
608
- var boxMin = box.min;
609
- var boxMax = box.max;
610
- var centerX = (boxMin.x + boxMax.x) / 2;
611
- var centerZ = (boxMin.z + boxMax.z) / 2;
612
- var modelW = boxMax.x - boxMin.x;
613
- var modelD = boxMax.z - boxMin.z;
614
- var modelH = boxMax.y - boxMin.y;
615
-
616
- if (modelW < 0.01 || modelD < 0.01) {
617
- console.warn('_addAllModeBuildings: 模型尺寸过小,跳过', { w: modelW, d: modelD, h: modelH });
618
- return;
619
- }
620
-
621
- console.log('_addAllModeBuildings: 模型包围盒 min', boxMin, 'max', boxMax,
622
- 'W=' + modelW.toFixed(2) + ' D=' + modelD.toFixed(2) + ' H=' + modelH.toFixed(2));
623
-
624
- // 建筑物高度取模型高度的 2~4 倍,宽度为 0.3 倍
625
- var bW = modelW * 0.3;
626
- var bD = modelD * 0.3;
627
- var heights = [modelH * 2.5, modelH * 3.5, modelH * 2.0, modelH * 4.0];
628
- // 前后左右,距模型边缘 0.8 倍尺寸
629
- var offsets = [
630
- { x: 0, z: -(modelD / 2 + modelD * 0.8), w: bW, d: bD }, // 前
631
- { x: 0, z: modelD / 2 + modelD * 0.8, w: bW, d: bD }, // 后
632
- { x: modelW / 2 + modelW * 0.8, z: 0, w: bW, d: bD }, // 右
633
- { x: -(modelW / 2 + modelW * 0.8), z: 0, w: bW, d: bD } // 左
634
- ];
635
-
636
- var self = this;
637
- heights.forEach(function(h, i) {
638
- var o = offsets[i];
639
- var geo = new THREE.BoxGeometry(o.w, h, o.d);
640
- var baseY = h / 2;
641
- var basePos = { x: centerX + o.x, y: baseY, z: centerZ + o.z };
642
-
643
- // 灰色半透明主体
644
- var mat = new THREE.MeshBasicMaterial({
645
- color: 0x888888,
646
- transparent: true,
647
- opacity: 0.25,
648
- depthWrite: false
649
- });
650
- var mesh = new THREE.Mesh(geo, mat);
651
- mesh.name = '__build__' + i;
652
- mesh.position.set(basePos.x, basePos.y, basePos.z);
653
- mesh.castShadow = false;
654
- mesh.receiveShadow = false;
655
- self.scene.add(mesh);
656
- self._allModeBuildings.push(mesh);
657
-
658
- // 淡蓝色描边
659
- var edgesGeo = new THREE.EdgesGeometry(geo);
660
- var edgesMat = new THREE.LineBasicMaterial({
661
- color: 0x4fc3f7,
662
- transparent: true,
663
- opacity: 0.8
664
- });
665
- var edges = new THREE.LineSegments(edgesGeo, edgesMat);
666
- edges.position.copy(mesh.position);
667
- edges.name = '__build__edges' + i;
668
- self.scene.add(edges);
669
- self._allModeBuildings.push(edges);
670
-
671
- // 添加窗户(前后面)
672
- self._addBuildingWindows(basePos.x, basePos.z - o.d / 2, o.w, h, 'z-', i, 1);
673
- self._addBuildingWindows(basePos.x, basePos.z + o.d / 2, o.w, h, 'z+', i, 1);
674
- // 添加窗户(左右面)
675
- self._addBuildingWindows(basePos.x - o.w / 2, basePos.z, o.d, h, 'x-', i, 2);
676
- self._addBuildingWindows(basePos.x + o.w / 2, basePos.z, o.d, h, 'x+', i, 2);
677
-
678
- // 顶部标记(淡蓝色)
679
- var tipGeo = new THREE.BoxGeometry(o.w * 0.3, 0.1, o.d * 0.3);
680
- var tipMat = new THREE.MeshBasicMaterial({ color: 0x4fc3f7 });
681
- var tip = new THREE.Mesh(tipGeo, tipMat);
682
- tip.name = '__build__tip' + i;
683
- tip.position.set(basePos.x, h + 0.05, basePos.z);
684
- tip.castShadow = false;
685
- tip.receiveShadow = false;
686
- self.scene.add(tip);
687
- self._allModeBuildings.push(tip);
688
-
689
- console.log(' 建筑物[' + i + '] 顶=' + baseY.toFixed(2) + ' 高=' + h.toFixed(2) +
690
- ' 位置(' + mesh.position.x.toFixed(2) + ', ' + mesh.position.y.toFixed(2) + ', ' + mesh.position.z.toFixed(2) + ')');
691
- });
692
-
693
- console.log('ALL 模式:已添加 ' + (self._allModeBuildings.length / 2) + ' 栋周边建筑物(共' + self._allModeBuildings.length + '个对象)');
694
- } catch (e) {
695
- console.warn('添加 ALL 模式建筑物失败:', e);
696
- }
697
- };
698
-
699
- /**
700
- * 为建筑物添加窗户
701
- * @param {number} baseX - 墙面中心X
702
- * @param {number} baseZ - 墙面中心Z
703
- * @param {number} wallWidth - 墙面宽度
704
- * @param {number} wallHeight - 墙面高度
705
- * @param {string} face - 墙面朝向 ('z-'|'z+'|'x-'|'x+')
706
- * @param {number} buildingIdx - 建筑物索引
707
- * @param {number} windowCols - 窗户列数
708
- * @private
709
- */
710
- SceneCore.prototype._addBuildingWindows = function(baseX, baseZ, wallWidth, wallHeight, face, buildingIdx, windowCols) {
711
- var windowRows = Math.max(2, Math.floor(wallHeight / 4)); // 每层约4米高,减少窗户数量
712
- var windowWidth = wallWidth * 0.12; // 窗户宽度占墙面的12%
713
- var windowHeight = wallHeight * 0.08; // 窗户高度占墙面的8%(更矮更协调)
714
- var windowSpacingX = wallWidth / (windowCols + 1);
715
- var windowSpacingY = wallHeight / (windowRows + 1);
716
-
717
- var self = this;
718
-
719
- for (var row = 0; row < windowRows; row++) {
720
- for (var col = 0; col < windowCols; col++) {
721
- var wx, wz, rotY;
722
-
723
- // 根据墙面朝向计算窗户位置
724
- if (face === 'z-') {
725
- wx = baseX - wallWidth / 2 + windowSpacingX * (col + 1);
726
- wz = baseZ - 0.01; // 稍微突出墙面
727
- rotY = 0;
728
- } else if (face === 'z+') {
729
- wx = baseX - wallWidth / 2 + windowSpacingX * (col + 1);
730
- wz = baseZ + 0.01;
731
- rotY = 0;
732
- } else if (face === 'x-') {
733
- wx = baseX - 0.01;
734
- wz = baseZ - wallWidth / 2 + windowSpacingX * (col + 1);
735
- rotY = Math.PI / 2;
736
- } else {
737
- wx = baseX + 0.01;
738
- wz = baseZ - wallWidth / 2 + windowSpacingX * (col + 1);
739
- rotY = Math.PI / 2;
740
- }
741
-
742
- var wy = windowSpacingY * (row + 1) + windowHeight / 2;
743
-
744
- // 窗户主体(降低亮度的淡蓝色,更柔和)
745
- var winGeo = new THREE.PlaneGeometry(windowWidth, windowHeight);
746
- var winMat = new THREE.MeshBasicMaterial({
747
- color: 0x3d5afe, // 深蓝色,更柔和
748
- transparent: true,
749
- opacity: 0.35, // 降低透明度,减少亮度
750
- side: THREE.DoubleSide
751
- });
752
- var win = new THREE.Mesh(winGeo, winMat);
753
- win.name = '__build__win_' + buildingIdx + '_' + face + '_' + row + '_' + col;
754
- win.position.set(wx, wy, wz);
755
- win.rotation.y = rotY;
756
- win.castShadow = false;
757
- win.receiveShadow = false;
758
- this.scene.add(win);
759
- this._allModeBuildings.push(win);
760
-
761
- // 窗户边框(细线,颜色与主体协调)
762
- var frameGeo = new THREE.EdgesGeometry(winGeo);
763
- var frameMat = new THREE.LineBasicMaterial({
764
- color: 0x5c6bc0, // 浅蓝紫色边框
765
- transparent: true,
766
- opacity: 0.6
767
- });
768
- var frame = new THREE.LineSegments(frameGeo, frameMat);
769
- frame.position.copy(win.position);
770
- frame.rotation.y = rotY;
771
- frame.name = '__build__winframe_' + buildingIdx + '_' + face + '_' + row + '_' + col;
772
- this.scene.add(frame);
773
- this._allModeBuildings.push(frame);
774
- }
775
- }
583
+ // ALL模式建筑已禁用,不再渲染
584
+ return;
776
585
  };
777
586
 
778
587
  /**