bruce-cesium 7.9.2 → 7.9.3

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 (36) hide show
  1. package/dist/bruce-cesium.es5.js +198 -65
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +196 -63
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/displaced-surface-primitive.js +17 -0
  7. package/dist/lib/rendering/displaced-surface-primitive.js.map +1 -1
  8. package/dist/lib/rendering/entity-render-engine-model3d.js +10 -10
  9. package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
  10. package/dist/lib/rendering/entity-render-engine-point.js +6 -6
  11. package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
  12. package/dist/lib/rendering/entity-render-engine-polygon.js +30 -12
  13. package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
  14. package/dist/lib/rendering/entity-render-engine-polyline.js +4 -4
  15. package/dist/lib/rendering/entity-render-engine-polyline.js.map +1 -1
  16. package/dist/lib/rendering/menu-item-manager.js +16 -2
  17. package/dist/lib/rendering/menu-item-manager.js.map +1 -1
  18. package/dist/lib/rendering/menu-item-style-overlay.js +51 -11
  19. package/dist/lib/rendering/menu-item-style-overlay.js.map +1 -1
  20. package/dist/lib/rendering/menu-item-styles.js +9 -1
  21. package/dist/lib/rendering/menu-item-styles.js.map +1 -1
  22. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +1 -1
  23. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  24. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +1 -1
  25. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  26. package/dist/lib/rendering/tileset-styler.js +14 -9
  27. package/dist/lib/rendering/tileset-styler.js.map +1 -1
  28. package/dist/lib/rendering/visuals-register.js +36 -5
  29. package/dist/lib/rendering/visuals-register.js.map +1 -1
  30. package/dist/types/bruce-cesium.d.ts +1 -1
  31. package/dist/types/rendering/displaced-surface-primitive.d.ts +6 -2
  32. package/dist/types/rendering/menu-item-manager.d.ts +1 -0
  33. package/dist/types/rendering/menu-item-style-overlay.d.ts +22 -4
  34. package/dist/types/rendering/tileset-styler.d.ts +1 -0
  35. package/dist/types/rendering/visuals-register.d.ts +11 -0
  36. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, HeightReference, Matrix4, ConstantPositionProperty, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ClassificationType, ColorBlendMode, Model, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ArcType, CornerType, SceneMode, IntersectionTests, Ray, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Cesium3DTileset, WebGLConstants, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, ShadowMode, CustomDataSource, GeometryInstance, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, CesiumInspector, defined, ClockRange, DynamicEnvironmentMapManager, Event, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, Api, EntityLod, UrlUtils, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, Assembly, EntityCoords, BruceApi, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ColorBlendMode, Model, ClassificationType, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, SceneMode, IntersectionTests, Ray, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, HeadingPitchRange, Ion, Cesium3DTileStyle, IonResource, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileColorBlendMode, OrthographicFrustum, EasingFunction, Intersect, WebGLConstants, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, defined, ClockRange, ShadowMode, DynamicEnvironmentMapManager, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, GeometryInstance, Event, CustomDataSource, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, ZoomControl, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Geometry as Geometry$1, Api, ProjectView, ProjectViewBookmark, Assembly, EntityCoords, ClientFileValueMap, Color as Color$1, Bounds, EntityRelation, BruceApi, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttribute, MathUtils } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -14309,7 +14309,7 @@ function updateEntityShow(viewer, rego, show) {
14309
14309
  }
14310
14310
  }
14311
14311
  function updateEntity(viewer, entityId, register, refresh, cache = {}) {
14312
- var _a, _b, _c;
14312
+ var _a, _b, _c, _d;
14313
14313
  if (!entityId) {
14314
14314
  // What are we doing?
14315
14315
  return;
@@ -14396,7 +14396,8 @@ function updateEntity(viewer, entityId, register, refresh, cache = {}) {
14396
14396
  }
14397
14397
  }
14398
14398
  if (refresh === true || (refresh !== false && (refresh === null || refresh === void 0 ? void 0 : refresh.opacity))) {
14399
- let effectiveOpacity = state.opacity;
14399
+ // An Entity's own opacity wins over the one its menu item's bookmark style asks for.
14400
+ let effectiveOpacity = (_b = state.opacity) !== null && _b !== void 0 ? _b : register.GetMenuItemOpacity(rego.menuItemId);
14400
14401
  if ((effectiveOpacity == null || effectiveOpacity == 1) && !state.isolated && visible) {
14401
14402
  if (cache.isolationOpacity === undefined) {
14402
14403
  cache.isolationOpacity = register.GetIsolationOpacity();
@@ -14427,14 +14428,14 @@ function updateEntity(viewer, entityId, register, refresh, cache = {}) {
14427
14428
  EntityLabel.Attach({
14428
14429
  rego,
14429
14430
  viewer,
14430
- api: (_b = register.ApiGetters) === null || _b === void 0 ? void 0 : _b.GetBruceApi(),
14431
+ api: (_c = register.ApiGetters) === null || _c === void 0 ? void 0 : _c.GetBruceApi(),
14431
14432
  visualRegister: register,
14432
14433
  options: labelGroup ? labelGroup.options : register.GetLabelDefaults(),
14433
14434
  groupId: labelGroup === null || labelGroup === void 0 ? void 0 : labelGroup.groupId,
14434
14435
  persistent: true
14435
14436
  });
14436
14437
  }
14437
- else if (!visible || ((_c = EntityLabel.GetLabel({ rego })) === null || _c === void 0 ? void 0 : _c.Persistent)) {
14438
+ else if (!visible || ((_d = EntityLabel.GetLabel({ rego })) === null || _d === void 0 ? void 0 : _d.Persistent)) {
14438
14439
  EntityLabel.Detatch({
14439
14440
  rego, force: true
14440
14441
  });
@@ -14604,6 +14605,8 @@ var VisualsRegister;
14604
14605
  // When no Menu Item ID is set, then the second key is a blank string.
14605
14606
  // If an Entity ID state is set without a Menu Item ID, then it acts as a default for all Menu Items.
14606
14607
  this.states = {};
14608
+ // Opacity a whole menu item is drawn at, from its bookmark style; never a saved state.
14609
+ this.menuItemOpacities = new Map();
14607
14610
  // Queue of Entity updates to process in batches to avoid overloading the render loop.
14608
14611
  this.updateQueue = [];
14609
14612
  // Mirrors updateQueue for O(1) "already queued" checks.
@@ -15588,7 +15591,7 @@ var VisualsRegister;
15588
15591
  return;
15589
15592
  }
15590
15593
  this.dimmingDirty = false;
15591
- const dimming = Object.values(this.states).some(states => Object.values(states).some(state => state.isolated || (state.opacity != null && state.opacity < 1)));
15594
+ const dimming = Object.values(this.states).some(states => Object.values(states).some(state => state.isolated || (state.opacity != null && state.opacity < 1))) || this.menuItemOpacities.size > 0;
15592
15595
  if (!CesiumEntityStyler.SetDimming(this.viewer, this.id, dimming)) {
15593
15596
  return;
15594
15597
  }
@@ -17174,6 +17177,34 @@ var VisualsRegister;
17174
17177
  }
17175
17178
  return (totalOpacity && totalTicks) ? (totalOpacity / totalTicks) : totalOpacity != null && typeof totalOpacity == "number" ? totalOpacity : 1;
17176
17179
  }
17180
+ /**
17181
+ * Draws every Entity of a menu item at this opacity unless it has its own; null puts them back.
17182
+ * It is not a visual state, so a Bookmark save does not store it per Entity.
17183
+ */
17184
+ SetMenuItemOpacity(params) {
17185
+ var _a, _b, _c;
17186
+ const { menuItemId, opacity } = params;
17187
+ const wanted = typeof opacity === "number" && opacity >= 0 && opacity < 1 ? opacity : null;
17188
+ if (((_a = this.menuItemOpacities.get(menuItemId)) !== null && _a !== void 0 ? _a : null) === wanted) {
17189
+ return;
17190
+ }
17191
+ if (wanted == null) {
17192
+ this.menuItemOpacities.delete(menuItemId);
17193
+ }
17194
+ else {
17195
+ this.menuItemOpacities.set(menuItemId, wanted);
17196
+ }
17197
+ this.dimmingDirty = true;
17198
+ const entityIds = new Set(this.GetRegos({ menuItemId }).map(rego => rego.entityId).filter(Boolean));
17199
+ entityIds.forEach(entityId => this.queueUpdate({ entityId, refresh: { opacity: true } }));
17200
+ if (params.requestRender !== false) {
17201
+ (_c = (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.scene) === null || _c === void 0 ? void 0 : _c.requestRender();
17202
+ }
17203
+ }
17204
+ GetMenuItemOpacity(menuItemId) {
17205
+ var _a;
17206
+ return menuItemId ? ((_a = this.menuItemOpacities.get(menuItemId)) !== null && _a !== void 0 ? _a : null) : null;
17207
+ }
17177
17208
  ClearOpacity(params) {
17178
17209
  const clearedIds = new Set();
17179
17210
  this.ForEachState((state) => {
@@ -17545,18 +17576,57 @@ var MenuItemStyleOverlay;
17545
17576
  MenuItem.EType.EntitiesLoaded,
17546
17577
  MenuItem.EType.DataLab
17547
17578
  ];
17579
+ // The row every Entities render manager draws an item with when it names none.
17580
+ const DEFAULT_ZOOM_ROW = {
17581
+ MinZoom: 0,
17582
+ MaxZoom: 200000,
17583
+ DisplayType: ZoomControl.EDisplayType.Model3D,
17584
+ LODCategoryID: "glb",
17585
+ LODLevel: 0,
17586
+ StyleID: 0
17587
+ };
17588
+ // Instructions an overlay carries that are not style fields, so a merge never copies them onto a style.
17589
+ const INSTRUCTION_KEYS = ["types", "expandSources", "opacity"];
17548
17590
  /**
17549
- * Returns the base style with each field the overlay sets laid over it.
17591
+ * Returns the base style with each field the overlay sets laid over it, then its style for the Entity Type when given.
17550
17592
  */
17551
- function Merge(base, overlay) {
17552
- var _a, _b;
17593
+ function Merge(base, overlay, entityTypeId) {
17594
+ var _a;
17553
17595
  if (!overlay) {
17554
17596
  return base;
17555
17597
  }
17556
- const merged = { ...(base !== null && base !== void 0 ? base : {}) };
17598
+ const merged = layFields({ ...(base !== null && base !== void 0 ? base : {}) }, overlay);
17599
+ const typed = entityTypeId ? (_a = overlay.types) === null || _a === void 0 ? void 0 : _a[entityTypeId] : null;
17600
+ return typed ? layFields(merged, typed) : merged;
17601
+ }
17602
+ MenuItemStyleOverlay.Merge = Merge;
17603
+ /**
17604
+ * Returns whether an overlay paints a model fill, for the layer or for any Entity Type in it.
17605
+ */
17606
+ function SetsModelFill(overlay) {
17607
+ var _a;
17608
+ if (!overlay) {
17609
+ return false;
17610
+ }
17611
+ const types = Object.values((_a = overlay.types) !== null && _a !== void 0 ? _a : {});
17612
+ return [overlay, ...types].some(style => { var _a; return isSet((_a = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _a === void 0 ? void 0 : _a.fillColor); });
17613
+ }
17614
+ MenuItemStyleOverlay.SetsModelFill = SetsModelFill;
17615
+ /**
17616
+ * Returns whether an overlay asks for attributes read from the Entities' sources.
17617
+ */
17618
+ function ExpandsSources(overlay) {
17619
+ return Boolean(overlay === null || overlay === void 0 ? void 0 : overlay.expandSources);
17620
+ }
17621
+ MenuItemStyleOverlay.ExpandsSources = ExpandsSources;
17622
+ /*
17623
+ * Lays each style field an overlay sets onto a copy already taken, leaving its instructions behind.
17624
+ */
17625
+ function layFields(merged, overlay) {
17626
+ var _a, _b;
17557
17627
  for (const key of Object.keys(overlay)) {
17558
17628
  const value = overlay[key];
17559
- if (!isSet(value)) {
17629
+ if (INSTRUCTION_KEYS.includes(key) || !isSet(value)) {
17560
17630
  continue;
17561
17631
  }
17562
17632
  if (isPlainObject(value)) {
@@ -17572,12 +17642,11 @@ var MenuItemStyleOverlay;
17572
17642
  }
17573
17643
  return merged;
17574
17644
  }
17575
- MenuItemStyleOverlay.Merge = Merge;
17576
17645
  /**
17577
- * Returns the overlay a zoom control row carries laid over the style it resolved.
17646
+ * Returns the overlay a zoom control row carries laid over the style it resolved, for an Entity of the given type.
17578
17647
  */
17579
- function ApplyRow(style, row) {
17580
- return Merge(style, row === null || row === void 0 ? void 0 : row.StyleOverlay);
17648
+ function ApplyRow(style, row, entityTypeId) {
17649
+ return Merge(style, row === null || row === void 0 ? void 0 : row.StyleOverlay, entityTypeId);
17581
17650
  }
17582
17651
  MenuItemStyleOverlay.ApplyRow = ApplyRow;
17583
17652
  /**
@@ -17616,7 +17685,7 @@ var MenuItemStyleOverlay;
17616
17685
  * Returns a copy carrying the overlay, or the item itself when it cannot take one and carries none.
17617
17686
  */
17618
17687
  function With(item, overlay) {
17619
- var _a;
17688
+ var _a, _b;
17620
17689
  const target = Supports(item) ? overlay : null;
17621
17690
  if (!target && !Get(item)) {
17622
17691
  return item;
@@ -17632,9 +17701,11 @@ var MenuItemStyleOverlay;
17632
17701
  return next;
17633
17702
  }
17634
17703
  const zItem = item;
17704
+ // An item with no rows is drawn on the render managers' own default row, which has to carry the overlay too.
17705
+ const rows = ((_a = zItem.CameraZoomSettings) === null || _a === void 0 ? void 0 : _a.length) || !target ? ((_b = zItem.CameraZoomSettings) !== null && _b !== void 0 ? _b : []) : [{ ...DEFAULT_ZOOM_ROW }];
17635
17706
  return {
17636
17707
  ...zItem,
17637
- CameraZoomSettings: ((_a = zItem.CameraZoomSettings) !== null && _a !== void 0 ? _a : []).map(row => {
17708
+ CameraZoomSettings: rows.map(row => {
17638
17709
  const next = { ...row };
17639
17710
  if (target) {
17640
17711
  next.StyleOverlay = target;
@@ -17836,6 +17907,8 @@ class TilesetStyler {
17836
17907
  this.scenario = 0;
17837
17908
  // Indicates that we should expand the sources of the Entity.
17838
17909
  this.expandSources = false;
17910
+ // What the item itself asks for, which an overlay reading sourced attributes can only add to.
17911
+ this.ownExpandSources = false;
17839
17912
  // Indicates that we are retrieving historic records.
17840
17913
  // This means that the current scene's time is included in the request.
17841
17914
  this.historic = false;
@@ -17901,8 +17974,9 @@ class TilesetStyler {
17901
17974
  this.applyStyles = Boolean(applyStyles);
17902
17975
  }
17903
17976
  if (expandSources != null) {
17904
- this.expandSources = expandSources;
17977
+ this.ownExpandSources = expandSources;
17905
17978
  }
17979
+ this.expandSources = this.ownExpandSources || MenuItemStyleOverlay.ExpandsSources(this.styleOverlay);
17906
17980
  if (fallbackStyleId != null) {
17907
17981
  this.fallbackStyleId = fallbackStyleId;
17908
17982
  }
@@ -18039,11 +18113,13 @@ class TilesetStyler {
18039
18113
  this.historic = params.historic;
18040
18114
  }
18041
18115
  if (params.expandSources != null) {
18042
- if (this.expandSources != params.expandSources) {
18043
- this.shouldUpdateRegoStates = true;
18044
- }
18045
- this.expandSources = params.expandSources;
18116
+ this.ownExpandSources = params.expandSources;
18117
+ }
18118
+ const expandSources = this.ownExpandSources || MenuItemStyleOverlay.ExpandsSources(this.styleOverlay);
18119
+ if (this.expandSources != expandSources) {
18120
+ this.shouldUpdateRegoStates = true;
18046
18121
  }
18122
+ this.expandSources = expandSources;
18047
18123
  // Reload styles.
18048
18124
  if (this.loaded) {
18049
18125
  this.styledEntityIds.clear();
@@ -18118,12 +18194,12 @@ class TilesetStyler {
18118
18194
  * Replaces the tileset's own colours while an overlay sets a model fill, so features show exactly what it maps to.
18119
18195
  */
18120
18196
  applyOverlayBlend() {
18121
- var _a, _b, _c, _d;
18197
+ var _a, _b;
18122
18198
  if (!this.cTileset || ((_b = (_a = this.cTileset).isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
18123
18199
  return;
18124
18200
  }
18125
- const fill = (_d = (_c = this.styleOverlay) === null || _c === void 0 ? void 0 : _c.modelStyle) === null || _d === void 0 ? void 0 : _d.fillColor;
18126
- const colours = Array.isArray(fill) ? fill.length > 0 : fill != null;
18201
+ // A fill for one Entity Type replaces too, as does a hide, which is a fully transparent fill.
18202
+ const colours = MenuItemStyleOverlay.SetsModelFill(this.styleOverlay);
18127
18203
  if (colours && this.blendBeforeOverlay == null) {
18128
18204
  this.blendBeforeOverlay = this.cTileset.colorBlendMode;
18129
18205
  this.cTileset.colorBlendMode = Cesium3DTileColorBlendMode.REPLACE;
@@ -18599,7 +18675,7 @@ class TilesetStyler {
18599
18675
  style = (_b = this.fallbackStyle) === null || _b === void 0 ? void 0 : _b.Settings;
18600
18676
  styleId = this.fallbackStyleId != null ? Number(this.fallbackStyleId) : null;
18601
18677
  }
18602
- style = MenuItemStyleOverlay.Merge(style, this.styleOverlay);
18678
+ style = MenuItemStyleOverlay.Merge(style, this.styleOverlay, entityTypeId);
18603
18679
  if (!style || !((_c = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _c === void 0 ? void 0 : _c.customize)) {
18604
18680
  return { settings: null, styleId: null };
18605
18681
  }
@@ -23021,7 +23097,7 @@ var EntitiesRenderManager;
23021
23097
  console.error(e);
23022
23098
  }
23023
23099
  }
23024
- style = MenuItemStyleOverlay.ApplyRow(style, zoomItem);
23100
+ style = MenuItemStyleOverlay.ApplyRow(style, zoomItem, entityTypeId);
23025
23101
  const pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
23026
23102
  const lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
23027
23103
  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;
@@ -24128,7 +24204,7 @@ var EntitiesLoadedRenderManager;
24128
24204
  if (!style) {
24129
24205
  style = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style;
24130
24206
  }
24131
- style = MenuItemStyleOverlay.ApplyRow(style, zoomItem);
24207
+ style = MenuItemStyleOverlay.ApplyRow(style, zoomItem, entityTypeId);
24132
24208
  const pStyle = (_h = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _h !== void 0 ? _h : {};
24133
24209
  const lStyle = (_j = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _j !== void 0 ? _j : {};
24134
24210
  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;
@@ -35642,7 +35718,15 @@ var MenuItemStyles;
35642
35718
  if (laid == null) {
35643
35719
  return next;
35644
35720
  }
35645
- return MenuItemStyleOverlay.WithItemStyle(next, itemStyle);
35721
+ // These two only run a Styler with Apply Styles on, and a bookmark that lays colours on one needs them drawn; opacity alone does not.
35722
+ const inline = MenuItemStyleOverlay.GetItemStyle(alternation);
35723
+ const drawsStyle = inline
35724
+ ? Object.keys(inline).some(key => key !== "opacity" && key !== "expandSources")
35725
+ : MenuItemStyleOverlay.GetItemStyleId(alternation) != null;
35726
+ const styled = drawsStyle && (next.Type === MenuItem.EType.ArbTileset || next.Type === MenuItem.EType.EntityTileset) && !next.ApplyStyles
35727
+ ? { ...next, ApplyStyles: true }
35728
+ : next;
35729
+ return MenuItemStyleOverlay.WithItemStyle(styled, itemStyle);
35646
35730
  }
35647
35731
  MenuItemStyles.ApplyAlternation = ApplyAlternation;
35648
35732
  /**
@@ -36397,6 +36481,7 @@ var MenuItemManager;
36397
36481
  }
36398
36482
  }
36399
36483
  if (rItem.renderManager && !((_g = rItem.renderManager) === null || _g === void 0 ? void 0 : _g.Disposed)) {
36484
+ this.syncItemOpacity(rItem);
36400
36485
  (_h = this.onUpdate) === null || _h === void 0 ? void 0 : _h.Trigger({ isEnabling: true, itemId: rItem.id });
36401
36486
  }
36402
36487
  return rItem.id;
@@ -36407,7 +36492,7 @@ var MenuItemManager;
36407
36492
  * @param params
36408
36493
  */
36409
36494
  RemoveItemById(params) {
36410
- var _a, _b;
36495
+ var _a, _b, _c;
36411
36496
  let { menuItemId: id, recursive, allowHandoff } = params;
36412
36497
  if (this.viewer.isDestroyed()) {
36413
36498
  return;
@@ -36442,8 +36527,9 @@ var MenuItemManager;
36442
36527
  }
36443
36528
  this.ClearSeriesSegments(item.id);
36444
36529
  }
36530
+ (_b = this.visualsRegister) === null || _b === void 0 ? void 0 : _b.SetMenuItemOpacity({ menuItemId: item.id, opacity: null, requestRender: false });
36445
36531
  this.items = this.items.filter(x => x.id !== id);
36446
- (_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: false, itemId: item.id });
36532
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({ isEnabling: false, itemId: item.id });
36447
36533
  }
36448
36534
  }
36449
36535
  /**
@@ -36482,6 +36568,7 @@ var MenuItemManager;
36482
36568
  const next = MenuItemStyleOverlay.With(chosen, this.getEffectiveOverlay(chosen, this.styleOverlay));
36483
36569
  rItem.renderManager.SwapStyle(next);
36484
36570
  rItem.item = next;
36571
+ this.syncItemOpacity(rItem);
36485
36572
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
36486
36573
  return true;
36487
36574
  }
@@ -36521,9 +36608,18 @@ var MenuItemManager;
36521
36608
  }
36522
36609
  rItem.renderManager.SwapStyle(next);
36523
36610
  rItem.item = next;
36611
+ this.syncItemOpacity(rItem);
36524
36612
  (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({ isEnabling: true, itemId: rItem.id });
36525
36613
  }
36526
36614
  }
36615
+ /*
36616
+ * Draws an item at the opacity its bookmark style asks for, or opaque again once none is asked.
36617
+ */
36618
+ syncItemOpacity(rItem) {
36619
+ var _a, _b;
36620
+ const wanted = (_a = MenuItemStyleOverlay.GetItemStyle(rItem.item)) === null || _a === void 0 ? void 0 : _a.opacity;
36621
+ (_b = this.visualsRegister) === null || _b === void 0 ? void 0 : _b.SetMenuItemOpacity({ menuItemId: rItem.id, opacity: typeof wanted === "number" ? wanted : null });
36622
+ }
36527
36623
  /**
36528
36624
  * Lays an inline style or any Style record on one enabled item under the scene-wide one; neither clears it.
36529
36625
  */
@@ -36547,6 +36643,7 @@ var MenuItemManager;
36547
36643
  const next = MenuItemStyleOverlay.With(styled, this.getEffectiveOverlay(styled, this.styleOverlay));
36548
36644
  rItem.renderManager.SwapStyle(next);
36549
36645
  rItem.item = next;
36646
+ this.syncItemOpacity(rItem);
36550
36647
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
36551
36648
  return true;
36552
36649
  }
@@ -36596,6 +36693,7 @@ var MenuItemManager;
36596
36693
  const next = MenuItemStyleOverlay.With(rItem.item, effective);
36597
36694
  rItem.renderManager.SwapStyle(next);
36598
36695
  rItem.item = next;
36696
+ this.syncItemOpacity(rItem);
36599
36697
  (_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: true, itemId: rItem.id });
36600
36698
  }
36601
36699
  }
@@ -53446,7 +53544,7 @@ var EntityRenderEnginePoint;
53446
53544
  * @returns
53447
53545
  */
53448
53546
  async function RenderGroup(params) {
53449
- var _a, _b, _c, _d, _e;
53547
+ var _a, _b, _c, _d, _e, _f;
53450
53548
  const api = params.apiGetter.getApi();
53451
53549
  const cEntities = new Map();
53452
53550
  // Gathering tags in case styling needs it.
@@ -53478,7 +53576,7 @@ var EntityRenderEnginePoint;
53478
53576
  const entity = params.entities[i];
53479
53577
  const zoomItem = params.zoomItems[entity.Bruce.ID];
53480
53578
  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;
53481
- const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
53579
+ const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
53482
53580
  // Pass through tags that may be needed for styling.
53483
53581
  const tagIds = entity.Bruce["Layer.ID"];
53484
53582
  const tags = [];
@@ -53490,11 +53588,11 @@ var EntityRenderEnginePoint;
53490
53588
  }
53491
53589
  }
53492
53590
  }
53493
- const pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
53591
+ const pStyle = (_c = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _c !== void 0 ? _c : {};
53494
53592
  let rego = null;
53495
53593
  // Only used for historic tracks right now.
53496
53594
  // So won't bother getting it if we don't have historic data.
53497
- if ((_c = params.entitiesHistoric) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]) {
53595
+ if ((_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]) {
53498
53596
  rego = params.visualRegister.GetRego({
53499
53597
  entityId: entity.Bruce.ID,
53500
53598
  menuItemId: params.menuItemId
@@ -53509,8 +53607,8 @@ var EntityRenderEnginePoint;
53509
53607
  apiGetter: params.apiGetter,
53510
53608
  maxDistance: zoomItem.MaxZoom,
53511
53609
  minDistance: zoomItem.MinZoom,
53512
- rendered: (_d = params.rendered) === null || _d === void 0 ? void 0 : _d.get(entity.Bruce.ID),
53513
- entityHistoric: (_e = params.entitiesHistoric) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
53610
+ rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e.get(entity.Bruce.ID),
53611
+ entityHistoric: (_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID],
53514
53612
  entityHistoricDrawTrack: params.entityHistoricDrawTrack,
53515
53613
  fullStyle: style,
53516
53614
  rego: rego
@@ -54340,7 +54438,7 @@ var EntityRenderEngineModel3d;
54340
54438
  * @returns
54341
54439
  */
54342
54440
  async function RenderGroup(params) {
54343
- var _a, _b, _c, _d, _e, _f, _g, _h;
54441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
54344
54442
  const api = params.apiGetter.getApi();
54345
54443
  await api.Loading;
54346
54444
  const cEntities = new Map();
@@ -54378,7 +54476,7 @@ var EntityRenderEngineModel3d;
54378
54476
  const entity = params.entities[i];
54379
54477
  const zoomItem = params.zoomItems[entity.Bruce.ID];
54380
54478
  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;
54381
- const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
54479
+ const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
54382
54480
  // Pass through tags that may be needed for styling.
54383
54481
  const tagIds = entity.Bruce["Layer.ID"];
54384
54482
  const tags = [];
@@ -54390,7 +54488,7 @@ var EntityRenderEngineModel3d;
54390
54488
  }
54391
54489
  }
54392
54490
  }
54393
- const mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
54491
+ const mStyle = (_c = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _c !== void 0 ? _c : {};
54394
54492
  let group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
54395
54493
  if (!group) {
54396
54494
  group = "DEFAULT";
@@ -54417,8 +54515,8 @@ var EntityRenderEngineModel3d;
54417
54515
  for (let i = 0; i < params.entities.length; i++) {
54418
54516
  const entity = params.entities[i];
54419
54517
  const zoomItem = params.zoomItems[entity.Bruce.ID];
54420
- 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;
54421
- const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
54518
+ const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_d = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _d === void 0 ? void 0 : _d.Settings : zoomItem.Style;
54519
+ const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e["EntityType.ID"]);
54422
54520
  const lod = lodData.find(x => x.entityId == entity.Bruce.ID);
54423
54521
  if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
54424
54522
  continue;
@@ -54437,21 +54535,21 @@ var EntityRenderEngineModel3d;
54437
54535
  let rego = null;
54438
54536
  // Only used for historic tracks right now.
54439
54537
  // So won't bother getting it if we don't have historic data.
54440
- if ((_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]) {
54538
+ if ((_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID]) {
54441
54539
  rego = params.visualRegister.GetRego({
54442
54540
  entityId: entity.Bruce.ID,
54443
54541
  menuItemId: params.menuItemId
54444
54542
  });
54445
54543
  }
54446
- const mStyle = (_e = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _e !== void 0 ? _e : {};
54544
+ const mStyle = (_g = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _g !== void 0 ? _g : {};
54447
54545
  const cEntity = Render({
54448
- rendered: (_f = params.rendered) === null || _f === void 0 ? void 0 : _f.get(entity.Bruce.ID),
54546
+ rendered: (_h = params.rendered) === null || _h === void 0 ? void 0 : _h.get(entity.Bruce.ID),
54449
54547
  entity: entity,
54450
- entityHistoric: (_g = params.entitiesHistoric) === null || _g === void 0 ? void 0 : _g[entity.Bruce.ID],
54548
+ entityHistoric: (_j = params.entitiesHistoric) === null || _j === void 0 ? void 0 : _j[entity.Bruce.ID],
54451
54549
  style: mStyle,
54452
54550
  tags: tags,
54453
54551
  viewer: params.viewer,
54454
- lodUrl: (_h = lod.url) !== null && _h !== void 0 ? _h : ClientFile.GetUrl({
54552
+ lodUrl: (_k = lod.url) !== null && _k !== void 0 ? _k : ClientFile.GetUrl({
54455
54553
  api,
54456
54554
  fileId: lod.clientFileId,
54457
54555
  viaCdn: true
@@ -54958,7 +55056,7 @@ var EntityRenderEnginePolyline;
54958
55056
  * @returns
54959
55057
  */
54960
55058
  async function RenderGroup(params) {
54961
- var _a, _b, _c;
55059
+ var _a, _b, _c, _d;
54962
55060
  const api = params.apiGetter.getApi();
54963
55061
  const cEntities = new Map();
54964
55062
  // Gathering tags in case styling needs it.
@@ -54990,7 +55088,7 @@ var EntityRenderEnginePolyline;
54990
55088
  const entity = params.entities[i];
54991
55089
  const zoomItem = params.zoomItems[entity.Bruce.ID];
54992
55090
  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;
54993
- const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
55091
+ const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
54994
55092
  // Pass through tags that may be needed for styling.
54995
55093
  const tagIds = entity.Bruce["Layer.ID"];
54996
55094
  const tags = [];
@@ -55002,7 +55100,7 @@ var EntityRenderEnginePolyline;
55002
55100
  }
55003
55101
  }
55004
55102
  }
55005
- const lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
55103
+ const lStyle = (_c = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _c !== void 0 ? _c : {};
55006
55104
  const cEntity = Render({
55007
55105
  entity: entity,
55008
55106
  style: lStyle,
@@ -55010,7 +55108,7 @@ var EntityRenderEnginePolyline;
55010
55108
  viewer: params.viewer,
55011
55109
  maxDistance: zoomItem.MaxZoom,
55012
55110
  minDistance: zoomItem.MinZoom,
55013
- rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID)
55111
+ rendered: (_d = params.rendered) === null || _d === void 0 ? void 0 : _d.get(entity.Bruce.ID)
55014
55112
  });
55015
55113
  if (cEntity) {
55016
55114
  const name = await getName$2(api, entity, params.offline);
@@ -58339,6 +58437,23 @@ void main() {
58339
58437
  GetPlacementKey() {
58340
58438
  return [this.groundPixels ? 1 : 0, this.baseHeight, this.exaggeration, this.followGround ? 1 : 0].join("|");
58341
58439
  }
58440
+ /**
58441
+ * Repaints the sheet with new colours, keeping its geometry and the frames it is reading.
58442
+ */
58443
+ SetRamp(rampStops, lowColor, highColor) {
58444
+ const pixels = RampLookup(rampStops || null, lowColor || DEFAULT_LOW_COLOR, highColor || DEFAULT_HIGH_COLOR);
58445
+ // A re-render with the same colours keeps the texture it already has.
58446
+ if (this.rampPixels && pixels.length === this.rampPixels.length && pixels.every((value, i) => value === this.rampPixels[i])) {
58447
+ return;
58448
+ }
58449
+ this.rampPixels = pixels;
58450
+ this.maskFillValue = firstOpaqueStop(this.rampPixels);
58451
+ // Rebuilt from the new pixels on the next frame.
58452
+ if (this.rampTexture) {
58453
+ this.rampTexture.destroy();
58454
+ this.rampTexture = null;
58455
+ }
58456
+ }
58342
58457
  /**
58343
58458
  * The ramp the sheet is painted with, as 256 RGBA steps across the value range.
58344
58459
  */
@@ -59091,6 +59206,8 @@ const TEXTURE_FRAME_SERIES_ANIMATOR_KEY = "TextureFrameSeriesAnimator.Animator";
59091
59206
  const EXTRUSION_ANIMATOR_KEY = "TextureFrameSeriesAnimator.ExtrusionAnimator";
59092
59207
  const TEXTURE_VALUE_LABELS_KEY = "TextureValueLabels.Overlay";
59093
59208
  const DISPLACED_SURFACE_KEY = "DisplacedSurfacePrimitive.Surface";
59209
+ // Whether the surface's animator was built hiding the baseline, which it cannot change afterwards.
59210
+ const EXTRUSION_BASELINE_KEY = "TextureFrameSeriesAnimator.ExtrusionBaseline";
59094
59211
  var EntityRenderEnginePolygon;
59095
59212
  (function (EntityRenderEnginePolygon) {
59096
59213
  /**
@@ -59646,7 +59763,7 @@ var EntityRenderEnginePolygon;
59646
59763
  }
59647
59764
  EntityRenderEnginePolygon.Render = Render;
59648
59765
  async function RenderGroup(params) {
59649
- var _a, _b, _c, _d;
59766
+ var _a, _b, _c, _d, _e;
59650
59767
  const api = params.apiGetter.getApi();
59651
59768
  const cEntities = new Map();
59652
59769
  // Gathering tags in case styling needs it.
@@ -59678,7 +59795,7 @@ var EntityRenderEnginePolygon;
59678
59795
  const entity = params.entities[i];
59679
59796
  const zoomItem = params.zoomItems[entity.Bruce.ID];
59680
59797
  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;
59681
- const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
59798
+ const style = MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
59682
59799
  // Pass through tags that may be needed for styling.
59683
59800
  const tagIds = entity.Bruce["Layer.ID"];
59684
59801
  const tags = [];
@@ -59690,7 +59807,7 @@ var EntityRenderEnginePolygon;
59690
59807
  }
59691
59808
  }
59692
59809
  }
59693
- const pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
59810
+ const pStyle = (_c = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _c !== void 0 ? _c : {};
59694
59811
  let cEntity = null;
59695
59812
  try {
59696
59813
  cEntity = await Render({
@@ -59704,14 +59821,14 @@ var EntityRenderEnginePolygon;
59704
59821
  // Temporarily disabling re-using graphics for polygons as they have some bugs, and
59705
59822
  // they don't support any animation yet.
59706
59823
  // rendered: null
59707
- rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID),
59824
+ rendered: (_d = params.rendered) === null || _d === void 0 ? void 0 : _d.get(entity.Bruce.ID),
59708
59825
  menuItemId: params.menuItemId,
59709
59826
  visualRegister: params.visualRegister,
59710
59827
  onSeriesDiscovered: params.onSeriesDiscovered
59711
59828
  });
59712
59829
  }
59713
59830
  catch (e) {
59714
- console.error(`Polygon.RenderGroup: failed to render entity ${((_d = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _d === void 0 ? void 0 : _d.ID) || "<NONE>"}:`, e);
59831
+ console.error(`Polygon.RenderGroup: failed to render entity ${((_e = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _e === void 0 ? void 0 : _e.ID) || "<NONE>"}:`, e);
59715
59832
  }
59716
59833
  if (cEntity) {
59717
59834
  const name = await getName$3(api, entity, params.offline);
@@ -59923,10 +60040,15 @@ function syncDisplacedSurface(params) {
59923
60040
  const placement = surfacePlacement(entity, heightRef, extrusionArchive && TextureFrameSeriesAnimator.IsDatumHeight(extrusionArchive.metadata));
59924
60041
  // Whether the surface follows terrain is baked into its ground sampling, so a change there has
59925
60042
  // to rebuild rather than update in place.
59926
- if (reusable && existingSurface.GetFollowsGround() === placement.followGround) {
60043
+ // The baseline mask is read by the animator as it is built, so a change there rebuilds too.
60044
+ const baselineKept = cEntity[EXTRUSION_BASELINE_KEY] === Boolean(style.maskTextureBaseline);
60045
+ if (reusable && baselineKept && existingSurface.GetFollowsGround() === placement.followGround) {
59927
60046
  existingSurface.SetBaseHeight(placement.baseHeight);
59928
60047
  existingSurface.SetExaggeration(exaggerationFor(style));
59929
60048
  existingSurface.SetWater(waterFor(style));
60049
+ // A restyle that only recolours, such as a bookmark's own ramp, repaints in place.
60050
+ const ramp = surfaceRamp(style.textureColorMask, extrusionArchive.metadata);
60051
+ existingSurface.SetRamp(ramp.rampStops, ramp.lowColor, ramp.highColor);
59930
60052
  return;
59931
60053
  }
59932
60054
  disposeDisplacedSurface(cEntity, viewer);
@@ -59953,7 +60075,8 @@ function syncDisplacedSurface(params) {
59953
60075
  maskBaseline: style.maskTextureBaseline
59954
60076
  });
59955
60077
  cEntity[EXTRUSION_ANIMATOR_KEY] = animator;
59956
- const mask = style.textureColorMask;
60078
+ cEntity[EXTRUSION_BASELINE_KEY] = Boolean(style.maskTextureBaseline);
60079
+ const ramp = surfaceRamp(style.textureColorMask, extrusionArchive.metadata);
59957
60080
  const surface = new DisplacedSurfacePrimitive.Surface({
59958
60081
  extent,
59959
60082
  // The grid has to be walked the way the raster was sampled, or the surface skews across the extent.
@@ -59967,18 +60090,28 @@ function syncDisplacedSurface(params) {
59967
60090
  packedValue: TextureFrameSeriesAnimator.IsPackedValue(extrusionArchive.metadata),
59968
60091
  exaggeration: exaggerationFor(style),
59969
60092
  water: waterFor(style),
60093
+ lowColor: ramp.lowColor,
60094
+ highColor: ramp.highColor,
60095
+ rampStops: ramp.rampStops
60096
+ });
60097
+ surface.BindAnimator(animator);
60098
+ viewer.scene.primitives.add(surface);
60099
+ cEntity[DISPLACED_SURFACE_KEY] = surface;
60100
+ }
60101
+ /*
60102
+ * The colours a displaced surface paints with, from the style's mask.
60103
+ */
60104
+ function surfaceRamp(mask, metadata) {
60105
+ return {
59970
60106
  lowColor: mask ? Color$1.ColorFromStr(mask.minColor) : null,
59971
60107
  highColor: mask ? Color$1.ColorFromStr(mask.maxColor) : null,
59972
60108
  // Normalised the same way the animator normalises them, so the surface and the flat drape
59973
60109
  // agree about which values the style hides.
59974
60110
  rampStops: ((mask && mask.points) || []).map((stop) => ({
59975
- position: TextureFrameSeriesAnimator.NormalisePosition(extrusionArchive.metadata, stop.position),
60111
+ position: TextureFrameSeriesAnimator.NormalisePosition(metadata, stop.position),
59976
60112
  color: Color$1.ColorFromStr(stop.color)
59977
60113
  })).filter((stop) => Boolean(stop.color))
59978
- });
59979
- surface.BindAnimator(animator);
59980
- viewer.scene.primitives.add(surface);
59981
- cEntity[DISPLACED_SURFACE_KEY] = surface;
60114
+ };
59982
60115
  }
59983
60116
  /**
59984
60117
  * Turns the polygon's altitude option into the two things the displaced surface needs:
@@ -61961,7 +62094,7 @@ var StyleUtils;
61961
62094
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
61962
62095
  })(StyleUtils || (StyleUtils = {}));
61963
62096
 
61964
- const VERSION = "7.9.2";
62097
+ const VERSION = "7.9.3";
61965
62098
  /**
61966
62099
  * Updates the environment instance used by bruce-cesium to one specified.
61967
62100
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.