bruce-cesium 5.5.5 → 5.5.6

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.
Files changed (41) hide show
  1. package/dist/bruce-cesium.es5.js +244 -7
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +235 -5
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +2 -1
  6. package/dist/lib/bruce-cesium.js.map +1 -1
  7. package/dist/lib/rendering/menu-item-manager.js +9 -0
  8. package/dist/lib/rendering/menu-item-manager.js.map +1 -1
  9. package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js +2 -0
  10. package/dist/lib/rendering/render-managers/data-source/data-source-static-csv-manager.js.map +1 -1
  11. package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js +1 -0
  12. package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js.map +1 -1
  13. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +1 -0
  14. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
  15. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +2 -0
  16. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  17. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +2 -0
  18. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  19. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +1 -0
  20. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js.map +1 -1
  21. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +218 -0
  22. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -0
  23. package/dist/lib/rendering/render-managers/other/google-search-render-manager.js +1 -0
  24. package/dist/lib/rendering/render-managers/other/google-search-render-manager.js.map +1 -1
  25. package/dist/lib/rendering/render-managers/other/legacy-relations-render-manager.js +1 -0
  26. package/dist/lib/rendering/render-managers/other/legacy-relations-render-manager.js.map +1 -1
  27. package/dist/lib/rendering/render-managers/other/relations-render-manager.js +1 -0
  28. package/dist/lib/rendering/render-managers/other/relations-render-manager.js.map +1 -1
  29. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +4 -1
  30. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
  31. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +4 -1
  32. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
  33. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +5 -2
  34. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
  35. package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js +1 -0
  36. package/dist/lib/rendering/render-managers/tilesets/tileset-osm-render-manager.js.map +1 -1
  37. package/dist/lib/rendering/visuals-register.js.map +1 -1
  38. package/dist/types/bruce-cesium.d.ts +2 -1
  39. package/dist/types/rendering/render-managers/other/assembly-render-manager.d.ts +35 -0
  40. package/dist/types/rendering/visuals-register.d.ts +1 -0
  41. package/package.json +2 -2
@@ -13249,6 +13249,7 @@
13249
13249
  groups.push(group);
13250
13250
  applyStyle(thing, entityId, group.data);
13251
13251
  const rego = {
13252
+ canEdit: true,
13252
13253
  entityId: entityId,
13253
13254
  menuItemId: this.item.id,
13254
13255
  menuItemType: this.item.Type,
@@ -13398,6 +13399,7 @@
13398
13399
  const wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
13399
13400
  const tagIds = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e["Layer.ID"];
13400
13401
  const rego = {
13402
+ canEdit: true,
13401
13403
  entityId: id,
13402
13404
  schemaId: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.SchemaID,
13403
13405
  menuItemId: this.item.id,
@@ -14116,6 +14118,7 @@
14116
14118
  groups.push(group);
14117
14119
  applyStyle(thing, entityId, group.data);
14118
14120
  const rego = {
14121
+ canEdit: true,
14119
14122
  entityId: entityId,
14120
14123
  menuItemId: this.item.id,
14121
14124
  menuItemType: this.item.Type,
@@ -14214,6 +14217,7 @@
14214
14217
  if (!visual || visual != cEntity) {
14215
14218
  this.visualsManager.AddRego({
14216
14219
  rego: {
14220
+ canEdit: true,
14217
14221
  entityId: id,
14218
14222
  menuItemId: this.item.id,
14219
14223
  menuItemType: this.item.Type,
@@ -14536,6 +14540,7 @@
14536
14540
  const clustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
14537
14541
  this.visualsManager.AddRego({
14538
14542
  rego: {
14543
+ canEdit: true,
14539
14544
  entityId: id,
14540
14545
  menuItemId: this.item.id,
14541
14546
  menuItemType: this.item.Type,
@@ -14855,6 +14860,7 @@
14855
14860
  if (!visual || visual != cEntity) {
14856
14861
  this.visualsManager.AddRego({
14857
14862
  rego: {
14863
+ canEdit: true,
14858
14864
  entityId: entity.Bruce.ID,
14859
14865
  menuItemId: this.item.id,
14860
14866
  menuItemType: this.item.Type,
@@ -17543,14 +17549,17 @@
17543
17549
  */
17544
17550
  mapTilesetFeature(feature, add) {
17545
17551
  var _a, _b, _c, _d, _e;
17552
+ const accountId = (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
17553
+ const canEdit = accountId === this.getters.GetAccountId();
17546
17554
  let rego = {
17555
+ canEdit: canEdit,
17547
17556
  entityId: null,
17548
17557
  entityTypeId: null,
17549
17558
  menuItemId: this.item.id,
17550
17559
  menuItemType: this.item.Type,
17551
17560
  priority: this.renderPriority,
17552
17561
  visual: feature,
17553
- accountId: (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17562
+ accountId: accountId,
17554
17563
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
17555
17564
  tilesetType: BModels.Tileset.EType.Cad,
17556
17565
  rootId: this.rootId,
@@ -18162,6 +18171,7 @@
18162
18171
  if (!rego) {
18163
18172
  this.visualsManager.AddRego({
18164
18173
  rego: {
18174
+ canEdit: true,
18165
18175
  entityId: id,
18166
18176
  menuItemId: this.item.id,
18167
18177
  menuItemType: this.item.Type,
@@ -18508,6 +18518,7 @@
18508
18518
  // Doesn't exist. Create a rego.
18509
18519
  else {
18510
18520
  rego = {
18521
+ canEdit: false,
18511
18522
  entityId: bruceId,
18512
18523
  menuItemId: this.item.id,
18513
18524
  menuItemType: this.item.Type,
@@ -18787,16 +18798,19 @@
18787
18798
  }
18788
18799
  }
18789
18800
  if (id) {
18801
+ const accountId = (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
18802
+ const canEdit = accountId === this.getters.GetAccountId();
18790
18803
  const rego = {
18804
+ canEdit: canEdit,
18791
18805
  entityId: id,
18792
18806
  entityTypeId: this.typeId,
18793
18807
  menuItemId: this.item.id,
18794
18808
  menuItemType: this.item.Type,
18795
18809
  priority: this.renderPriority,
18796
18810
  visual: feature,
18797
- tilesetId: (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID,
18811
+ tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
18798
18812
  tilesetType: BModels.Tileset.EType.EntitiesSet,
18799
- accountId: (_c = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID) !== null && _c !== void 0 ? _c : this.getters.GetAccountId()
18813
+ accountId: accountId
18800
18814
  };
18801
18815
  this.visualsManager.AddRego({
18802
18816
  rego,
@@ -19334,14 +19348,17 @@
19334
19348
  }
19335
19349
  mapTilesetFeature(feature) {
19336
19350
  var _a, _b, _c, _d;
19351
+ const accountId = (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
19352
+ const canEdit = accountId === this.getters.GetAccountId();
19337
19353
  let rego = {
19354
+ canEdit: canEdit,
19338
19355
  entityId: null,
19339
19356
  entityTypeId: null,
19340
19357
  menuItemId: this.item.id,
19341
19358
  menuItemType: this.item.Type,
19342
19359
  priority: this.renderPriority,
19343
19360
  visual: feature,
19344
- accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
19361
+ accountId: accountId,
19345
19362
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
19346
19363
  tilesetType: this.tilesetType
19347
19364
  };
@@ -19743,6 +19760,7 @@
19743
19760
  if (!visual || visual != cEntity) {
19744
19761
  this.register.AddRego({
19745
19762
  rego: {
19763
+ canEdit: false,
19746
19764
  entityId: (_b = relation["Data.Entity.ID"]) !== null && _b !== void 0 ? _b : BModels.ObjectUtils.UId(),
19747
19765
  menuItemId: this.item.id,
19748
19766
  menuItemType: this.item.Type,
@@ -20120,6 +20138,7 @@
20120
20138
  if (!visual || visual != cEntity) {
20121
20139
  this.register.AddRego({
20122
20140
  rego: {
20141
+ canEdit: false,
20123
20142
  entityId: (_b = relation["Data.Entity.ID"]) !== null && _b !== void 0 ? _b : BModels.ObjectUtils.UId(),
20124
20143
  menuItemId: this.item.id,
20125
20144
  menuItemType: this.item.Type,
@@ -20416,6 +20435,7 @@
20416
20435
  if (vehicleEntity) {
20417
20436
  this.register.AddRego({
20418
20437
  rego: {
20438
+ canEdit: false,
20419
20439
  entityId: vehicleEntityId,
20420
20440
  menuItemId: this.item.id,
20421
20441
  menuItemType: this.item.Type,
@@ -20439,6 +20459,7 @@
20439
20459
  if (nextspaceEntityId) {
20440
20460
  this.register.AddRego({
20441
20461
  rego: {
20462
+ canEdit: false,
20442
20463
  entityId: nextspaceEntityId,
20443
20464
  menuItemId: this.item.id,
20444
20465
  menuItemType: this.item.Type,
@@ -21023,6 +21044,7 @@
21023
21044
  });
21024
21045
  this.register.AddRego({
21025
21046
  rego: {
21047
+ canEdit: false,
21026
21048
  // If we ever want the user to be able to create a Nextspace record-
21027
21049
  //we must match this logic with the OSM logic.
21028
21050
  entityId: itemId,
@@ -21226,6 +21248,206 @@
21226
21248
  return window["google"];
21227
21249
  }
21228
21250
 
21251
+ (function (AssemblyRenderManager) {
21252
+ class Manager {
21253
+ get Disposed() {
21254
+ return this.disposed;
21255
+ }
21256
+ constructor(params) {
21257
+ this.disposed = false;
21258
+ // Cache of the hierarchy so that our scene-tree can reference it.
21259
+ this.hierarchy = null;
21260
+ const { viewer, register: visualsManager, getters, item } = params;
21261
+ this.viewer = viewer;
21262
+ this.getters = getters;
21263
+ this.item = item;
21264
+ this.visualsManager = visualsManager;
21265
+ }
21266
+ Init() {
21267
+ this.renderPriority = this.item.renderPriority;
21268
+ if (this.renderPriority == null) {
21269
+ this.renderPriority = 1;
21270
+ }
21271
+ (async () => {
21272
+ var _a;
21273
+ if (this.disposed) {
21274
+ return;
21275
+ }
21276
+ try {
21277
+ const flatEntityIds = [];
21278
+ let rootId = null;
21279
+ {
21280
+ const hierarchy = await this.getters.GetBruceApi().GET(`v3/assembly/${this.item["Assembly.ID"]}/hierarchy`);
21281
+ this.hierarchy = hierarchy;
21282
+ if (this.disposed) {
21283
+ return;
21284
+ }
21285
+ const traverseHierarchy = (node, leavesOnly) => {
21286
+ var _a;
21287
+ if (node.Children) {
21288
+ for (let i = 0; i < node.Children.length; i++) {
21289
+ traverseHierarchy(node.Children[i], leavesOnly);
21290
+ }
21291
+ }
21292
+ const addNode = !leavesOnly || !((_a = node.Children) === null || _a === void 0 ? void 0 : _a.length);
21293
+ if (addNode && node.ID && !flatEntityIds.includes(node.ID)) {
21294
+ flatEntityIds.push(node.ID);
21295
+ }
21296
+ };
21297
+ if (hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.Root) {
21298
+ traverseHierarchy(hierarchy.Root, true);
21299
+ rootId = hierarchy.Root.ID;
21300
+ }
21301
+ }
21302
+ if (this.disposed) {
21303
+ return;
21304
+ }
21305
+ const BATCH_SIZE = 200;
21306
+ let batches = Math.ceil(flatEntityIds.length / BATCH_SIZE);
21307
+ for (let i = 0; i < batches; i++) {
21308
+ const batch = flatEntityIds.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE);
21309
+ if (!batch.length) {
21310
+ continue;
21311
+ }
21312
+ const { entities } = await BModels.Entity.GetListByIds({
21313
+ entityIds: batch,
21314
+ api: this.getters.GetBruceApi(),
21315
+ expandLODs: true,
21316
+ expandLocation: true
21317
+ });
21318
+ if (this.disposed) {
21319
+ return;
21320
+ }
21321
+ for (const entity of entities) {
21322
+ const lod = entity.Bruce.LOD ? entity.Bruce.LOD[0] : null;
21323
+ if (!lod || !((_a = lod["ClientFile"]) === null || _a === void 0 ? void 0 : _a.URL)) {
21324
+ // Won't bother with vector data for this experiment.
21325
+ continue;
21326
+ }
21327
+ const pos3d = calcEntityLocation(entity);
21328
+ const orient = calcEntityOrientation(entity, pos3d);
21329
+ if (!pos3d || !orient) {
21330
+ continue;
21331
+ }
21332
+ const cEntity = this.viewer.entities.add({
21333
+ model: {
21334
+ uri: lod["ClientFile"].URL,
21335
+ heightReference: Cesium.HeightReference.NONE
21336
+ },
21337
+ // point: {
21338
+ // pixelSize: 50,
21339
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
21340
+ // color: Cesium.Color.fromCssColorString("#FF0000"),
21341
+ // heightReference: Cesium.HeightReference.NONE
21342
+ // },
21343
+ position: pos3d,
21344
+ orientation: new Cesium.ConstantProperty(orient)
21345
+ });
21346
+ this.visualsManager.AddRego({
21347
+ rego: {
21348
+ canEdit: false,
21349
+ entityId: entity.Bruce.ID,
21350
+ menuItemId: this.item.id,
21351
+ menuItemType: this.item.Type,
21352
+ priority: this.renderPriority,
21353
+ visual: cEntity,
21354
+ accountId: this.getters.GetAccountId(),
21355
+ entityTypeId: entity.Bruce["EntityType.ID"],
21356
+ name: entity.Bruce.Name,
21357
+ rootId: rootId
21358
+ },
21359
+ requestRender: false
21360
+ });
21361
+ }
21362
+ this.viewer.scene.requestRender();
21363
+ }
21364
+ }
21365
+ catch (e) {
21366
+ console.error("AssemblyRenderManager.Manager.Init()", e);
21367
+ }
21368
+ })();
21369
+ }
21370
+ Dispose() {
21371
+ if (this.disposed) {
21372
+ return;
21373
+ }
21374
+ this.disposed = true;
21375
+ this.visualsManager.RemoveRegos({
21376
+ menuItemId: this.item.id
21377
+ });
21378
+ }
21379
+ async ReRender(params) {
21380
+ let { entityIds, force, entities } = params;
21381
+ if (entities && !entityIds) {
21382
+ entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
21383
+ }
21384
+ }
21385
+ }
21386
+ AssemblyRenderManager.Manager = Manager;
21387
+ })(exports.AssemblyRenderManager || (exports.AssemblyRenderManager = {}));
21388
+ const axis_shift = new Cesium.Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
21389
+ function calcEntityLocation(entity) {
21390
+ const aRootLocation = entity.Bruce.AssemblyRootLocation;
21391
+ if (!(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude) || !aRootLocation.latitude) {
21392
+ return null;
21393
+ }
21394
+ const worldPosition = entity.Bruce.AssemblyWorldPosition;
21395
+ if (!worldPosition) {
21396
+ return null;
21397
+ }
21398
+ let offset = new Cesium.Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
21399
+ let heading = 0;
21400
+ let pitch = 0;
21401
+ let roll = 0;
21402
+ {
21403
+ const eTransform = entity.Bruce.Transform;
21404
+ if (eTransform) {
21405
+ if (eTransform.heading) {
21406
+ heading = eTransform.heading;
21407
+ }
21408
+ if (eTransform.pitch) {
21409
+ pitch = eTransform.pitch;
21410
+ }
21411
+ if (eTransform.roll) {
21412
+ roll = eTransform.roll;
21413
+ }
21414
+ }
21415
+ }
21416
+ let pos3d = Cesium.Cartesian3.fromDegrees(aRootLocation.longitude, aRootLocation.latitude, aRootLocation.altitude || 0);
21417
+ const m1 = Cesium.Transforms.eastNorthUpToFixedFrame(pos3d);
21418
+ const hpr = Cesium.HeadingPitchRoll.fromDegrees(heading, pitch, roll, new Cesium.HeadingPitchRoll());
21419
+ const transform = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
21420
+ const transformedOffset = Cesium.Matrix3.multiplyByVector(transform, offset, new Cesium.Cartesian3());
21421
+ pos3d = Cesium.Matrix4.multiplyByPoint(m1, transformedOffset, new Cesium.Cartesian3());
21422
+ return pos3d;
21423
+ }
21424
+ function calcEntityOrientation(entity, pos3d) {
21425
+ var _a, _b, _c;
21426
+ if (!entity.Bruce || !pos3d) {
21427
+ return null;
21428
+ }
21429
+ let hpr = Cesium.HeadingPitchRoll.fromDegrees(((_a = entity.Bruce.Transform) === null || _a === void 0 ? void 0 : _a.heading) || 90, ((_b = entity.Bruce.Transform) === null || _b === void 0 ? void 0 : _b.pitch) || 0, ((_c = entity.Bruce.Transform) === null || _c === void 0 ? void 0 : _c.roll) || 0);
21430
+ let orientation = Cesium.Transforms.headingPitchRollQuaternion(pos3d, hpr);
21431
+ if (entity.Bruce.AssemblyWorldPosition) {
21432
+ // extract rot, scale
21433
+ const awp = entity.Bruce.AssemblyWorldPosition;
21434
+ const mawp = new Cesium.Matrix4(+awp[0][0], +awp[0][1], +awp[0][2], +awp[0][3], +awp[1][0], +awp[1][1], +awp[1][2], +awp[1][3], +awp[2][0], +awp[2][1], +awp[2][2], +awp[2][3], +awp[3][0], +awp[3][1], +awp[3][2], +awp[3][3]);
21435
+ let rotmat = new Cesium.Matrix3();
21436
+ rotmat = Cesium.Matrix4.getRotation(mawp, rotmat);
21437
+ // chuck on a heading rotation of +90
21438
+ // according to docs, that is around -z
21439
+ // https://cesium.com/learn/ion-sdk/ref-doc/HeadingPitchRoll.html
21440
+ // see axis_shift quat defined above (could possibly be -ve z value)
21441
+ const q = Cesium.Quaternion.fromRotationMatrix(rotmat);
21442
+ hpr = Cesium.HeadingPitchRoll.fromQuaternion(q);
21443
+ orientation = Cesium.Transforms.headingPitchRollQuaternion(pos3d, hpr);
21444
+ // add another h +90, quats multiply to concat rotations - but are not
21445
+ // subject to order of rotation like HPR
21446
+ orientation = Cesium.Quaternion.multiply(orientation, axis_shift, new Cesium.Quaternion());
21447
+ }
21448
+ return orientation;
21449
+ }
21450
+
21229
21451
  (function (MenuItemManager) {
21230
21452
  class Manager {
21231
21453
  get Getters() {
@@ -21409,6 +21631,14 @@
21409
21631
  item: params.item
21410
21632
  });
21411
21633
  break;
21634
+ case BModels.MenuItem.EType.Assembly:
21635
+ rItem.renderManager = new exports.AssemblyRenderManager.Manager({
21636
+ viewer: this.viewer,
21637
+ register: this.visualsRegister,
21638
+ getters: params.getters,
21639
+ item: params.item
21640
+ });
21641
+ break;
21412
21642
  case BModels.MenuItem.EType.Osm:
21413
21643
  rItem.renderManager = new exports.TilesetOsmRenderManager.Manager({
21414
21644
  viewer: this.viewer,
@@ -31124,7 +31354,7 @@
31124
31354
  }
31125
31355
  }
31126
31356
 
31127
- const VERSION = "5.5.5";
31357
+ const VERSION = "5.5.6";
31128
31358
 
31129
31359
  exports.VERSION = VERSION;
31130
31360
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;