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.umd.js
CHANGED
|
@@ -13935,11 +13935,16 @@
|
|
|
13935
13935
|
cacheToken: tileset.generateVersion,
|
|
13936
13936
|
viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
|
|
13937
13937
|
});
|
|
13938
|
-
api.get(modelTreeUrl).then((
|
|
13938
|
+
api.get(modelTreeUrl).then(async (result) => {
|
|
13939
13939
|
if (this.disposed) {
|
|
13940
13940
|
return;
|
|
13941
13941
|
}
|
|
13942
|
-
|
|
13942
|
+
// S3 signed URLs may return application/octet-stream instead of application/json,
|
|
13943
|
+
// causing the API to return a Blob rather than a parsed object.
|
|
13944
|
+
if (result instanceof Blob) {
|
|
13945
|
+
result = JSON.parse(await result.text());
|
|
13946
|
+
}
|
|
13947
|
+
this.modelTree = result || null;
|
|
13943
13948
|
this.modelTreeUpdate.Trigger(this.modelTree);
|
|
13944
13949
|
}).catch((err) => {
|
|
13945
13950
|
this.modelTreeError = err.message || "Unknown error";
|
|
@@ -13947,12 +13952,15 @@
|
|
|
13947
13952
|
}
|
|
13948
13953
|
// In v1 the model-tree is inside the tileset.json.
|
|
13949
13954
|
else {
|
|
13950
|
-
api.get(tileset.loadUrl).then((
|
|
13955
|
+
api.get(tileset.loadUrl).then(async (result) => {
|
|
13951
13956
|
var _a;
|
|
13952
13957
|
if (this.disposed) {
|
|
13953
13958
|
return;
|
|
13954
13959
|
}
|
|
13955
|
-
|
|
13960
|
+
if (result instanceof Blob) {
|
|
13961
|
+
result = JSON.parse(await result.text());
|
|
13962
|
+
}
|
|
13963
|
+
this.modelTree = ((_a = result === null || result === void 0 ? void 0 : result.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
|
|
13956
13964
|
this.modelTreeUpdate.Trigger(this.modelTree);
|
|
13957
13965
|
}).catch((err) => {
|
|
13958
13966
|
this.modelTreeError = err.message || "Unknown error";
|
|
@@ -15780,10 +15788,14 @@
|
|
|
15780
15788
|
}
|
|
15781
15789
|
// API gave us a URL to use.
|
|
15782
15790
|
else if (curCell.FetchURL) {
|
|
15783
|
-
|
|
15791
|
+
let tmpResponse = await this.api.get(curCell.FetchURL, {
|
|
15784
15792
|
abortSignal: abortController.signal,
|
|
15785
15793
|
noCache: true
|
|
15786
15794
|
});
|
|
15795
|
+
// S3 signed URLs may return application/octet-stream, causing a Blob result.
|
|
15796
|
+
if (tmpResponse instanceof Blob) {
|
|
15797
|
+
tmpResponse = JSON.parse(await tmpResponse.text());
|
|
15798
|
+
}
|
|
15787
15799
|
// Same mapping as bruce-models doing Entity.GetList.
|
|
15788
15800
|
response = {
|
|
15789
15801
|
entities: tmpResponse.Items ? tmpResponse.Items : [],
|
|
@@ -30557,25 +30569,27 @@
|
|
|
30557
30569
|
var _a;
|
|
30558
30570
|
const prepareLatitude = (propName, value) => {
|
|
30559
30571
|
value = +value;
|
|
30560
|
-
// Check to see if the lat is in valid degrees, if not,
|
|
30572
|
+
// Check to see if the lat is in valid degrees, if not, convert from radians.
|
|
30561
30573
|
if (value < -90 || value > 90) {
|
|
30562
|
-
|
|
30574
|
+
return Cesium.Math.toDegrees(value);
|
|
30563
30575
|
}
|
|
30564
30576
|
// If the value is really small we'll assume it's in radians.
|
|
30565
30577
|
// "cesium#blah" properties are always in degrees. No need to check.
|
|
30566
|
-
|
|
30578
|
+
// (Only reached when the value wasn't already converted above, to avoid double-converting.)
|
|
30579
|
+
if (value < 0.9 && value > -0.9 && !propName.startsWith("cesium#")) {
|
|
30567
30580
|
value = Cesium.Math.toDegrees(value);
|
|
30568
30581
|
}
|
|
30569
30582
|
return value;
|
|
30570
30583
|
};
|
|
30571
30584
|
const prepareLongitude = (propName, value) => {
|
|
30572
30585
|
value = +value;
|
|
30573
|
-
// Check to see if the lon is in valid degrees, if not,
|
|
30586
|
+
// Check to see if the lon is in valid degrees, if not, convert from radians.
|
|
30574
30587
|
if (value < -180 || value > 180) {
|
|
30575
|
-
|
|
30588
|
+
return Cesium.Math.toDegrees(value);
|
|
30576
30589
|
}
|
|
30577
30590
|
// If the value is really small we'll assume it's in radians.
|
|
30578
30591
|
// "cesium#blah" properties are always in degrees. No need to check.
|
|
30592
|
+
// (Only reached when the value wasn't already converted above, to avoid double-converting.)
|
|
30579
30593
|
if (value < 0.9 && value > -0.9 && !propName.startsWith("cesium#")) {
|
|
30580
30594
|
value = Cesium.Math.toDegrees(value);
|
|
30581
30595
|
}
|
|
@@ -31256,6 +31270,84 @@
|
|
|
31256
31270
|
catch (e) {
|
|
31257
31271
|
console.error(e);
|
|
31258
31272
|
}
|
|
31273
|
+
// Some records may still not be expanded.
|
|
31274
|
+
// We have to detect whatever is an Assembly Entity and expand it.
|
|
31275
|
+
try {
|
|
31276
|
+
const needsExpansion = recordSamples.filter(x => {
|
|
31277
|
+
const assemblyPos = BModels.Entity.GetValue({
|
|
31278
|
+
entity: x.entity,
|
|
31279
|
+
path: ["Bruce", "AssemblyPosition"]
|
|
31280
|
+
});
|
|
31281
|
+
if (!assemblyPos) {
|
|
31282
|
+
return false;
|
|
31283
|
+
}
|
|
31284
|
+
const rootPos = BModels.Entity.GetValue({
|
|
31285
|
+
entity: x.entity,
|
|
31286
|
+
path: ["Bruce", "AssemblyRootPosition"]
|
|
31287
|
+
});
|
|
31288
|
+
return !rootPos;
|
|
31289
|
+
});
|
|
31290
|
+
if (needsExpansion.length) {
|
|
31291
|
+
const EXPAND_BATCH_SIZE = 30;
|
|
31292
|
+
const EXPAND_MAX_IDS = 200;
|
|
31293
|
+
// Figure out if any are in the scene.
|
|
31294
|
+
// Helps us sort leaf-nodes away from category nodes thta don't have geometry.
|
|
31295
|
+
const isInScene = (sample) => {
|
|
31296
|
+
var _a;
|
|
31297
|
+
return !!(visualRegister && visualRegister.GetRego({
|
|
31298
|
+
entityId: (_a = sample.entityId) !== null && _a !== void 0 ? _a : sample.entity.Bruce.ID,
|
|
31299
|
+
menuItemId: sample.menuItemId
|
|
31300
|
+
}));
|
|
31301
|
+
};
|
|
31302
|
+
// Trim to max 200 with a preference to those in the scene.
|
|
31303
|
+
const sceneSamples = needsExpansion.filter(isInScene);
|
|
31304
|
+
const offSceneSamples = sceneSamples.length ? needsExpansion.filter(x => !isInScene(x)) : [];
|
|
31305
|
+
if (offSceneSamples.length) {
|
|
31306
|
+
const offSceneIds = new Set(offSceneSamples.map(x => x.entity.Bruce.ID));
|
|
31307
|
+
recordSamples = recordSamples.filter(x => !offSceneIds.has(x.entity.Bruce.ID));
|
|
31308
|
+
}
|
|
31309
|
+
const effectiveSamples = sceneSamples.length ? sceneSamples : needsExpansion;
|
|
31310
|
+
const uniqueIds = Array.from(new Set(effectiveSamples.map(x => x.entity.Bruce.ID)));
|
|
31311
|
+
const expandIds = uniqueIds.slice(0, EXPAND_MAX_IDS);
|
|
31312
|
+
// Anything we didn't expand will taint the overall result so we have to filter them out.
|
|
31313
|
+
const droppedIds = new Set(uniqueIds.slice(EXPAND_MAX_IDS));
|
|
31314
|
+
if (droppedIds.size) {
|
|
31315
|
+
recordSamples = recordSamples.filter(x => !droppedIds.has(x.entity.Bruce.ID));
|
|
31316
|
+
}
|
|
31317
|
+
const expandedMap = new Map();
|
|
31318
|
+
const batches = [];
|
|
31319
|
+
for (let i = 0; i < expandIds.length; i += EXPAND_BATCH_SIZE) {
|
|
31320
|
+
batches.push(expandIds.slice(i, i + EXPAND_BATCH_SIZE));
|
|
31321
|
+
}
|
|
31322
|
+
const batchResults = await Promise.all(batches.map(batchIds => BModels.Entity.GetListByIds({
|
|
31323
|
+
entityIds: batchIds,
|
|
31324
|
+
historicPoint: latestDate,
|
|
31325
|
+
expandLocation: true,
|
|
31326
|
+
expandSources: true,
|
|
31327
|
+
migrated: true,
|
|
31328
|
+
maxSearchTimeSec: 60 * 2,
|
|
31329
|
+
api
|
|
31330
|
+
}).catch(e => {
|
|
31331
|
+
console.error(e);
|
|
31332
|
+
return { entities: [] };
|
|
31333
|
+
})));
|
|
31334
|
+
for (const { entities } of batchResults) {
|
|
31335
|
+
for (let i = 0; i < entities.length; i++) {
|
|
31336
|
+
expandedMap.set(entities[i].Bruce.ID, entities[i]);
|
|
31337
|
+
}
|
|
31338
|
+
}
|
|
31339
|
+
for (let i = 0; i < effectiveSamples.length; i++) {
|
|
31340
|
+
const sample = effectiveSamples[i];
|
|
31341
|
+
const expanded = expandedMap.get(sample.entity.Bruce.ID);
|
|
31342
|
+
if (expanded) {
|
|
31343
|
+
sample.entity = expanded;
|
|
31344
|
+
}
|
|
31345
|
+
}
|
|
31346
|
+
}
|
|
31347
|
+
}
|
|
31348
|
+
catch (e) {
|
|
31349
|
+
console.error(e);
|
|
31350
|
+
}
|
|
31259
31351
|
for (let i = 0; i < recordSamples.length; i++) {
|
|
31260
31352
|
const sample = recordSamples[i];
|
|
31261
31353
|
const samplePosses = await getRecordEntityPositions(sample);
|
|
@@ -36382,7 +36474,7 @@
|
|
|
36382
36474
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
36383
36475
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
36384
36476
|
|
|
36385
|
-
const VERSION = "6.7.
|
|
36477
|
+
const VERSION = "6.7.9";
|
|
36386
36478
|
/**
|
|
36387
36479
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
36388
36480
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|