bruce-cesium 7.1.7 → 7.1.9

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, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, Cartesian2, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, JulianDate, Quaternion, ArcType, CornerType, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, Intersect, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, ClockRange, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Carto, Geometry as Geometry$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, ProjectViewBookmarkGroup, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, Cartesian2, JulianDate, Quaternion, HeadingPitchRoll, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, DistanceDisplayCondition, ArcType, CornerType, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CustomDataSource, CesiumInspector, ClockRange, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry as Geometry$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Api, BruceEvent, EntityCoords, Bounds, Color as Color$1, DataLab, DelayQueue, EntityHistoricData, BruceApi, EntityRelation, AccountConcept, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -2976,6 +2976,8 @@ const CESIUM_TIMELINE_INTERVAL_KEY = "_nextspace_timeline_interval";
2976
2976
  const CESIUM_MODEL_SPACE_KEY = "_nextspace_model_space";
2977
2977
  const DEFAULT_LIVE_PADDING_SECONDS = 30 * 60;
2978
2978
  const DEFAULT_BRIGHTNESS_SHIFT = 0.2;
2979
+ const DEFAULT_LIGHT_INTENSITY = 3;
2980
+ const LIGHTING_SETTINGS_VERSION = 2;
2979
2981
  var ViewUtils;
2980
2982
  (function (ViewUtils) {
2981
2983
  function GatherLegacyMapTiles(params) {
@@ -3327,23 +3329,50 @@ var ViewUtils;
3327
3329
  */
3328
3330
  function ApplyDefaultBrightness(viewer, shift = DEFAULT_BRIGHTNESS_SHIFT) {
3329
3331
  const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
3330
- if (!scene || !(shift > 0)) {
3332
+ if (!scene) {
3331
3333
  return;
3332
3334
  }
3333
3335
  // Atmosphere settings moved from Globe onto Scene, and the sky keeps its own copy, so each is
3334
3336
  // probed rather than version checked: host apps bring their own CesiumJS.
3335
3337
  const SCENE = scene;
3336
- if (SCENE.atmosphere && typeof SCENE.atmosphere.brightnessShift === "number") {
3337
- SCENE.atmosphere.brightnessShift = shift;
3338
- }
3339
- if (SCENE.globe && typeof SCENE.globe.atmosphereBrightnessShift === "number") {
3340
- SCENE.globe.atmosphereBrightnessShift = shift;
3341
- }
3342
- if (SCENE.skyAtmosphere && typeof SCENE.skyAtmosphere.brightnessShift === "number") {
3343
- SCENE.skyAtmosphere.brightnessShift = shift;
3338
+ if (shift > 0) {
3339
+ if (SCENE.atmosphere && typeof SCENE.atmosphere.brightnessShift === "number") {
3340
+ SCENE.atmosphere.brightnessShift = shift;
3341
+ }
3342
+ if (SCENE.globe && typeof SCENE.globe.atmosphereBrightnessShift === "number") {
3343
+ SCENE.globe.atmosphereBrightnessShift = shift;
3344
+ }
3345
+ if (SCENE.skyAtmosphere && typeof SCENE.skyAtmosphere.brightnessShift === "number") {
3346
+ SCENE.skyAtmosphere.brightnessShift = shift;
3347
+ }
3344
3348
  }
3345
3349
  }
3346
3350
  ViewUtils.ApplyDefaultBrightness = ApplyDefaultBrightness;
3351
+ /**
3352
+ * Resolves the sun colour and intensity to apply for a bookmark's lighting settings.
3353
+ * @param lighting the bookmark's lighting settings, or null when it carries none.
3354
+ * @returns the colour and intensity to put on the scene light.
3355
+ */
3356
+ function ResolveLightSettings(lighting) {
3357
+ const raw = lighting === null || lighting === void 0 ? void 0 : lighting.color;
3358
+ // An unreadable or missing colour would otherwise leave the light undefined.
3359
+ const parsed = raw ? Color.fromCssColorString(raw) : null;
3360
+ const version = Number(lighting === null || lighting === void 0 ? void 0 : lighting.lightingVer);
3361
+ const stale = !Number.isFinite(version) || version <= 1;
3362
+ const intensity = Number(lighting === null || lighting === void 0 ? void 0 : lighting.intensity);
3363
+ return {
3364
+ color: parsed || Color.WHITE,
3365
+ intensity: stale || !Number.isFinite(intensity) ? DEFAULT_LIGHT_INTENSITY : intensity
3366
+ };
3367
+ }
3368
+ ViewUtils.ResolveLightSettings = ResolveLightSettings;
3369
+ /**
3370
+ * Options handed to every tileset and model this library creates.
3371
+ */
3372
+ function DefaultEnvironmentMapOptions() {
3373
+ return { enabled: false };
3374
+ }
3375
+ ViewUtils.DefaultEnvironmentMapOptions = DefaultEnvironmentMapOptions;
3347
3376
  function SetGlobeDetails(params) {
3348
3377
  let { viewer, hidden, baseColor } = params;
3349
3378
  const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
@@ -14702,6 +14731,7 @@ async function createTileset(url, props, noMemoryLimit) {
14702
14731
  const defaultProps = {
14703
14732
  // "Optimization option. Reduce the screen space error for tiles that are further away from the camera.".
14704
14733
  dynamicScreenSpaceError: true,
14734
+ environmentMapOptions: ViewUtils.DefaultEnvironmentMapOptions()
14705
14735
  };
14706
14736
  if (noMemoryLimit != true) {
14707
14737
  // "The maximum amount of memory in MB that can be used by the tileset.".
@@ -21438,7 +21468,8 @@ var TilesetGooglePhotosRenderManager;
21438
21468
  return;
21439
21469
  }
21440
21470
  this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
21441
- showCreditsOnScreen: true
21471
+ showCreditsOnScreen: true,
21472
+ environmentMapOptions: ViewUtils.DefaultEnvironmentMapOptions()
21442
21473
  });
21443
21474
  }
21444
21475
  else {
@@ -22982,6 +23013,7 @@ var AssemblyRenderManager;
22982
23013
  const cEntity = this.viewer.entities.add({
22983
23014
  model: {
22984
23015
  uri: lod["ClientFile"].URL,
23016
+ environmentMapOptions: ViewUtils.DefaultEnvironmentMapOptions(),
22985
23017
  heightReference: HeightReference.NONE
22986
23018
  },
22987
23019
  // point: {
@@ -29059,13 +29091,15 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
29059
29091
  if (lighting == null) {
29060
29092
  lighting = {
29061
29093
  color: Color.WHITE.toCssColorString(),
29062
- intensity: 2
29094
+ intensity: DEFAULT_LIGHT_INTENSITY,
29095
+ lightingVer: LIGHTING_SETTINGS_VERSION
29063
29096
  };
29064
29097
  }
29065
29098
  const light = viewer.scene.light;
29066
29099
  if (light) {
29067
- light.color = Color.fromCssColorString(lighting.color);
29068
- light.intensity = EnsureNumber(lighting.intensity);
29100
+ const resolved = ViewUtils.ResolveLightSettings(lighting);
29101
+ light.color = resolved.color;
29102
+ light.intensity = resolved.intensity;
29069
29103
  }
29070
29104
  ViewUtils.ApplyDefaultBrightness(viewer, EnsureNumber(lighting.brightnessShift, DEFAULT_BRIGHTNESS_SHIFT));
29071
29105
  let quality = bSettings === null || bSettings === void 0 ? void 0 : bSettings.quality;
@@ -38734,6 +38768,7 @@ var EntityRenderEngineModel3d;
38734
38768
  id: ObjectUtils.UId(15),
38735
38769
  model: {
38736
38770
  uri: params.lodUrl,
38771
+ environmentMapOptions: ViewUtils.DefaultEnvironmentMapOptions(),
38737
38772
  heightReference: heightRef,
38738
38773
  scale: new CallbackProperty(() => scale * styleScale, true),
38739
38774
  shadows: ShadowMode.ENABLED,
@@ -39375,7 +39410,8 @@ async function getModelEntity(url, scale) {
39375
39410
  return await CESIUM.Model.fromGltfAsync({
39376
39411
  url: url,
39377
39412
  asynchronous: true,
39378
- scale: scale
39413
+ scale: scale,
39414
+ environmentMapOptions: ViewUtils.DefaultEnvironmentMapOptions()
39379
39415
  });
39380
39416
  }
39381
39417
  // Older versions of Cesium have a fromGltf method.
@@ -43537,7 +43573,7 @@ var StyleUtils;
43537
43573
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
43538
43574
  })(StyleUtils || (StyleUtils = {}));
43539
43575
 
43540
- const VERSION = "7.1.7";
43576
+ const VERSION = "7.1.9";
43541
43577
  /**
43542
43578
  * Updates the environment instance used by bruce-cesium to one specified.
43543
43579
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -43554,5 +43590,5 @@ const getENVIRONMENT = () => {
43554
43590
  return ENVIRONMENT;
43555
43591
  };
43556
43592
 
43557
- export { VERSION, setENVIRONMENT, getENVIRONMENT, CesiumAnimatedInOut, DisplacedSurfacePrimitive, CesiumAnimatedProperty, isStyleChanged, isOutlineChanged$1 as isOutlineChanged, StyleEffective, EntityRenderEngine, EntityRenderEngineModel3d, EntityRenderEnginePoint, EntityRenderEnginePolygon, EntityRenderEnginePolyline, MenuItemCreator, MenuItemManager, CesiumParabola, EntityLabel, LiveCursor, SharedGetters, DataSourceStaticKmlManager, DataLabRenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, AssemblyRenderManager, GoogleSearchRenderManager, RelationsRenderManager, RenderManager, TilesetArbRenderManager, TilesetCadRenderManager, TilesetEntitiesRenderManager, TilesetGooglePhotosRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TileRenderEngine, createTileset, TilesetRenderEngine, ViewRenderEngine, VisualRegisterCuller, VisualsRegister, XGridsRenderEngine, CesiumEntityStyler, DrawingUtils, EntityUtils, MeasureUtils, StyleUtils, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, DEFAULT_BRIGHTNESS_SHIFT, ViewUtils, CesiumViewMonitor, ViewGroundArea, ViewerEventTracker, ViewerUtils, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, WidgetControlViewBar, WidgetControlViewBarSearch, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks, WidgetLeftPanelTabDashboard, EMenuItemState, WidgetLeftPanelTabMenuItems, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar };
43593
+ export { VERSION, setENVIRONMENT, getENVIRONMENT, CesiumAnimatedInOut, DisplacedSurfacePrimitive, CesiumAnimatedProperty, isStyleChanged, isOutlineChanged$1 as isOutlineChanged, StyleEffective, EntityRenderEngine, EntityRenderEngineModel3d, EntityRenderEnginePoint, EntityRenderEnginePolygon, EntityRenderEnginePolyline, MenuItemCreator, MenuItemManager, CesiumParabola, EntityLabel, LiveCursor, SharedGetters, DataSourceStaticKmlManager, DataLabRenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, AssemblyRenderManager, GoogleSearchRenderManager, RelationsRenderManager, RenderManager, TilesetArbRenderManager, TilesetCadRenderManager, TilesetEntitiesRenderManager, TilesetGooglePhotosRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TileRenderEngine, createTileset, TilesetRenderEngine, ViewRenderEngine, VisualRegisterCuller, VisualsRegister, XGridsRenderEngine, CesiumEntityStyler, DrawingUtils, EntityUtils, MeasureUtils, StyleUtils, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, DEFAULT_BRIGHTNESS_SHIFT, DEFAULT_LIGHT_INTENSITY, LIGHTING_SETTINGS_VERSION, ViewUtils, CesiumViewMonitor, ViewGroundArea, ViewerEventTracker, ViewerUtils, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, WidgetControlViewBar, WidgetControlViewBarSearch, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks, WidgetLeftPanelTabDashboard, EMenuItemState, WidgetLeftPanelTabMenuItems, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar };
43558
43594
  //# sourceMappingURL=bruce-cesium.es5.js.map