bruce-cesium 7.8.4 → 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, 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';
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
  }
@@ -30177,7 +30216,7 @@ var XGridsRenderEngine;
30177
30216
  * Loads a scan with optional SDK tuning and per-viewer budget control.
30178
30217
  */
30179
30218
  function Render(params) {
30180
- var _a, _b, _c, _d;
30219
+ var _a, _b, _c;
30181
30220
  const { api, viewer, tileset } = params;
30182
30221
  if (typeof LCCRender === "undefined" || typeof (LCCRender === null || LCCRender === void 0 ? void 0 : LCCRender.load) !== "function") {
30183
30222
  console.warn("[XGridsRenderEngine] Render() LCCRender library not available.");
@@ -30308,8 +30347,7 @@ var XGridsRenderEngine;
30308
30347
  return null;
30309
30348
  }
30310
30349
  try {
30311
- const sdkBudget = typeof obj.getCurrentConfig === "function" ? (_d = obj.getCurrentConfig()) === null || _d === void 0 ? void 0 : _d.maxLoadSplatCount : undefined;
30312
- maxSplats = GetSplatBudget(sdkBudget, profile);
30350
+ maxSplats = GetSplatBudget(profile);
30313
30351
  if (LCCRender.nextspaceMetadataReady === 1 &&
30314
30352
  typeof obj.setNextspaceMetadataCallback === "function" &&
30315
30353
  typeof obj.setMaxSplats === "function") {
@@ -30351,16 +30389,16 @@ var XGridsRenderEngine;
30351
30389
  }
30352
30390
  XGridsRenderEngine.Render = Render;
30353
30391
  /*
30354
- * The most splats a scan may load: the tier's, lowered by the SDK's GPU limit unless overridden.
30392
+ * The most splats a scan may load: the tier's, capped by what the SDK's splat texture can hold.
30355
30393
  */
30356
- function GetSplatBudget(sdkBudget, profile) {
30394
+ function GetSplatBudget(profile) {
30395
+ var _a;
30357
30396
  const budget = DeviceProfile.GetBudget(profile.tier).splats;
30358
- // Above 2M the SDK is reporting its flat default, not a limit it chose for this GPU.
30359
- if (!profile.overridden &&
30360
- Number.isFinite(sdkBudget) &&
30361
- sdkBudget > 0 &&
30362
- sdkBudget <= 2000000) {
30363
- return Math.min(sdkBudget, budget);
30397
+ // The SDK's GPU guess misreads many GPU names and skips Firefox; only its texture cap is real.
30398
+ const size = (_a = profile.environment) === null || _a === void 0 ? void 0 : _a.maxTextureSize;
30399
+ if (Number.isFinite(size) &&
30400
+ size > 0) {
30401
+ return Math.min(budget, size * size / 4);
30364
30402
  }
30365
30403
  return budget;
30366
30404
  }
@@ -61030,7 +61068,7 @@ var StyleUtils;
61030
61068
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
61031
61069
  })(StyleUtils || (StyleUtils = {}));
61032
61070
 
61033
- const VERSION = "7.8.4";
61071
+ const VERSION = "7.8.6";
61034
61072
  /**
61035
61073
  * Updates the environment instance used by bruce-cesium to one specified.
61036
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.