bruce-cesium 7.2.8 → 7.2.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, JulianDate, Quaternion, HeadingPitchRoll, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, ClassificationType, ConstantPositionProperty, ColorBlendMode, ShadowMode, Model, 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, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CustomDataSource, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ProjectViewTile, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, EntityLod, Carto, Geometry as Geometry$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, BruceApi, EntityRelation, EntitySource, AccountConcept, RecordChangeFeed, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, 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, ArcType, CornerType, ConstantPositionProperty, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, HorizontalOrigin, VerticalOrigin, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Ion, IonResource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, CustomDataSource, GeometryInstance, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, 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, Bounds, ClientFileValueMap, Color as Color$1, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DelayQueue, DataLab, EntityRelation, BruceApi, AccountConcept, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, ProjectViewBookmarkGroup, EntityRelationType, EntityHistoricData } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -42468,7 +42468,7 @@ var TextureValueLabels;
42468
42468
  var DisplacedSurfacePrimitive;
42469
42469
  (function (DisplacedSurfacePrimitive) {
42470
42470
  // Grid densities a tile can draw at, coarsest first.
42471
- const TIERS = [32, 64, 128, 192];
42471
+ const TIERS = [32, 64, 128, 192, 256, 384];
42472
42472
  // Tiles per side the extent is cut into.
42473
42473
  const TILES_PER_SIDE = 6;
42474
42474
  // Screen pixels one grid cell should cover. Lower means finer meshes sooner.
@@ -43116,6 +43116,7 @@ void main() {
43116
43116
  const camera = frameState.camera;
43117
43117
  const fovy = camera.frustum && camera.frustum.fovy ? camera.frustum.fovy : Math$1.PI_OVER_THREE;
43118
43118
  const pixelsPerRadian = frameState.context.drawingBufferHeight / fovy;
43119
+ const ceiling = this.tierCeiling();
43119
43120
  for (const tile of this.tiles) {
43120
43121
  if (!tile.centre) {
43121
43122
  tile.tier = TIERS[0];
@@ -43126,13 +43127,33 @@ void main() {
43126
43127
  const wanted = screenPixels / TARGET_CELL_PIXELS;
43127
43128
  let tier = TIERS[0];
43128
43129
  for (const candidate of TIERS) {
43129
- if (candidate <= wanted) {
43130
+ if (candidate <= wanted && candidate <= ceiling) {
43130
43131
  tier = candidate;
43131
43132
  }
43132
43133
  }
43133
43134
  tile.tier = tier;
43134
43135
  }
43135
43136
  }
43137
+ /*
43138
+ * The finest tier worth drawing for this surface, from the texture behind it.
43139
+ *
43140
+ * Subdividing past one vertex per texel spends vertices resolving detail the source does not
43141
+ * carry, so the ladder is capped one step above the texel count rather than run to its top.
43142
+ */
43143
+ tierCeiling() {
43144
+ const source = this.source;
43145
+ if (!source || !source.width || !source.height) {
43146
+ return TIERS[TIERS.length - 1];
43147
+ }
43148
+ const perSide = Math.sqrt(this.tiles.length) || TILES_PER_SIDE;
43149
+ const texelsPerTile = Math.max(source.width, source.height) / perSide;
43150
+ for (const candidate of TIERS) {
43151
+ if (candidate >= texelsPerTile) {
43152
+ return candidate;
43153
+ }
43154
+ }
43155
+ return TIERS[TIERS.length - 1];
43156
+ }
43136
43157
  shouldReselect(frameState, nowMs) {
43137
43158
  if (this.selectionDirty) {
43138
43159
  return true;
@@ -43145,9 +43166,23 @@ void main() {
43145
43166
  return true;
43146
43167
  }
43147
43168
  const moved = Cartesian3.distance(eye, this.lastEyePosition);
43148
- const anchor = this.tiles[0].centre;
43149
- const reference = anchor ? Math.max(1, Cartesian3.distance(eye, anchor)) : 1;
43150
- return moved / reference > MOVEMENT_THRESHOLD;
43169
+ return moved / this.nearestTileDistance(eye) > MOVEMENT_THRESHOLD;
43170
+ }
43171
+ /*
43172
+ * Distance to the closest tile, measured the way selectTiers measures each one.
43173
+ */
43174
+ nearestTileDistance(eye) {
43175
+ let nearest = Number.POSITIVE_INFINITY;
43176
+ for (const tile of this.tiles) {
43177
+ if (!tile.centre) {
43178
+ continue;
43179
+ }
43180
+ const distance = Cartesian3.distance(eye, tile.centre) - tile.radius;
43181
+ if (distance < nearest) {
43182
+ nearest = distance;
43183
+ }
43184
+ }
43185
+ return isFinite(nearest) ? Math.max(1, nearest) : 1;
43151
43186
  }
43152
43187
  commandFor(context, tile, mesh) {
43153
43188
  if (!this.shaderProgram) {
@@ -45879,7 +45914,7 @@ var StyleUtils;
45879
45914
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
45880
45915
  })(StyleUtils || (StyleUtils = {}));
45881
45916
 
45882
- const VERSION = "7.2.8";
45917
+ const VERSION = "7.2.9";
45883
45918
  /**
45884
45919
  * Updates the environment instance used by bruce-cesium to one specified.
45885
45920
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.