bruce-cesium 6.9.8 → 7.0.0

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, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, JulianDate, Quaternion, Matrix4, ArcType, CornerType, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, 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, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Carto, Geometry, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, Color as Color$1, BruceEvent, EntityCoords, DelayQueue, EntityHistoricData, DataLab, BruceApi, EntityRelation, AccountConcept, RecordChangeFeed, ProgramKey, ProjectViewLegacyTile, ProjectViewTile, EntitySource, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, Cartesian3, ClassificationType, ConstantPositionProperty, Math as Math$1, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, SceneTransforms, NearFarScalar, Cartesian2, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Ion, IonResource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileset, OrthographicFrustum, EasingFunction, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Carto, Geometry, EntityLod, Bounds, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, BruceApi, EntityRelation, ProgramKey, AccountConcept, RecordChangeFeed, EntitySource, Camera, ProjectViewTile, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -36896,7 +36896,8 @@ var TextureFrameSeriesAnimator;
36896
36896
  if (this.disposed) {
36897
36897
  return;
36898
36898
  }
36899
- this.swapToFrame(this.findFrameIndex(currentTime));
36899
+ const idx = this.findFrameIndex(currentTime);
36900
+ this.swapToFrame(idx);
36900
36901
  }
36901
36902
  // Binary-search the frame whose timestamp is <= currentTime.
36902
36903
  findFrameIndex(currentTime) {
@@ -37108,7 +37109,9 @@ var EntityRenderEnginePolygon;
37108
37109
  textureTraceEffective = resolved.effective;
37109
37110
  frameArchive = resolved.frameArchive || null;
37110
37111
  }
37111
- const hasFill = fillType === Style.EPolygonFillType.Texture ? Boolean(textureDataUri || frameArchive) : cFillColor.alpha > 0;
37112
+ const hasFill = fillType === Style.EPolygonFillType.Texture
37113
+ ? Boolean(textureDataUri || frameArchive || cFillColor.alpha > 0)
37114
+ : cFillColor.alpha > 0;
37112
37115
  const fillMaterial = textureDataUri
37113
37116
  ? new ImageMaterialProperty({ image: textureDataUri, transparent: true })
37114
37117
  : frameArchive
@@ -37513,6 +37516,17 @@ var EntityRenderEnginePolygon;
37513
37516
  return cEntities;
37514
37517
  }
37515
37518
  EntityRenderEnginePolygon.RenderGroup = RenderGroup;
37519
+ /**
37520
+ * Disposes a cEntity's TextureFrameSeriesAnimator.Animator (if any).
37521
+ */
37522
+ function DisposeTextureFrameSeriesAnimator(cEntity) {
37523
+ const existing = cEntity === null || cEntity === void 0 ? void 0 : cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY];
37524
+ if (existing && !existing.IsDisposed()) {
37525
+ existing.Dispose();
37526
+ cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY] = null;
37527
+ }
37528
+ }
37529
+ EntityRenderEnginePolygon.DisposeTextureFrameSeriesAnimator = DisposeTextureFrameSeriesAnimator;
37516
37530
  })(EntityRenderEnginePolygon || (EntityRenderEnginePolygon = {}));
37517
37531
  async function getName$3(api, entity) {
37518
37532
  try {
@@ -37703,7 +37717,11 @@ function extractClientFileIdFromTextureValue(raw) {
37703
37717
  */
37704
37718
  async function resolveTexturedFill(params) {
37705
37719
  const { api, style, entity, tags } = params;
37706
- let textureRows = style.texture == null ? [] : style.texture;
37720
+ const textureValue = style.texture;
37721
+ if (textureValue && !Array.isArray(textureValue)) {
37722
+ return resolveTextureCondition({ api, condition: textureValue });
37723
+ }
37724
+ let textureRows = Array.isArray(textureValue) ? textureValue : [];
37707
37725
  textureRows.forEach((row) => {
37708
37726
  if (row.type == Calculator.EValueType.Color) {
37709
37727
  row.type = Calculator.EValueType.Input;
@@ -37740,6 +37758,31 @@ async function resolveTexturedFill(params) {
37740
37758
  }
37741
37759
  return { dataUri: await prom, effective: textureTrace.effective };
37742
37760
  }
37761
+ async function resolveTextureCondition(params) {
37762
+ const { api, condition } = params;
37763
+ const entityTypeSourceId = condition === null || condition === void 0 ? void 0 : condition["EntityType.Source.ID"];
37764
+ const attribute = condition === null || condition === void 0 ? void 0 : condition.Attribute;
37765
+ if (!api || !entityTypeSourceId || !attribute) {
37766
+ return { dataUri: null, effective: null };
37767
+ }
37768
+ await api.Loading;
37769
+ const clientFile = await ClientFile.FindGeneratedTexture({ api, entityTypeSourceId, attribute });
37770
+ if (!clientFile) {
37771
+ return { dataUri: null, effective: null };
37772
+ }
37773
+ const url = clientFile.URL;
37774
+ const clientFileData = clientFile.Data;
37775
+ if (TextureFrameSeriesAnimator.IsFrameArchiveMetadata(clientFileData)) {
37776
+ return { dataUri: null, effective: null, frameArchive: { url, metadata: clientFileData.generation } };
37777
+ }
37778
+ const cacheKey = "texture-" + url + "-none";
37779
+ let prom = _textureCache.Get(cacheKey);
37780
+ if (!prom) {
37781
+ prom = buildTintedTextureDataUri(url).catch(() => null);
37782
+ _textureCache.Set(cacheKey, prom);
37783
+ }
37784
+ return { dataUri: await prom, effective: null };
37785
+ }
37743
37786
  /**
37744
37787
  * Fetches an image and, if a color mask is provided, remaps its (assumed grayscale) pixel values
37745
37788
  * into a gradient between the mask's minColor/maxColor, preserving source alpha.
@@ -38397,6 +38440,7 @@ var EntityRenderEngine;
38397
38440
  entity._dispose();
38398
38441
  entity._dispose = null;
38399
38442
  }
38443
+ EntityRenderEnginePolygon.DisposeTextureFrameSeriesAnimator(entity);
38400
38444
  if (entity._parentEntity && !ignoreParent) {
38401
38445
  doRemove({
38402
38446
  viewer,
@@ -39081,7 +39125,7 @@ var StyleUtils;
39081
39125
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
39082
39126
  })(StyleUtils || (StyleUtils = {}));
39083
39127
 
39084
- const VERSION = "6.9.8";
39128
+ const VERSION = "7.0.0";
39085
39129
  /**
39086
39130
  * Updates the environment instance used by bruce-cesium to one specified.
39087
39131
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.