bruce-cesium 7.5.1 → 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.
@@ -48088,11 +48088,32 @@ void main() {
48088
48088
  }
48089
48089
  })(exports.DisplacedSurfacePrimitive || (exports.DisplacedSurfacePrimitive = {}));
48090
48090
 
48091
+ // Vertex heights within this many metres of zero count as no height at all.
48092
+ const FLAT_HEIGHT_EPSILON = 1e-3;
48091
48093
  const TEXTURE_FRAME_SERIES_ANIMATOR_KEY = "TextureFrameSeriesAnimator.Animator";
48092
48094
  const EXTRUSION_ANIMATOR_KEY = "TextureFrameSeriesAnimator.ExtrusionAnimator";
48093
48095
  const TEXTURE_VALUE_LABELS_KEY = "TextureValueLabels.Overlay";
48094
48096
  const DISPLACED_SURFACE_KEY = "DisplacedSurfacePrimitive.Surface";
48095
48097
  (function (EntityRenderEnginePolygon) {
48098
+ /**
48099
+ * The height reference a polygon is actually drawn with.
48100
+ * @param params
48101
+ */
48102
+ function FlatHeightRef(params) {
48103
+ const { heightRef, extruded, textured, altitudes } = params;
48104
+ if (extruded || heightRef === Cesium.HeightReference.CLAMP_TO_GROUND) {
48105
+ return heightRef;
48106
+ }
48107
+ const hasHeights = altitudes.some((altitude) => Math.abs(EnsureNumber(altitude)) > FLAT_HEIGHT_EPSILON);
48108
+ if (hasHeights) {
48109
+ return heightRef;
48110
+ }
48111
+ if (heightRef === Cesium.HeightReference.RELATIVE_TO_GROUND || textured) {
48112
+ return Cesium.HeightReference.CLAMP_TO_GROUND;
48113
+ }
48114
+ return heightRef;
48115
+ }
48116
+ EntityRenderEnginePolygon.FlatHeightRef = FlatHeightRef;
48096
48117
  async function Render(params) {
48097
48118
  var _a, _b, _c, _d, _e;
48098
48119
  const entity = params.entity;
@@ -48193,6 +48214,14 @@ void main() {
48193
48214
  ? { posses, value: undefined, exHeightRef: Cesium.HeightReference.NONE }
48194
48215
  : getPolygonExtrusion(entity, params.tags, outerRing, posses, heightRef, style);
48195
48216
  posses = extrusion.posses;
48217
+ heightRef = FlatHeightRef({
48218
+ heightRef,
48219
+ extruded: drawsDisplacedSurface || extrusion.value != undefined,
48220
+ textured: fillType === BModels.Style.EPolygonFillType.Texture,
48221
+ altitudes: pRings.flatMap((ring) => (ring === null || ring === void 0 ? void 0 : ring.LinearRing)
48222
+ ? BModels.Geometry.ParsePoints(ring.LinearRing).map((point) => point.altitude)
48223
+ : [])
48224
+ });
48196
48225
  posses = CullDuplicateCPosses(posses);
48197
48226
  if (posses.length < 4) {
48198
48227
  return null;
@@ -48232,6 +48261,14 @@ void main() {
48232
48261
  }
48233
48262
  };
48234
48263
  const hasOutline = width > 0 && cLineColor;
48264
+ // Cesium draws nothing for a ground polygon with an image material once it carries a distance display condition.
48265
+ const drapesImage = (!drawsDisplacedSurface &&
48266
+ heightRef === Cesium.HeightReference.CLAMP_TO_GROUND &&
48267
+ extrusion.value == undefined &&
48268
+ (fillMaterial instanceof Cesium.ImageMaterialProperty || Boolean(frameArchive || keepsAnimator)));
48269
+ const polygonDisplayCondition = drapesImage
48270
+ ? undefined
48271
+ : exports.EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size);
48235
48272
  let cEntity = null;
48236
48273
  const isExistingGraphic = Boolean(params.rendered && params.rendered.polygon);
48237
48274
  if (!isExistingGraphic) {
@@ -48248,7 +48285,7 @@ void main() {
48248
48285
  classificationType: classification,
48249
48286
  perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
48250
48287
  zIndex: zIndex,
48251
- distanceDisplayCondition: exports.EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
48288
+ distanceDisplayCondition: polygonDisplayCondition
48252
48289
  },
48253
48290
  position: exports.EntityUtils.GetPos({
48254
48291
  viewer: params.viewer,
@@ -48308,12 +48345,17 @@ void main() {
48308
48345
  if (oldZIndex != zIndex) {
48309
48346
  cEntity.polygon.zIndex = new Cesium.ConstantProperty(zIndex);
48310
48347
  }
48311
- SetCPropIfChanged({
48312
- viewer: params.viewer,
48313
- graphic: cEntity.polygon,
48314
- property: "distanceDisplayCondition",
48315
- value: exports.EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
48316
- });
48348
+ if (polygonDisplayCondition) {
48349
+ SetCPropIfChanged({
48350
+ viewer: params.viewer,
48351
+ graphic: cEntity.polygon,
48352
+ property: "distanceDisplayCondition",
48353
+ value: polygonDisplayCondition
48354
+ });
48355
+ }
48356
+ else if (cEntity.polygon.distanceDisplayCondition) {
48357
+ cEntity.polygon.distanceDisplayCondition = undefined;
48358
+ }
48317
48359
  SetCPropIfChanged({
48318
48360
  viewer: params.viewer,
48319
48361
  graphic: cEntity.polygon,
@@ -50874,7 +50916,7 @@ void main() {
50874
50916
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
50875
50917
  })(exports.StyleUtils || (exports.StyleUtils = {}));
50876
50918
 
50877
- const VERSION = "7.5.1";
50919
+ const VERSION = "7.5.2";
50878
50920
  /**
50879
50921
  * Updates the environment instance used by bruce-cesium to one specified.
50880
50922
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.