bruce-cesium 6.5.2 → 6.5.3
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.
- package/dist/bruce-cesium.es5.js +147 -163
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +141 -158
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/viewer/cesium-view-monitor.js +6 -239
- package/dist/lib/viewer/cesium-view-monitor.js.map +1 -1
- package/dist/lib/viewer/view-ground-area.js +222 -0
- package/dist/lib/viewer/view-ground-area.js.map +1 -0
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/viewer/cesium-view-monitor.d.ts +2 -4
- package/dist/types/viewer/view-ground-area.d.ts +10 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -14777,23 +14777,13 @@
|
|
|
14777
14777
|
DataLabRenderManager.Manager = Manager;
|
|
14778
14778
|
})(exports.DataLabRenderManager || (exports.DataLabRenderManager = {}));
|
|
14779
14779
|
|
|
14780
|
-
const TIME_LAG = 300;
|
|
14781
|
-
const POSITION_CHECK_TIMER = 950;
|
|
14782
14780
|
const DEFAULT_GROUNDED_HEIGHT = 300;
|
|
14783
14781
|
const MINIMUM_VIEW_AREA_SIZE_DEGREES = 0.01;
|
|
14784
14782
|
const NET_STEP_PERCENT = 5;
|
|
14785
14783
|
const BORDER_STEPS = 3;
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
|
|
14790
|
-
ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
|
|
14791
|
-
})(ESearchStatus || (ESearchStatus = {}));
|
|
14792
|
-
/**
|
|
14793
|
-
* @param viewer
|
|
14794
|
-
* @param center the previously calculated center of the view area. This is in degrees.
|
|
14795
|
-
* @returns
|
|
14796
|
-
*/
|
|
14784
|
+
function isDefined(value) {
|
|
14785
|
+
return value !== null && value !== undefined;
|
|
14786
|
+
}
|
|
14797
14787
|
function netScanViewForBoundaries(viewer, center) {
|
|
14798
14788
|
let maxLong = -2 * Math.PI;
|
|
14799
14789
|
let minLong = 2 * Math.PI;
|
|
@@ -14801,7 +14791,6 @@
|
|
|
14801
14791
|
let minLat = 2 * Math.PI;
|
|
14802
14792
|
let found = 0;
|
|
14803
14793
|
const updateMinMax = (lon, lat) => {
|
|
14804
|
-
// Check to see if given lon/lat (in radians) are within valid range.
|
|
14805
14794
|
if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
|
|
14806
14795
|
return;
|
|
14807
14796
|
}
|
|
@@ -14811,13 +14800,13 @@
|
|
|
14811
14800
|
minLat = Math.min(minLat, lat);
|
|
14812
14801
|
};
|
|
14813
14802
|
const updateMinMaxForPoint = (stepX, stepY) => {
|
|
14814
|
-
const x = Math.round(
|
|
14815
|
-
const y = Math.round(
|
|
14803
|
+
const x = Math.round((viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
|
|
14804
|
+
const y = Math.round((viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
|
|
14816
14805
|
const winPos = new Cesium.Cartesian2(x, y);
|
|
14817
14806
|
try {
|
|
14818
|
-
|
|
14807
|
+
const intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
|
|
14819
14808
|
if (intersection) {
|
|
14820
|
-
|
|
14809
|
+
const point = Cesium.Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
14821
14810
|
updateMinMax(point.longitude, point.latitude);
|
|
14822
14811
|
found++;
|
|
14823
14812
|
}
|
|
@@ -14826,115 +14815,78 @@
|
|
|
14826
14815
|
console.error(e);
|
|
14827
14816
|
}
|
|
14828
14817
|
};
|
|
14829
|
-
// Outer circle.
|
|
14830
14818
|
updateMinMaxForPoint(BORDER_STEPS, BORDER_STEPS);
|
|
14831
14819
|
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, BORDER_STEPS);
|
|
14832
14820
|
updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
14833
14821
|
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
14834
|
-
// Inner circle.
|
|
14835
14822
|
updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
14836
14823
|
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
14837
14824
|
updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
14838
14825
|
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
14839
|
-
// If we failed to find intersections and a center-point was provided, then we can use that to make some guesses.
|
|
14840
|
-
// This happens if terrain is hidden, and there's nothing to intersect with.
|
|
14841
14826
|
if (center && found <= 0) {
|
|
14842
14827
|
updateMinMax(Cesium.Math.toRadians(center.longitude), Cesium.Math.toRadians(center.latitude));
|
|
14843
14828
|
found += 1;
|
|
14844
|
-
|
|
14845
|
-
let size = viewer.camera.positionCartographic.height;
|
|
14829
|
+
const size = viewer.camera.positionCartographic.height;
|
|
14846
14830
|
const pitch = viewer.camera.pitch;
|
|
14847
14831
|
const distance = size / Math.tan(pitch);
|
|
14848
|
-
const p1 =
|
|
14832
|
+
const p1 = offsetPoint({
|
|
14849
14833
|
altitude: center.altitude,
|
|
14850
14834
|
latitude: center.latitude,
|
|
14851
14835
|
longitude: center.longitude
|
|
14852
14836
|
}, distance, 45);
|
|
14853
|
-
const p2 =
|
|
14837
|
+
const p2 = offsetPoint({
|
|
14854
14838
|
altitude: center.altitude,
|
|
14855
14839
|
latitude: center.latitude,
|
|
14856
14840
|
longitude: center.longitude
|
|
14857
14841
|
}, -distance, 45);
|
|
14858
|
-
if (p1 === null || p1 === void 0 ? void 0 : p1.latitude) {
|
|
14842
|
+
if (isDefined(p1 === null || p1 === void 0 ? void 0 : p1.latitude) && isDefined(p1 === null || p1 === void 0 ? void 0 : p1.longitude)) {
|
|
14859
14843
|
updateMinMax(Cesium.Math.toRadians(p1.longitude), Cesium.Math.toRadians(p1.latitude));
|
|
14860
14844
|
}
|
|
14861
|
-
if (p2 === null || p2 === void 0 ? void 0 : p2.latitude) {
|
|
14845
|
+
if (isDefined(p2 === null || p2 === void 0 ? void 0 : p2.latitude) && isDefined(p2 === null || p2 === void 0 ? void 0 : p2.longitude)) {
|
|
14862
14846
|
updateMinMax(Cesium.Math.toRadians(p2.longitude), Cesium.Math.toRadians(p2.latitude));
|
|
14863
14847
|
}
|
|
14864
14848
|
}
|
|
14865
14849
|
if (found > 0) {
|
|
14866
|
-
|
|
14850
|
+
return {
|
|
14867
14851
|
east: maxLong,
|
|
14868
14852
|
west: minLong,
|
|
14869
14853
|
north: maxLat,
|
|
14870
14854
|
south: minLat
|
|
14871
14855
|
};
|
|
14872
|
-
return viewRect;
|
|
14873
14856
|
}
|
|
14874
14857
|
return null;
|
|
14875
14858
|
}
|
|
14876
|
-
|
|
14877
|
-
* Moves a given point by a given distance towards a heading.
|
|
14878
|
-
* @param point in degrees.
|
|
14879
|
-
* @param distance in meters.
|
|
14880
|
-
* @param heading in degrees.
|
|
14881
|
-
* @returns
|
|
14882
|
-
*/
|
|
14883
|
-
function _offsetPoint(point, distance, heading) {
|
|
14884
|
-
// Radius of earth.
|
|
14859
|
+
function offsetPoint(point, distance, heading) {
|
|
14885
14860
|
const radius = 6371e3;
|
|
14886
|
-
const
|
|
14887
|
-
const
|
|
14888
|
-
const
|
|
14889
|
-
const
|
|
14890
|
-
const
|
|
14891
|
-
const
|
|
14892
|
-
const y = Math.sin(
|
|
14893
|
-
const x = Math.cos(
|
|
14894
|
-
const
|
|
14861
|
+
const delta = distance / radius;
|
|
14862
|
+
const theta = Cesium.Math.toRadians(heading);
|
|
14863
|
+
const phi1 = Cesium.Math.toRadians(point.latitude);
|
|
14864
|
+
const lambda1 = Cesium.Math.toRadians(point.longitude);
|
|
14865
|
+
const sinPhi2 = Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta);
|
|
14866
|
+
const phi2 = Math.asin(sinPhi2);
|
|
14867
|
+
const y = Math.sin(theta) * Math.sin(delta) * Math.cos(phi1);
|
|
14868
|
+
const x = Math.cos(delta) - Math.sin(phi1) * sinPhi2;
|
|
14869
|
+
const lambda2 = lambda1 + Math.atan2(y, x);
|
|
14895
14870
|
return {
|
|
14896
14871
|
altitude: point.altitude,
|
|
14897
|
-
latitude: Cesium.Math.toDegrees(
|
|
14898
|
-
longitude: Cesium.Math.toDegrees(
|
|
14872
|
+
latitude: Cesium.Math.toDegrees(phi2),
|
|
14873
|
+
longitude: Cesium.Math.toDegrees(lambda2)
|
|
14899
14874
|
};
|
|
14900
14875
|
}
|
|
14901
|
-
|
|
14902
|
-
* @param pos3d
|
|
14903
|
-
* @param distance in meters
|
|
14904
|
-
* @param heading in degrees
|
|
14905
|
-
* @returns
|
|
14906
|
-
*/
|
|
14907
|
-
function _offsetPos3d(pos3d, distance, heading) {
|
|
14876
|
+
function offsetPos3d(pos3d, distance, heading) {
|
|
14908
14877
|
const carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
14909
|
-
const newCarto =
|
|
14878
|
+
const newCarto = offsetPoint({
|
|
14910
14879
|
altitude: carto.height,
|
|
14911
14880
|
latitude: Cesium.Math.toDegrees(carto.latitude),
|
|
14912
14881
|
longitude: Cesium.Math.toDegrees(carto.longitude)
|
|
14913
14882
|
}, distance, heading);
|
|
14914
14883
|
return Cesium.Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
|
|
14915
14884
|
}
|
|
14916
|
-
/**
|
|
14917
|
-
* Returns the intersection of the camera ray with the ground.
|
|
14918
|
-
* @param viewer
|
|
14919
|
-
* @param screenPos
|
|
14920
|
-
* @returns
|
|
14921
|
-
*/
|
|
14922
14885
|
function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
|
|
14923
14886
|
const ray = viewer.camera.getPickRay(screenPos);
|
|
14924
14887
|
const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
14925
|
-
|
|
14926
|
-
return intersection;
|
|
14927
|
-
}
|
|
14928
|
-
return null;
|
|
14888
|
+
return intersection || null;
|
|
14929
14889
|
}
|
|
14930
|
-
/**
|
|
14931
|
-
* Returns the intersection of the camera ray with the ground.
|
|
14932
|
-
* If no intersection is found, then a "guess" is made based on the camera angle and height.
|
|
14933
|
-
* The guess is made at the center of the view! It ignores the screenPos.
|
|
14934
|
-
* @param viewer
|
|
14935
|
-
* @param screenPos
|
|
14936
|
-
* @returns
|
|
14937
|
-
*/
|
|
14938
14890
|
function getGroundCenterOfCameraRay(viewer, screenPos) {
|
|
14939
14891
|
var _a, _b;
|
|
14940
14892
|
const ray = viewer.camera.getPickRay(screenPos);
|
|
@@ -14942,19 +14894,113 @@
|
|
|
14942
14894
|
if (intersection) {
|
|
14943
14895
|
return intersection;
|
|
14944
14896
|
}
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
// We will use the camera angle + camera height.
|
|
14948
|
-
// Eg: if camera is looking straight down and is 100 meters above the ground, then the intersection will be 100 meters below the camera.
|
|
14949
|
-
let cameraHeight = viewer.camera.positionCartographic.height;
|
|
14950
|
-
if (!isNaN(cameraHeight) && cameraHeight != null && ((_b = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.clone)) {
|
|
14897
|
+
const cameraHeight = viewer.camera.positionCartographic.height;
|
|
14898
|
+
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)) {
|
|
14951
14899
|
const cameraPos3d = viewer.camera.position.clone();
|
|
14952
14900
|
const pitch = viewer.camera.pitch;
|
|
14953
14901
|
const distance = cameraHeight / Math.tan(pitch);
|
|
14954
|
-
return
|
|
14902
|
+
return offsetPos3d(cameraPos3d, -distance, Cesium.Math.toDegrees(viewer.camera.heading));
|
|
14955
14903
|
}
|
|
14956
14904
|
return null;
|
|
14957
14905
|
}
|
|
14906
|
+
(function (CesiumViewGroundArea) {
|
|
14907
|
+
function ToBboxPolygon(bounds) {
|
|
14908
|
+
return `${bounds.west},${bounds.south} ${bounds.west},${bounds.north} ${bounds.east},${bounds.north} ${bounds.east},${bounds.south}`;
|
|
14909
|
+
}
|
|
14910
|
+
CesiumViewGroundArea.ToBboxPolygon = ToBboxPolygon;
|
|
14911
|
+
async function GetViewArea(viewer) {
|
|
14912
|
+
var _a, _b;
|
|
14913
|
+
if (!viewer || viewer.isDestroyed()) {
|
|
14914
|
+
return null;
|
|
14915
|
+
}
|
|
14916
|
+
if (!viewer.container || ((_a = viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
|
|
14917
|
+
return null;
|
|
14918
|
+
}
|
|
14919
|
+
let viewRect = null;
|
|
14920
|
+
let center = null;
|
|
14921
|
+
const camera = viewer.camera;
|
|
14922
|
+
const terrData = await exports.DrawingUtils.GetTerrainHeight({
|
|
14923
|
+
pos3d: camera.position,
|
|
14924
|
+
viewer
|
|
14925
|
+
});
|
|
14926
|
+
const cameraPosition = viewer.camera.positionCartographic;
|
|
14927
|
+
const terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
|
|
14928
|
+
if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
14929
|
+
viewRect = {};
|
|
14930
|
+
const viewRectRad = netScanViewForBoundaries(viewer);
|
|
14931
|
+
if (viewRectRad &&
|
|
14932
|
+
isDefined(viewRectRad.east) &&
|
|
14933
|
+
isDefined(viewRectRad.west) &&
|
|
14934
|
+
isDefined(viewRectRad.north) &&
|
|
14935
|
+
isDefined(viewRectRad.south)) {
|
|
14936
|
+
viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
14937
|
+
viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
14938
|
+
viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
14939
|
+
viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
14940
|
+
}
|
|
14941
|
+
else {
|
|
14942
|
+
viewRect.east = Cesium.Math.toDegrees(cameraPosition.longitude);
|
|
14943
|
+
viewRect.west = Cesium.Math.toDegrees(cameraPosition.longitude);
|
|
14944
|
+
viewRect.south = Cesium.Math.toDegrees(cameraPosition.latitude);
|
|
14945
|
+
viewRect.north = Cesium.Math.toDegrees(cameraPosition.latitude);
|
|
14946
|
+
}
|
|
14947
|
+
center = {
|
|
14948
|
+
altitude: camera.positionCartographic.height,
|
|
14949
|
+
latitude: Cesium.Math.toDegrees(camera.positionCartographic.latitude),
|
|
14950
|
+
longitude: Cesium.Math.toDegrees(camera.positionCartographic.longitude)
|
|
14951
|
+
};
|
|
14952
|
+
}
|
|
14953
|
+
else {
|
|
14954
|
+
const windowPosition = new Cesium.Cartesian2(viewer.container.clientWidth / 2, viewer.container.clientHeight / 2);
|
|
14955
|
+
const intersection = getGroundCenterOfCameraRay(viewer, windowPosition);
|
|
14956
|
+
let point = null;
|
|
14957
|
+
if (intersection) {
|
|
14958
|
+
point = Cesium.Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
14959
|
+
}
|
|
14960
|
+
if (point) {
|
|
14961
|
+
center = {
|
|
14962
|
+
altitude: point.height,
|
|
14963
|
+
latitude: Cesium.Math.toDegrees(point.latitude),
|
|
14964
|
+
longitude: Cesium.Math.toDegrees(point.longitude)
|
|
14965
|
+
};
|
|
14966
|
+
const viewRectRad = netScanViewForBoundaries(viewer, center);
|
|
14967
|
+
if (viewRectRad) {
|
|
14968
|
+
viewRect = {};
|
|
14969
|
+
viewRect.east = Cesium.Math.toDegrees(viewRectRad.east);
|
|
14970
|
+
viewRect.west = Cesium.Math.toDegrees(viewRectRad.west);
|
|
14971
|
+
viewRect.south = Cesium.Math.toDegrees(viewRectRad.south);
|
|
14972
|
+
viewRect.north = Cesium.Math.toDegrees(viewRectRad.north);
|
|
14973
|
+
}
|
|
14974
|
+
}
|
|
14975
|
+
}
|
|
14976
|
+
if (viewRect) {
|
|
14977
|
+
const centerLong = (viewRect.east + viewRect.west) / 2;
|
|
14978
|
+
const centerLat = (viewRect.north + viewRect.south) / 2;
|
|
14979
|
+
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14980
|
+
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14981
|
+
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14982
|
+
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14983
|
+
viewRect.alt = (_b = viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height;
|
|
14984
|
+
}
|
|
14985
|
+
if (center && viewRect) {
|
|
14986
|
+
return {
|
|
14987
|
+
bounds: viewRect,
|
|
14988
|
+
target: center
|
|
14989
|
+
};
|
|
14990
|
+
}
|
|
14991
|
+
return null;
|
|
14992
|
+
}
|
|
14993
|
+
CesiumViewGroundArea.GetViewArea = GetViewArea;
|
|
14994
|
+
})(exports.CesiumViewGroundArea || (exports.CesiumViewGroundArea = {}));
|
|
14995
|
+
|
|
14996
|
+
const TIME_LAG = 300;
|
|
14997
|
+
const POSITION_CHECK_TIMER = 950;
|
|
14998
|
+
var ESearchStatus;
|
|
14999
|
+
(function (ESearchStatus) {
|
|
15000
|
+
ESearchStatus[ESearchStatus["LocationFound"] = 1] = "LocationFound";
|
|
15001
|
+
ESearchStatus[ESearchStatus["LocationChanged"] = 2] = "LocationChanged";
|
|
15002
|
+
ESearchStatus[ESearchStatus["LocationMissing"] = 3] = "LocationMissing";
|
|
15003
|
+
})(ESearchStatus || (ESearchStatus = {}));
|
|
14958
15004
|
function areBoundsEqual(a, b) {
|
|
14959
15005
|
return a.north == b.north && a.south == b.south && a.east == b.east && a.west == b.west;
|
|
14960
15006
|
}
|
|
@@ -15035,7 +15081,7 @@
|
|
|
15035
15081
|
this.destroyEntity();
|
|
15036
15082
|
}
|
|
15037
15083
|
async tryDoUpdate() {
|
|
15038
|
-
var _a
|
|
15084
|
+
var _a;
|
|
15039
15085
|
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
15040
15086
|
this.Dispose();
|
|
15041
15087
|
return ESearchStatus.LocationMissing;
|
|
@@ -15043,73 +15089,10 @@
|
|
|
15043
15089
|
if (!this.viewer.container || ((_a = this.viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
|
|
15044
15090
|
return ESearchStatus.LocationMissing;
|
|
15045
15091
|
}
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
pos3d: camera.position,
|
|
15051
|
-
viewer: this.viewer
|
|
15052
|
-
});
|
|
15053
|
-
const cameraPosition = this.viewer.camera.positionCartographic;
|
|
15054
|
-
const terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
|
|
15055
|
-
// We are almost at the ground, screw horizon, just load around.
|
|
15056
|
-
if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
15057
|
-
// View area calculation.
|
|
15058
|
-
viewRect = {};
|
|
15059
|
-
const viewRectRad = netScanViewForBoundaries(this.viewer);
|
|
15060
|
-
if (viewRectRad &&
|
|
15061
|
-
viewRectRad.east &&
|
|
15062
|
-
viewRectRad.west &&
|
|
15063
|
-
viewRectRad.north &&
|
|
15064
|
-
viewRectRad.south) {
|
|
15065
|
-
viewRect.east = Cesium.Math.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
15066
|
-
viewRect.west = Cesium.Math.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
15067
|
-
viewRect.south = Cesium.Math.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
15068
|
-
viewRect.north = Cesium.Math.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
15069
|
-
}
|
|
15070
|
-
else {
|
|
15071
|
-
viewRect.east = cameraPosition.longitude;
|
|
15072
|
-
viewRect.west = cameraPosition.longitude;
|
|
15073
|
-
viewRect.south = cameraPosition.latitude;
|
|
15074
|
-
viewRect.north = cameraPosition.latitude;
|
|
15075
|
-
}
|
|
15076
|
-
center = {};
|
|
15077
|
-
center.latitude = Cesium.Math.toDegrees(camera.positionCartographic.latitude);
|
|
15078
|
-
center.longitude = Cesium.Math.toDegrees(camera.positionCartographic.longitude);
|
|
15079
|
-
}
|
|
15080
|
-
else {
|
|
15081
|
-
// View area calculation.
|
|
15082
|
-
const windowPosition = new Cesium.Cartesian2(this.viewer.container.clientWidth / 2, this.viewer.container.clientHeight / 2);
|
|
15083
|
-
const intersection = getGroundCenterOfCameraRay(this.viewer, windowPosition);
|
|
15084
|
-
let point = null;
|
|
15085
|
-
if (intersection) {
|
|
15086
|
-
point = Cesium.Cartographic.fromCartesian(intersection, this.viewer.scene.globe.ellipsoid);
|
|
15087
|
-
}
|
|
15088
|
-
if (point) {
|
|
15089
|
-
center = {};
|
|
15090
|
-
center.latitude = Cesium.Math.toDegrees(point.latitude);
|
|
15091
|
-
center.longitude = Cesium.Math.toDegrees(point.longitude);
|
|
15092
|
-
let viewRectRad = netScanViewForBoundaries(this.viewer, center);
|
|
15093
|
-
if (viewRectRad) {
|
|
15094
|
-
viewRect = {};
|
|
15095
|
-
viewRect.east = Cesium.Math.toDegrees(viewRectRad.east);
|
|
15096
|
-
viewRect.west = Cesium.Math.toDegrees(viewRectRad.west);
|
|
15097
|
-
viewRect.south = Cesium.Math.toDegrees(viewRectRad.south);
|
|
15098
|
-
viewRect.north = Cesium.Math.toDegrees(viewRectRad.north);
|
|
15099
|
-
}
|
|
15100
|
-
}
|
|
15101
|
-
}
|
|
15102
|
-
// Minimal field of view.
|
|
15103
|
-
if (viewRect) {
|
|
15104
|
-
const centerLong = (viewRect.east + viewRect.west) / 2;
|
|
15105
|
-
const centerLat = (viewRect.north + viewRect.south) / 2;
|
|
15106
|
-
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
15107
|
-
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
15108
|
-
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
15109
|
-
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
15110
|
-
viewRect.alt = (_b = this.viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height;
|
|
15111
|
-
}
|
|
15112
|
-
if (center && viewRect) {
|
|
15092
|
+
const viewArea = await exports.CesiumViewGroundArea.GetViewArea(this.viewer);
|
|
15093
|
+
if ((viewArea === null || viewArea === void 0 ? void 0 : viewArea.target) && (viewArea === null || viewArea === void 0 ? void 0 : viewArea.bounds)) {
|
|
15094
|
+
const center = viewArea.target;
|
|
15095
|
+
const viewRect = viewArea.bounds;
|
|
15113
15096
|
if ((!this.target || (this.target && !arePosEqual(this.target, center))) ||
|
|
15114
15097
|
(!this.bounds || (this.bounds && !areBoundsEqual(this.bounds, viewRect)))) {
|
|
15115
15098
|
this.target = center;
|
|
@@ -26127,7 +26110,7 @@
|
|
|
26127
26110
|
data.actions.get(EAction.Backward)) {
|
|
26128
26111
|
const heading = getMovementHeading(viewer);
|
|
26129
26112
|
const pos = viewer.camera.positionCartographic;
|
|
26130
|
-
const newPos = _offsetPoint
|
|
26113
|
+
const newPos = _offsetPoint({
|
|
26131
26114
|
altitude: pos.height,
|
|
26132
26115
|
latitude: Cesium.Math.toDegrees(pos.latitude),
|
|
26133
26116
|
longitude: Cesium.Math.toDegrees(pos.longitude)
|
|
@@ -26144,7 +26127,7 @@
|
|
|
26144
26127
|
* @param heading in degrees.
|
|
26145
26128
|
* @returns
|
|
26146
26129
|
*/
|
|
26147
|
-
function _offsetPoint
|
|
26130
|
+
function _offsetPoint(point, distance, heading) {
|
|
26148
26131
|
// Radius of earth.
|
|
26149
26132
|
const radius = 6371e3;
|
|
26150
26133
|
const δ = distance / radius;
|
|
@@ -30094,7 +30077,7 @@
|
|
|
30094
30077
|
// This gives a better experience than looking straight down.
|
|
30095
30078
|
if (!is2d) {
|
|
30096
30079
|
// Combine the elevation with the sideways offset.
|
|
30097
|
-
const finalStartingPosition = _offsetPos3d
|
|
30080
|
+
const finalStartingPosition = _offsetPos3d(elevatedPos3d, -range, Cesium.Math.toDegrees(params.viewer.camera.heading));
|
|
30098
30081
|
// Calculate the direction from the elevated and offset starting position towards the destination.
|
|
30099
30082
|
const direction = Cesium.Cartesian3.subtract(destination, finalStartingPosition, new Cesium.Cartesian3());
|
|
30100
30083
|
Cesium.Cartesian3.normalize(direction, direction);
|
|
@@ -30150,7 +30133,7 @@
|
|
|
30150
30133
|
* @param heading in degrees.
|
|
30151
30134
|
* @returns
|
|
30152
30135
|
*/
|
|
30153
|
-
function _offsetPoint$
|
|
30136
|
+
function _offsetPoint$1(point, distance, heading) {
|
|
30154
30137
|
// Radius of earth.
|
|
30155
30138
|
const radius = 6371e3;
|
|
30156
30139
|
const δ = distance / radius;
|
|
@@ -30174,9 +30157,9 @@
|
|
|
30174
30157
|
* @param heading in degrees
|
|
30175
30158
|
* @returns
|
|
30176
30159
|
*/
|
|
30177
|
-
function _offsetPos3d
|
|
30160
|
+
function _offsetPos3d(pos3d, distance, heading) {
|
|
30178
30161
|
const carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
30179
|
-
const newCarto = _offsetPoint$
|
|
30162
|
+
const newCarto = _offsetPoint$1({
|
|
30180
30163
|
altitude: carto.height,
|
|
30181
30164
|
latitude: Cesium.Math.toDegrees(carto.latitude),
|
|
30182
30165
|
longitude: Cesium.Math.toDegrees(carto.longitude)
|
|
@@ -35219,7 +35202,7 @@
|
|
|
35219
35202
|
}
|
|
35220
35203
|
}
|
|
35221
35204
|
|
|
35222
|
-
const VERSION = "6.5.
|
|
35205
|
+
const VERSION = "6.5.3";
|
|
35223
35206
|
/**
|
|
35224
35207
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
35225
35208
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|