@kimap/indoor-positioning-sdk-vue2 4.1.7 → 4.2.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": "4.1.7",
3
+ "version": "4.2.0",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -524,6 +524,9 @@ KimapSDK.prototype.getCoordinateSystem = function() {
524
524
  KimapSDK.prototype.getConfig = function() {
525
525
  var config = {};
526
526
 
527
+ console.log('[getConfig] _mapConfig:', this._mapConfig);
528
+ console.log('[getConfig] _borderInfo:', this._borderInfo);
529
+
527
530
  // 从coordinateSystem获取scale
528
531
  if (this.core && this.core.coordinateSystem) {
529
532
  var coordSys = this.core.coordinateSystem;
@@ -553,13 +556,16 @@ KimapSDK.prototype.getConfig = function() {
553
556
  // modelToRealScale: 模型尺寸与真实尺寸的比例
554
557
  if (this._mapConfig.modelToRealScale) {
555
558
  config.modelToRealScale = this._mapConfig.modelToRealScale;
559
+ console.log('[getConfig] 使用_mapConfig中的modelToRealScale:', config.modelToRealScale);
556
560
  } else if (config.mapX && this._mapConfig.realWidth) {
557
561
  // 如果没有直接提供modelToRealScale,根据模型尺寸和真实尺寸计算
558
562
  // modelToRealScale = 模型宽度(米) / 真实宽度(米)
559
563
  config.modelToRealScale = config.mapX / (this._mapConfig.realWidth / 100);
564
+ console.log('[getConfig] 计算modelToRealScale:', config.modelToRealScale, '= mapX:', config.mapX, '/ realWidth:', this._mapConfig.realWidth / 100);
560
565
  } else {
561
566
  // 默认值
562
567
  config.modelToRealScale = 1.0;
568
+ console.log('[getConfig] 使用默认modelToRealScale: 1.0');
563
569
  }
564
570
 
565
571
  // 添加完整的mapConfig数据
@@ -570,6 +576,7 @@ KimapSDK.prototype.getConfig = function() {
570
576
  config.isCalibrated = false;
571
577
  // 默认modelToRealScale为1.0(模型单位=真实单位)
572
578
  config.modelToRealScale = 1.0;
579
+ console.log('[getConfig] 没有校准数据,使用默认modelToRealScale: 1.0');
573
580
  }
574
581
 
575
582
  return config;
@@ -202,8 +202,8 @@ SceneCore.prototype.addCoordinateHelper = function() {
202
202
  var origin = this.coordinateSystem.origin;
203
203
  var maxX = this.coordinateSystem.maxX;
204
204
  var maxY = this.coordinateSystem.maxY;
205
- var showGrid = this.config.showGrid !== false;
206
- var showAxes = this.config.showAxes !== false;
205
+ var showGrid = this.config.showGrid === true;
206
+ var showAxes = this.config.showAxes === true;
207
207
 
208
208
  if (showGrid) {
209
209
  var gridSize = Math.max(maxX, maxY) * 1.5;
@@ -40,30 +40,49 @@ function extractBorderFromOBJ(objContent) {
40
40
  /**
41
41
  * 从OBJ内容中提取地图配置信息
42
42
  * 格式示例:
43
+ * # KIMAP_CONFIG_IS_CALIBRATED true
44
+ * # KIMAP_CONFIG_CALIBRATION_SCALE 1.0
45
+ * # KIMAP_CONFIG_REAL_WIDTH 1000.0
46
+ * # KIMAP_CONFIG_REAL_HEIGHT 800.0
43
47
  * # KIMAP_CONFIG_MODEL_TO_REAL_SCALE 2.0000
44
48
  */
45
49
  function extractMapConfigFromOBJ(objContent) {
46
50
  var config = {
47
51
  isCalibrated: false,
48
- modelToRealScale: 1.0,
49
- realToModelScale: 1.0
52
+ calibrationScale: null,
53
+ realWidth: null,
54
+ realHeight: null,
55
+ modelToRealScale: null
50
56
  };
51
57
 
52
58
  var lines = objContent.split('\n');
59
+ var foundConfig = false;
53
60
 
54
61
  for (var i = 0; i < lines.length; i++) {
55
62
  var line = lines[i].trim();
56
63
 
57
- if (line.indexOf('# KIMAP_CONFIG_IS_CALIBRATED') === 0) {
58
- var value = line.split(' ')[2];
59
- config.isCalibrated = (value === '1' || value.toLowerCase() === 'true');
60
- } else if (line.indexOf('# KIMAP_CONFIG_MODEL_TO_REAL_SCALE') === 0) {
64
+ if (line.indexOf('KIMAP_CONFIG_CALIBRATED') !== -1) {
65
+ config.isCalibrated = line.split(' ')[2] === 'true';
66
+ foundConfig = true;
67
+ } else if (line.indexOf('KIMAP_CONFIG_CALIBRATION_SCALE') !== -1) {
68
+ config.calibrationScale = parseFloat(line.split(' ')[2]);
69
+ } else if (line.indexOf('KIMAP_CONFIG_REAL_WIDTH') !== -1) {
70
+ config.realWidth = parseFloat(line.split(' ')[2]);
71
+ } else if (line.indexOf('KIMAP_CONFIG_REAL_HEIGHT') !== -1) {
72
+ config.realHeight = parseFloat(line.split(' ')[2]);
73
+ } else if (line.indexOf('KIMAP_CONFIG_MODEL_TO_REAL_SCALE') !== -1) {
61
74
  config.modelToRealScale = parseFloat(line.split(' ')[2]);
62
- config.realToModelScale = 1.0 / config.modelToRealScale;
75
+ }
76
+
77
+ // 只在遇到 End Config Info 时停止
78
+ if (line.indexOf('End Config Info') !== -1) {
79
+ break;
63
80
  }
64
81
  }
65
82
 
66
- return config;
83
+ console.log('[Parsers] 提取到的地图配置:', config);
84
+
85
+ return foundConfig ? config : null;
67
86
  }
68
87
 
69
88
  /**