bruce-cesium 7.8.5 → 7.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as Cesium from 'cesium';
2
- import { Cartographic, 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, ColorMaterialProperty, Color, JulianDate, Quaternion, HeadingPitchRoll, HeightReference, ColorBlendMode, Entity, CallbackProperty, ConstantProperty, Model, ClassificationType, ConstantPositionProperty, DistanceDisplayCondition, ArcType, CornerType, Primitive, Cesium3DTileFeature, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, HorizontalOrigin, VerticalOrigin, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, FeatureDetection, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Intersect, WebGLConstants, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, ShadowMode, DynamicEnvironmentMapManager, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, CustomDataSource, GeometryInstance, 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, EntityLod, UrlUtils, Geometry as Geometry$1, Bounds, ClientFileValueMap, Color as Color$1, ProjectView, ProjectViewBookmark, ZoomControl, Api, Assembly, EntityCoords, EntityRelation, BruceApi, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttribute, MathUtils } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Cartesian3, Model, ClassificationType, Matrix4, 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, JulianDate, Quaternion, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Rectangle, DistanceDisplayCondition, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, FeatureDetection, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, Intersect, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, WebGLConstants, OrthographicFrustum, EasingFunction, ShadowMode, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, GeometryInstance, Event, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, 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, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, 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.
@@ -11192,6 +11192,35 @@ var EntityLabel;
11192
11192
 
11193
11193
  var EntityLabelGroup;
11194
11194
  (function (EntityLabelGroup) {
11195
+ // Prefixes that make an icon value name its kind, so one mapping can send Entities to icons of different kinds.
11196
+ EntityLabelGroup.ICON_PREFIX = {
11197
+ // A Font Awesome class, "FA:fas fa-cube".
11198
+ FontAwesome: "FA:",
11199
+ // A client file by id, or an image by URL, "CF:<file id or URL>".
11200
+ ClientFile: "CF:"
11201
+ };
11202
+ /*
11203
+ * The icon a prefixed value names, as a class or an image URL, or null for a value with no known prefix.
11204
+ */
11205
+ function ParseIcon(value, api) {
11206
+ if (typeof value !== "string") {
11207
+ return null;
11208
+ }
11209
+ const named = value.trim();
11210
+ if (named.startsWith(EntityLabelGroup.ICON_PREFIX.FontAwesome)) {
11211
+ const iconClass = named.slice(EntityLabelGroup.ICON_PREFIX.FontAwesome.length).trim();
11212
+ return iconClass ? { iconClass } : null;
11213
+ }
11214
+ if (named.startsWith(EntityLabelGroup.ICON_PREFIX.ClientFile)) {
11215
+ const file = named.slice(EntityLabelGroup.ICON_PREFIX.ClientFile.length).trim();
11216
+ if (!file) {
11217
+ return null;
11218
+ }
11219
+ return { iconUrl: /^[a-z][a-z0-9+.-]*:/i.test(file) ? file : ClientFile.GetUrl({ api, fileId: file, viaCdn: true }) };
11220
+ }
11221
+ return null;
11222
+ }
11223
+ EntityLabelGroup.ParseIcon = ParseIcon;
11195
11224
  // The glow a selected place is drawn with.
11196
11225
  const PLACE_SELECTED_COLOR = "#33B1FF";
11197
11226
  // Keys places share the entity bookkeeping under, scoped to their group so a copied group keeps its own.
@@ -11667,7 +11696,7 @@ var EntityLabelGroup;
11667
11696
  * One member's label settings, with any image its own text links to but before its default image.
11668
11697
  */
11669
11698
  compose(group, entityId, menuItemId) {
11670
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
11699
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
11671
11700
  const item = group.items.get(entityId);
11672
11701
  const entity = (_a = item.entity) !== null && _a !== void 0 ? _a : { Bruce: { ID: entityId, Name: item.text } };
11673
11702
  let iconPriority = (_b = group.definition.options) === null || _b === void 0 ? void 0 : _b.iconPriority;
@@ -11718,6 +11747,13 @@ var EntityLabelGroup;
11718
11747
  iconPriority: Number.isFinite(iconPriority) ? iconPriority : item.iconPriority,
11719
11748
  iconStatus: (_p = resolveIcon((_o = group.definition.options) === null || _o === void 0 ? void 0 : _o.iconStatus, entity)) !== null && _p !== void 0 ? _p : item.iconStatus
11720
11749
  };
11750
+ // A prefixed icon names its kind and replaces the group's others; an unprefixed one stays the glyph it was.
11751
+ const named = ParseIcon(options.icon, (_q = this.register.ApiGetters) === null || _q === void 0 ? void 0 : _q.GetBruceApi());
11752
+ if (named) {
11753
+ options.icon = undefined;
11754
+ options.iconClass = named.iconClass;
11755
+ options.iconUrl = named.iconUrl;
11756
+ }
11721
11757
  if (item.placeId) {
11722
11758
  // Clickable only when the app asks, and reported then, as there is no Entity to select.
11723
11759
  options.selectOnClick = this.placesInteractive;
@@ -11728,16 +11764,19 @@ var EntityLabelGroup;
11728
11764
  options.iconUrl = look.iconUrl || undefined;
11729
11765
  options.iconClass = look.iconUrl ? undefined : look.iconClass;
11730
11766
  }
11731
- if (look === null || look === void 0 ? void 0 : look.iconColor) {
11732
- options.iconColor = look.iconColor;
11767
+ if ((look === null || look === void 0 ? void 0 : look.iconColor) != null) {
11768
+ options.iconColor = look.iconColor || undefined;
11733
11769
  }
11734
11770
  if ((look === null || look === void 0 ? void 0 : look.iconBackground) != null) {
11735
11771
  options.iconBackground = look.iconBackground;
11736
11772
  }
11773
+ if ((look === null || look === void 0 ? void 0 : look.iconScale) > 0) {
11774
+ options.iconScale = look.iconScale;
11775
+ }
11737
11776
  }
11738
11777
  if (options.attributes && item.entity && !(expression && resolvedText != null)) {
11739
11778
  options.text = [
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,
11779
+ (_t = (_r = options.text) !== null && _r !== void 0 ? _r : (_s = item.entity.Bruce) === null || _s === void 0 ? void 0 : _s.Name) !== null && _t !== void 0 ? _t : entityId,
11741
11780
  ...options.attributes.map(path => Entity$1.GetValue({ entity: item.entity, path })).filter(value => value != null).map(String)
11742
11781
  ].join("\n");
11743
11782
  }
@@ -61029,7 +61068,7 @@ var StyleUtils;
61029
61068
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
61030
61069
  })(StyleUtils || (StyleUtils = {}));
61031
61070
 
61032
- const VERSION = "7.8.5";
61071
+ const VERSION = "7.8.6";
61033
61072
  /**
61034
61073
  * Updates the environment instance used by bruce-cesium to one specified.
61035
61074
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.