@kimap/indoor-positioning-sdk-vue2 5.4.7 → 5.4.8

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.4.7",
3
+ "version": "5.4.8",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -916,10 +916,11 @@ KimapSDK.prototype._zoomToShowAllFloors = function() {
916
916
  var maxSize = Math.max(size.x, size.z);
917
917
  var distance = maxSize * 2;
918
918
 
919
- // 计算目标位置
919
+ // 计算目标位置 - 从侧面斜45度角看过去
920
+ // X方向偏移distance,Z方向也偏移distance,形成45度角
920
921
  var targetPosition = new THREE.Vector3(
921
- center.x,
922
- center.y + distance * 1.5,
922
+ center.x + distance,
923
+ center.y + distance * 0.8,
923
924
  center.z + distance
924
925
  );
925
926
 
@@ -29,6 +29,7 @@ var extractColorsFromOBJ = parsers.extractColorsFromOBJ;
29
29
  var extractTextElementsFromOBJ = parsers.extractTextElementsFromOBJ;
30
30
  var extractWallOpacityFromOBJ = parsers.extractWallOpacityFromOBJ;
31
31
  var extractShapeOpacityFromOBJ = parsers.extractShapeOpacityFromOBJ;
32
+ var extractAreaOpacityFromOBJ = parsers.extractAreaOpacityFromOBJ;
32
33
  var extractCalibrationBoundaryAreaIdsFromOBJ = parsers.extractCalibrationBoundaryAreaIdsFromOBJ;
33
34
 
34
35
  /**
@@ -452,7 +453,13 @@ SceneCore.prototype._loadKimapFile = function(kimapUrl, themeUrl, objLoader, mtl
452
453
  if (shapeOpacity && Object.keys(shapeOpacity).length > 0) {
453
454
  self._shapeOpacity = shapeOpacity;
454
455
  }
455
-
456
+
457
+ // 提取区域透明度信息
458
+ var areaOpacity = extractAreaOpacityFromOBJ(objContent);
459
+ if (areaOpacity && Object.keys(areaOpacity).length > 0) {
460
+ self._areaOpacity = areaOpacity;
461
+ }
462
+
456
463
  // 解析OBJ内容
457
464
  var object = objLoader.parse(objContent);
458
465
 
@@ -621,6 +628,11 @@ SceneCore.prototype._loadKimapFileToGroup = function(kimapUrl, themeUrl, objLoad
621
628
  if (shapeOpacity && Object.keys(shapeOpacity).length > 0) {
622
629
  self._shapeOpacity = shapeOpacity;
623
630
  }
631
+
632
+ var areaOpacity = extractAreaOpacityFromOBJ(objContent);
633
+ if (areaOpacity && Object.keys(areaOpacity).length > 0) {
634
+ self._areaOpacity = areaOpacity;
635
+ }
624
636
  }
625
637
 
626
638
  var object = objLoader.parse(objContent);
@@ -1146,11 +1158,26 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
1146
1158
  // 与主应用 three-helper.ts 保持一致
1147
1159
  // =====================================================
1148
1160
  var depthWrite = true;
1149
-
1161
+ var emissiveEnabled = false;
1162
+ var emissiveColor = 0x000000;
1163
+ var emissiveIntensity = 0;
1164
+
1150
1165
  if (child.material.name.startsWith('Area_')) {
1151
1166
  roughness = 0.5;
1152
1167
  metalness = 0.2;
1153
1168
  transparent = true;
1169
+ // 从OBJ提取的区域透明度数据中读取
1170
+ if (self._areaOpacity) {
1171
+ var areaId = child.material.name.replace('Area_', '');
1172
+ if (self._areaOpacity[areaId]) {
1173
+ opacity = self._areaOpacity[areaId].opacity;
1174
+ transparent = opacity < 1.0;
1175
+ }
1176
+ }
1177
+ // 添加轻微emissive提亮区域颜色
1178
+ emissiveEnabled = true;
1179
+ emissiveColor = mtlColor;
1180
+ emissiveIntensity = 0.15;
1154
1181
  // 区域通常是高透明度的,关闭depthWrite避免与3D家具的深度冲突
1155
1182
  depthWrite = false;
1156
1183
  } else if (child.material.name.startsWith('Wall_')) {
@@ -1196,6 +1223,8 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
1196
1223
  transparent: transparent,
1197
1224
  roughness: roughness,
1198
1225
  metalness: metalness,
1226
+ emissive: emissiveEnabled ? new THREE.Color(emissiveColor) : new THREE.Color(0x000000),
1227
+ emissiveIntensity: emissiveEnabled ? emissiveIntensity : 0,
1199
1228
  side: THREE.DoubleSide,
1200
1229
  depthWrite: depthWrite // 高透明度时关闭depthWrite避免频闪
1201
1230
  });
@@ -242,6 +242,36 @@ function extractShapeOpacityFromOBJ(objContent) {
242
242
  return shapeOpacity;
243
243
  }
244
244
 
245
+ /**
246
+ * 从OBJ内容中提取区域透明度信息
247
+ * 格式: # AREA_OPACITY 0.9
248
+ */
249
+ function extractAreaOpacityFromOBJ(objContent) {
250
+ var areaOpacity = {};
251
+ var lines = objContent.split('\n');
252
+ var currentAreaId = null;
253
+
254
+ for (var i = 0; i < lines.length; i++) {
255
+ var line = lines[i].trim();
256
+
257
+ if (line.indexOf('o Area_') === 0) {
258
+ // 提取区域ID(格式:Area_<id>)
259
+ var match = line.match(/Area_(.+)/);
260
+ if (match) {
261
+ currentAreaId = match[1];
262
+ }
263
+ } else if (currentAreaId && line.indexOf('# AREA_OPACITY') === 0) {
264
+ var opacity = parseFloat(line.split(' ')[2]);
265
+ if (!areaOpacity[currentAreaId]) {
266
+ areaOpacity[currentAreaId] = {};
267
+ }
268
+ areaOpacity[currentAreaId].opacity = opacity;
269
+ }
270
+ }
271
+
272
+ return areaOpacity;
273
+ }
274
+
245
275
  /**
246
276
  * 从 OBJ 中提取「真实世界尺寸校准边界」区域 ID(与绘制端 objExporter 中 # KIMAP_AREA_CALIBRATION_BOUNDARY 对应)
247
277
  * 仅此类区域不应显示;普通 Area_ 地面应保留。
@@ -273,5 +303,6 @@ module.exports = {
273
303
  extractTextElementsFromOBJ: extractTextElementsFromOBJ,
274
304
  extractWallOpacityFromOBJ: extractWallOpacityFromOBJ,
275
305
  extractShapeOpacityFromOBJ: extractShapeOpacityFromOBJ,
306
+ extractAreaOpacityFromOBJ: extractAreaOpacityFromOBJ,
276
307
  extractCalibrationBoundaryAreaIdsFromOBJ: extractCalibrationBoundaryAreaIdsFromOBJ
277
308
  };