bruce-cesium 6.7.7 → 6.7.9
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/bruce-cesium.es5.js +103 -11
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +103 -11
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/getters/entity-filter-getter.js +5 -1
- package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +12 -4
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +85 -5
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -13981,11 +13981,16 @@ var TilesetCadRenderManager;
|
|
|
13981
13981
|
cacheToken: tileset.generateVersion,
|
|
13982
13982
|
viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
|
|
13983
13983
|
});
|
|
13984
|
-
api.get(modelTreeUrl).then((
|
|
13984
|
+
api.get(modelTreeUrl).then(async (result) => {
|
|
13985
13985
|
if (this.disposed) {
|
|
13986
13986
|
return;
|
|
13987
13987
|
}
|
|
13988
|
-
|
|
13988
|
+
// S3 signed URLs may return application/octet-stream instead of application/json,
|
|
13989
|
+
// causing the API to return a Blob rather than a parsed object.
|
|
13990
|
+
if (result instanceof Blob) {
|
|
13991
|
+
result = JSON.parse(await result.text());
|
|
13992
|
+
}
|
|
13993
|
+
this.modelTree = result || null;
|
|
13989
13994
|
this.modelTreeUpdate.Trigger(this.modelTree);
|
|
13990
13995
|
}).catch((err) => {
|
|
13991
13996
|
this.modelTreeError = err.message || "Unknown error";
|
|
@@ -13993,12 +13998,15 @@ var TilesetCadRenderManager;
|
|
|
13993
13998
|
}
|
|
13994
13999
|
// In v1 the model-tree is inside the tileset.json.
|
|
13995
14000
|
else {
|
|
13996
|
-
api.get(tileset.loadUrl).then((
|
|
14001
|
+
api.get(tileset.loadUrl).then(async (result) => {
|
|
13997
14002
|
var _a;
|
|
13998
14003
|
if (this.disposed) {
|
|
13999
14004
|
return;
|
|
14000
14005
|
}
|
|
14001
|
-
|
|
14006
|
+
if (result instanceof Blob) {
|
|
14007
|
+
result = JSON.parse(await result.text());
|
|
14008
|
+
}
|
|
14009
|
+
this.modelTree = ((_a = result === null || result === void 0 ? void 0 : result.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
|
|
14002
14010
|
this.modelTreeUpdate.Trigger(this.modelTree);
|
|
14003
14011
|
}).catch((err) => {
|
|
14004
14012
|
this.modelTreeError = err.message || "Unknown error";
|
|
@@ -15827,10 +15835,14 @@ var EntityFilterGetter;
|
|
|
15827
15835
|
}
|
|
15828
15836
|
// API gave us a URL to use.
|
|
15829
15837
|
else if (curCell.FetchURL) {
|
|
15830
|
-
|
|
15838
|
+
let tmpResponse = await this.api.get(curCell.FetchURL, {
|
|
15831
15839
|
abortSignal: abortController.signal,
|
|
15832
15840
|
noCache: true
|
|
15833
15841
|
});
|
|
15842
|
+
// S3 signed URLs may return application/octet-stream, causing a Blob result.
|
|
15843
|
+
if (tmpResponse instanceof Blob) {
|
|
15844
|
+
tmpResponse = JSON.parse(await tmpResponse.text());
|
|
15845
|
+
}
|
|
15834
15846
|
// Same mapping as bruce-models doing Entity.GetList.
|
|
15835
15847
|
response = {
|
|
15836
15848
|
entities: tmpResponse.Items ? tmpResponse.Items : [],
|
|
@@ -30649,25 +30661,27 @@ const getLocationFromFeature = (feature) => {
|
|
|
30649
30661
|
var _a;
|
|
30650
30662
|
const prepareLatitude = (propName, value) => {
|
|
30651
30663
|
value = +value;
|
|
30652
|
-
// Check to see if the lat is in valid degrees, if not,
|
|
30664
|
+
// Check to see if the lat is in valid degrees, if not, convert from radians.
|
|
30653
30665
|
if (value < -90 || value > 90) {
|
|
30654
|
-
|
|
30666
|
+
return Math$1.toDegrees(value);
|
|
30655
30667
|
}
|
|
30656
30668
|
// If the value is really small we'll assume it's in radians.
|
|
30657
30669
|
// "cesium#blah" properties are always in degrees. No need to check.
|
|
30658
|
-
|
|
30670
|
+
// (Only reached when the value wasn't already converted above, to avoid double-converting.)
|
|
30671
|
+
if (value < 0.9 && value > -0.9 && !propName.startsWith("cesium#")) {
|
|
30659
30672
|
value = Math$1.toDegrees(value);
|
|
30660
30673
|
}
|
|
30661
30674
|
return value;
|
|
30662
30675
|
};
|
|
30663
30676
|
const prepareLongitude = (propName, value) => {
|
|
30664
30677
|
value = +value;
|
|
30665
|
-
// Check to see if the lon is in valid degrees, if not,
|
|
30678
|
+
// Check to see if the lon is in valid degrees, if not, convert from radians.
|
|
30666
30679
|
if (value < -180 || value > 180) {
|
|
30667
|
-
|
|
30680
|
+
return Math$1.toDegrees(value);
|
|
30668
30681
|
}
|
|
30669
30682
|
// If the value is really small we'll assume it's in radians.
|
|
30670
30683
|
// "cesium#blah" properties are always in degrees. No need to check.
|
|
30684
|
+
// (Only reached when the value wasn't already converted above, to avoid double-converting.)
|
|
30671
30685
|
if (value < 0.9 && value > -0.9 && !propName.startsWith("cesium#")) {
|
|
30672
30686
|
value = Math$1.toDegrees(value);
|
|
30673
30687
|
}
|
|
@@ -31349,6 +31363,84 @@ var EntityUtils;
|
|
|
31349
31363
|
catch (e) {
|
|
31350
31364
|
console.error(e);
|
|
31351
31365
|
}
|
|
31366
|
+
// Some records may still not be expanded.
|
|
31367
|
+
// We have to detect whatever is an Assembly Entity and expand it.
|
|
31368
|
+
try {
|
|
31369
|
+
const needsExpansion = recordSamples.filter(x => {
|
|
31370
|
+
const assemblyPos = Entity$1.GetValue({
|
|
31371
|
+
entity: x.entity,
|
|
31372
|
+
path: ["Bruce", "AssemblyPosition"]
|
|
31373
|
+
});
|
|
31374
|
+
if (!assemblyPos) {
|
|
31375
|
+
return false;
|
|
31376
|
+
}
|
|
31377
|
+
const rootPos = Entity$1.GetValue({
|
|
31378
|
+
entity: x.entity,
|
|
31379
|
+
path: ["Bruce", "AssemblyRootPosition"]
|
|
31380
|
+
});
|
|
31381
|
+
return !rootPos;
|
|
31382
|
+
});
|
|
31383
|
+
if (needsExpansion.length) {
|
|
31384
|
+
const EXPAND_BATCH_SIZE = 30;
|
|
31385
|
+
const EXPAND_MAX_IDS = 200;
|
|
31386
|
+
// Figure out if any are in the scene.
|
|
31387
|
+
// Helps us sort leaf-nodes away from category nodes thta don't have geometry.
|
|
31388
|
+
const isInScene = (sample) => {
|
|
31389
|
+
var _a;
|
|
31390
|
+
return !!(visualRegister && visualRegister.GetRego({
|
|
31391
|
+
entityId: (_a = sample.entityId) !== null && _a !== void 0 ? _a : sample.entity.Bruce.ID,
|
|
31392
|
+
menuItemId: sample.menuItemId
|
|
31393
|
+
}));
|
|
31394
|
+
};
|
|
31395
|
+
// Trim to max 200 with a preference to those in the scene.
|
|
31396
|
+
const sceneSamples = needsExpansion.filter(isInScene);
|
|
31397
|
+
const offSceneSamples = sceneSamples.length ? needsExpansion.filter(x => !isInScene(x)) : [];
|
|
31398
|
+
if (offSceneSamples.length) {
|
|
31399
|
+
const offSceneIds = new Set(offSceneSamples.map(x => x.entity.Bruce.ID));
|
|
31400
|
+
recordSamples = recordSamples.filter(x => !offSceneIds.has(x.entity.Bruce.ID));
|
|
31401
|
+
}
|
|
31402
|
+
const effectiveSamples = sceneSamples.length ? sceneSamples : needsExpansion;
|
|
31403
|
+
const uniqueIds = Array.from(new Set(effectiveSamples.map(x => x.entity.Bruce.ID)));
|
|
31404
|
+
const expandIds = uniqueIds.slice(0, EXPAND_MAX_IDS);
|
|
31405
|
+
// Anything we didn't expand will taint the overall result so we have to filter them out.
|
|
31406
|
+
const droppedIds = new Set(uniqueIds.slice(EXPAND_MAX_IDS));
|
|
31407
|
+
if (droppedIds.size) {
|
|
31408
|
+
recordSamples = recordSamples.filter(x => !droppedIds.has(x.entity.Bruce.ID));
|
|
31409
|
+
}
|
|
31410
|
+
const expandedMap = new Map();
|
|
31411
|
+
const batches = [];
|
|
31412
|
+
for (let i = 0; i < expandIds.length; i += EXPAND_BATCH_SIZE) {
|
|
31413
|
+
batches.push(expandIds.slice(i, i + EXPAND_BATCH_SIZE));
|
|
31414
|
+
}
|
|
31415
|
+
const batchResults = await Promise.all(batches.map(batchIds => Entity$1.GetListByIds({
|
|
31416
|
+
entityIds: batchIds,
|
|
31417
|
+
historicPoint: latestDate,
|
|
31418
|
+
expandLocation: true,
|
|
31419
|
+
expandSources: true,
|
|
31420
|
+
migrated: true,
|
|
31421
|
+
maxSearchTimeSec: 60 * 2,
|
|
31422
|
+
api
|
|
31423
|
+
}).catch(e => {
|
|
31424
|
+
console.error(e);
|
|
31425
|
+
return { entities: [] };
|
|
31426
|
+
})));
|
|
31427
|
+
for (const { entities } of batchResults) {
|
|
31428
|
+
for (let i = 0; i < entities.length; i++) {
|
|
31429
|
+
expandedMap.set(entities[i].Bruce.ID, entities[i]);
|
|
31430
|
+
}
|
|
31431
|
+
}
|
|
31432
|
+
for (let i = 0; i < effectiveSamples.length; i++) {
|
|
31433
|
+
const sample = effectiveSamples[i];
|
|
31434
|
+
const expanded = expandedMap.get(sample.entity.Bruce.ID);
|
|
31435
|
+
if (expanded) {
|
|
31436
|
+
sample.entity = expanded;
|
|
31437
|
+
}
|
|
31438
|
+
}
|
|
31439
|
+
}
|
|
31440
|
+
}
|
|
31441
|
+
catch (e) {
|
|
31442
|
+
console.error(e);
|
|
31443
|
+
}
|
|
31352
31444
|
for (let i = 0; i < recordSamples.length; i++) {
|
|
31353
31445
|
const sample = recordSamples[i];
|
|
31354
31446
|
const samplePosses = await getRecordEntityPositions(sample);
|
|
@@ -36504,7 +36596,7 @@ var StyleUtils;
|
|
|
36504
36596
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
36505
36597
|
})(StyleUtils || (StyleUtils = {}));
|
|
36506
36598
|
|
|
36507
|
-
const VERSION = "6.7.
|
|
36599
|
+
const VERSION = "6.7.9";
|
|
36508
36600
|
/**
|
|
36509
36601
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
36510
36602
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|