bruce-cesium 7.6.6 → 7.6.8

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 (48) hide show
  1. package/dist/bruce-cesium.es5.js +512 -60
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +505 -57
  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/entity-render-engine-model3d.js +17 -10
  8. package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
  9. package/dist/lib/rendering/entity-render-engine-point.js +3 -1
  10. package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
  11. package/dist/lib/rendering/entity-render-engine-polygon.js +3 -1
  12. package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
  13. package/dist/lib/rendering/entity-render-engine-polyline.js +3 -1
  14. package/dist/lib/rendering/entity-render-engine-polyline.js.map +1 -1
  15. package/dist/lib/rendering/menu-item-manager.js +132 -2
  16. package/dist/lib/rendering/menu-item-manager.js.map +1 -1
  17. package/dist/lib/rendering/menu-item-style-overlay.js +213 -0
  18. package/dist/lib/rendering/menu-item-style-overlay.js.map +1 -0
  19. package/dist/lib/rendering/menu-item-styles.js +9 -4
  20. package/dist/lib/rendering/menu-item-styles.js.map +1 -1
  21. package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js +31 -8
  22. package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js.map +1 -1
  23. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +9 -4
  24. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
  25. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +10 -3
  26. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  27. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +26 -7
  28. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  29. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js +8 -2
  30. package/dist/lib/rendering/render-managers/entities/entity-render-manager.js.map +1 -1
  31. package/dist/lib/rendering/render-managers/render-manager.js +4 -3
  32. package/dist/lib/rendering/render-managers/render-manager.js.map +1 -1
  33. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +4 -1
  34. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
  35. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +5 -1
  36. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
  37. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +5 -1
  38. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
  39. package/dist/lib/rendering/tileset-styler.js +42 -7
  40. package/dist/lib/rendering/tileset-styler.js.map +1 -1
  41. package/dist/types/bruce-cesium.d.ts +2 -1
  42. package/dist/types/rendering/menu-item-manager.d.ts +23 -1
  43. package/dist/types/rendering/menu-item-style-overlay.d.ts +57 -0
  44. package/dist/types/rendering/menu-item-styles.d.ts +1 -1
  45. package/dist/types/rendering/render-managers/entities/entities-datalab-render-manager.d.ts +1 -0
  46. package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +1 -0
  47. package/dist/types/rendering/tileset-styler.d.ts +5 -0
  48. package/package.json +2 -2
@@ -16406,6 +16406,211 @@
16406
16406
  // whatever the writer's clock and this one disagree by.
16407
16407
  HistoricGatherer.LIVE_TAIL_MS = 15000;
16408
16408
 
16409
+ (function (MenuItemStyleOverlay) {
16410
+ // Tileset items whose render manager runs a Styler, given the item settings that make it run one.
16411
+ const TILESET_TYPES = [
16412
+ BModels.MenuItem.EType.CadTileset,
16413
+ BModels.MenuItem.EType.ArbTileset,
16414
+ BModels.MenuItem.EType.IonTileset,
16415
+ BModels.MenuItem.EType.EntityTileset
16416
+ ];
16417
+ // Items whose style resolves per Entity from their zoom control rows.
16418
+ const ZOOM_CONTROL_TYPES = [
16419
+ BModels.MenuItem.EType.Entities,
16420
+ BModels.MenuItem.EType.Entity,
16421
+ BModels.MenuItem.EType.EntitiesIds,
16422
+ BModels.MenuItem.EType.EntitiesLoaded,
16423
+ BModels.MenuItem.EType.DataLab
16424
+ ];
16425
+ /**
16426
+ * Returns the base style with each field the overlay sets laid over it.
16427
+ */
16428
+ function Merge(base, overlay) {
16429
+ var _a, _b;
16430
+ if (!overlay) {
16431
+ return base;
16432
+ }
16433
+ const merged = { ...(base !== null && base !== void 0 ? base : {}) };
16434
+ for (const key of Object.keys(overlay)) {
16435
+ const value = overlay[key];
16436
+ if (!isSet(value)) {
16437
+ continue;
16438
+ }
16439
+ if (isPlainObject(value)) {
16440
+ merged[key] = { ...((_a = merged[key]) !== null && _a !== void 0 ? _a : {}), ...pickSet(value) };
16441
+ }
16442
+ else {
16443
+ merged[key] = value;
16444
+ }
16445
+ }
16446
+ // Tilesets only paint a customised model style, and an overlay that sets a colour wants painting.
16447
+ if (isSet((_b = overlay.modelStyle) === null || _b === void 0 ? void 0 : _b.fillColor) && overlay.modelStyle.customize == null) {
16448
+ merged.modelStyle = { ...merged.modelStyle, customize: true };
16449
+ }
16450
+ return merged;
16451
+ }
16452
+ MenuItemStyleOverlay.Merge = Merge;
16453
+ /**
16454
+ * Returns the overlay a zoom control row carries laid over the style it resolved.
16455
+ */
16456
+ function ApplyRow(style, row) {
16457
+ return Merge(style, row === null || row === void 0 ? void 0 : row.StyleOverlay);
16458
+ }
16459
+ MenuItemStyleOverlay.ApplyRow = ApplyRow;
16460
+ /**
16461
+ * Returns true when the item renders through a path that honours an overlay.
16462
+ */
16463
+ function Supports(item) {
16464
+ if (ZOOM_CONTROL_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
16465
+ return true;
16466
+ }
16467
+ if (!TILESET_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
16468
+ return false;
16469
+ }
16470
+ // These two only run a Styler when asked to.
16471
+ if (item.Type === BModels.MenuItem.EType.ArbTileset || item.Type === BModels.MenuItem.EType.EntityTileset) {
16472
+ return Boolean(item.ApplyStyles);
16473
+ }
16474
+ return true;
16475
+ }
16476
+ MenuItemStyleOverlay.Supports = Supports;
16477
+ /**
16478
+ * Returns the overlay laid on the item, or null when it carries none.
16479
+ */
16480
+ function Get(item) {
16481
+ var _a, _b, _c;
16482
+ if (TILESET_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
16483
+ return (_a = item.styleOverlay) !== null && _a !== void 0 ? _a : null;
16484
+ }
16485
+ if (ZOOM_CONTROL_TYPES.includes(item === null || item === void 0 ? void 0 : item.Type)) {
16486
+ const rows = item.CameraZoomSettings;
16487
+ return (_c = (_b = rows === null || rows === void 0 ? void 0 : rows.find(x => x === null || x === void 0 ? void 0 : x.StyleOverlay)) === null || _b === void 0 ? void 0 : _b.StyleOverlay) !== null && _c !== void 0 ? _c : null;
16488
+ }
16489
+ return null;
16490
+ }
16491
+ MenuItemStyleOverlay.Get = Get;
16492
+ /**
16493
+ * Returns a copy carrying the overlay, or the item itself when it cannot take one and carries none.
16494
+ */
16495
+ function With(item, overlay) {
16496
+ var _a;
16497
+ const target = Supports(item) ? overlay : null;
16498
+ if (!target && !Get(item)) {
16499
+ return item;
16500
+ }
16501
+ if (TILESET_TYPES.includes(item.Type)) {
16502
+ const next = { ...item };
16503
+ if (target) {
16504
+ next.styleOverlay = target;
16505
+ }
16506
+ else {
16507
+ delete next.styleOverlay;
16508
+ }
16509
+ return next;
16510
+ }
16511
+ const zItem = item;
16512
+ return {
16513
+ ...zItem,
16514
+ CameraZoomSettings: ((_a = zItem.CameraZoomSettings) !== null && _a !== void 0 ? _a : []).map(row => {
16515
+ const next = { ...row };
16516
+ if (target) {
16517
+ next.StyleOverlay = target;
16518
+ }
16519
+ else {
16520
+ delete next.StyleOverlay;
16521
+ }
16522
+ return next;
16523
+ })
16524
+ };
16525
+ }
16526
+ MenuItemStyleOverlay.With = With;
16527
+ /**
16528
+ * Returns the style a bookmark laid on this one item, or null when it carries none.
16529
+ */
16530
+ function GetItemStyle(item) {
16531
+ var _a, _b;
16532
+ return (_b = (_a = item === null || item === void 0 ? void 0 : item.style) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : null;
16533
+ }
16534
+ MenuItemStyleOverlay.GetItemStyle = GetItemStyle;
16535
+ /**
16536
+ * Returns the Style record a bookmark laid on this one item, or null when it names none.
16537
+ */
16538
+ function GetItemStyleId(item) {
16539
+ var _a;
16540
+ const styleId = (_a = item === null || item === void 0 ? void 0 : item.style) === null || _a === void 0 ? void 0 : _a.styleId;
16541
+ return styleId == null || styleId === "" || styleId == -1 ? null : styleId;
16542
+ }
16543
+ MenuItemStyleOverlay.GetItemStyleId = GetItemStyleId;
16544
+ /**
16545
+ * Returns a copy carrying the given bookmark style, inline or by record, or without one for null.
16546
+ */
16547
+ function WithItemStyle(item, itemStyle) {
16548
+ const has = Boolean(itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.style) || (itemStyle === null || itemStyle === void 0 ? void 0 : itemStyle.styleId) != null;
16549
+ if (!item || (!has && !item.style)) {
16550
+ return item;
16551
+ }
16552
+ const next = { ...item };
16553
+ if (has) {
16554
+ next.style = { ...itemStyle };
16555
+ }
16556
+ else {
16557
+ delete next.style;
16558
+ }
16559
+ return next;
16560
+ }
16561
+ MenuItemStyleOverlay.WithItemStyle = WithItemStyle;
16562
+ /**
16563
+ * Returns the overlay an item renders with: its inline or loaded bookmark style, under the scene-wide one.
16564
+ */
16565
+ function Effective(item, overlay, record) {
16566
+ var _a, _b;
16567
+ const own = (_b = (_a = GetItemStyle(item)) !== null && _a !== void 0 ? _a : record) !== null && _b !== void 0 ? _b : null;
16568
+ // Either alone is used as it is, so an unchanged overlay still compares equal.
16569
+ return own ? Merge(own, overlay) : overlay;
16570
+ }
16571
+ MenuItemStyleOverlay.Effective = Effective;
16572
+ /**
16573
+ * Returns a copy without its overlay or bookmark style, so what else two items differ by can be compared.
16574
+ */
16575
+ function Strip(item) {
16576
+ return With(WithItemStyle(item, null), null);
16577
+ }
16578
+ MenuItemStyleOverlay.Strip = Strip;
16579
+ /**
16580
+ * Returns true when the two items differ by nothing but their overlay or bookmark style.
16581
+ */
16582
+ function IsChangeOnly(from, to) {
16583
+ if (!from || !to || from.Type !== to.Type) {
16584
+ return false;
16585
+ }
16586
+ const sameOverlay = JSON.stringify(Get(from)) === JSON.stringify(Get(to));
16587
+ if (sameOverlay && JSON.stringify(from.style) === JSON.stringify(to.style)) {
16588
+ return false;
16589
+ }
16590
+ // Removing keys keeps the order of the rest, so the two compare as text.
16591
+ return JSON.stringify(Strip(from)) === JSON.stringify(Strip(to));
16592
+ }
16593
+ MenuItemStyleOverlay.IsChangeOnly = IsChangeOnly;
16594
+ /*
16595
+ * Returns false for what leaves the base value in place: unset, null, or an empty Calculator field list.
16596
+ */
16597
+ function isSet(value) {
16598
+ return value !== undefined && value !== null && !(Array.isArray(value) && !value.length);
16599
+ }
16600
+ function isPlainObject(value) {
16601
+ return typeof value === "object" && !Array.isArray(value);
16602
+ }
16603
+ function pickSet(value) {
16604
+ const picked = {};
16605
+ for (const key of Object.keys(value)) {
16606
+ if (isSet(value[key])) {
16607
+ picked[key] = value[key];
16608
+ }
16609
+ }
16610
+ return picked;
16611
+ }
16612
+ })(exports.MenuItemStyleOverlay || (exports.MenuItemStyleOverlay = {}));
16613
+
16409
16614
  const BATCH_SIZE = 500;
16410
16615
  const CHECK_BATCH_SIZE = 250;
16411
16616
  function getValue$2(viewer, obj) {
@@ -16461,6 +16666,8 @@
16461
16666
  this.isRunningCheck = false;
16462
16667
  this.viewMonitorRemoval = null;
16463
16668
  this.renderQueue = [];
16669
+ // Queued Entities a caller handed in, drawn even when the skip gate sees nothing changed.
16670
+ this.renderQueueForced = new Set();
16464
16671
  this.renderQueueInterval = null;
16465
16672
  this.sources = [];
16466
16673
  // Highly experimental flag to try improve rendering large sets of polygons and polylines.
@@ -16555,6 +16762,7 @@
16555
16762
  clearInterval(this.renderQueueInterval);
16556
16763
  this.renderQueueInterval = null;
16557
16764
  this.renderQueue = [];
16765
+ this.renderQueueForced.clear();
16558
16766
  // Remove just the ones that shouldn't be rendered.
16559
16767
  // Eg: for a tag menu item we can see what tags are selected and only render those.
16560
16768
  if (shouldRender) {
@@ -16865,6 +17073,7 @@
16865
17073
  (_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
16866
17074
  clearInterval(this.renderQueueInterval);
16867
17075
  this.renderQueue = [];
17076
+ this.renderQueueForced.clear();
16868
17077
  (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.Dispose();
16869
17078
  this.clustering = null;
16870
17079
  for (let i = 0; i < this.sources.length; i++) {
@@ -16953,7 +17162,8 @@
16953
17162
  }
16954
17163
  else {
16955
17164
  if (entities === null || entities === void 0 ? void 0 : entities.length) {
16956
- this.distributeForRender(entities);
17165
+ // The skip gate cannot see an edited copy, so handed-in Entities are drawn forced.
17166
+ this.distributeForRender(entities, true);
16957
17167
  }
16958
17168
  else {
16959
17169
  await this.doEntityCheck(entityIds);
@@ -17104,12 +17314,22 @@
17104
17314
  }
17105
17315
  this.isRunningCheck = false;
17106
17316
  }
17107
- distributeForRender(entities) {
17317
+ distributeForRender(entities, force = false) {
17318
+ if (force) {
17319
+ entities.forEach(x => this.renderQueueForced.add(x));
17320
+ }
17108
17321
  this.renderQueue = this.renderQueue.concat(entities);
17109
17322
  if (!this.renderQueueInterval && this.renderQueue.length) {
17110
17323
  this.renderQueueInterval = setInterval(() => {
17111
17324
  const batch = this.renderQueue.splice(0, BATCH_SIZE);
17112
- this.renderEntities(batch);
17325
+ const forced = new Set(batch.filter(x => this.renderQueueForced.delete(x)));
17326
+ const rest = batch.filter(x => !forced.has(x));
17327
+ if (forced.size) {
17328
+ this.renderEntities(Array.from(forced), true);
17329
+ }
17330
+ if (rest.length) {
17331
+ this.renderEntities(rest);
17332
+ }
17113
17333
  if (this.renderQueue.length <= 0) {
17114
17334
  clearInterval(this.renderQueueInterval);
17115
17335
  this.renderQueueInterval = null;
@@ -17245,6 +17465,7 @@
17245
17465
  console.error(e);
17246
17466
  }
17247
17467
  }
17468
+ style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem);
17248
17469
  const pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
17249
17470
  const lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
17250
17471
  const polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
@@ -17536,7 +17757,7 @@
17536
17757
  return recordsByIds;
17537
17758
  }
17538
17759
  async doRenderAsIndividuals(entities, force = false) {
17539
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
17760
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17540
17761
  // When live we just want to show the latest pos.
17541
17762
  // When not live, the user might scroll the timeline and want to see it a fluid animation between points in time.
17542
17763
  const isLive = exports.ViewUtils.GetTimeDetails({
@@ -17640,8 +17861,9 @@
17640
17861
  rego.schema = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.Schema;
17641
17862
  rego.canEdit = canEdit;
17642
17863
  rego.internalId = (_k = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.InternalID) !== null && _k !== void 0 ? _k : rego.internalId;
17643
- rego.styleId = (_l = cEntity.styleId) !== null && _l !== void 0 ? _l : rego.styleId;
17644
- rego.styleEffective = (_m = cEntity.styleEffective) !== null && _m !== void 0 ? _m : rego.styleEffective;
17864
+ // Assigned outright, so a restyle that traces nothing clears the old key.
17865
+ rego.styleId = cEntity.styleId;
17866
+ rego.styleEffective = cEntity.styleEffective;
17645
17867
  // Marked as stale meaning some change was performed that requires a refresh.
17646
17868
  // This usually means a new sibling was added that we need to update.
17647
17869
  if (rego.stale) {
@@ -17671,7 +17893,7 @@
17671
17893
  menuItemId: this.item.id,
17672
17894
  requestRender: false
17673
17895
  });
17674
- (_o = this.clustering) === null || _o === void 0 ? void 0 : _o.RemoveEntity(id, false);
17896
+ (_l = this.clustering) === null || _l === void 0 ? void 0 : _l.RemoveEntity(id, false);
17675
17897
  }
17676
17898
  }
17677
17899
  this.viewer.scene.requestRender();
@@ -17750,6 +17972,7 @@
17750
17972
  clearInterval(this.renderQueueInterval);
17751
17973
  this.renderQueueInterval = null;
17752
17974
  this.renderQueue = [];
17975
+ this.renderQueueForced.clear();
17753
17976
  this.disposed = true;
17754
17977
  return payload;
17755
17978
  }
@@ -18106,7 +18329,8 @@
18106
18329
  menuItemIds: [this.item.id]
18107
18330
  });
18108
18331
  if (entities === null || entities === void 0 ? void 0 : entities.length) {
18109
- this.onGetterUpdate(entities, force);
18332
+ // The skip gate cannot see an edited copy, so handed-in Entities are drawn forced.
18333
+ this.onGetterUpdate(entities, true);
18110
18334
  }
18111
18335
  else {
18112
18336
  this.doEntityCheck(entityIds, force);
@@ -18340,6 +18564,7 @@
18340
18564
  if (!style) {
18341
18565
  style = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style;
18342
18566
  }
18567
+ style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem);
18343
18568
  const pStyle = (_h = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _h !== void 0 ? _h : {};
18344
18569
  const lStyle = (_j = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _j !== void 0 ? _j : {};
18345
18570
  const polygonsClamped = ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == null ? true : ((_l = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _l === void 0 ? void 0 : _l.id) == 0;
@@ -18584,7 +18809,7 @@
18584
18809
  return next;
18585
18810
  }
18586
18811
  async doRenderAsIndividuals(entities, force = false) {
18587
- var _a;
18812
+ var _a, _b, _c;
18588
18813
  const { updated, entities: cEntities } = await exports.EntityRenderEngine.Render({
18589
18814
  viewer: this.viewer,
18590
18815
  apiGetter: this.apiGetter,
@@ -18638,7 +18863,9 @@
18638
18863
  priority: this.renderPriority,
18639
18864
  entityTypeId: entity.Bruce["EntityType.ID"],
18640
18865
  accountId: this.apiGetter.accountId,
18641
- name: cEntity.name
18866
+ name: cEntity.name,
18867
+ styleId: (_b = cEntity.styleId) !== null && _b !== void 0 ? _b : undefined,
18868
+ styleEffective: (_c = cEntity.styleEffective) !== null && _c !== void 0 ? _c : undefined
18642
18869
  },
18643
18870
  requestRender: false
18644
18871
  });
@@ -18646,6 +18873,8 @@
18646
18873
  else if (updated.get(id) && rego) {
18647
18874
  rego.visual = cEntity;
18648
18875
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
18876
+ rego.styleId = cEntity.styleId;
18877
+ rego.styleEffective = cEntity.styleEffective;
18649
18878
  rego.name = cEntity.name;
18650
18879
  // We manually trigger an update event since the graphic was updated but not recreated.
18651
18880
  this.visualsManager.OnUpdate.Trigger({
@@ -18820,7 +19049,8 @@
18820
19049
  menuItemIds: [this.item.id]
18821
19050
  });
18822
19051
  if (entities === null || entities === void 0 ? void 0 : entities.length) {
18823
- this.renderEntities(entities, force);
19052
+ // The skip gate cannot see an edited copy, so handed-in Entities are drawn forced.
19053
+ this.renderEntities(entities, true);
18824
19054
  }
18825
19055
  else {
18826
19056
  this.onGetterUpdate(entityIds, force);
@@ -19032,7 +19262,7 @@
19032
19262
  * @returns
19033
19263
  */
19034
19264
  async renderAsIndividuals(entities, force = false) {
19035
- var _a;
19265
+ var _a, _b, _c;
19036
19266
  if (this.disposed || this.viewer.isDestroyed() || !entities.length) {
19037
19267
  return;
19038
19268
  }
@@ -19091,7 +19321,9 @@
19091
19321
  entityTypeId: entity.Bruce["EntityType.ID"],
19092
19322
  accountId: this.apiGetter.accountId,
19093
19323
  overrideShow: clustered ? false : null,
19094
- name: cEntity.name
19324
+ name: cEntity.name,
19325
+ styleId: (_a = cEntity.styleId) !== null && _a !== void 0 ? _a : undefined,
19326
+ styleEffective: (_b = cEntity.styleEffective) !== null && _b !== void 0 ? _b : undefined
19095
19327
  },
19096
19328
  requestRender: false
19097
19329
  });
@@ -19099,6 +19331,8 @@
19099
19331
  else if (updated.get(id) && rego) {
19100
19332
  rego.visual = cEntity;
19101
19333
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
19334
+ rego.styleId = cEntity.styleId;
19335
+ rego.styleEffective = cEntity.styleEffective;
19102
19336
  rego.name = cEntity.name;
19103
19337
  // We manually trigger an update event since the graphic was updated but not recreated.
19104
19338
  this.visualsManager.OnUpdate.Trigger({
@@ -19114,7 +19348,7 @@
19114
19348
  menuItemId: this.item.id,
19115
19349
  requestRender: false
19116
19350
  });
19117
- (_a = this.clustering) === null || _a === void 0 ? void 0 : _a.RemoveEntity(id, false);
19351
+ (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(id, false);
19118
19352
  }
19119
19353
  }
19120
19354
  if (!this.disposed) {
@@ -19260,7 +19494,8 @@
19260
19494
  menuItemIds: [this.item.id]
19261
19495
  });
19262
19496
  if (incoming) {
19263
- await this.renderEntity(incoming, force);
19497
+ // The skip gate cannot see an edited copy, so handed-in Entities are drawn forced.
19498
+ await this.renderEntity(incoming, true);
19264
19499
  }
19265
19500
  else {
19266
19501
  await this.onGetterUpdate(itemEntityId, force);
@@ -19334,6 +19569,7 @@
19334
19569
  return next;
19335
19570
  }
19336
19571
  async doRenderEntity(entity, force = false) {
19572
+ var _a, _b;
19337
19573
  try {
19338
19574
  if (this.disposed || this.viewer.isDestroyed()) {
19339
19575
  return;
@@ -19366,7 +19602,9 @@
19366
19602
  priority: this.renderPriority,
19367
19603
  entityTypeId: entity.Bruce["EntityType.ID"],
19368
19604
  accountId: this.apiGetter.accountId,
19369
- name: cEntity.name
19605
+ name: cEntity.name,
19606
+ styleId: (_a = cEntity.styleId) !== null && _a !== void 0 ? _a : undefined,
19607
+ styleEffective: (_b = cEntity.styleEffective) !== null && _b !== void 0 ? _b : undefined
19370
19608
  },
19371
19609
  requestRender: false
19372
19610
  });
@@ -19374,6 +19612,8 @@
19374
19612
  else if (updated.get(id) && rego) {
19375
19613
  rego.visual = cEntity;
19376
19614
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
19615
+ rego.styleId = cEntity.styleId;
19616
+ rego.styleEffective = cEntity.styleEffective;
19377
19617
  rego.name = cEntity.name;
19378
19618
  // We manually trigger an update event since the graphic was updated but not recreated.
19379
19619
  this.visualsManager.OnUpdate.Trigger({
@@ -20444,6 +20684,10 @@
20444
20684
  // Once the style is loaded, we can queue the set for styling.
20445
20685
  this.stylePendingEntityIds = new Map();
20446
20686
  this.fallbackStyle = null;
20687
+ // Laid over whichever style each feature resolves, so it only changes the fields it sets.
20688
+ this.styleOverlay = null;
20689
+ // The tileset's blend before an overlay's colours replaced it, put back once no overlay colours it.
20690
+ this.blendBeforeOverlay = null;
20447
20691
  this.styleFallbackLoaded = false;
20448
20692
  this.loadingCounter = 0;
20449
20693
  // Entity IDs -> boolean to indicate if we should override the feature colour.
@@ -20496,12 +20740,18 @@
20496
20740
  return this._styleProgress;
20497
20741
  }
20498
20742
  Init(params) {
20499
- var _a, _b;
20743
+ var _a, _b, _c;
20500
20744
  let { viewer, api, cTileset, fallbackStyleId, styleMapping, expandSources, menuItemId, register, scenario, historic, applyStyles, monitor } = params;
20745
+ this.styleOverlay = (_a = params.styleOverlay) !== null && _a !== void 0 ? _a : null;
20501
20746
  this.monitor = monitor;
20502
20747
  this.viewer = viewer;
20503
20748
  this.api = api;
20749
+ // A tileset handed in fresh still has its own blend, so nothing is left to put back on it.
20750
+ if (cTileset !== this.cTileset) {
20751
+ this.blendBeforeOverlay = null;
20752
+ }
20504
20753
  this.cTileset = cTileset;
20754
+ this.applyOverlayBlend();
20505
20755
  this.bakedAttributes = getBakedAttributes(cTileset);
20506
20756
  this.register = register;
20507
20757
  this.menuItemId = menuItemId;
@@ -20525,7 +20775,7 @@
20525
20775
  // We have some evil hard-coded style mappings that need to be fixed.
20526
20776
  // These exist within legacy project views.
20527
20777
  // Update: This now also lets people have a style mapping without a real style record.
20528
- if ((_a = this.styleMapping) === null || _a === void 0 ? void 0 : _a.length) {
20778
+ if ((_b = this.styleMapping) === null || _b === void 0 ? void 0 : _b.length) {
20529
20779
  for (let i = 0; i < this.styleMapping.length; i++) {
20530
20780
  const mapItem = this.styleMapping[i];
20531
20781
  const mapStyle = mapItem.style ? mapItem.style : mapItem.Style;
@@ -20565,7 +20815,7 @@
20565
20815
  });
20566
20816
  this.loaded = true;
20567
20817
  this.loadStyles();
20568
- const feed = (_b = this.api) === null || _b === void 0 ? void 0 : _b.RecordChangeFeed;
20818
+ const feed = (_c = this.api) === null || _c === void 0 ? void 0 : _c.RecordChangeFeed;
20569
20819
  if (feed) {
20570
20820
  this.feedSub = feed.Subscribe({
20571
20821
  concepts: [BModels.AccountConcept.EConcept.ENTITY],
@@ -20630,6 +20880,11 @@
20630
20880
  else {
20631
20881
  this.fallbackStyle = null;
20632
20882
  }
20883
+ // Left as it is when a caller omits it, so a mapping change keeps the scene-wide style.
20884
+ if (params.styleOverlay !== undefined) {
20885
+ this.styleOverlay = params.styleOverlay;
20886
+ this.applyOverlayBlend();
20887
+ }
20633
20888
  if (params.scenario != null) {
20634
20889
  if (!this.shouldUpdateRegoStates && !!this.scenario) {
20635
20890
  this.shouldUpdateRegoStates = true;
@@ -20718,6 +20973,25 @@
20718
20973
  }
20719
20974
  this.queueTilesetFeatureStyle(regos, highPriority);
20720
20975
  }
20976
+ /*
20977
+ * Replaces the tileset's own colours while an overlay sets a model fill, so features show exactly what it maps to.
20978
+ */
20979
+ applyOverlayBlend() {
20980
+ var _a, _b, _c, _d;
20981
+ if (!this.cTileset || ((_b = (_a = this.cTileset).isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
20982
+ return;
20983
+ }
20984
+ const fill = (_d = (_c = this.styleOverlay) === null || _c === void 0 ? void 0 : _c.modelStyle) === null || _d === void 0 ? void 0 : _d.fillColor;
20985
+ const colours = Array.isArray(fill) ? fill.length > 0 : fill != null;
20986
+ if (colours && this.blendBeforeOverlay == null) {
20987
+ this.blendBeforeOverlay = this.cTileset.colorBlendMode;
20988
+ this.cTileset.colorBlendMode = Cesium.Cesium3DTileColorBlendMode.REPLACE;
20989
+ }
20990
+ else if (!colours && this.blendBeforeOverlay != null) {
20991
+ this.cTileset.colorBlendMode = this.blendBeforeOverlay;
20992
+ this.blendBeforeOverlay = null;
20993
+ }
20994
+ }
20721
20995
  /**
20722
20996
  * Calculates the current progress % and updates the progress if there is a change.
20723
20997
  */
@@ -21132,12 +21406,11 @@
21132
21406
  override: override
21133
21407
  });
21134
21408
  this.overrideFeatureColor.set(rego.entityId, true);
21135
- if (resolvedStyleId != null) {
21136
- rego.styleId = resolvedStyleId;
21137
- }
21409
+ // Assigned outright, so a restyle that traces nothing clears the old key.
21410
+ rego.styleId = resolvedStyleId !== null && resolvedStyleId !== void 0 ? resolvedStyleId : undefined;
21138
21411
  rego.styleEffective = (_b = exports.StyleEffective.Combine([
21139
21412
  { key: "color", effective: fillColorTrace.effective }
21140
- ])) !== null && _b !== void 0 ? _b : rego.styleEffective;
21413
+ ])) !== null && _b !== void 0 ? _b : undefined;
21141
21414
  }
21142
21415
  if (((_c = data === null || data === void 0 ? void 0 : data.Bruce) === null || _c === void 0 ? void 0 : _c.InternalID) != null) {
21143
21416
  rego.internalId = data.Bruce.InternalID;
@@ -21183,6 +21456,7 @@
21183
21456
  style = (_b = this.fallbackStyle) === null || _b === void 0 ? void 0 : _b.Settings;
21184
21457
  styleId = this.fallbackStyleId != null ? Number(this.fallbackStyleId) : null;
21185
21458
  }
21459
+ style = exports.MenuItemStyleOverlay.Merge(style, this.styleOverlay);
21186
21460
  if (!style || !((_c = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _c === void 0 ? void 0 : _c.customize)) {
21187
21461
  return { settings: null, styleId: null };
21188
21462
  }
@@ -22368,6 +22642,7 @@
22368
22642
  api: this.getters.GetBruceApi(),
22369
22643
  cTileset: this.cTileset,
22370
22644
  fallbackStyleId: this.item.styleId,
22645
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item),
22371
22646
  styleMapping: this.item.StyleMapping,
22372
22647
  expandSources: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandSources,
22373
22648
  menuItemId: this.item.id,
@@ -22582,6 +22857,7 @@
22582
22857
  api: this.getters.GetBruceApi(),
22583
22858
  cTileset: this.cTileset,
22584
22859
  fallbackStyleId: this.item.styleId,
22860
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item),
22585
22861
  styleMapping: this.item.StyleMapping,
22586
22862
  expandSources: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandSources,
22587
22863
  menuItemId: this.item.id,
@@ -23203,7 +23479,8 @@
23203
23479
  // Before the tileset loads this only stores the pick, and the styler's Init reads the new item.
23204
23480
  this.styler.UpdateStyleMapping({
23205
23481
  styleMapping: (_a = item.StyleMapping) !== null && _a !== void 0 ? _a : [],
23206
- fallbackStyleId: item.styleId
23482
+ fallbackStyleId: item.styleId,
23483
+ styleOverlay: exports.MenuItemStyleOverlay.Get(item)
23207
23484
  });
23208
23485
  }
23209
23486
  Dispose() {
@@ -24685,6 +24962,8 @@
24685
24962
  this.isRunningCheck = false;
24686
24963
  this.viewMonitorRemoval = null;
24687
24964
  this.renderQueue = [];
24965
+ // Queued Entities a caller handed in, drawn even when the skip gate sees nothing changed.
24966
+ this.renderQueueForced = new Set();
24688
24967
  this.renderQueueInterval = null;
24689
24968
  this.zoomControl = [];
24690
24969
  this.queryLoadId = 0;
@@ -24713,6 +24992,7 @@
24713
24992
  clearInterval(this.renderQueueInterval);
24714
24993
  this.renderQueueInterval = null;
24715
24994
  this.renderQueue = [];
24995
+ this.renderQueueForced.clear();
24716
24996
  this.renderedEntities = {};
24717
24997
  this.ensureSettings();
24718
24998
  this.visualsManager.RemoveRegos({
@@ -24875,6 +25155,7 @@
24875
25155
  clearInterval(this.renderQueueInterval);
24876
25156
  this.renderQueueInterval = null;
24877
25157
  this.renderQueue = [];
25158
+ this.renderQueueForced.clear();
24878
25159
  this.entityCheckQueueIds = [];
24879
25160
  this.visualsManager.RemoveRegos({
24880
25161
  menuItemId: this.item.id
@@ -24917,7 +25198,8 @@
24917
25198
  await this.renderDataLabEntities(entities, true);
24918
25199
  }
24919
25200
  else {
24920
- this.distributeForRender(entities);
25201
+ // The skip gate cannot see an edited copy, so handed-in Entities are drawn forced.
25202
+ this.distributeForRender(entities, true);
24921
25203
  }
24922
25204
  }
24923
25205
  else {
@@ -25040,15 +25322,28 @@
25040
25322
  }
25041
25323
  }
25042
25324
  }
25043
- distributeForRender(entities) {
25325
+ distributeForRender(entities, force = false) {
25044
25326
  if (this.disposed || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
25045
25327
  return;
25046
25328
  }
25329
+ if (force) {
25330
+ entities.forEach(x => this.renderQueueForced.add(x));
25331
+ }
25047
25332
  this.renderQueue = this.renderQueue.concat(entities);
25048
25333
  if (!this.renderQueueInterval && this.renderQueue.length) {
25049
25334
  this.renderQueueInterval = setInterval(() => {
25050
- const batch = this.deduplicateEntities(this.renderQueue.splice(0, BATCH_SIZE$3));
25051
- this.renderDataLabEntities(batch);
25335
+ const taken = this.renderQueue.splice(0, BATCH_SIZE$3);
25336
+ // Read before de-duplicating, so a copy it drops does not stay in the set.
25337
+ const takenForced = new Set(taken.filter(x => this.renderQueueForced.delete(x)));
25338
+ const batch = this.deduplicateEntities(taken);
25339
+ const forced = batch.filter(x => takenForced.has(x));
25340
+ const rest = batch.filter(x => !takenForced.has(x));
25341
+ if (forced.length) {
25342
+ this.renderDataLabEntities(forced, true);
25343
+ }
25344
+ if (rest.length) {
25345
+ this.renderDataLabEntities(rest);
25346
+ }
25052
25347
  if (this.renderQueue.length <= 0) {
25053
25348
  clearInterval(this.renderQueueInterval);
25054
25349
  this.renderQueueInterval = null;
@@ -25080,7 +25375,7 @@
25080
25375
  return next;
25081
25376
  }
25082
25377
  async doRenderDataLabEntities(entities, force = false) {
25083
- var _a, _b, _c;
25378
+ var _a, _b, _c, _d, _e;
25084
25379
  if (this.disposed || this.viewer.isDestroyed() || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
25085
25380
  return;
25086
25381
  }
@@ -25129,7 +25424,9 @@
25129
25424
  tagIds: entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [],
25130
25425
  name: cEntity.name,
25131
25426
  cdn: this.item.cdnEnabled,
25132
- outline: entity.Bruce.Outline
25427
+ outline: entity.Bruce.Outline,
25428
+ styleId: (_b = cEntity.styleId) !== null && _b !== void 0 ? _b : undefined,
25429
+ styleEffective: (_c = cEntity.styleEffective) !== null && _c !== void 0 ? _c : undefined
25133
25430
  },
25134
25431
  requestRender: false
25135
25432
  });
@@ -25138,10 +25435,12 @@
25138
25435
  rego.name = cEntity.name;
25139
25436
  rego.visual = cEntity;
25140
25437
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
25438
+ rego.styleId = cEntity.styleId;
25439
+ rego.styleEffective = cEntity.styleEffective;
25141
25440
  rego.tagIds = entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [];
25142
- rego.outline = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.Outline;
25441
+ rego.outline = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.Outline;
25143
25442
  rego.cdn = this.item.cdnEnabled;
25144
- rego.schema = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.Schema;
25443
+ rego.schema = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.Schema;
25145
25444
  rego.canEdit = canEdit;
25146
25445
  if (rego.stale) {
25147
25446
  this.visualsManager.RefreshMark({
@@ -25217,6 +25516,7 @@
25217
25516
  renderSignature: Manager.GetRenderSignature(this.item)
25218
25517
  };
25219
25518
  this.renderQueue = [];
25519
+ this.renderQueueForced.clear();
25220
25520
  this.queryLoadId += 1;
25221
25521
  this.disposed = true;
25222
25522
  return payload;
@@ -26651,6 +26951,7 @@
26651
26951
  api: api,
26652
26952
  cTileset: this.cTileset,
26653
26953
  fallbackStyleId: this.item.styleId,
26954
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item),
26654
26955
  styleMapping: [],
26655
26956
  expandSources: false,
26656
26957
  menuItemId: this.item.id,
@@ -26873,7 +27174,8 @@
26873
27174
  if (Manager.NeedsStyler(item)) {
26874
27175
  this.styler.UpdateStyleMapping({
26875
27176
  styleMapping: [],
26876
- fallbackStyleId: item.styleId
27177
+ fallbackStyleId: item.styleId,
27178
+ styleOverlay: exports.MenuItemStyleOverlay.Get(item)
26877
27179
  });
26878
27180
  }
26879
27181
  }
@@ -27024,6 +27326,7 @@
27024
27326
  api: this.getters.GetBruceApi(),
27025
27327
  cTileset: this.cTileset,
27026
27328
  fallbackStyleId: this.item.styleId,
27329
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item),
27027
27330
  styleMapping: [],
27028
27331
  expandSources: false,
27029
27332
  menuItemId: this.item.id,
@@ -27944,6 +28247,7 @@
27944
28247
  api: api,
27945
28248
  cTileset: this.cTileset,
27946
28249
  fallbackStyleId: this.item.styleId,
28250
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item),
27947
28251
  styleMapping: this.item.StyleMapping,
27948
28252
  expandSources: false,
27949
28253
  menuItemId: this.item.id,
@@ -28139,7 +28443,8 @@
28139
28443
  if (this.item.ApplyStyles || this.item.Type == BModels.MenuItem.EType.IonTileset) {
28140
28444
  this.styler.UpdateStyleMapping({
28141
28445
  styleMapping: (_a = this.item.StyleMapping) !== null && _a !== void 0 ? _a : [],
28142
- fallbackStyleId: this.item.styleId
28446
+ fallbackStyleId: this.item.styleId,
28447
+ styleOverlay: exports.MenuItemStyleOverlay.Get(this.item)
28143
28448
  });
28144
28449
  }
28145
28450
  }
@@ -31757,17 +32062,21 @@
31757
32062
  }
31758
32063
  MenuItemStyles.Resolve = Resolve;
31759
32064
  /**
31760
- * Returns a copy on the style a bookmark alternation picked, or the item itself when that is not an option.
32065
+ * Returns a copy on the style a bookmark alternation picked and carrying any style it laid on the item.
31761
32066
  */
31762
32067
  function ApplyAlternation(item, alternation) {
31763
32068
  var _a, _b, _c;
31764
32069
  // Alternations are partial items and may carry no Type, so the pick is read from whichever field is present.
31765
32070
  const alt = alternation;
31766
32071
  const picked = (_a = alt === null || alt === void 0 ? void 0 : alt.styleId) !== null && _a !== void 0 ? _a : (_b = getVisibleRow(alt === null || alt === void 0 ? void 0 : alt.CameraZoomSettings)) === null || _b === void 0 ? void 0 : _b.StyleID;
31767
- if (picked == null) {
31768
- return item;
32072
+ const next = picked == null ? item : ((_c = WithStyleId(item, picked)) !== null && _c !== void 0 ? _c : item);
32073
+ // A style laid by record need not be one of the item's own, unlike the pick.
32074
+ const itemStyle = alternation === null || alternation === void 0 ? void 0 : alternation.style;
32075
+ const laid = exports.MenuItemStyleOverlay.GetItemStyle(alternation) || exports.MenuItemStyleOverlay.GetItemStyleId(alternation);
32076
+ if (laid == null) {
32077
+ return next;
31769
32078
  }
31770
- return (_c = WithStyleId(item, picked)) !== null && _c !== void 0 ? _c : item;
32079
+ return exports.MenuItemStyleOverlay.WithItemStyle(next, itemStyle);
31771
32080
  }
31772
32081
  MenuItemStyles.ApplyAlternation = ApplyAlternation;
31773
32082
  /**
@@ -31993,6 +32302,9 @@
31993
32302
  get Viewer() {
31994
32303
  return this.viewer;
31995
32304
  }
32305
+ get StyleOverlay() {
32306
+ return this.styleOverlay;
32307
+ }
31996
32308
  get VisualsRegister() {
31997
32309
  return this.visualsRegister;
31998
32310
  }
@@ -32053,6 +32365,12 @@
32053
32365
  this.pendingHandoffPool = [];
32054
32366
  // The settings bookmark alternations overwrite on a view's items, as that view authored them.
32055
32367
  this.authoredAlternations = new WeakMap();
32368
+ // Laid over each item's own style where it can take one, including items rendered after it was set.
32369
+ this.styleOverlay = null;
32370
+ this.styleOverlayCounter = 0;
32371
+ // Style records bookmark styles name by ID, loaded once each; null for one that failed to load.
32372
+ this.itemStyleRecords = new Map();
32373
+ this.itemStyleRecordsLoading = new Set();
32056
32374
  this.onUpdate = null;
32057
32375
  // Segments discovered so far per menu item ID.
32058
32376
  this.seriesSegments = new Map();
@@ -32134,12 +32452,18 @@
32134
32452
  }
32135
32453
  // An item with a style set renders its first style unless the caller already picked one of them.
32136
32454
  params = { ...params, item: exports.MenuItemStyles.Resolve(params.item) };
32455
+ // The overlay rides on the rendered copy, so the view's item never carries it.
32456
+ const effective = this.getEffectiveOverlay(params.item, this.styleOverlay);
32457
+ params = { ...params, item: exports.MenuItemStyleOverlay.With(params.item, effective) };
32137
32458
  let rItem = this.items.find(x => x.id == params.item.id);
32138
32459
  let create = true;
32139
32460
  // Item already exists so we'll check if we should re-create it.
32140
32461
  if (rItem) {
32141
- // Only the picked style changed, so what is drawn gets restyled rather than rebuilt.
32142
- if (exports.MenuItemStyles.IsStyleChangeOnly(rItem.item, params.item) && this.isStyleSwapCapable(rItem.renderManager)) {
32462
+ // Only the style pick, overlay or bookmark style changed, so the graphics are restyled, not rebuilt.
32463
+ const stripped = exports.MenuItemStyleOverlay.Strip(params.item);
32464
+ const pickOnly = exports.MenuItemStyles.IsStyleChangeOnly(exports.MenuItemStyleOverlay.Strip(rItem.item), stripped);
32465
+ const restyleOnly = pickOnly || exports.MenuItemStyleOverlay.IsChangeOnly(rItem.item, params.item);
32466
+ if (restyleOnly && this.isStyleSwapCapable(rItem.renderManager)) {
32143
32467
  rItem.renderManager.SwapStyle(params.item);
32144
32468
  rItem.item = params.item;
32145
32469
  create = false;
@@ -32586,6 +32910,120 @@
32586
32910
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
32587
32911
  return true;
32588
32912
  }
32913
+ /**
32914
+ * Lays a style, inline or by record, over every item that can take one; null clears it.
32915
+ */
32916
+ async SetStyleOverlay(params) {
32917
+ var _a, _b, _c;
32918
+ const counter = ++this.styleOverlayCounter;
32919
+ let overlay = (_a = params === null || params === void 0 ? void 0 : params.style) !== null && _a !== void 0 ? _a : null;
32920
+ if (!overlay && (params === null || params === void 0 ? void 0 : params.styleId) != null && params.styleId !== "" && params.styleId != -1) {
32921
+ // A record that fails to load leaves every item on its own style.
32922
+ try {
32923
+ const { style } = await BModels.Style.Get({
32924
+ api: this.getters.GetBruceApi(),
32925
+ styleId: params.styleId
32926
+ });
32927
+ overlay = (_b = style === null || style === void 0 ? void 0 : style.Settings) !== null && _b !== void 0 ? _b : null;
32928
+ }
32929
+ catch (e) {
32930
+ console.error(e);
32931
+ }
32932
+ }
32933
+ // A later call won while the record loaded.
32934
+ if (counter !== this.styleOverlayCounter) {
32935
+ return;
32936
+ }
32937
+ this.styleOverlay = overlay;
32938
+ for (const rItem of this.items) {
32939
+ const next = exports.MenuItemStyleOverlay.With(rItem.item, this.getEffectiveOverlay(rItem.item, overlay));
32940
+ // Setting the same overlay again would otherwise restyle every feature for nothing.
32941
+ const unchanged = JSON.stringify(exports.MenuItemStyleOverlay.Get(next)) === JSON.stringify(exports.MenuItemStyleOverlay.Get(rItem.item));
32942
+ if (unchanged ||
32943
+ !this.isStyleSwapCapable(rItem.renderManager) ||
32944
+ rItem.renderManager.Disposed) {
32945
+ continue;
32946
+ }
32947
+ rItem.renderManager.SwapStyle(next);
32948
+ rItem.item = next;
32949
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({ isEnabling: true, itemId: rItem.id });
32950
+ }
32951
+ }
32952
+ /**
32953
+ * Lays an inline style or any Style record on one enabled item under the scene-wide one; neither clears it.
32954
+ */
32955
+ SetItemStyleOverlay(params) {
32956
+ var _a;
32957
+ const rItem = this.items.find(x => x.id === params.menuItemId);
32958
+ let itemStyle = null;
32959
+ if (params.style) {
32960
+ itemStyle = { style: params.style };
32961
+ }
32962
+ else if (params.styleId != null) {
32963
+ itemStyle = { styleId: params.styleId };
32964
+ }
32965
+ if (!rItem ||
32966
+ !this.isStyleSwapCapable(rItem.renderManager) ||
32967
+ rItem.renderManager.Disposed ||
32968
+ (itemStyle && !exports.MenuItemStyleOverlay.Supports(rItem.item))) {
32969
+ return false;
32970
+ }
32971
+ const styled = exports.MenuItemStyleOverlay.WithItemStyle(rItem.item, itemStyle);
32972
+ const next = exports.MenuItemStyleOverlay.With(styled, this.getEffectiveOverlay(styled, this.styleOverlay));
32973
+ rItem.renderManager.SwapStyle(next);
32974
+ rItem.item = next;
32975
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
32976
+ return true;
32977
+ }
32978
+ /*
32979
+ * Returns the overlay the item renders with, starting the load of a record it names that is not loaded yet.
32980
+ */
32981
+ getEffectiveOverlay(item, overlay) {
32982
+ const styleId = exports.MenuItemStyleOverlay.GetItemStyle(item) ? null : exports.MenuItemStyleOverlay.GetItemStyleId(item);
32983
+ if (styleId != null && !this.itemStyleRecords.has(String(styleId))) {
32984
+ this.loadItemStyleRecord(styleId);
32985
+ }
32986
+ const record = styleId != null ? this.itemStyleRecords.get(String(styleId)) : null;
32987
+ return exports.MenuItemStyleOverlay.Effective(item, overlay, record !== null && record !== void 0 ? record : undefined);
32988
+ }
32989
+ /*
32990
+ * Loads a record a bookmark style names, then restyles every enabled item that names it.
32991
+ */
32992
+ async loadItemStyleRecord(styleId) {
32993
+ var _a, _b;
32994
+ const key = String(styleId);
32995
+ if (this.itemStyleRecordsLoading.has(key)) {
32996
+ return;
32997
+ }
32998
+ this.itemStyleRecordsLoading.add(key);
32999
+ let settings = null;
33000
+ // A record that fails to load leaves the item on its own style.
33001
+ try {
33002
+ const { style } = await BModels.Style.Get({
33003
+ api: this.getters.GetBruceApi(),
33004
+ styleId
33005
+ });
33006
+ settings = (_a = style === null || style === void 0 ? void 0 : style.Settings) !== null && _a !== void 0 ? _a : null;
33007
+ }
33008
+ catch (e) {
33009
+ console.error(e);
33010
+ }
33011
+ this.itemStyleRecordsLoading.delete(key);
33012
+ this.itemStyleRecords.set(key, settings);
33013
+ for (const rItem of this.items) {
33014
+ if (String(exports.MenuItemStyleOverlay.GetItemStyleId(rItem.item)) !== key ||
33015
+ exports.MenuItemStyleOverlay.GetItemStyle(rItem.item) ||
33016
+ !this.isStyleSwapCapable(rItem.renderManager) ||
33017
+ rItem.renderManager.Disposed) {
33018
+ continue;
33019
+ }
33020
+ const effective = this.getEffectiveOverlay(rItem.item, this.styleOverlay);
33021
+ const next = exports.MenuItemStyleOverlay.With(rItem.item, effective);
33022
+ rItem.renderManager.SwapStyle(next);
33023
+ rItem.item = next;
33024
+ (_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: true, itemId: rItem.id });
33025
+ }
33026
+ }
32589
33027
  /*
32590
33028
  * Picks the child the caller asked for, else the one already enabled, else the first.
32591
33029
  */
@@ -46488,15 +46926,16 @@
46488
46926
  */
46489
46927
  function GetZoomControlSignature(zoomControl) {
46490
46928
  return JSON.stringify([].concat(zoomControl !== null && zoomControl !== void 0 ? zoomControl : []).map((zoomItem) => {
46491
- var _a, _b, _c, _d, _e, _f, _g;
46929
+ var _a, _b, _c, _d, _e, _f, _g, _h;
46492
46930
  return ({
46493
46931
  MinZoom: (_a = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.MinZoom) !== null && _a !== void 0 ? _a : null,
46494
46932
  MaxZoom: (_b = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.MaxZoom) !== null && _b !== void 0 ? _b : null,
46495
46933
  DisplayType: (_c = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.DisplayType) !== null && _c !== void 0 ? _c : null,
46496
46934
  StyleID: (_d = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) !== null && _d !== void 0 ? _d : null,
46497
46935
  Style: (_e = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style) !== null && _e !== void 0 ? _e : null,
46498
- LODCategoryID: (_f = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODCategoryID) !== null && _f !== void 0 ? _f : null,
46499
- LODLevel: (_g = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODLevel) !== null && _g !== void 0 ? _g : null
46936
+ StyleOverlay: (_f = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleOverlay) !== null && _f !== void 0 ? _f : null,
46937
+ LODCategoryID: (_g = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODCategoryID) !== null && _g !== void 0 ? _g : null,
46938
+ LODLevel: (_h = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODLevel) !== null && _h !== void 0 ? _h : null
46500
46939
  });
46501
46940
  }));
46502
46941
  }
@@ -47762,7 +48201,8 @@
47762
48201
  for (let i = 0; i < params.entities.length; i++) {
47763
48202
  const entity = params.entities[i];
47764
48203
  const zoomItem = params.zoomItems[entity.Bruce.ID];
47765
- const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
48204
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
48205
+ const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
47766
48206
  // Pass through tags that may be needed for styling.
47767
48207
  const tagIds = entity.Bruce["Layer.ID"];
47768
48208
  const tags = [];
@@ -48591,6 +49031,10 @@
48591
49031
  trackEntity._parentEntity = cEntity;
48592
49032
  }
48593
49033
  cEntity._siblingGraphics = siblings;
49034
+ cEntity.styleEffective = exports.StyleEffective.Combine([
49035
+ { key: "color", effective: fillColorTrace.effective },
49036
+ { key: "scale", effective: scaleTrace.effective }
49037
+ ]);
48594
49038
  return cEntity;
48595
49039
  }
48596
49040
  EntityRenderEngineModel3d.Render = Render;
@@ -48601,7 +49045,7 @@
48601
49045
  * @returns
48602
49046
  */
48603
49047
  async function RenderGroup(params) {
48604
- var _a, _b, _c, _d, _e, _f, _g;
49048
+ var _a, _b, _c, _d, _e, _f, _g, _h;
48605
49049
  const api = params.apiGetter.getApi();
48606
49050
  await api.Loading;
48607
49051
  const cEntities = new Map();
@@ -48638,7 +49082,8 @@
48638
49082
  for (let i = 0; i < params.entities.length; i++) {
48639
49083
  const entity = params.entities[i];
48640
49084
  const zoomItem = params.zoomItems[entity.Bruce.ID];
48641
- const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
49085
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
49086
+ const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
48642
49087
  // Pass through tags that may be needed for styling.
48643
49088
  const tagIds = entity.Bruce["Layer.ID"];
48644
49089
  const tags = [];
@@ -48677,8 +49122,8 @@
48677
49122
  for (let i = 0; i < params.entities.length; i++) {
48678
49123
  const entity = params.entities[i];
48679
49124
  const zoomItem = params.zoomItems[entity.Bruce.ID];
48680
- const styleRecord = (!params.offline && zoomItem.StyleID != -1) ? (await getStyle$2(api, entity, zoomItem.StyleID)) : null;
48681
- const style = (!params.offline && zoomItem.StyleID != -1) ? styleRecord === null || styleRecord === void 0 ? void 0 : styleRecord.Settings : zoomItem.Style;
49125
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_c = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _c === void 0 ? void 0 : _c.Settings : zoomItem.Style;
49126
+ const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
48682
49127
  const lod = lodData.find(x => x.entityId == entity.Bruce.ID);
48683
49128
  if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
48684
49129
  continue;
@@ -48697,21 +49142,21 @@
48697
49142
  let rego = null;
48698
49143
  // Only used for historic tracks right now.
48699
49144
  // So won't bother getting it if we don't have historic data.
48700
- if ((_c = params.entitiesHistoric) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]) {
49145
+ if ((_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]) {
48701
49146
  rego = params.visualRegister.GetRego({
48702
49147
  entityId: entity.Bruce.ID,
48703
49148
  menuItemId: params.menuItemId
48704
49149
  });
48705
49150
  }
48706
- const mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
49151
+ const mStyle = (_e = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _e !== void 0 ? _e : {};
48707
49152
  const cEntity = Render({
48708
- rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e.get(entity.Bruce.ID),
49153
+ rendered: (_f = params.rendered) === null || _f === void 0 ? void 0 : _f.get(entity.Bruce.ID),
48709
49154
  entity: entity,
48710
- entityHistoric: (_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID],
49155
+ entityHistoric: (_g = params.entitiesHistoric) === null || _g === void 0 ? void 0 : _g[entity.Bruce.ID],
48711
49156
  style: mStyle,
48712
49157
  tags: tags,
48713
49158
  viewer: params.viewer,
48714
- lodUrl: (_g = lod.url) !== null && _g !== void 0 ? _g : BModels.ClientFile.GetUrl({
49159
+ lodUrl: (_h = lod.url) !== null && _h !== void 0 ? _h : BModels.ClientFile.GetUrl({
48715
49160
  api,
48716
49161
  fileId: lod.clientFileId,
48717
49162
  viaCdn: true
@@ -48727,7 +49172,8 @@
48727
49172
  const name = await getName$1(api, entity, params.offline);
48728
49173
  cEntity.name = name;
48729
49174
  cEntity._renderGroup = exports.EntityRenderEngine.GetRenderGroupId(zoomItem);
48730
- cEntity.styleId = zoomItem.StyleID == -1 ? -1 : styleRecord === null || styleRecord === void 0 ? void 0 : styleRecord.ID;
49175
+ // The skip gate compares this with the zoom item, so it must not name the type default.
49176
+ cEntity.styleId = zoomItem.StyleID == -1 ? -1 : (+zoomItem.StyleID || null);
48731
49177
  cEntities.set(entity.Bruce.ID, cEntity);
48732
49178
  }
48733
49179
  }
@@ -49162,7 +49608,8 @@
49162
49608
  for (let i = 0; i < params.entities.length; i++) {
49163
49609
  const entity = params.entities[i];
49164
49610
  const zoomItem = params.zoomItems[entity.Bruce.ID];
49165
- const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
49611
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
49612
+ const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
49166
49613
  // Pass through tags that may be needed for styling.
49167
49614
  const tagIds = entity.Bruce["Layer.ID"];
49168
49615
  const tags = [];
@@ -53829,7 +54276,8 @@ void main() {
53829
54276
  for (let i = 0; i < params.entities.length; i++) {
53830
54277
  const entity = params.entities[i];
53831
54278
  const zoomItem = params.zoomItems[entity.Bruce.ID];
53832
- const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
54279
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
54280
+ const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
53833
54281
  // Pass through tags that may be needed for styling.
53834
54282
  const tagIds = entity.Bruce["Layer.ID"];
53835
54283
  const tags = [];
@@ -56085,7 +56533,7 @@ void main() {
56085
56533
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
56086
56534
  })(exports.StyleUtils || (exports.StyleUtils = {}));
56087
56535
 
56088
- const VERSION = "7.6.6";
56536
+ const VERSION = "7.6.8";
56089
56537
  /**
56090
56538
  * Updates the environment instance used by bruce-cesium to one specified.
56091
56539
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.