fl-web-component 2.1.17 → 2.1.19
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/dist/fl-web-component.common.js +200 -170
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-graphics/index.vue +64 -13
- package/packages/components/com-graphics/mock.json +1417 -44
- package/packages/utils/StreamLoader.js +62 -62
|
@@ -1468,68 +1468,68 @@ export class StreamLoader {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
1470
|
|
|
1471
|
-
async getBox({ id, projectId = this.projectId || 0, isDebug }) {
|
|
1472
|
-
// 1. 尝试从 IndexedDB 读取
|
|
1473
|
-
const cached = await this._getFromDB(id, projectId);
|
|
1474
|
-
if (cached && !isDebug) {
|
|
1475
|
-
return cached;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
const getLegacyBox = async () => {
|
|
1479
|
-
if (!this.modelApi || typeof this.modelApi.getBox !== 'function') {
|
|
1480
|
-
throw new Error('modelApi.getBox is not available');
|
|
1481
|
-
}
|
|
1482
|
-
const res = await this.modelApi.getBox({ id, projectId });
|
|
1483
|
-
if (!res) return null;
|
|
1484
|
-
this._applyPrefixId(res, 'id', id);
|
|
1485
|
-
this._saveToDB(id, res, projectId);
|
|
1486
|
-
return res;
|
|
1487
|
-
};
|
|
1488
|
-
|
|
1489
|
-
// 2. 未配置批次数接口时,兼容旧版一次性请求。
|
|
1490
|
-
if (!this.modelApi || typeof this.modelApi.getMeshBatchCount !== 'function') {
|
|
1491
|
-
return getLegacyBox();
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
// 3. 先获取批次数量,再顺序拉取每一批包围盒数据。
|
|
1495
|
-
let batchResult;
|
|
1496
|
-
try {
|
|
1497
|
-
batchResult = await this.modelApi.getMeshBatchCount({ id, projectId });
|
|
1498
|
-
} catch (error) {
|
|
1499
|
-
const status = error && error.response ? error.response.status : error && error.status;
|
|
1500
|
-
if (status === 404) {
|
|
1501
|
-
return getLegacyBox();
|
|
1502
|
-
}
|
|
1503
|
-
throw error;
|
|
1504
|
-
}
|
|
1505
|
-
const batchCount = Number(
|
|
1506
|
-
batchResult && typeof batchResult === 'object' ? batchResult.index : batchResult
|
|
1507
|
-
);
|
|
1508
|
-
if (!Number.isInteger(batchCount) || batchCount < 0) {
|
|
1509
|
-
throw new Error('Invalid getBox batch count');
|
|
1510
|
-
}
|
|
1511
|
-
if (batchCount === 0) {
|
|
1512
|
-
return [];
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
const boxList = [];
|
|
1516
|
-
for (let index = 0; index < batchCount; index++) {
|
|
1517
|
-
const batch = await this.modelApi.getBox({ id, projectId, index });
|
|
1518
|
-
if (!batch) {
|
|
1519
|
-
throw new Error(`Failed to get box batch: ${index}`);
|
|
1520
|
-
}
|
|
1521
|
-
if (Array.isArray(batch)) {
|
|
1522
|
-
boxList.push(...batch);
|
|
1523
|
-
} else {
|
|
1524
|
-
boxList.push(batch);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
// 4. 全部批次成功后统一处理并写入完整缓存。
|
|
1529
|
-
this._applyPrefixId(boxList, 'id', id);
|
|
1530
|
-
this._saveToDB(id, boxList, projectId);
|
|
1531
|
-
return boxList;
|
|
1532
|
-
}
|
|
1471
|
+
async getBox({ id, projectId = this.projectId || 0, isDebug }) {
|
|
1472
|
+
// 1. 尝试从 IndexedDB 读取
|
|
1473
|
+
const cached = await this._getFromDB(id, projectId);
|
|
1474
|
+
if (cached && !isDebug) {
|
|
1475
|
+
return cached;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
const getLegacyBox = async () => {
|
|
1479
|
+
if (!this.modelApi || typeof this.modelApi.getBox !== 'function') {
|
|
1480
|
+
throw new Error('modelApi.getBox is not available');
|
|
1481
|
+
}
|
|
1482
|
+
const res = await this.modelApi.getBox({ id, projectId });
|
|
1483
|
+
if (!res) return null;
|
|
1484
|
+
this._applyPrefixId(res, 'id', id);
|
|
1485
|
+
this._saveToDB(id, res, projectId);
|
|
1486
|
+
return res;
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
// 2. 未配置批次数接口时,兼容旧版一次性请求。
|
|
1490
|
+
if (!this.modelApi || typeof this.modelApi.getMeshBatchCount !== 'function') {
|
|
1491
|
+
return getLegacyBox();
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// 3. 先获取批次数量,再顺序拉取每一批包围盒数据。
|
|
1495
|
+
let batchResult;
|
|
1496
|
+
try {
|
|
1497
|
+
batchResult = await this.modelApi.getMeshBatchCount({ id, projectId });
|
|
1498
|
+
} catch (error) {
|
|
1499
|
+
const status = error && error.response ? error.response.status : error && error.status;
|
|
1500
|
+
if (status === 404) {
|
|
1501
|
+
return getLegacyBox();
|
|
1502
|
+
}
|
|
1503
|
+
throw error;
|
|
1504
|
+
}
|
|
1505
|
+
const batchCount = Number(
|
|
1506
|
+
batchResult && typeof batchResult === 'object' ? batchResult.index : batchResult
|
|
1507
|
+
);
|
|
1508
|
+
if (!Number.isInteger(batchCount) || batchCount < 0) {
|
|
1509
|
+
throw new Error('Invalid getBox batch count');
|
|
1510
|
+
}
|
|
1511
|
+
if (batchCount === 0) {
|
|
1512
|
+
return [];
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
const boxList = [];
|
|
1516
|
+
for (let index = 0; index < batchCount; index++) {
|
|
1517
|
+
const batch = await this.modelApi.getBox({ id, projectId, index });
|
|
1518
|
+
if (!batch) {
|
|
1519
|
+
throw new Error(`Failed to get box batch: ${index}`);
|
|
1520
|
+
}
|
|
1521
|
+
if (Array.isArray(batch)) {
|
|
1522
|
+
boxList.push(...batch);
|
|
1523
|
+
} else {
|
|
1524
|
+
boxList.push(batch);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// 4. 全部批次成功后统一处理并写入完整缓存。
|
|
1529
|
+
this._applyPrefixId(boxList, 'id', id);
|
|
1530
|
+
this._saveToDB(id, boxList, projectId);
|
|
1531
|
+
return boxList;
|
|
1532
|
+
}
|
|
1533
1533
|
|
|
1534
1534
|
async handleCameraControlForStream(args) {
|
|
1535
1535
|
// 性能优化注释:禁用 range 被注释字段的解构声明与初始化
|