bruce-cesium 6.6.1 → 6.6.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
- import { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, DataLab, EntityCoords, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Bounds, Carto, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
1
+ import { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, DataLab, EntityCoords, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Carto, ProjectView, ProjectViewBookmark, Bounds, ProjectViewLegacyTile, Camera, AbstractApi, Session, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
3
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, ArcType, CornerType, ConstantPositionProperty, JulianDate, Quaternion, Matrix4, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, Cartesian2, SceneTransforms, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Cesium3DTileset, IonResource, Ion, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -12852,236 +12852,6 @@ function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
12852
12852
  return [id, cell];
12853
12853
  }
12854
12854
 
12855
- const DEFAULT_GROUNDED_HEIGHT = 300;
12856
- const MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
12857
- const NET_STEP_PERCENT = 5;
12858
- const BORDER_STEPS = 3;
12859
- function isDefined(value) {
12860
- return value !== null && value !== undefined;
12861
- }
12862
- function netScanViewForBoundaries(viewer, center) {
12863
- let maxLong = -2 * Math.PI;
12864
- let minLong = 2 * Math.PI;
12865
- let maxLat = -2 * Math.PI;
12866
- let minLat = 2 * Math.PI;
12867
- let found = 0;
12868
- const updateMinMax = (lon, lat) => {
12869
- if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
12870
- return;
12871
- }
12872
- maxLong = Math.max(maxLong, lon);
12873
- maxLat = Math.max(maxLat, lat);
12874
- minLong = Math.min(minLong, lon);
12875
- minLat = Math.min(minLat, lat);
12876
- };
12877
- const updateMinMaxForPoint = (stepX, stepY) => {
12878
- const x = Math.round((viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
12879
- const y = Math.round((viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
12880
- const winPos = new Cartesian2(x, y);
12881
- try {
12882
- const intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
12883
- if (intersection) {
12884
- const point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
12885
- updateMinMax(point.longitude, point.latitude);
12886
- found++;
12887
- }
12888
- }
12889
- catch (e) {
12890
- console.error(e);
12891
- }
12892
- };
12893
- updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
12894
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
12895
- updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
12896
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
12897
- updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
12898
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
12899
- updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
12900
- updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
12901
- if (center && found <= 0) {
12902
- updateMinMax(Math$1.toRadians(center.longitude), Math$1.toRadians(center.latitude));
12903
- found += 1;
12904
- const size = viewer.camera.positionCartographic.height;
12905
- const pitch = viewer.camera.pitch;
12906
- const distance = size / Math.tan(pitch);
12907
- const p1 = offsetPoint({
12908
- altitude: center.altitude,
12909
- latitude: center.latitude,
12910
- longitude: center.longitude
12911
- }, distance, 45);
12912
- const p2 = offsetPoint({
12913
- altitude: center.altitude,
12914
- latitude: center.latitude,
12915
- longitude: center.longitude
12916
- }, -distance, 45);
12917
- if (isDefined(p1 === null || p1 === void 0 ? void 0 : p1.latitude) && isDefined(p1 === null || p1 === void 0 ? void 0 : p1.longitude)) {
12918
- updateMinMax(Math$1.toRadians(p1.longitude), Math$1.toRadians(p1.latitude));
12919
- }
12920
- if (isDefined(p2 === null || p2 === void 0 ? void 0 : p2.latitude) && isDefined(p2 === null || p2 === void 0 ? void 0 : p2.longitude)) {
12921
- updateMinMax(Math$1.toRadians(p2.longitude), Math$1.toRadians(p2.latitude));
12922
- }
12923
- }
12924
- if (found > 0) {
12925
- return {
12926
- east: maxLong,
12927
- west: minLong,
12928
- north: maxLat,
12929
- south: minLat
12930
- };
12931
- }
12932
- return null;
12933
- }
12934
- function offsetPoint(point, distance, heading) {
12935
- const radius = 6371e3;
12936
- const delta = distance / radius;
12937
- const theta = Math$1.toRadians(heading);
12938
- const phi1 = Math$1.toRadians(point.latitude);
12939
- const lambda1 = Math$1.toRadians(point.longitude);
12940
- const sinPhi2 = Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta);
12941
- const phi2 = Math.asin(sinPhi2);
12942
- const y = Math.sin(theta) * Math.sin(delta) * Math.cos(phi1);
12943
- const x = Math.cos(delta) - Math.sin(phi1) * sinPhi2;
12944
- const lambda2 = lambda1 + Math.atan2(y, x);
12945
- return {
12946
- altitude: point.altitude,
12947
- latitude: Math$1.toDegrees(phi2),
12948
- longitude: Math$1.toDegrees(lambda2)
12949
- };
12950
- }
12951
- function offsetPos3d(pos3d, distance, heading) {
12952
- const carto = Cartographic.fromCartesian(pos3d);
12953
- const newCarto = offsetPoint({
12954
- altitude: carto.height,
12955
- latitude: Math$1.toDegrees(carto.latitude),
12956
- longitude: Math$1.toDegrees(carto.longitude)
12957
- }, distance, heading);
12958
- return Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
12959
- }
12960
- function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
12961
- const ray = viewer.camera.getPickRay(screenPos);
12962
- const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
12963
- return intersection || null;
12964
- }
12965
- function getGroundCenterOfCameraRay(viewer, screenPos) {
12966
- var _a, _b;
12967
- const ray = viewer.camera.getPickRay(screenPos);
12968
- const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
12969
- if (intersection) {
12970
- return intersection;
12971
- }
12972
- const cameraHeight = viewer.camera.positionCartographic.height;
12973
- if (!isNaN(cameraHeight) && isDefined(cameraHeight) && ((_b = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.clone)) {
12974
- const cameraPos3d = viewer.camera.position.clone();
12975
- const pitch = viewer.camera.pitch;
12976
- const distance = cameraHeight / Math.tan(pitch);
12977
- return offsetPos3d(cameraPos3d, -distance, Math$1.toDegrees(viewer.camera.heading));
12978
- }
12979
- return null;
12980
- }
12981
- var ViewGroundArea;
12982
- (function (ViewGroundArea) {
12983
- function ToBboxPolygon(bounds) {
12984
- return `${bounds.west},${bounds.south} ${bounds.west},${bounds.north} ${bounds.east},${bounds.north} ${bounds.east},${bounds.south}`;
12985
- }
12986
- ViewGroundArea.ToBboxPolygon = ToBboxPolygon;
12987
- function NormalizeBounds(bounds, altitude) {
12988
- if (!bounds ||
12989
- !isDefined(bounds.east) ||
12990
- !isDefined(bounds.west) ||
12991
- !isDefined(bounds.north) ||
12992
- !isDefined(bounds.south)) {
12993
- return null;
12994
- }
12995
- const viewRect = { ...bounds };
12996
- const centerLong = (viewRect.east + viewRect.west) / 2;
12997
- const centerLat = (viewRect.north + viewRect.south) / 2;
12998
- viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
12999
- viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
13000
- viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
13001
- viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
13002
- if (isDefined(altitude)) {
13003
- viewRect.alt = altitude;
13004
- }
13005
- return viewRect;
13006
- }
13007
- ViewGroundArea.NormalizeBounds = NormalizeBounds;
13008
- async function GetViewArea(viewer) {
13009
- var _a, _b;
13010
- if (!viewer || viewer.isDestroyed()) {
13011
- return null;
13012
- }
13013
- if (!viewer.container || ((_a = viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
13014
- return null;
13015
- }
13016
- let viewRect = null;
13017
- let center = null;
13018
- const camera = viewer.camera;
13019
- const terrData = await DrawingUtils.GetTerrainHeight({
13020
- pos3d: camera.position,
13021
- viewer
13022
- });
13023
- const cameraPosition = viewer.camera.positionCartographic;
13024
- const terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
13025
- if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
13026
- viewRect = {};
13027
- const viewRectRad = netScanViewForBoundaries(viewer);
13028
- if (viewRectRad &&
13029
- isDefined(viewRectRad.east) &&
13030
- isDefined(viewRectRad.west) &&
13031
- isDefined(viewRectRad.north) &&
13032
- isDefined(viewRectRad.south)) {
13033
- viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
13034
- viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
13035
- viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
13036
- viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
13037
- }
13038
- else {
13039
- viewRect.east = Math$1.toDegrees(cameraPosition.longitude);
13040
- viewRect.west = Math$1.toDegrees(cameraPosition.longitude);
13041
- viewRect.south = Math$1.toDegrees(cameraPosition.latitude);
13042
- viewRect.north = Math$1.toDegrees(cameraPosition.latitude);
13043
- }
13044
- center = {
13045
- altitude: camera.positionCartographic.height,
13046
- latitude: Math$1.toDegrees(camera.positionCartographic.latitude),
13047
- longitude: Math$1.toDegrees(camera.positionCartographic.longitude)
13048
- };
13049
- }
13050
- else {
13051
- const windowPosition = new Cartesian2(viewer.container.clientWidth / 2, viewer.container.clientHeight / 2);
13052
- const intersection = getGroundCenterOfCameraRay(viewer, windowPosition);
13053
- let point = null;
13054
- if (intersection) {
13055
- point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
13056
- }
13057
- if (point) {
13058
- center = {
13059
- altitude: point.height,
13060
- latitude: Math$1.toDegrees(point.latitude),
13061
- longitude: Math$1.toDegrees(point.longitude)
13062
- };
13063
- const viewRectRad = netScanViewForBoundaries(viewer, center);
13064
- if (viewRectRad) {
13065
- viewRect = {};
13066
- viewRect.east = Math$1.toDegrees(viewRectRad.east);
13067
- viewRect.west = Math$1.toDegrees(viewRectRad.west);
13068
- viewRect.south = Math$1.toDegrees(viewRectRad.south);
13069
- viewRect.north = Math$1.toDegrees(viewRectRad.north);
13070
- }
13071
- }
13072
- }
13073
- viewRect = NormalizeBounds(viewRect, (_b = viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height);
13074
- if (center && viewRect) {
13075
- return {
13076
- bounds: viewRect,
13077
- target: center
13078
- };
13079
- }
13080
- return null;
13081
- }
13082
- ViewGroundArea.GetViewArea = GetViewArea;
13083
- })(ViewGroundArea || (ViewGroundArea = {}));
13084
-
13085
12855
  const MAX_AREA_IN_DEGREES$1 = 90;
13086
12856
  const MAX_RETRY_ATTEMPTS = 1;
13087
12857
  const RETRY_DELAY_INCREMENT = 500;
@@ -13101,6 +12871,23 @@ async function delay(milliseconds) {
13101
12871
  }, milliseconds);
13102
12872
  });
13103
12873
  }
12874
+ function createBoundsPolygonGeometry(bounds) {
12875
+ const ring = [
12876
+ `${bounds.west},${bounds.south}`,
12877
+ `${bounds.west},${bounds.north}`,
12878
+ `${bounds.east},${bounds.north}`,
12879
+ `${bounds.east},${bounds.south}`,
12880
+ `${bounds.west},${bounds.south}`
12881
+ ].join(" ");
12882
+ return {
12883
+ Polygon: [
12884
+ {
12885
+ Facing: Geometry.EPolygonRingType.Boundaries,
12886
+ LinearRing: ring
12887
+ }
12888
+ ]
12889
+ };
12890
+ }
13104
12891
  /**
13105
12892
  * This is a batched entity getter.
13106
12893
  * It will scan for entity records in a view-area and emit them in batches.
@@ -13402,8 +13189,9 @@ var EntityFilterGetter;
13402
13189
  LogicOperator: "AND",
13403
13190
  AttributeValue: {
13404
13191
  AttributePath: "Bruce/Boundaries",
13405
- OperandA: ViewGroundArea.ToBboxPolygon(bounds),
13406
- Operator: "intersects"
13192
+ OperandA: createBoundsPolygonGeometry(bounds),
13193
+ Operator: "intersects",
13194
+ ValueOption: "CONST"
13407
13195
  },
13408
13196
  key: "attribute"
13409
13197
  }
@@ -15643,6 +15431,236 @@ var DataLabRenderManager;
15643
15431
  DataLabRenderManager.Manager = Manager;
15644
15432
  })(DataLabRenderManager || (DataLabRenderManager = {}));
15645
15433
 
15434
+ const DEFAULT_GROUNDED_HEIGHT = 300;
15435
+ const MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
15436
+ const NET_STEP_PERCENT = 5;
15437
+ const BORDER_STEPS = 3;
15438
+ function isDefined(value) {
15439
+ return value !== null && value !== undefined;
15440
+ }
15441
+ function netScanViewForBoundaries(viewer, center) {
15442
+ let maxLong = -2 * Math.PI;
15443
+ let minLong = 2 * Math.PI;
15444
+ let maxLat = -2 * Math.PI;
15445
+ let minLat = 2 * Math.PI;
15446
+ let found = 0;
15447
+ const updateMinMax = (lon, lat) => {
15448
+ if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
15449
+ return;
15450
+ }
15451
+ maxLong = Math.max(maxLong, lon);
15452
+ maxLat = Math.max(maxLat, lat);
15453
+ minLong = Math.min(minLong, lon);
15454
+ minLat = Math.min(minLat, lat);
15455
+ };
15456
+ const updateMinMaxForPoint = (stepX, stepY) => {
15457
+ const x = Math.round((viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
15458
+ const y = Math.round((viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
15459
+ const winPos = new Cartesian2(x, y);
15460
+ try {
15461
+ const intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
15462
+ if (intersection) {
15463
+ const point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
15464
+ updateMinMax(point.longitude, point.latitude);
15465
+ found++;
15466
+ }
15467
+ }
15468
+ catch (e) {
15469
+ console.error(e);
15470
+ }
15471
+ };
15472
+ updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
15473
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
15474
+ updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
15475
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
15476
+ updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
15477
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
15478
+ updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
15479
+ updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
15480
+ if (center && found <= 0) {
15481
+ updateMinMax(Math$1.toRadians(center.longitude), Math$1.toRadians(center.latitude));
15482
+ found += 1;
15483
+ const size = viewer.camera.positionCartographic.height;
15484
+ const pitch = viewer.camera.pitch;
15485
+ const distance = size / Math.tan(pitch);
15486
+ const p1 = offsetPoint({
15487
+ altitude: center.altitude,
15488
+ latitude: center.latitude,
15489
+ longitude: center.longitude
15490
+ }, distance, 45);
15491
+ const p2 = offsetPoint({
15492
+ altitude: center.altitude,
15493
+ latitude: center.latitude,
15494
+ longitude: center.longitude
15495
+ }, -distance, 45);
15496
+ if (isDefined(p1 === null || p1 === void 0 ? void 0 : p1.latitude) && isDefined(p1 === null || p1 === void 0 ? void 0 : p1.longitude)) {
15497
+ updateMinMax(Math$1.toRadians(p1.longitude), Math$1.toRadians(p1.latitude));
15498
+ }
15499
+ if (isDefined(p2 === null || p2 === void 0 ? void 0 : p2.latitude) && isDefined(p2 === null || p2 === void 0 ? void 0 : p2.longitude)) {
15500
+ updateMinMax(Math$1.toRadians(p2.longitude), Math$1.toRadians(p2.latitude));
15501
+ }
15502
+ }
15503
+ if (found > 0) {
15504
+ return {
15505
+ east: maxLong,
15506
+ west: minLong,
15507
+ north: maxLat,
15508
+ south: minLat
15509
+ };
15510
+ }
15511
+ return null;
15512
+ }
15513
+ function offsetPoint(point, distance, heading) {
15514
+ const radius = 6371e3;
15515
+ const delta = distance / radius;
15516
+ const theta = Math$1.toRadians(heading);
15517
+ const phi1 = Math$1.toRadians(point.latitude);
15518
+ const lambda1 = Math$1.toRadians(point.longitude);
15519
+ const sinPhi2 = Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta);
15520
+ const phi2 = Math.asin(sinPhi2);
15521
+ const y = Math.sin(theta) * Math.sin(delta) * Math.cos(phi1);
15522
+ const x = Math.cos(delta) - Math.sin(phi1) * sinPhi2;
15523
+ const lambda2 = lambda1 + Math.atan2(y, x);
15524
+ return {
15525
+ altitude: point.altitude,
15526
+ latitude: Math$1.toDegrees(phi2),
15527
+ longitude: Math$1.toDegrees(lambda2)
15528
+ };
15529
+ }
15530
+ function offsetPos3d(pos3d, distance, heading) {
15531
+ const carto = Cartographic.fromCartesian(pos3d);
15532
+ const newCarto = offsetPoint({
15533
+ altitude: carto.height,
15534
+ latitude: Math$1.toDegrees(carto.latitude),
15535
+ longitude: Math$1.toDegrees(carto.longitude)
15536
+ }, distance, heading);
15537
+ return Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
15538
+ }
15539
+ function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
15540
+ const ray = viewer.camera.getPickRay(screenPos);
15541
+ const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
15542
+ return intersection || null;
15543
+ }
15544
+ function getGroundCenterOfCameraRay(viewer, screenPos) {
15545
+ var _a, _b;
15546
+ const ray = viewer.camera.getPickRay(screenPos);
15547
+ const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
15548
+ if (intersection) {
15549
+ return intersection;
15550
+ }
15551
+ const cameraHeight = viewer.camera.positionCartographic.height;
15552
+ if (!isNaN(cameraHeight) && isDefined(cameraHeight) && ((_b = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.clone)) {
15553
+ const cameraPos3d = viewer.camera.position.clone();
15554
+ const pitch = viewer.camera.pitch;
15555
+ const distance = cameraHeight / Math.tan(pitch);
15556
+ return offsetPos3d(cameraPos3d, -distance, Math$1.toDegrees(viewer.camera.heading));
15557
+ }
15558
+ return null;
15559
+ }
15560
+ var ViewGroundArea;
15561
+ (function (ViewGroundArea) {
15562
+ function ToBboxPolygon(bounds) {
15563
+ return `${bounds.west},${bounds.south} ${bounds.west},${bounds.north} ${bounds.east},${bounds.north} ${bounds.east},${bounds.south}`;
15564
+ }
15565
+ ViewGroundArea.ToBboxPolygon = ToBboxPolygon;
15566
+ function NormalizeBounds(bounds, altitude) {
15567
+ if (!bounds ||
15568
+ !isDefined(bounds.east) ||
15569
+ !isDefined(bounds.west) ||
15570
+ !isDefined(bounds.north) ||
15571
+ !isDefined(bounds.south)) {
15572
+ return null;
15573
+ }
15574
+ const viewRect = { ...bounds };
15575
+ const centerLong = (viewRect.east + viewRect.west) / 2;
15576
+ const centerLat = (viewRect.north + viewRect.south) / 2;
15577
+ viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15578
+ viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15579
+ viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15580
+ viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15581
+ if (isDefined(altitude)) {
15582
+ viewRect.alt = altitude;
15583
+ }
15584
+ return viewRect;
15585
+ }
15586
+ ViewGroundArea.NormalizeBounds = NormalizeBounds;
15587
+ async function GetViewArea(viewer) {
15588
+ var _a, _b;
15589
+ if (!viewer || viewer.isDestroyed()) {
15590
+ return null;
15591
+ }
15592
+ if (!viewer.container || ((_a = viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
15593
+ return null;
15594
+ }
15595
+ let viewRect = null;
15596
+ let center = null;
15597
+ const camera = viewer.camera;
15598
+ const terrData = await DrawingUtils.GetTerrainHeight({
15599
+ pos3d: camera.position,
15600
+ viewer
15601
+ });
15602
+ const cameraPosition = viewer.camera.positionCartographic;
15603
+ const terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
15604
+ if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
15605
+ viewRect = {};
15606
+ const viewRectRad = netScanViewForBoundaries(viewer);
15607
+ if (viewRectRad &&
15608
+ isDefined(viewRectRad.east) &&
15609
+ isDefined(viewRectRad.west) &&
15610
+ isDefined(viewRectRad.north) &&
15611
+ isDefined(viewRectRad.south)) {
15612
+ viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
15613
+ viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
15614
+ viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
15615
+ viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
15616
+ }
15617
+ else {
15618
+ viewRect.east = Math$1.toDegrees(cameraPosition.longitude);
15619
+ viewRect.west = Math$1.toDegrees(cameraPosition.longitude);
15620
+ viewRect.south = Math$1.toDegrees(cameraPosition.latitude);
15621
+ viewRect.north = Math$1.toDegrees(cameraPosition.latitude);
15622
+ }
15623
+ center = {
15624
+ altitude: camera.positionCartographic.height,
15625
+ latitude: Math$1.toDegrees(camera.positionCartographic.latitude),
15626
+ longitude: Math$1.toDegrees(camera.positionCartographic.longitude)
15627
+ };
15628
+ }
15629
+ else {
15630
+ const windowPosition = new Cartesian2(viewer.container.clientWidth / 2, viewer.container.clientHeight / 2);
15631
+ const intersection = getGroundCenterOfCameraRay(viewer, windowPosition);
15632
+ let point = null;
15633
+ if (intersection) {
15634
+ point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
15635
+ }
15636
+ if (point) {
15637
+ center = {
15638
+ altitude: point.height,
15639
+ latitude: Math$1.toDegrees(point.latitude),
15640
+ longitude: Math$1.toDegrees(point.longitude)
15641
+ };
15642
+ const viewRectRad = netScanViewForBoundaries(viewer, center);
15643
+ if (viewRectRad) {
15644
+ viewRect = {};
15645
+ viewRect.east = Math$1.toDegrees(viewRectRad.east);
15646
+ viewRect.west = Math$1.toDegrees(viewRectRad.west);
15647
+ viewRect.south = Math$1.toDegrees(viewRectRad.south);
15648
+ viewRect.north = Math$1.toDegrees(viewRectRad.north);
15649
+ }
15650
+ }
15651
+ }
15652
+ viewRect = NormalizeBounds(viewRect, (_b = viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height);
15653
+ if (center && viewRect) {
15654
+ return {
15655
+ bounds: viewRect,
15656
+ target: center
15657
+ };
15658
+ }
15659
+ return null;
15660
+ }
15661
+ ViewGroundArea.GetViewArea = GetViewArea;
15662
+ })(ViewGroundArea || (ViewGroundArea = {}));
15663
+
15646
15664
  const TIME_LAG = 300;
15647
15665
  const POSITION_CHECK_TIMER = 950;
15648
15666
  var ESearchStatus;
@@ -35950,7 +35968,7 @@ class WidgetViewBar extends Widget.AWidget {
35950
35968
  }
35951
35969
  }
35952
35970
 
35953
- const VERSION = "6.6.1";
35971
+ const VERSION = "6.6.2";
35954
35972
  /**
35955
35973
  * Updates the environment instance used by bruce-cesium to one specified.
35956
35974
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.