bruce-cesium 7.5.0 → 7.5.2

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, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ClassificationType, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, SceneMode, SceneTransforms, KmlDataSource, NearFarScalar, Matrix3, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CustomDataSource, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, Carto, Entity as Entity$1, EntityTag, EntityType, Geometry as Geometry$1, ObjectUtils, Style, ClientFile, EntityLod, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, Cartesian3, ClassificationType, Math as Math$1, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, ImageMaterialProperty, Ellipsoid, Cartesian2, SceneTransforms, ShaderSource, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, SceneMode, NearFarScalar, KmlDataSource, Matrix3, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, defined, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Api, Calculator, ClientFile, Entity as Entity$1, EntityTag, EntityType, ObjectUtils, Style, Carto, Geometry as Geometry$1, EntityLod, ClientFileValueMap, Color as Color$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, BruceEvent, EntityCoords, DataLab, DelayQueue, BruceApi, EntityRelation, AccountConcept, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -29069,7 +29069,7 @@ class WidgetLeftPanelTabBookmarks extends WidgetLeftPanelTab.ATab {
29069
29069
  // In case another widget messed with the panel width.
29070
29070
  // Probably should just add a SetWidth method to avoid having plugins mess with the container CSS.
29071
29071
  if (this.Container) {
29072
- this.Container.style.width = "300px";
29072
+ this.Container.style.width = "260px";
29073
29073
  }
29074
29074
  }
29075
29075
  Dispose() {
@@ -29635,7 +29635,7 @@ class WidgetLeftPanelTabUser extends WidgetLeftPanelTab.ATab {
29635
29635
  // In case another widget messed with the panel width.
29636
29636
  // Probably should just add a SetWidth method to avoid having plugins mess with the container CSS.
29637
29637
  if (this.Container) {
29638
- this.Container.style.width = "300px";
29638
+ this.Container.style.width = "390px";
29639
29639
  }
29640
29640
  this.loadUser();
29641
29641
  this.paramsChangeRemoval = ENVIRONMENT.OnParamsChange.Subscribe(() => {
@@ -48212,12 +48212,33 @@ void main() {
48212
48212
  }
48213
48213
  })(DisplacedSurfacePrimitive || (DisplacedSurfacePrimitive = {}));
48214
48214
 
48215
+ // Vertex heights within this many metres of zero count as no height at all.
48216
+ const FLAT_HEIGHT_EPSILON = 1e-3;
48215
48217
  const TEXTURE_FRAME_SERIES_ANIMATOR_KEY = "TextureFrameSeriesAnimator.Animator";
48216
48218
  const EXTRUSION_ANIMATOR_KEY = "TextureFrameSeriesAnimator.ExtrusionAnimator";
48217
48219
  const TEXTURE_VALUE_LABELS_KEY = "TextureValueLabels.Overlay";
48218
48220
  const DISPLACED_SURFACE_KEY = "DisplacedSurfacePrimitive.Surface";
48219
48221
  var EntityRenderEnginePolygon;
48220
48222
  (function (EntityRenderEnginePolygon) {
48223
+ /**
48224
+ * The height reference a polygon is actually drawn with.
48225
+ * @param params
48226
+ */
48227
+ function FlatHeightRef(params) {
48228
+ const { heightRef, extruded, textured, altitudes } = params;
48229
+ if (extruded || heightRef === HeightReference.CLAMP_TO_GROUND) {
48230
+ return heightRef;
48231
+ }
48232
+ const hasHeights = altitudes.some((altitude) => Math.abs(EnsureNumber(altitude)) > FLAT_HEIGHT_EPSILON);
48233
+ if (hasHeights) {
48234
+ return heightRef;
48235
+ }
48236
+ if (heightRef === HeightReference.RELATIVE_TO_GROUND || textured) {
48237
+ return HeightReference.CLAMP_TO_GROUND;
48238
+ }
48239
+ return heightRef;
48240
+ }
48241
+ EntityRenderEnginePolygon.FlatHeightRef = FlatHeightRef;
48221
48242
  async function Render(params) {
48222
48243
  var _a, _b, _c, _d, _e;
48223
48244
  const entity = params.entity;
@@ -48318,6 +48339,14 @@ var EntityRenderEnginePolygon;
48318
48339
  ? { posses, value: undefined, exHeightRef: HeightReference.NONE }
48319
48340
  : getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
48320
48341
  posses = extrusion.posses;
48342
+ heightRef = FlatHeightRef({
48343
+ heightRef,
48344
+ extruded: drawsDisplacedSurface || extrusion.value != undefined,
48345
+ textured: fillType === Style.EPolygonFillType.Texture,
48346
+ altitudes: pRings.flatMap((ring) => (ring === null || ring === void 0 ? void 0 : ring.LinearRing)
48347
+ ? Geometry$1.ParsePoints(ring.LinearRing).map((point) => point.altitude)
48348
+ : [])
48349
+ });
48321
48350
  posses = CullDuplicateCPosses(posses);
48322
48351
  if (posses.length < 4) {
48323
48352
  return null;
@@ -48357,6 +48386,14 @@ var EntityRenderEnginePolygon;
48357
48386
  }
48358
48387
  };
48359
48388
  const hasOutline = width > 0 && cLineColor;
48389
+ // Cesium draws nothing for a ground polygon with an image material once it carries a distance display condition.
48390
+ const drapesImage = (!drawsDisplacedSurface &&
48391
+ heightRef === HeightReference.CLAMP_TO_GROUND &&
48392
+ extrusion.value == undefined &&
48393
+ (fillMaterial instanceof ImageMaterialProperty || Boolean(frameArchive || keepsAnimator)));
48394
+ const polygonDisplayCondition = drapesImage
48395
+ ? undefined
48396
+ : EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size);
48360
48397
  let cEntity = null;
48361
48398
  const isExistingGraphic = Boolean(params.rendered && params.rendered.polygon);
48362
48399
  if (!isExistingGraphic) {
@@ -48373,7 +48410,7 @@ var EntityRenderEnginePolygon;
48373
48410
  classificationType: classification,
48374
48411
  perPositionHeight: heightRef == HeightReference.CLAMP_TO_GROUND ? false : true,
48375
48412
  zIndex: zIndex,
48376
- distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
48413
+ distanceDisplayCondition: polygonDisplayCondition
48377
48414
  },
48378
48415
  position: EntityUtils.GetPos({
48379
48416
  viewer: params.viewer,
@@ -48433,12 +48470,17 @@ var EntityRenderEnginePolygon;
48433
48470
  if (oldZIndex != zIndex) {
48434
48471
  cEntity.polygon.zIndex = new ConstantProperty(zIndex);
48435
48472
  }
48436
- SetCPropIfChanged({
48437
- viewer: params.viewer,
48438
- graphic: cEntity.polygon,
48439
- property: "distanceDisplayCondition",
48440
- value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
48441
- });
48473
+ if (polygonDisplayCondition) {
48474
+ SetCPropIfChanged({
48475
+ viewer: params.viewer,
48476
+ graphic: cEntity.polygon,
48477
+ property: "distanceDisplayCondition",
48478
+ value: polygonDisplayCondition
48479
+ });
48480
+ }
48481
+ else if (cEntity.polygon.distanceDisplayCondition) {
48482
+ cEntity.polygon.distanceDisplayCondition = undefined;
48483
+ }
48442
48484
  SetCPropIfChanged({
48443
48485
  viewer: params.viewer,
48444
48486
  graphic: cEntity.polygon,
@@ -51014,7 +51056,7 @@ var StyleUtils;
51014
51056
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
51015
51057
  })(StyleUtils || (StyleUtils = {}));
51016
51058
 
51017
- const VERSION = "7.5.0";
51059
+ const VERSION = "7.5.2";
51018
51060
  /**
51019
51061
  * Updates the environment instance used by bruce-cesium to one specified.
51020
51062
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.