bruce-cesium 7.8.3 → 7.8.4

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.
@@ -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, ColorBlendMode, Model, ClassificationType, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, ArcType, CornerType, DistanceDisplayCondition, 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, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, FeatureDetection, Cesium3DTileset, IonResource, Cesium3DTileColorBlendMode, Intersect, OrthographicFrustum, EasingFunction, WebGLConstants, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, ShadowMode, DynamicEnvironmentMapManager, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, Event, CustomDataSource, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, GeometryInstance, 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, EntityLod, UrlUtils, Api, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, ClientFileValueMap, Color as Color$1, Bounds, BruceApi, EntityRelation, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, JulianDate, Quaternion, HeadingPitchRoll, ClassificationType, ArcType, CornerType, ColorBlendMode, Model, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, HorizontalOrigin, VerticalOrigin, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, Cesium3DTileset, OrthographicFrustum, EasingFunction, WebGLConstants, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PrimitiveCollection, ShadowMode, PolylineCollection, LabelCollection, LabelStyle, Material, GeometryInstance, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CustomDataSource, 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, Geometry as Geometry$1, EntityLod, UrlUtils, Bounds, ClientFileValueMap, Color as Color$1, Assembly, EntityCoords, ZoomControl, Api, ProjectView, ProjectViewBookmark, EntityRelation, BruceApi, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -9679,8 +9679,18 @@ var EntityLabel;
9679
9679
  if (!selectOnClick || this.disposed || this.counter !== counter || !clickEntityIds.length || !this.visualRegister) {
9680
9680
  return;
9681
9681
  }
9682
+ // A group's places name no Entity to select, so the app is told about them instead.
9683
+ const places = clickEntityIds.filter(id => { var _a, _b; return (_b = (_a = this.visualRegister.GetLabelGroupFor(id)) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.placeId; });
9684
+ if (places.length) {
9685
+ const keys = event;
9686
+ this.visualRegister.ClickLabelPlaces(places, Boolean(keys.ctrlKey || keys.metaKey || keys.shiftKey));
9687
+ }
9688
+ const entityIds = clickEntityIds.filter(id => !places.includes(id));
9689
+ if (!entityIds.length) {
9690
+ return;
9691
+ }
9682
9692
  this.visualRegister.ClearSelected({ requestRender: false });
9683
- this.visualRegister.SetSelected({ entityIds: clickEntityIds, selected: true });
9693
+ this.visualRegister.SetSelected({ entityIds, selected: true });
9684
9694
  };
9685
9695
  const makeClickable = (target) => {
9686
9696
  if (!selectOnClick || !this.visualRegister) {
@@ -9854,6 +9864,9 @@ var EntityLabel;
9854
9864
  ele.style.width = "max-content";
9855
9865
  layer.element.appendChild(ele);
9856
9866
  }
9867
+ // Follows the drawn shape, so a pin glows as a pin rather than as its box.
9868
+ const glow = this.options.highlightColor;
9869
+ ele.style.filter = glow ? `drop-shadow(0 0 1.5px ${glow}) drop-shadow(0 0 1.5px ${glow}) drop-shadow(0 0 4px ${glow})` : "";
9857
9870
  if (this.line) {
9858
9871
  lineEle = this.line;
9859
9872
  runEle = this.leaderRun;
@@ -11179,6 +11192,39 @@ var EntityLabel;
11179
11192
 
11180
11193
  var EntityLabelGroup;
11181
11194
  (function (EntityLabelGroup) {
11195
+ // The glow a selected place is drawn with.
11196
+ const PLACE_SELECTED_COLOR = "#33B1FF";
11197
+ // Keys places share the entity bookkeeping under, scoped to their group so a copied group keeps its own.
11198
+ const PLACE_KEY_PREFIX = "place:";
11199
+ function GetPlaceKey(groupId, placeId) {
11200
+ return `${PLACE_KEY_PREFIX}${groupId}:${placeId}`;
11201
+ }
11202
+ EntityLabelGroup.GetPlaceKey = GetPlaceKey;
11203
+ function IsPlaceKey(key) {
11204
+ return typeof key === "string" && key.startsWith(PLACE_KEY_PREFIX);
11205
+ }
11206
+ EntityLabelGroup.IsPlaceKey = IsPlaceKey;
11207
+ /*
11208
+ * A group's places as label items, leaving out any without an id or a position on the globe.
11209
+ */
11210
+ function FromPlaces(groupId, places) {
11211
+ return (Array.isArray(places) ? places : []).filter(place => {
11212
+ var _a;
11213
+ return typeof (place === null || place === void 0 ? void 0 : place.id) === "string" && place.id &&
11214
+ [place.longitude, place.latitude, (_a = place.altitude) !== null && _a !== void 0 ? _a : 0].every(Number.isFinite) &&
11215
+ Math.abs(place.latitude) <= 90;
11216
+ }).map(place => ({
11217
+ entityId: GetPlaceKey(groupId, place.id),
11218
+ placeId: place.id,
11219
+ text: place.text,
11220
+ longitude: place.longitude,
11221
+ latitude: place.latitude,
11222
+ altitude: place.altitude,
11223
+ look: place.look,
11224
+ selected: place.selected || undefined
11225
+ }));
11226
+ }
11227
+ EntityLabelGroup.FromPlaces = FromPlaces;
11182
11228
  /*
11183
11229
  * Keeps the query response useful even when the Entity has no loaded visual yet.
11184
11230
  * An Assembly part is placed from its record when shown (Manager.RefreshEntity); Location is its fallback.
@@ -11368,6 +11414,7 @@ var EntityLabelGroup;
11368
11414
  this.imagesQueued = new Set();
11369
11415
  this.imagesAsking = new Set();
11370
11416
  this.imagesTimer = null;
11417
+ this.placesInteractive = false;
11371
11418
  }
11372
11419
  notify() {
11373
11420
  try {
@@ -11395,7 +11442,7 @@ var EntityLabelGroup;
11395
11442
  return true;
11396
11443
  }
11397
11444
  async Set(definition) {
11398
- var _a, _b, _c, _d, _e, _f, _g, _h;
11445
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11399
11446
  if (!(definition === null || definition === void 0 ? void 0 : definition.id) || !definition.source) {
11400
11447
  throw new Error("Label group requires id and source");
11401
11448
  }
@@ -11417,7 +11464,7 @@ var EntityLabelGroup;
11417
11464
  }
11418
11465
  this.errors.delete(definition.id);
11419
11466
  this.notify();
11420
- const cancelled = () => ({ id: definition.id, entityIds: [], truncated: false, cancelled: true });
11467
+ const cancelled = () => ({ id: definition.id, entityIds: [], placeIds: [], truncated: false, cancelled: true });
11421
11468
  const items = new Map();
11422
11469
  let truncated = false;
11423
11470
  try {
@@ -11459,6 +11506,11 @@ var EntityLabelGroup;
11459
11506
  }
11460
11507
  offset = next;
11461
11508
  }
11509
+ // Placed by hand, so outside maxItems; read again as SetPlaces may change them during the load.
11510
+ definition = (_j = this.definitions.get(definition.id)) !== null && _j !== void 0 ? _j : definition;
11511
+ for (const place of FromPlaces(definition.id, definition.places)) {
11512
+ items.set(place.entityId, place);
11513
+ }
11462
11514
  const previous = this.active.get(definition.id);
11463
11515
  const affected = new Set([...((previous === null || previous === void 0 ? void 0 : previous.items.keys()) || []), ...items.keys()]);
11464
11516
  this.unindex(definition.id);
@@ -11472,7 +11524,7 @@ var EntityLabelGroup;
11472
11524
  this.members.get(id).add(definition.id);
11473
11525
  }
11474
11526
  this.refresh(affected);
11475
- return { id: definition.id, entityIds: Array.from(items.keys()), truncated, cancelled: false };
11527
+ return { id: definition.id, ...splitKeys(items), truncated, cancelled: false };
11476
11528
  }
11477
11529
  catch (error) {
11478
11530
  if (controller.signal.aborted || this.register.Disposed) {
@@ -11488,13 +11540,90 @@ var EntityLabelGroup;
11488
11540
  }
11489
11541
  }
11490
11542
  }
11543
+ /*
11544
+ * Replaces a group's places without reading its source again, redrawing only the places that changed.
11545
+ */
11546
+ SetPlaces(id, places) {
11547
+ var _a, _b;
11548
+ const definition = this.definitions.get(id);
11549
+ if (!definition) {
11550
+ return false;
11551
+ }
11552
+ this.definitions.set(id, { ...definition, places: copyOptions(places) });
11553
+ const group = this.active.get(id);
11554
+ if (!group) {
11555
+ // Still loading, and Set takes them from the definition when it commits.
11556
+ return true;
11557
+ }
11558
+ group.definition = this.definitions.get(id);
11559
+ const next = new Map(FromPlaces(id, places).map(item => [item.entityId, item]));
11560
+ const changed = new Set();
11561
+ for (const [key, item] of group.items) {
11562
+ if (item.placeId && JSON.stringify(item) !== JSON.stringify(next.get(key))) {
11563
+ changed.add(key);
11564
+ }
11565
+ }
11566
+ for (const [key, item] of next) {
11567
+ if (JSON.stringify(item) !== JSON.stringify(group.items.get(key))) {
11568
+ changed.add(key);
11569
+ }
11570
+ }
11571
+ if (!changed.size) {
11572
+ return true;
11573
+ }
11574
+ for (const key of changed) {
11575
+ const item = next.get(key);
11576
+ if (item) {
11577
+ group.items.set(key, item);
11578
+ if (!this.members.has(key)) {
11579
+ this.members.set(key, new Set());
11580
+ }
11581
+ this.members.get(key).add(id);
11582
+ }
11583
+ else {
11584
+ group.items.delete(key);
11585
+ (_a = this.members.get(key)) === null || _a === void 0 ? void 0 : _a.delete(id);
11586
+ if (!((_b = this.members.get(key)) === null || _b === void 0 ? void 0 : _b.size)) {
11587
+ this.members.delete(key);
11588
+ }
11589
+ }
11590
+ }
11591
+ // A place that stays where it is takes its new look in place, so a highlight or a colour never flickers it.
11592
+ const moved = new Set([...changed].filter(key => !SameSpot(this.standaloneItems.get(key), group.items.get(key))));
11593
+ this.refresh(moved);
11594
+ for (const key of changed) {
11595
+ if (!moved.has(key)) {
11596
+ this.RefreshEntity(key);
11597
+ }
11598
+ }
11599
+ this.notify();
11600
+ return true;
11601
+ }
11602
+ /*
11603
+ * Whether a click on a place is reported to the app, as it is while the app lets its markup be edited.
11604
+ */
11605
+ SetPlacesInteractive(on) {
11606
+ if (this.placesInteractive === on) {
11607
+ return;
11608
+ }
11609
+ this.placesInteractive = on;
11610
+ const keys = new Set();
11611
+ for (const group of this.active.values()) {
11612
+ for (const [key, item] of group.items) {
11613
+ if (item.placeId) {
11614
+ keys.add(key);
11615
+ }
11616
+ }
11617
+ }
11618
+ this.refresh(keys);
11619
+ }
11491
11620
  Get() {
11492
11621
  return Array.from(this.definitions.keys(), id => {
11493
11622
  var _a;
11494
11623
  const group = this.active.get(id);
11495
11624
  return {
11496
11625
  id,
11497
- entityIds: Array.from((group === null || group === void 0 ? void 0 : group.items.keys()) || []),
11626
+ ...splitKeys(group === null || group === void 0 ? void 0 : group.items),
11498
11627
  truncated: (_a = group === null || group === void 0 ? void 0 : group.truncated) !== null && _a !== void 0 ? _a : false,
11499
11628
  cancelled: false,
11500
11629
  visible: this.visibility.get(id) !== false,
@@ -11513,21 +11642,22 @@ var EntityLabelGroup;
11513
11642
  return false;
11514
11643
  }
11515
11644
  Resolve(entityId, menuItemId) {
11516
- var _a, _b, _c, _d, _e;
11645
+ var _a, _b, _c, _d, _e, _f;
11517
11646
  const ids = Array.from(this.members.get(entityId) || []).reverse();
11518
11647
  for (const id of ids) {
11519
11648
  const group = this.active.get(id);
11520
11649
  if (this.visibility.get(id) === false) {
11521
11650
  continue;
11522
11651
  }
11523
- if (group.definition.menuItemId && group.definition.menuItemId !== menuItemId) {
11652
+ // A place belongs to its group alone, never to a menu item's Entities.
11653
+ if (group.definition.menuItemId && group.definition.menuItemId !== menuItemId && !((_a = group.items.get(entityId)) === null || _a === void 0 ? void 0 : _a.placeId)) {
11524
11654
  continue;
11525
11655
  }
11526
11656
  const options = this.compose(group, entityId, menuItemId);
11527
11657
  const item = group.items.get(entityId);
11528
- const image = (_a = this.images.get(entityId)) !== null && _a !== void 0 ? _a : (Array.isArray((_c = (_b = item.entity) === null || _b === void 0 ? void 0 : _b.Bruce) === null || _c === void 0 ? void 0 : _c.Attachment) ? EntityLabel.GetDefaultImageUrl(item.entity, (_d = this.register.ApiGetters) === null || _d === void 0 ? void 0 : _d.GetBruceApi()) : null);
11658
+ const image = (_b = this.images.get(entityId)) !== null && _b !== void 0 ? _b : (Array.isArray((_d = (_c = item.entity) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d.Attachment) ? EntityLabel.GetDefaultImageUrl(item.entity, (_e = this.register.ApiGetters) === null || _e === void 0 ? void 0 : _e.GetBruceApi()) : null);
11529
11659
  if (image && !EntityLabel.HasIcon(options)) {
11530
- (_e = options.photo) !== null && _e !== void 0 ? _e : (options.photo = image);
11660
+ (_f = options.photo) !== null && _f !== void 0 ? _f : (options.photo = image);
11531
11661
  }
11532
11662
  return { groupId: id, options, item };
11533
11663
  }
@@ -11537,7 +11667,7 @@ var EntityLabelGroup;
11537
11667
  * One member's label settings, with any image its own text links to but before its default image.
11538
11668
  */
11539
11669
  compose(group, entityId, menuItemId) {
11540
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
11670
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
11541
11671
  const item = group.items.get(entityId);
11542
11672
  const entity = (_a = item.entity) !== null && _a !== void 0 ? _a : { Bruce: { ID: entityId, Name: item.text } };
11543
11673
  let iconPriority = (_b = group.definition.options) === null || _b === void 0 ? void 0 : _b.iconPriority;
@@ -11572,21 +11702,42 @@ var EntityLabelGroup;
11572
11702
  }
11573
11703
  const fallbackText = [item.text, (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.Name, (_f = this.register.GetRego({ entityId, menuItemId })) === null || _f === void 0 ? void 0 : _f.name, entityId]
11574
11704
  .find(text => typeof text === "string" && text.trim().length > 0);
11705
+ if (item.placeId) {
11706
+ // A place says what it was given: its key is no name, and an expression has no record to read.
11707
+ resolvedText = (_g = item.text) !== null && _g !== void 0 ? _g : "";
11708
+ }
11575
11709
  const options = {
11576
11710
  ...group.definition.options,
11577
11711
  text: resolvedText !== null && resolvedText !== void 0 ? resolvedText : fallbackText,
11578
11712
  iconScale: iconScale,
11579
- icon: resolveIcon((_g = group.definition.options) === null || _g === void 0 ? void 0 : _g.icon, entity),
11580
- iconUrl: resolveIcon((_h = group.definition.options) === null || _h === void 0 ? void 0 : _h.iconUrl, entity),
11581
- iconClass: resolveIcon((_j = group.definition.options) === null || _j === void 0 ? void 0 : _j.iconClass, entity),
11582
- iconColor: resolveIcon((_k = group.definition.options) === null || _k === void 0 ? void 0 : _k.iconColor, entity),
11583
- iconBackground: resolveBackground((_l = group.definition.options) === null || _l === void 0 ? void 0 : _l.iconBackground, entity),
11713
+ icon: resolveIcon((_h = group.definition.options) === null || _h === void 0 ? void 0 : _h.icon, entity),
11714
+ iconUrl: resolveIcon((_j = group.definition.options) === null || _j === void 0 ? void 0 : _j.iconUrl, entity),
11715
+ iconClass: resolveIcon((_k = group.definition.options) === null || _k === void 0 ? void 0 : _k.iconClass, entity),
11716
+ iconColor: resolveIcon((_l = group.definition.options) === null || _l === void 0 ? void 0 : _l.iconColor, entity),
11717
+ iconBackground: resolveBackground((_m = group.definition.options) === null || _m === void 0 ? void 0 : _m.iconBackground, entity),
11584
11718
  iconPriority: Number.isFinite(iconPriority) ? iconPriority : item.iconPriority,
11585
- iconStatus: (_o = resolveIcon((_m = group.definition.options) === null || _m === void 0 ? void 0 : _m.iconStatus, entity)) !== null && _o !== void 0 ? _o : item.iconStatus
11719
+ iconStatus: (_p = resolveIcon((_o = group.definition.options) === null || _o === void 0 ? void 0 : _o.iconStatus, entity)) !== null && _p !== void 0 ? _p : item.iconStatus
11586
11720
  };
11721
+ if (item.placeId) {
11722
+ // Clickable only when the app asks, and reported then, as there is no Entity to select.
11723
+ options.selectOnClick = this.placesInteractive;
11724
+ options.highlightColor = item.selected ? PLACE_SELECTED_COLOR : undefined;
11725
+ const look = item.look;
11726
+ if ((look === null || look === void 0 ? void 0 : look.iconUrl) || (look === null || look === void 0 ? void 0 : look.iconClass)) {
11727
+ options.icon = undefined;
11728
+ options.iconUrl = look.iconUrl || undefined;
11729
+ options.iconClass = look.iconUrl ? undefined : look.iconClass;
11730
+ }
11731
+ if (look === null || look === void 0 ? void 0 : look.iconColor) {
11732
+ options.iconColor = look.iconColor;
11733
+ }
11734
+ if ((look === null || look === void 0 ? void 0 : look.iconBackground) != null) {
11735
+ options.iconBackground = look.iconBackground;
11736
+ }
11737
+ }
11587
11738
  if (options.attributes && item.entity && !(expression && resolvedText != null)) {
11588
11739
  options.text = [
11589
- (_r = (_p = options.text) !== null && _p !== void 0 ? _p : (_q = item.entity.Bruce) === null || _q === void 0 ? void 0 : _q.Name) !== null && _r !== void 0 ? _r : entityId,
11740
+ (_s = (_q = options.text) !== null && _q !== void 0 ? _q : (_r = item.entity.Bruce) === null || _r === void 0 ? void 0 : _r.Name) !== null && _s !== void 0 ? _s : entityId,
11590
11741
  ...options.attributes.map(path => Entity$1.GetValue({ entity: item.entity, path })).filter(value => value != null).map(String)
11591
11742
  ].join("\n");
11592
11743
  }
@@ -11608,7 +11759,7 @@ var EntityLabelGroup;
11608
11759
  RequestImage(entityId) {
11609
11760
  var _a, _b, _c, _d, _e, _f;
11610
11761
  const api = (_a = this.register.ApiGetters) === null || _a === void 0 ? void 0 : _a.GetBruceApi();
11611
- if (!api || !entityId || this.images.has(entityId) || this.imagesAsking.has(entityId)) {
11762
+ if (!api || !entityId || IsPlaceKey(entityId) || this.images.has(entityId) || this.imagesAsking.has(entityId)) {
11612
11763
  return;
11613
11764
  }
11614
11765
  // Members read with their attachments already know their image, or that they have none.
@@ -11667,8 +11818,9 @@ var EntityLabelGroup;
11667
11818
  var _a, _b, _c, _d, _e, _f, _g, _h;
11668
11819
  const match = this.Resolve(entityId);
11669
11820
  const registered = this.register.GetRego({ entityId });
11670
- if (!registered && match && this.standalone.has(entityId) && this.standaloneItems.get(entityId) === match.item) {
11821
+ if (!registered && match && this.standalone.has(entityId) && SameSpot(this.standaloneItems.get(entityId), match.item)) {
11671
11822
  this.standalone.get(entityId).Configure({ ...match.options, text: (_b = (_a = match.options.text) !== null && _a !== void 0 ? _a : match.item.text) !== null && _b !== void 0 ? _b : entityId }, match.groupId);
11823
+ this.standaloneItems.set(entityId, match.item);
11672
11824
  return;
11673
11825
  }
11674
11826
  (_c = this.standalone.get(entityId)) === null || _c === void 0 ? void 0 : _c.Dispose();
@@ -11681,7 +11833,7 @@ var EntityLabelGroup;
11681
11833
  return;
11682
11834
  }
11683
11835
  const item = match.item;
11684
- const position = (_d = this.assemblyPosition(item.entity)) !== null && _d !== void 0 ? _d : ([item.longitude, item.latitude, (_e = item.altitude) !== null && _e !== void 0 ? _e : 0].every(Number.isFinite) && Math.abs(item.latitude) <= 90
11836
+ const position = (_d = (item.placeId ? null : this.assemblyPosition(item.entity))) !== null && _d !== void 0 ? _d : ([item.longitude, item.latitude, (_e = item.altitude) !== null && _e !== void 0 ? _e : 0].every(Number.isFinite) && Math.abs(item.latitude) <= 90
11685
11837
  ? Cartesian3.fromDegrees(item.longitude, item.latitude, item.altitude || 0)
11686
11838
  : null);
11687
11839
  if (!position) {
@@ -11699,6 +11851,10 @@ var EntityLabelGroup;
11699
11851
  options: { ...match.options, text: (_h = (_g = match.options.text) !== null && _g !== void 0 ? _g : item.text) !== null && _h !== void 0 ? _h : entityId },
11700
11852
  groupId: match.groupId,
11701
11853
  visible: () => {
11854
+ // A place is markup, which isolating Entities leaves alone.
11855
+ if (item.placeId) {
11856
+ return true;
11857
+ }
11702
11858
  const state = this.register.GetState({ entityId });
11703
11859
  return !state.hidden && (!this.register.GetIsIsolatedAny() || state.isolated || this.register.GetIsolationOpacity() != null);
11704
11860
  }
@@ -11822,11 +11978,49 @@ var EntityLabelGroup;
11822
11978
  this.standalone.delete(id);
11823
11979
  this.standaloneItems.delete(id);
11824
11980
  }
11825
- this.register.ForceUpdate({ entityIds: Array.from(ids) });
11981
+ const all = Array.from(ids);
11982
+ this.register.ForceUpdate({ entityIds: all.filter(id => !IsPlaceKey(id)) });
11983
+ // Places skip the register, whose update events would announce them to the app as Entities.
11984
+ for (const id of all.filter(IsPlaceKey)) {
11985
+ this.RefreshEntity(id);
11986
+ }
11826
11987
  this.register.Viewer.scene.requestRender();
11827
11988
  }
11828
11989
  }
11829
11990
  EntityLabelGroup.Manager = Manager;
11991
+ /*
11992
+ * Whether a standalone label already drawn for one item can be reconfigured for the other rather than drawn again.
11993
+ */
11994
+ function SameSpot(drawn, item) {
11995
+ var _a, _b;
11996
+ if (!drawn || !item) {
11997
+ return false;
11998
+ }
11999
+ if (drawn === item) {
12000
+ return true;
12001
+ }
12002
+ return Boolean(drawn.placeId &&
12003
+ drawn.placeId === item.placeId &&
12004
+ drawn.longitude === item.longitude &&
12005
+ drawn.latitude === item.latitude &&
12006
+ ((_a = drawn.altitude) !== null && _a !== void 0 ? _a : 0) === ((_b = item.altitude) !== null && _b !== void 0 ? _b : 0));
12007
+ }
12008
+ /*
12009
+ * A group's members split into the Entities it labels and the ids of its places.
12010
+ */
12011
+ function splitKeys(items) {
12012
+ const entityIds = [];
12013
+ const placeIds = [];
12014
+ for (const [key, item] of items !== null && items !== void 0 ? items : []) {
12015
+ if (item.placeId) {
12016
+ placeIds.push(item.placeId);
12017
+ }
12018
+ else {
12019
+ entityIds.push(key);
12020
+ }
12021
+ }
12022
+ return { entityIds, placeIds };
12023
+ }
11830
12024
  /*
11831
12025
  * Rejects invalid geometry settings before they can create unbounded spatial-index work.
11832
12026
  */
@@ -13693,6 +13887,7 @@ var VisualsRegister;
13693
13887
  return this.onStyleChange;
13694
13888
  }
13695
13889
  get OnLabelGroupsChanged() { return this.labelGroupsChanged; }
13890
+ get OnLabelPlaceClick() { return this.labelPlaceClicked; }
13696
13891
  constructor(params) {
13697
13892
  var _a, _b, _c, _d, _e, _f, _g;
13698
13893
  this.id = ObjectUtils.UId();
@@ -13746,6 +13941,7 @@ var VisualsRegister;
13746
13941
  this.simulationRemoval = null;
13747
13942
  this.shadowsRemoval = null;
13748
13943
  this.labelGroupsChanged = new BruceEvent();
13944
+ this.labelPlaceClicked = new BruceEvent();
13749
13945
  this.hoverRingState = {};
13750
13946
  this.retiringHoverLabels = new Map();
13751
13947
  /*
@@ -14745,6 +14941,7 @@ var VisualsRegister;
14745
14941
  this.retiringHoverLabels.clear();
14746
14942
  (_c = this.labelGroups) === null || _c === void 0 ? void 0 : _c.Dispose();
14747
14943
  this.labelGroupsChanged.Clear();
14944
+ this.labelPlaceClicked.Clear();
14748
14945
  for (const regos of Object.values(this.rego)) {
14749
14946
  for (const rego of regos)
14750
14947
  EntityLabel.Detatch({ rego, force: true });
@@ -16518,6 +16715,35 @@ var VisualsRegister;
16518
16715
  }
16519
16716
  return (_b = (_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.Refresh(id)) !== null && _b !== void 0 ? _b : Promise.reject(new Error(`Unknown label group: ${id}`));
16520
16717
  }
16718
+ /*
16719
+ * Whether clicks on label group places are reported through OnLabelPlaceClick. Off by default.
16720
+ */
16721
+ SetLabelPlacesInteractive(on) {
16722
+ if (this.disposed) {
16723
+ return;
16724
+ }
16725
+ if (!this.labelGroups) {
16726
+ this.labelGroups = new EntityLabelGroup.Manager(this, () => this.labelGroupsChanged.Trigger(undefined));
16727
+ }
16728
+ this.labelGroups.SetPlacesInteractive(on);
16729
+ }
16730
+ /*
16731
+ * Called by a label clicked while places are interactive, with the place keys it stands for.
16732
+ */
16733
+ ClickLabelPlaces(keys, additive) {
16734
+ const places = keys.map(key => { var _a, _b, _c; return ({ groupId: (_a = this.GetLabelGroupFor(key)) === null || _a === void 0 ? void 0 : _a.groupId, placeId: (_c = (_b = this.GetLabelGroupFor(key)) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.placeId }); })
16735
+ .filter(place => place.groupId && place.placeId);
16736
+ if (places.length) {
16737
+ this.labelPlaceClicked.Trigger({ places, additive });
16738
+ }
16739
+ }
16740
+ /*
16741
+ * Replaces a group's places without reading its source again. False when no such group was set.
16742
+ */
16743
+ SetLabelGroupPlaces(id, places) {
16744
+ var _a, _b;
16745
+ return (_b = (_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.SetPlaces(id, places)) !== null && _b !== void 0 ? _b : false;
16746
+ }
16521
16747
  SetLabelGroupVisible(id, visible) {
16522
16748
  var _a, _b;
16523
16749
  return (_b = (_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.SetVisible(id, visible)) !== null && _b !== void 0 ? _b : false;
@@ -60804,7 +61030,7 @@ var StyleUtils;
60804
61030
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
60805
61031
  })(StyleUtils || (StyleUtils = {}));
60806
61032
 
60807
- const VERSION = "7.8.3";
61033
+ const VERSION = "7.8.4";
60808
61034
  /**
60809
61035
  * Updates the environment instance used by bruce-cesium to one specified.
60810
61036
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.