@kimap/indoor-positioning-sdk-vue2 4.1.5 → 4.1.7
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 +1 -1
- package/src/core/KimapSDK.js +33 -1
- package/src/core/SceneCore.js +12 -2
package/package.json
CHANGED
package/src/core/KimapSDK.js
CHANGED
|
@@ -524,6 +524,18 @@ KimapSDK.prototype.getCoordinateSystem = function() {
|
|
|
524
524
|
KimapSDK.prototype.getConfig = function() {
|
|
525
525
|
var config = {};
|
|
526
526
|
|
|
527
|
+
// 从coordinateSystem获取scale
|
|
528
|
+
if (this.core && this.core.coordinateSystem) {
|
|
529
|
+
var coordSys = this.core.coordinateSystem;
|
|
530
|
+
if (coordSys.scale) {
|
|
531
|
+
config.scale = coordSys.scale;
|
|
532
|
+
}
|
|
533
|
+
// 添加坐标系统信息
|
|
534
|
+
config.maxX = coordSys.maxX;
|
|
535
|
+
config.maxY = coordSys.maxY;
|
|
536
|
+
config.maxZ = coordSys.maxZ;
|
|
537
|
+
}
|
|
538
|
+
|
|
527
539
|
// 模型尺寸(从边界信息获取,单位:米)
|
|
528
540
|
if (this._borderInfo) {
|
|
529
541
|
var border = this._borderInfo;
|
|
@@ -537,7 +549,27 @@ KimapSDK.prototype.getConfig = function() {
|
|
|
537
549
|
config.isCalibrated = true;
|
|
538
550
|
config.baseMapWidth = this._mapConfig.realWidth / 100; // 底图真实宽度(米)
|
|
539
551
|
config.baseMapHeight = this._mapConfig.realHeight / 100; // 底图真实高度(米)
|
|
540
|
-
|
|
552
|
+
|
|
553
|
+
// modelToRealScale: 模型尺寸与真实尺寸的比例
|
|
554
|
+
if (this._mapConfig.modelToRealScale) {
|
|
555
|
+
config.modelToRealScale = this._mapConfig.modelToRealScale;
|
|
556
|
+
} else if (config.mapX && this._mapConfig.realWidth) {
|
|
557
|
+
// 如果没有直接提供modelToRealScale,根据模型尺寸和真实尺寸计算
|
|
558
|
+
// modelToRealScale = 模型宽度(米) / 真实宽度(米)
|
|
559
|
+
config.modelToRealScale = config.mapX / (this._mapConfig.realWidth / 100);
|
|
560
|
+
} else {
|
|
561
|
+
// 默认值
|
|
562
|
+
config.modelToRealScale = 1.0;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// 添加完整的mapConfig数据
|
|
566
|
+
config.realWidth = this._mapConfig.realWidth;
|
|
567
|
+
config.realHeight = this._mapConfig.realHeight;
|
|
568
|
+
} else {
|
|
569
|
+
// 如果没有校准数据,提供默认值
|
|
570
|
+
config.isCalibrated = false;
|
|
571
|
+
// 默认modelToRealScale为1.0(模型单位=真实单位)
|
|
572
|
+
config.modelToRealScale = 1.0;
|
|
541
573
|
}
|
|
542
574
|
|
|
543
575
|
return config;
|
package/src/core/SceneCore.js
CHANGED
|
@@ -41,10 +41,20 @@ function SceneCore(config) {
|
|
|
41
41
|
this.mapModel = null;
|
|
42
42
|
|
|
43
43
|
// 需要先加载 THREE 才能使用 THREE.Vector3
|
|
44
|
+
var mapWidth = config.maxX || 100;
|
|
45
|
+
var mapHeight = config.maxY || 50;
|
|
46
|
+
var mapDepth = config.maxZ || 10;
|
|
47
|
+
|
|
44
48
|
this.coordinateSystem = {
|
|
45
49
|
origin: config.origin || { x: 0, y: 0, z: 0 },
|
|
46
|
-
maxX:
|
|
47
|
-
maxY:
|
|
50
|
+
maxX: mapWidth,
|
|
51
|
+
maxY: mapHeight,
|
|
52
|
+
maxZ: mapDepth,
|
|
53
|
+
scale: {
|
|
54
|
+
x: mapWidth,
|
|
55
|
+
y: mapDepth,
|
|
56
|
+
z: mapHeight
|
|
57
|
+
}
|
|
48
58
|
};
|
|
49
59
|
}
|
|
50
60
|
|