bruce-cesium 7.7.5 → 7.7.7

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, Entity, ConstantPositionProperty, HeightReference, Color, DistanceDisplayCondition, ColorMaterialProperty, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, Model, ClassificationType, Matrix4, JulianDate, Quaternion, ArcType, CornerType, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, HorizontalOrigin, VerticalOrigin, SceneMode, IntersectionTests, Ray, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, 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, WebGLConstants, Intersect, PolygonPipeline, CustomDataSource, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Geometry as Geometry$1, Api, ClientFileValueMap, Color as Color$1, Bounds, ZoomControl, Assembly, EntityCoords, ProjectView, ProjectViewBookmark, EntityRelation, BruceApi, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } 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, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, JulianDate, Quaternion, HeadingPitchRoll, ColorBlendMode, ShadowMode, Model, ClassificationType, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, FeatureDetection, Matrix3, NearFarScalar, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Intersect, CustomDataSource, WebGLConstants, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Api, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, BruceApi, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -28652,26 +28652,38 @@ var XGridsRenderEngine;
28652
28652
  */
28653
28653
  function ApplyPosition(params) {
28654
28654
  const { renderObject, origin, rotation, dontRotate, dontTransform } = params;
28655
- if (!renderObject) {
28655
+ if (!renderObject || dontTransform) {
28656
28656
  return;
28657
28657
  }
28658
28658
  const lat = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.latitude, 0);
28659
28659
  const lon = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.longitude, 0);
28660
28660
  const alt = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.altitude, 0);
28661
28661
  const scale = EnsureNumber((origin === null || origin === void 0 ? void 0 : origin.scale) || 1, 1);
28662
+ // A complete matrix avoids SDK setters whose translation, rotation and scale contracts differ.
28663
+ if (typeof renderObject.setModelMatrix === "function") {
28664
+ const matrix = Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(lon, lat, alt));
28665
+ if (!dontRotate) {
28666
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.z), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.x), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.y));
28667
+ const local = Matrix4.fromRotation(Matrix3.fromHeadingPitchRoll(hpr));
28668
+ Matrix4.multiply(matrix, local, matrix);
28669
+ Matrix4.multiplyByUniformScale(matrix, scale, matrix);
28670
+ }
28671
+ renderObject.setModelMatrix(matrix);
28672
+ return;
28673
+ }
28662
28674
  if (!dontTransform) {
28663
28675
  const pos = Cartesian3.fromDegrees(lon, lat, alt);
28664
- if (typeof renderObject.setTranslation === 'function') {
28676
+ if (typeof renderObject.setTranslation === "function") {
28665
28677
  renderObject.setTranslation(pos);
28666
28678
  }
28667
28679
  }
28668
28680
  if (!dontRotate && !dontTransform) {
28669
28681
  const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.z), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.x), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.y), new HeadingPitchRoll());
28670
28682
  const rotMatrix = Matrix3.fromHeadingPitchRoll(hpr);
28671
- if (typeof renderObject.setRotation === 'function') {
28683
+ if (typeof renderObject.setRotation === "function") {
28672
28684
  renderObject.setRotation(rotMatrix);
28673
28685
  }
28674
- if (typeof renderObject.setScale === 'function') {
28686
+ if (typeof renderObject.setScale === "function") {
28675
28687
  renderObject.setScale(new Cartesian3(scale, scale, scale));
28676
28688
  }
28677
28689
  }
@@ -54995,6 +55007,12 @@ var EntityRenderEnginePolygon;
54995
55007
  ? Geometry$1.ParsePoints(ring.LinearRing).map((point) => point.altitude)
54996
55008
  : [])
54997
55009
  });
55010
+ const drapesOnGround = (heightRef === HeightReference.CLAMP_TO_GROUND &&
55011
+ extrusion.value == undefined &&
55012
+ !drawsDisplacedSurface);
55013
+ if (drapesOnGround) {
55014
+ posses = groundPosses(posses);
55015
+ }
54998
55016
  posses = CullDuplicateCPosses(posses);
54999
55017
  if (posses.length < 4) {
55000
55018
  return null;
@@ -55003,6 +55021,9 @@ var EntityRenderEnginePolygon;
55003
55021
  const holePosses = holeRings.map((x) => {
55004
55022
  const points = Geometry$1.ParsePoints(x.LinearRing);
55005
55023
  let holePosses = points.map(x => Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)));
55024
+ if (drapesOnGround) {
55025
+ holePosses = groundPosses(holePosses);
55026
+ }
55006
55027
  holePosses = CullDuplicateCPosses(holePosses);
55007
55028
  Cartes.CloseRing3(holePosses);
55008
55029
  return holePosses;
@@ -55789,6 +55810,18 @@ function waterFor(style) {
55789
55810
  /*
55790
55811
  * The lon/lat bounding rectangle of a ring, which is the frame Cesium drapes an image material in.
55791
55812
  */
55813
+ /*
55814
+ * Moves a ring onto the ellipsoid, as Cesium fills only a strip of a ground polygon with high vertices.
55815
+ */
55816
+ function groundPosses(posses) {
55817
+ return posses.map((pos) => {
55818
+ const carto = Cartographic.fromCartesian(pos);
55819
+ if (!carto) {
55820
+ return pos;
55821
+ }
55822
+ return Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
55823
+ });
55824
+ }
55792
55825
  function polygonBbox(posses) {
55793
55826
  if (!posses || posses.length === 0) {
55794
55827
  return undefined;
@@ -57715,7 +57748,7 @@ var StyleUtils;
57715
57748
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
57716
57749
  })(StyleUtils || (StyleUtils = {}));
57717
57750
 
57718
- const VERSION = "7.7.5";
57751
+ const VERSION = "7.7.7";
57719
57752
  /**
57720
57753
  * Updates the environment instance used by bruce-cesium to one specified.
57721
57754
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.