bruce-cesium 6.5.9 → 6.6.1
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 +891 -301
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1015 -425
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/getters/entity-filter-getter.js +96 -3
- package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +4 -0
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js +383 -67
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +176 -0
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/rendering/xgrids-render-engine.js +6 -0
- package/dist/lib/rendering/xgrids-render-engine.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/getters/entity-filter-getter.d.ts +10 -1
- package/dist/types/rendering/render-managers/common/shared-getters.d.ts +1 -0
- package/dist/types/rendering/render-managers/entities/entities-datalab-render-manager.d.ts +33 -4
- package/dist/types/rendering/tileset-render-engine.d.ts +33 -0
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -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,
|
|
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';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature,
|
|
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';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -11926,6 +11926,66 @@ function isAlive$2(viewer, cTileset) {
|
|
|
11926
11926
|
}
|
|
11927
11927
|
const VIEWER_WATCH_KEY = "bruce-viewer-watch";
|
|
11928
11928
|
const WATCH_KEY = "bruce-tileset-watch";
|
|
11929
|
+
const VIEWER_DATE_RANGE_WATCH_KEY = "bruce-viewer-date-range-watch";
|
|
11930
|
+
const DATE_RANGE_WATCH_KEY = "bruce-tileset-date-range-watch";
|
|
11931
|
+
function parseDate(value) {
|
|
11932
|
+
if (!value) {
|
|
11933
|
+
return null;
|
|
11934
|
+
}
|
|
11935
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
11936
|
+
if (isNaN(date.getTime())) {
|
|
11937
|
+
return null;
|
|
11938
|
+
}
|
|
11939
|
+
return date;
|
|
11940
|
+
}
|
|
11941
|
+
function getTilesetDateRange(tileset) {
|
|
11942
|
+
var _a, _b, _c;
|
|
11943
|
+
const settings = (_a = tileset === null || tileset === void 0 ? void 0 : tileset.settings) !== null && _a !== void 0 ? _a : tileset === null || tileset === void 0 ? void 0 : tileset.Settings;
|
|
11944
|
+
const visual = (settings === null || settings === void 0 ? void 0 : settings.visual) || (settings === null || settings === void 0 ? void 0 : settings.Visual);
|
|
11945
|
+
const start = parseDate((_b = settings === null || settings === void 0 ? void 0 : settings.dateStart) !== null && _b !== void 0 ? _b : visual === null || visual === void 0 ? void 0 : visual.dateStart);
|
|
11946
|
+
const end = parseDate((_c = settings === null || settings === void 0 ? void 0 : settings.dateEnd) !== null && _c !== void 0 ? _c : visual === null || visual === void 0 ? void 0 : visual.dateEnd);
|
|
11947
|
+
if ((!start && !end) || (start && end && end < start)) {
|
|
11948
|
+
return null;
|
|
11949
|
+
}
|
|
11950
|
+
return { start, end };
|
|
11951
|
+
}
|
|
11952
|
+
function isDateInRange(date, range) {
|
|
11953
|
+
const time = date.getTime();
|
|
11954
|
+
if (range.start && time < range.start.getTime()) {
|
|
11955
|
+
return false;
|
|
11956
|
+
}
|
|
11957
|
+
if (range.end && time > range.end.getTime()) {
|
|
11958
|
+
return false;
|
|
11959
|
+
}
|
|
11960
|
+
return true;
|
|
11961
|
+
}
|
|
11962
|
+
function watchTilesetDateRange(viewer, cTileset, tileset) {
|
|
11963
|
+
TilesetRenderEngine.WatchDateRange(viewer, cTileset, tileset);
|
|
11964
|
+
}
|
|
11965
|
+
function isDateRangeWatchAlive(viewer, renderObject) {
|
|
11966
|
+
if (!viewer || viewer.isDestroyed() || !renderObject) {
|
|
11967
|
+
return false;
|
|
11968
|
+
}
|
|
11969
|
+
if (typeof renderObject.isDestroyed === "function" && renderObject.isDestroyed()) {
|
|
11970
|
+
return false;
|
|
11971
|
+
}
|
|
11972
|
+
if (typeof renderObject.setVisible === "function") {
|
|
11973
|
+
return true;
|
|
11974
|
+
}
|
|
11975
|
+
if (typeof renderObject.isDestroyed !== "function") {
|
|
11976
|
+
return true;
|
|
11977
|
+
}
|
|
11978
|
+
return isAlive$2(viewer, renderObject);
|
|
11979
|
+
}
|
|
11980
|
+
function setDateRangeVisible(renderObject, visible) {
|
|
11981
|
+
if (typeof renderObject.setVisible === "function") {
|
|
11982
|
+
renderObject.setVisible(visible);
|
|
11983
|
+
}
|
|
11984
|
+
else {
|
|
11985
|
+
renderObject.show = visible;
|
|
11986
|
+
}
|
|
11987
|
+
renderObject._bruceDateRangeVisible = visible;
|
|
11988
|
+
}
|
|
11929
11989
|
/**
|
|
11930
11990
|
* Creates and returns a tileset instance from a given url.
|
|
11931
11991
|
* This is made to handle the difference between old and new cesium versions.
|
|
@@ -12197,6 +12257,7 @@ var TilesetRenderEngine;
|
|
|
12197
12257
|
}
|
|
12198
12258
|
const cTileset = await createTileset(loadUrl, null, params.noMemoryLimit);
|
|
12199
12259
|
params.viewer.scene.primitives.add(cTileset);
|
|
12260
|
+
watchTilesetDateRange(params.viewer, cTileset, params.tileset);
|
|
12200
12261
|
OnTilesetReady(cTileset).then(() => {
|
|
12201
12262
|
var _a, _b, _c, _d;
|
|
12202
12263
|
try {
|
|
@@ -12243,6 +12304,7 @@ var TilesetRenderEngine;
|
|
|
12243
12304
|
}
|
|
12244
12305
|
const cTileset = await createTileset(loadUrl, null, params.noMemoryLimit);
|
|
12245
12306
|
params.viewer.scene.primitives.add(cTileset);
|
|
12307
|
+
watchTilesetDateRange(params.viewer, cTileset, params.tileset);
|
|
12246
12308
|
return cTileset;
|
|
12247
12309
|
}
|
|
12248
12310
|
else if (params.tileset.type == Tileset.EType.PointCloud) {
|
|
@@ -12258,6 +12320,7 @@ var TilesetRenderEngine;
|
|
|
12258
12320
|
}
|
|
12259
12321
|
const cTileset = await createTileset(loadUrl, null, params.noMemoryLimit);
|
|
12260
12322
|
params.viewer.scene.primitives.add(cTileset);
|
|
12323
|
+
watchTilesetDateRange(params.viewer, cTileset, params.tileset);
|
|
12261
12324
|
OnTilesetReady(cTileset).then(() => {
|
|
12262
12325
|
var _a;
|
|
12263
12326
|
try {
|
|
@@ -12346,6 +12409,7 @@ var TilesetRenderEngine;
|
|
|
12346
12409
|
backFaceCulling: backFaceCulling === true
|
|
12347
12410
|
}, noMemoryLimit);
|
|
12348
12411
|
viewer.scene.primitives.add(cTileset);
|
|
12412
|
+
watchTilesetDateRange(viewer, cTileset, tileset);
|
|
12349
12413
|
OnTilesetReady(cTileset).then(() => {
|
|
12350
12414
|
var _a;
|
|
12351
12415
|
try {
|
|
@@ -12422,11 +12486,110 @@ var TilesetRenderEngine;
|
|
|
12422
12486
|
class Styler extends TilesetStyler {
|
|
12423
12487
|
}
|
|
12424
12488
|
TilesetRenderEngine.Styler = Styler;
|
|
12489
|
+
function GetTilesetDateRange(tileset) {
|
|
12490
|
+
return getTilesetDateRange(tileset);
|
|
12491
|
+
}
|
|
12492
|
+
TilesetRenderEngine.GetTilesetDateRange = GetTilesetDateRange;
|
|
12493
|
+
function WatchDateRange(viewer, renderObject, tileset) {
|
|
12494
|
+
var _a;
|
|
12495
|
+
const range = getTilesetDateRange(tileset);
|
|
12496
|
+
if (!range) {
|
|
12497
|
+
return;
|
|
12498
|
+
}
|
|
12499
|
+
(_a = GetDateRangeWatcher(viewer)) === null || _a === void 0 ? void 0 : _a.Watch(renderObject, range);
|
|
12500
|
+
}
|
|
12501
|
+
TilesetRenderEngine.WatchDateRange = WatchDateRange;
|
|
12502
|
+
function UnwatchDateRange(viewer, renderObject) {
|
|
12503
|
+
var _a;
|
|
12504
|
+
(_a = viewer === null || viewer === void 0 ? void 0 : viewer[VIEWER_DATE_RANGE_WATCH_KEY]) === null || _a === void 0 ? void 0 : _a.Unwatch(renderObject);
|
|
12505
|
+
}
|
|
12506
|
+
TilesetRenderEngine.UnwatchDateRange = UnwatchDateRange;
|
|
12425
12507
|
/**
|
|
12426
12508
|
* The maximum memory in MB that can be used by all tilesets.
|
|
12427
12509
|
* This is distributed evenly between all loaded tilesets.
|
|
12428
12510
|
*/
|
|
12429
12511
|
TilesetRenderEngine.MAX_TILESET_MEMORY = 1024;
|
|
12512
|
+
/**
|
|
12513
|
+
* Watches tileset date cutoffs and toggles their primitive visibility based on the viewer clock.
|
|
12514
|
+
*/
|
|
12515
|
+
class DateRangeWatcher {
|
|
12516
|
+
constructor(viewer) {
|
|
12517
|
+
this.watched = [];
|
|
12518
|
+
this.clockRemoval = null;
|
|
12519
|
+
this.viewer = viewer;
|
|
12520
|
+
this.clockRemoval = viewer.clock.onTick.addEventListener(() => {
|
|
12521
|
+
this.update();
|
|
12522
|
+
});
|
|
12523
|
+
}
|
|
12524
|
+
clean() {
|
|
12525
|
+
this.watched = this.watched.filter(x => isDateRangeWatchAlive(this.viewer, x));
|
|
12526
|
+
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
12527
|
+
this.destroy();
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12530
|
+
updateTileset(tileset) {
|
|
12531
|
+
if (!(tileset === null || tileset === void 0 ? void 0 : tileset._bruceDateRange) || !isDateRangeWatchAlive(this.viewer, tileset)) {
|
|
12532
|
+
return false;
|
|
12533
|
+
}
|
|
12534
|
+
const currentDate = JulianDate.toDate(this.viewer.clock.currentTime);
|
|
12535
|
+
const shouldShow = isDateInRange(currentDate, tileset._bruceDateRange);
|
|
12536
|
+
if (tileset._bruceDateRangeVisible === shouldShow && (typeof tileset.setVisible === "function" || tileset.show === shouldShow)) {
|
|
12537
|
+
return false;
|
|
12538
|
+
}
|
|
12539
|
+
setDateRangeVisible(tileset, shouldShow);
|
|
12540
|
+
return true;
|
|
12541
|
+
}
|
|
12542
|
+
update() {
|
|
12543
|
+
this.clean();
|
|
12544
|
+
let changed = false;
|
|
12545
|
+
this.watched.forEach(x => {
|
|
12546
|
+
changed = this.updateTileset(x) || changed;
|
|
12547
|
+
});
|
|
12548
|
+
if (changed) {
|
|
12549
|
+
this.viewer.scene.requestRender();
|
|
12550
|
+
}
|
|
12551
|
+
}
|
|
12552
|
+
destroy() {
|
|
12553
|
+
var _a;
|
|
12554
|
+
(_a = this.clockRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
12555
|
+
this.clockRemoval = null;
|
|
12556
|
+
this.watched = [];
|
|
12557
|
+
}
|
|
12558
|
+
Watch(tileset, range) {
|
|
12559
|
+
if (!tileset) {
|
|
12560
|
+
return;
|
|
12561
|
+
}
|
|
12562
|
+
if (!(range === null || range === void 0 ? void 0 : range.start) && !(range === null || range === void 0 ? void 0 : range.end)) {
|
|
12563
|
+
this.Unwatch(tileset);
|
|
12564
|
+
return;
|
|
12565
|
+
}
|
|
12566
|
+
if (!tileset[DATE_RANGE_WATCH_KEY]) {
|
|
12567
|
+
tileset[DATE_RANGE_WATCH_KEY] = ObjectUtils.UId();
|
|
12568
|
+
}
|
|
12569
|
+
tileset._bruceDateRange = range;
|
|
12570
|
+
const index = this.watched.findIndex(x => x[DATE_RANGE_WATCH_KEY] === tileset[DATE_RANGE_WATCH_KEY]);
|
|
12571
|
+
if (index < 0) {
|
|
12572
|
+
this.watched.push(tileset);
|
|
12573
|
+
}
|
|
12574
|
+
if (this.updateTileset(tileset)) {
|
|
12575
|
+
this.viewer.scene.requestRender();
|
|
12576
|
+
}
|
|
12577
|
+
}
|
|
12578
|
+
Unwatch(tileset) {
|
|
12579
|
+
if (!tileset) {
|
|
12580
|
+
return;
|
|
12581
|
+
}
|
|
12582
|
+
if (!tileset[DATE_RANGE_WATCH_KEY]) {
|
|
12583
|
+
tileset[DATE_RANGE_WATCH_KEY] = ObjectUtils.UId();
|
|
12584
|
+
}
|
|
12585
|
+
const index = this.watched.findIndex(x => (x === null || x === void 0 ? void 0 : x[DATE_RANGE_WATCH_KEY]) === tileset[DATE_RANGE_WATCH_KEY]);
|
|
12586
|
+
if (index > -1) {
|
|
12587
|
+
this.watched.splice(index, 1);
|
|
12588
|
+
}
|
|
12589
|
+
tileset._bruceDateRange = null;
|
|
12590
|
+
}
|
|
12591
|
+
}
|
|
12592
|
+
TilesetRenderEngine.DateRangeWatcher = DateRangeWatcher;
|
|
12430
12593
|
/**
|
|
12431
12594
|
* Watches tilesets in the viewer.
|
|
12432
12595
|
* This will regulate their max memory param.
|
|
@@ -12480,9 +12643,11 @@ var TilesetRenderEngine;
|
|
|
12480
12643
|
this.distributeMemory();
|
|
12481
12644
|
}
|
|
12482
12645
|
Unwatch(tileset) {
|
|
12646
|
+
var _a, _b;
|
|
12483
12647
|
if (!tileset) {
|
|
12484
12648
|
return;
|
|
12485
12649
|
}
|
|
12650
|
+
(_b = (_a = this.viewer) === null || _a === void 0 ? void 0 : _a[VIEWER_DATE_RANGE_WATCH_KEY]) === null || _b === void 0 ? void 0 : _b.Unwatch(tileset);
|
|
12486
12651
|
if (!tileset[WATCH_KEY]) {
|
|
12487
12652
|
tileset[WATCH_KEY] = ObjectUtils.UId();
|
|
12488
12653
|
}
|
|
@@ -12505,6 +12670,17 @@ var TilesetRenderEngine;
|
|
|
12505
12670
|
return viewer[VIEWER_WATCH_KEY];
|
|
12506
12671
|
}
|
|
12507
12672
|
TilesetRenderEngine.GetMemoryWatcher = GetMemoryWatcher;
|
|
12673
|
+
function GetDateRangeWatcher(viewer) {
|
|
12674
|
+
// If viewer is dead return nothing.
|
|
12675
|
+
if (!viewer || viewer.isDestroyed()) {
|
|
12676
|
+
return null;
|
|
12677
|
+
}
|
|
12678
|
+
if (!viewer[VIEWER_DATE_RANGE_WATCH_KEY]) {
|
|
12679
|
+
viewer[VIEWER_DATE_RANGE_WATCH_KEY] = new DateRangeWatcher(viewer);
|
|
12680
|
+
}
|
|
12681
|
+
return viewer[VIEWER_DATE_RANGE_WATCH_KEY];
|
|
12682
|
+
}
|
|
12683
|
+
TilesetRenderEngine.GetDateRangeWatcher = GetDateRangeWatcher;
|
|
12508
12684
|
})(TilesetRenderEngine || (TilesetRenderEngine = {}));
|
|
12509
12685
|
|
|
12510
12686
|
/**
|
|
@@ -12676,6 +12852,236 @@ function getOrCreateCell(cells, cellSize, lon, maxLon, lat, maxLat) {
|
|
|
12676
12852
|
return [id, cell];
|
|
12677
12853
|
}
|
|
12678
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
|
+
|
|
12679
13085
|
const MAX_AREA_IN_DEGREES$1 = 90;
|
|
12680
13086
|
const MAX_RETRY_ATTEMPTS = 1;
|
|
12681
13087
|
const RETRY_DELAY_INCREMENT = 500;
|
|
@@ -12753,7 +13159,7 @@ var EntityFilterGetter;
|
|
|
12753
13159
|
// We use this for refreshing historic data without having to repeat geographic queries.
|
|
12754
13160
|
this.gatheredIntegrity = null;
|
|
12755
13161
|
this.gatheredEntityIds = [];
|
|
12756
|
-
const { api, viewer, viewPort, typeIds, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario } = params;
|
|
13162
|
+
const { api, viewer, viewPort, typeIds, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario, dataLab } = params;
|
|
12757
13163
|
this.api = api;
|
|
12758
13164
|
this.typeIds = typeIds;
|
|
12759
13165
|
this.schemaId = schemaId;
|
|
@@ -12764,6 +13170,7 @@ var EntityFilterGetter;
|
|
|
12764
13170
|
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
12765
13171
|
this.viewPort = viewPort;
|
|
12766
13172
|
this.attrFilter = attrFilter;
|
|
13173
|
+
this.dataLab = dataLab;
|
|
12767
13174
|
this.viewer = viewer;
|
|
12768
13175
|
this.scenario = scenario ? scenario : 0;
|
|
12769
13176
|
this.updateBounds();
|
|
@@ -12788,6 +13195,9 @@ var EntityFilterGetter;
|
|
|
12788
13195
|
if (this.typeIds) {
|
|
12789
13196
|
integrity += this.typeIds.join();
|
|
12790
13197
|
}
|
|
13198
|
+
if (this.dataLab) {
|
|
13199
|
+
integrity += JSON.stringify(this.dataLab);
|
|
13200
|
+
}
|
|
12791
13201
|
return integrity;
|
|
12792
13202
|
}
|
|
12793
13203
|
viewAreaSub() {
|
|
@@ -12894,6 +13304,22 @@ var EntityFilterGetter;
|
|
|
12894
13304
|
delete this.registeredItems[menuItemId];
|
|
12895
13305
|
this.updateState(true);
|
|
12896
13306
|
}
|
|
13307
|
+
Dispose() {
|
|
13308
|
+
var _a, _b, _c, _d;
|
|
13309
|
+
this.registeredItems = {};
|
|
13310
|
+
this.getterLoopId += 1;
|
|
13311
|
+
for (const key in this.getterLoopAbortControllers) {
|
|
13312
|
+
this.getterLoopAbortControllers[key].abort();
|
|
13313
|
+
}
|
|
13314
|
+
this.getterLoopAbortControllers = {};
|
|
13315
|
+
(_a = this.historicRefreshAbortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
13316
|
+
this.historicRefreshAbortController = null;
|
|
13317
|
+
this.viewAreaDispose();
|
|
13318
|
+
this.viewerDateTimeDispose();
|
|
13319
|
+
(_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Clear();
|
|
13320
|
+
(_c = this.onStateUpdate) === null || _c === void 0 ? void 0 : _c.Clear();
|
|
13321
|
+
(_d = this.onScanUpdate) === null || _d === void 0 ? void 0 : _d.Clear();
|
|
13322
|
+
}
|
|
12897
13323
|
updateBounds() {
|
|
12898
13324
|
const viewRect = this.viewPort.GetBounds();
|
|
12899
13325
|
const poi = this.viewPort.GetTarget();
|
|
@@ -12964,6 +13390,67 @@ var EntityFilterGetter;
|
|
|
12964
13390
|
this.LastStateUpdates[status.msg] = status;
|
|
12965
13391
|
(_a = this.onStateUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(status);
|
|
12966
13392
|
}
|
|
13393
|
+
createDataLabQuery(bounds) {
|
|
13394
|
+
var _a;
|
|
13395
|
+
const dataLab = this.dataLab;
|
|
13396
|
+
const userItems = (dataLab === null || dataLab === void 0 ? void 0 : dataLab.queryItems) ? JSON.parse(JSON.stringify(dataLab.queryItems)) : [];
|
|
13397
|
+
const primaryKey = DataLab.EReqKey.Primary;
|
|
13398
|
+
const baseQuery = (dataLab === null || dataLab === void 0 ? void 0 : dataLab.query) ? JSON.parse(JSON.stringify(dataLab.query)) : {};
|
|
13399
|
+
const basePrimary = (_a = baseQuery === null || baseQuery === void 0 ? void 0 : baseQuery[primaryKey]) !== null && _a !== void 0 ? _a : {};
|
|
13400
|
+
const items = [
|
|
13401
|
+
{
|
|
13402
|
+
LogicOperator: "AND",
|
|
13403
|
+
AttributeValue: {
|
|
13404
|
+
AttributePath: "Bruce/Boundaries",
|
|
13405
|
+
OperandA: ViewGroundArea.ToBboxPolygon(bounds),
|
|
13406
|
+
Operator: "intersects"
|
|
13407
|
+
},
|
|
13408
|
+
key: "attribute"
|
|
13409
|
+
}
|
|
13410
|
+
];
|
|
13411
|
+
if (userItems.length) {
|
|
13412
|
+
items.push({
|
|
13413
|
+
LogicOperator: "AND",
|
|
13414
|
+
Items: [],
|
|
13415
|
+
key: "subquery",
|
|
13416
|
+
Subquery: {
|
|
13417
|
+
Items: userItems
|
|
13418
|
+
}
|
|
13419
|
+
});
|
|
13420
|
+
}
|
|
13421
|
+
baseQuery[primaryKey] = {
|
|
13422
|
+
...basePrimary,
|
|
13423
|
+
Items: items
|
|
13424
|
+
};
|
|
13425
|
+
baseQuery.Expand = "location,source";
|
|
13426
|
+
return baseQuery;
|
|
13427
|
+
}
|
|
13428
|
+
async getDataLabResponse(params) {
|
|
13429
|
+
var _a;
|
|
13430
|
+
const { bounds, pageIndex, pageSize, abortSignal } = params;
|
|
13431
|
+
const skip = pageIndex * pageSize;
|
|
13432
|
+
const data = await DataLab.Run({
|
|
13433
|
+
api: this.api,
|
|
13434
|
+
query: this.createDataLabQuery(bounds),
|
|
13435
|
+
skip,
|
|
13436
|
+
load: pageSize,
|
|
13437
|
+
migrated: true,
|
|
13438
|
+
req: {
|
|
13439
|
+
noCache: true,
|
|
13440
|
+
abortSignal
|
|
13441
|
+
}
|
|
13442
|
+
});
|
|
13443
|
+
const entities = (_a = data.entities) !== null && _a !== void 0 ? _a : [];
|
|
13444
|
+
const totalCount = data.totalCount;
|
|
13445
|
+
const nextPage = totalCount != null
|
|
13446
|
+
? skip + entities.length < totalCount
|
|
13447
|
+
: entities.length >= pageSize;
|
|
13448
|
+
return {
|
|
13449
|
+
entities,
|
|
13450
|
+
nextPage,
|
|
13451
|
+
nextPageUrl: null
|
|
13452
|
+
};
|
|
13453
|
+
}
|
|
12967
13454
|
startGetterLoop() {
|
|
12968
13455
|
// Increase id so that existing loops stop.
|
|
12969
13456
|
this.getterLoopId += 1;
|
|
@@ -13042,13 +13529,24 @@ var EntityFilterGetter;
|
|
|
13042
13529
|
nextPage: false,
|
|
13043
13530
|
nextPageUrl: null
|
|
13044
13531
|
};
|
|
13045
|
-
|
|
13532
|
+
const queueName = this.dataLab
|
|
13533
|
+
? "Loading DataLab Entities from Menu Item"
|
|
13534
|
+
: "Loading Entities from Menu Item that loads Entity Type: " + this.typeIds;
|
|
13535
|
+
await SharedGetters.Queue.Run(queueName, async () => {
|
|
13046
13536
|
var _a;
|
|
13047
13537
|
if (abortController.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
13048
13538
|
return;
|
|
13049
13539
|
}
|
|
13540
|
+
if (this.dataLab) {
|
|
13541
|
+
response = await this.getDataLabResponse({
|
|
13542
|
+
bounds: curCell.GetBounds(),
|
|
13543
|
+
pageIndex: curCell.FetchPageIndex,
|
|
13544
|
+
pageSize: PAGE_SIZE,
|
|
13545
|
+
abortSignal: abortController.signal
|
|
13546
|
+
});
|
|
13547
|
+
}
|
|
13050
13548
|
// API gave us a URL to use.
|
|
13051
|
-
if (curCell.FetchURL) {
|
|
13549
|
+
else if (curCell.FetchURL) {
|
|
13052
13550
|
const tmpResponse = await this.api.get(curCell.FetchURL, {
|
|
13053
13551
|
abortSignal: abortController.signal,
|
|
13054
13552
|
noCache: true
|
|
@@ -13318,6 +13816,9 @@ function createFilterGetterCacheKey(params) {
|
|
|
13318
13816
|
cacheKey += params.historicAttrKey ? params.historicAttrKey : "";
|
|
13319
13817
|
cacheKey += params.historic ? "true" : "false";
|
|
13320
13818
|
cacheKey += params.scenario ? params.scenario : 0;
|
|
13819
|
+
if (params.dataLab) {
|
|
13820
|
+
cacheKey += JSON.stringify(params.dataLab);
|
|
13821
|
+
}
|
|
13321
13822
|
if (params.historicAttrKey) {
|
|
13322
13823
|
cacheKey += params.historicInterpolation ? "true" : "false";
|
|
13323
13824
|
}
|
|
@@ -13349,6 +13850,7 @@ var SharedGetters;
|
|
|
13349
13850
|
historicInterpolation: params.historicInterpolation,
|
|
13350
13851
|
viaCdn: params.cdn,
|
|
13351
13852
|
scenario: params.scenario,
|
|
13853
|
+
dataLab: params.dataLab,
|
|
13352
13854
|
});
|
|
13353
13855
|
this.data[cacheKey] = getter;
|
|
13354
13856
|
/**
|
|
@@ -14691,6 +15193,8 @@ var TilesetCadRenderManager;
|
|
|
14691
15193
|
TilesetCadRenderManager.Manager = Manager;
|
|
14692
15194
|
})(TilesetCadRenderManager || (TilesetCadRenderManager = {}));
|
|
14693
15195
|
|
|
15196
|
+
const BATCH_SIZE$3 = 500;
|
|
15197
|
+
const CHECK_BATCH_SIZE$2 = 250;
|
|
14694
15198
|
var DataLabRenderManager;
|
|
14695
15199
|
(function (DataLabRenderManager) {
|
|
14696
15200
|
class Manager {
|
|
@@ -14699,7 +15203,18 @@ var DataLabRenderManager;
|
|
|
14699
15203
|
}
|
|
14700
15204
|
constructor(params) {
|
|
14701
15205
|
this.getter = null;
|
|
15206
|
+
this.getterSub = null;
|
|
14702
15207
|
this.disposed = false;
|
|
15208
|
+
this.renderedEntities = {};
|
|
15209
|
+
this.entityCheckQueue = null;
|
|
15210
|
+
this.entityCheckQueueIds = [];
|
|
15211
|
+
this.isRunningCheck = false;
|
|
15212
|
+
this.viewMonitorRemoval = null;
|
|
15213
|
+
this.renderQueue = [];
|
|
15214
|
+
this.renderQueueInterval = null;
|
|
15215
|
+
this.reRenderState = new EntityReRenderMaintainState();
|
|
15216
|
+
this.zoomControl = [];
|
|
15217
|
+
this.queryLoadId = 0;
|
|
14703
15218
|
const { viewer, item, apiGetter, monitor, visualsRegister } = params;
|
|
14704
15219
|
this.viewer = viewer;
|
|
14705
15220
|
this.item = item;
|
|
@@ -14707,13 +15222,54 @@ var DataLabRenderManager;
|
|
|
14707
15222
|
this.monitor = monitor;
|
|
14708
15223
|
this.visualsManager = visualsRegister;
|
|
14709
15224
|
}
|
|
14710
|
-
Init() {
|
|
15225
|
+
Init(params) {
|
|
14711
15226
|
var _a;
|
|
14712
15227
|
if (this.disposed) {
|
|
14713
15228
|
throw new Error("This manager has already been disposed.");
|
|
14714
15229
|
}
|
|
14715
|
-
if (
|
|
14716
|
-
this.item
|
|
15230
|
+
if (params === null || params === void 0 ? void 0 : params.item) {
|
|
15231
|
+
this.item = params.item;
|
|
15232
|
+
}
|
|
15233
|
+
this.queryLoadId += 1;
|
|
15234
|
+
const loadId = this.queryLoadId;
|
|
15235
|
+
this.unsetGetter();
|
|
15236
|
+
(_a = this.viewMonitorRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
15237
|
+
this.viewMonitorRemoval = null;
|
|
15238
|
+
clearInterval(this.renderQueueInterval);
|
|
15239
|
+
this.renderQueueInterval = null;
|
|
15240
|
+
this.renderQueue = [];
|
|
15241
|
+
this.renderedEntities = {};
|
|
15242
|
+
this.ensureSettings();
|
|
15243
|
+
this.visualsManager.RemoveRegos({
|
|
15244
|
+
menuItemId: this.item.id
|
|
15245
|
+
});
|
|
15246
|
+
this.setEntityCheckQueue();
|
|
15247
|
+
(async () => {
|
|
15248
|
+
var _a, _b, _c, _d;
|
|
15249
|
+
try {
|
|
15250
|
+
const { query } = await DataLab.Get({
|
|
15251
|
+
api: this.apiGetter.getApi(),
|
|
15252
|
+
queryId: this.item.DataLabQueryID,
|
|
15253
|
+
req: {
|
|
15254
|
+
noCache: true
|
|
15255
|
+
}
|
|
15256
|
+
});
|
|
15257
|
+
if (this.disposed || loadId != this.queryLoadId) {
|
|
15258
|
+
return;
|
|
15259
|
+
}
|
|
15260
|
+
const queryItems = (_d = (_b = (_a = query === null || query === void 0 ? void 0 : query.PrimarySelectionCriteria) === null || _a === void 0 ? void 0 : _a.Items) !== null && _b !== void 0 ? _b : (_c = query === null || query === void 0 ? void 0 : query[DataLab.EReqKey.Primary]) === null || _c === void 0 ? void 0 : _c.Items) !== null && _d !== void 0 ? _d : [];
|
|
15261
|
+
this.setGetter(queryItems);
|
|
15262
|
+
}
|
|
15263
|
+
catch (e) {
|
|
15264
|
+
console.error("Failed to initialise DataLab render manager:", e);
|
|
15265
|
+
}
|
|
15266
|
+
})();
|
|
15267
|
+
}
|
|
15268
|
+
ensureSettings() {
|
|
15269
|
+
var _a;
|
|
15270
|
+
this.zoomControl = this.item.CameraZoomSettings;
|
|
15271
|
+
if (!((_a = this.zoomControl) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
15272
|
+
this.zoomControl = [
|
|
14717
15273
|
{
|
|
14718
15274
|
MinZoom: 0,
|
|
14719
15275
|
MaxZoom: 200000,
|
|
@@ -14723,17 +15279,74 @@ var DataLabRenderManager;
|
|
|
14723
15279
|
StyleID: 0
|
|
14724
15280
|
}
|
|
14725
15281
|
];
|
|
15282
|
+
this.item.CameraZoomSettings = this.zoomControl;
|
|
14726
15283
|
}
|
|
14727
15284
|
this.renderPriority = this.item.renderPriority;
|
|
14728
15285
|
if (this.renderPriority == null) {
|
|
14729
15286
|
this.renderPriority = 3;
|
|
14730
15287
|
}
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
this.
|
|
14734
|
-
|
|
15288
|
+
}
|
|
15289
|
+
setGetter(queryItems) {
|
|
15290
|
+
this.unsetGetter();
|
|
15291
|
+
this.getter = new EntityFilterGetter.Getter({
|
|
15292
|
+
api: this.apiGetter.getApi(),
|
|
15293
|
+
attrFilter: {},
|
|
15294
|
+
batchSize: BATCH_SIZE$3,
|
|
15295
|
+
typeIds: null,
|
|
15296
|
+
viewPort: this.monitor,
|
|
15297
|
+
viewer: this.viewer,
|
|
15298
|
+
dataLab: {
|
|
15299
|
+
queryItems: queryItems !== null && queryItems !== void 0 ? queryItems : []
|
|
15300
|
+
}
|
|
14735
15301
|
});
|
|
14736
|
-
|
|
15302
|
+
const minMax = RenderManager.GetZoomMinMax({
|
|
15303
|
+
zoomControl: this.zoomControl
|
|
15304
|
+
});
|
|
15305
|
+
this.getter.IncludeMenuItem(this.item.id, null, [], minMax[0], minMax[1]);
|
|
15306
|
+
this.getterSub = this.getter.OnUpdate.Subscribe((data) => {
|
|
15307
|
+
var _a;
|
|
15308
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.entities) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
15309
|
+
return;
|
|
15310
|
+
}
|
|
15311
|
+
this.distributeForRender(data.entities);
|
|
15312
|
+
});
|
|
15313
|
+
}
|
|
15314
|
+
unsetGetter() {
|
|
15315
|
+
var _a, _b, _c;
|
|
15316
|
+
(_a = this.getter) === null || _a === void 0 ? void 0 : _a.ExcludeMenuItem(this.item.id);
|
|
15317
|
+
(_b = this.getterSub) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
15318
|
+
this.getterSub = null;
|
|
15319
|
+
(_c = this.getter) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
15320
|
+
this.getter = null;
|
|
15321
|
+
}
|
|
15322
|
+
setEntityCheckQueue() {
|
|
15323
|
+
var _a, _b;
|
|
15324
|
+
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
15325
|
+
this.entityCheckQueue = null;
|
|
15326
|
+
const displayItems = this.zoomControl ? this.zoomControl.filter(x => x.DisplayType != ZoomControl.EDisplayType.Hidden) : [];
|
|
15327
|
+
const shouldCheck = displayItems.length > 1;
|
|
15328
|
+
this.entityCheckQueue = new DelayQueue(() => {
|
|
15329
|
+
this.doEntityCheck(Object.keys(this.renderedEntities));
|
|
15330
|
+
}, shouldCheck ? 3000 : 30000);
|
|
15331
|
+
(_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
15332
|
+
this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
|
|
15333
|
+
var _a;
|
|
15334
|
+
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Call();
|
|
15335
|
+
});
|
|
15336
|
+
}
|
|
15337
|
+
preventCurrentCheckApiRefresh(entityIds) {
|
|
15338
|
+
var _a;
|
|
15339
|
+
this.reRenderState.markSkipForCurrentRun(entityIds, this.isRunningCheck);
|
|
15340
|
+
if ((_a = this.entityCheckQueueIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
15341
|
+
const lookup = {};
|
|
15342
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
15343
|
+
const id = entityIds[i];
|
|
15344
|
+
if (id) {
|
|
15345
|
+
lookup[id] = true;
|
|
15346
|
+
}
|
|
15347
|
+
}
|
|
15348
|
+
this.entityCheckQueueIds = this.entityCheckQueueIds.filter(id => !lookup[id]);
|
|
15349
|
+
}
|
|
14737
15350
|
}
|
|
14738
15351
|
Dispose() {
|
|
14739
15352
|
if (this.disposed) {
|
|
@@ -14742,321 +15355,293 @@ var DataLabRenderManager;
|
|
|
14742
15355
|
this.doDispose();
|
|
14743
15356
|
}
|
|
14744
15357
|
doDispose() {
|
|
14745
|
-
var _a;
|
|
15358
|
+
var _a, _b;
|
|
14746
15359
|
this.disposed = true;
|
|
14747
|
-
|
|
15360
|
+
this.queryLoadId += 1;
|
|
15361
|
+
this.unsetGetter();
|
|
15362
|
+
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Dispose();
|
|
15363
|
+
this.entityCheckQueue = null;
|
|
15364
|
+
(_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
15365
|
+
this.viewMonitorRemoval = null;
|
|
15366
|
+
clearInterval(this.renderQueueInterval);
|
|
15367
|
+
this.renderQueueInterval = null;
|
|
15368
|
+
this.renderQueue = [];
|
|
15369
|
+
this.entityCheckQueueIds = [];
|
|
14748
15370
|
this.visualsManager.RemoveRegos({
|
|
14749
15371
|
menuItemId: this.item.id
|
|
14750
15372
|
});
|
|
14751
15373
|
}
|
|
14752
|
-
async
|
|
14753
|
-
|
|
14754
|
-
if (this.disposed
|
|
15374
|
+
async ReRender(params) {
|
|
15375
|
+
let { entityIds, force, entities, maintain } = params;
|
|
15376
|
+
if (this.disposed) {
|
|
14755
15377
|
return;
|
|
14756
15378
|
}
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
const result = await DataLab.Get({ api, queryId });
|
|
14760
|
-
const query = result.query;
|
|
14761
|
-
const queryResult = await DataLab.Run({ api, query: {
|
|
14762
|
-
[DataLab.EReqKey.Primary]: {
|
|
14763
|
-
Items: ((_a = query === null || query === void 0 ? void 0 : query.PrimarySelectionCriteria) === null || _a === void 0 ? void 0 : _a.Items) || [],
|
|
14764
|
-
}
|
|
14765
|
-
} });
|
|
14766
|
-
this.renderDataLabEntities(queryResult.entities || []);
|
|
15379
|
+
if (entities && !entityIds) {
|
|
15380
|
+
entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
14767
15381
|
}
|
|
14768
|
-
|
|
14769
|
-
|
|
15382
|
+
if (entityIds == null) {
|
|
15383
|
+
entityIds = Object.keys(this.renderedEntities);
|
|
14770
15384
|
}
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
if (this.disposed || this.viewer.isDestroyed()) {
|
|
15385
|
+
entityIds = entityIds.filter((x, index) => !!x && entityIds.indexOf(x) === index);
|
|
15386
|
+
if (!entityIds.length) {
|
|
14774
15387
|
return;
|
|
14775
15388
|
}
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
15389
|
+
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
15390
|
+
entities = [].concat(entities).filter(x => { var _a; return entityIds.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID); });
|
|
15391
|
+
if (force) {
|
|
15392
|
+
this.reRenderState.bumpApiRevisions(entityIds);
|
|
15393
|
+
this.preventCurrentCheckApiRefresh(entityIds);
|
|
15394
|
+
}
|
|
15395
|
+
}
|
|
15396
|
+
if (maintain === true && (entities === null || entities === void 0 ? void 0 : entities.length)) {
|
|
15397
|
+
this.reRenderState.setMaintainedEntities(entities);
|
|
15398
|
+
}
|
|
15399
|
+
else if (maintain !== true) {
|
|
15400
|
+
this.reRenderState.clearMaintainedEntities(entityIds);
|
|
15401
|
+
}
|
|
15402
|
+
this.visualsManager.MarkStale({
|
|
15403
|
+
entityIds: entityIds,
|
|
15404
|
+
menuItemIds: [this.item.id]
|
|
14783
15405
|
});
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
const cEntity = cEntities.get(id);
|
|
14788
|
-
if (cEntity) {
|
|
14789
|
-
const rego = this.visualsManager.GetRego({
|
|
14790
|
-
entityId: id,
|
|
14791
|
-
menuItemId: this.item.id
|
|
14792
|
-
});
|
|
14793
|
-
if (!rego) {
|
|
14794
|
-
this.visualsManager.AddRego({
|
|
14795
|
-
rego: {
|
|
14796
|
-
canEdit: true,
|
|
14797
|
-
entityId: id,
|
|
14798
|
-
menuItemId: this.item.id,
|
|
14799
|
-
menuItemType: this.item.Type,
|
|
14800
|
-
visual: cEntity,
|
|
14801
|
-
priority: this.renderPriority,
|
|
14802
|
-
entityTypeId: entity.Bruce["EntityType.ID"],
|
|
14803
|
-
accountId: this.apiGetter.accountId,
|
|
14804
|
-
name: cEntity.name
|
|
14805
|
-
},
|
|
14806
|
-
requestRender: false
|
|
14807
|
-
});
|
|
14808
|
-
}
|
|
15406
|
+
if (entities === null || entities === void 0 ? void 0 : entities.length) {
|
|
15407
|
+
if (force) {
|
|
15408
|
+
await this.renderDataLabEntities(entities, true);
|
|
14809
15409
|
}
|
|
14810
15410
|
else {
|
|
14811
|
-
this.
|
|
14812
|
-
entityId: id,
|
|
14813
|
-
menuItemId: this.item.id,
|
|
14814
|
-
requestRender: false
|
|
14815
|
-
});
|
|
15411
|
+
this.distributeForRender(entities);
|
|
14816
15412
|
}
|
|
14817
15413
|
}
|
|
14818
|
-
|
|
15414
|
+
else {
|
|
15415
|
+
await this.doEntityCheck(entityIds, force);
|
|
15416
|
+
}
|
|
14819
15417
|
}
|
|
14820
|
-
|
|
15418
|
+
UpdateSettings(params) {
|
|
15419
|
+
const { zoomControl, queueRerender } = params;
|
|
14821
15420
|
if (this.disposed) {
|
|
14822
15421
|
return;
|
|
14823
15422
|
}
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
return value !== null && value !== undefined;
|
|
14837
|
-
}
|
|
14838
|
-
function netScanViewForBoundaries(viewer, center) {
|
|
14839
|
-
let maxLong = -2 * Math.PI;
|
|
14840
|
-
let minLong = 2 * Math.PI;
|
|
14841
|
-
let maxLat = -2 * Math.PI;
|
|
14842
|
-
let minLat = 2 * Math.PI;
|
|
14843
|
-
let found = 0;
|
|
14844
|
-
const updateMinMax = (lon, lat) => {
|
|
14845
|
-
if (lon < -Math.PI || lon > Math.PI || lat < -Math.PI / 2 || lat > Math.PI / 2) {
|
|
14846
|
-
return;
|
|
14847
|
-
}
|
|
14848
|
-
maxLong = Math.max(maxLong, lon);
|
|
14849
|
-
maxLat = Math.max(maxLat, lat);
|
|
14850
|
-
minLong = Math.min(minLong, lon);
|
|
14851
|
-
minLat = Math.min(minLat, lat);
|
|
14852
|
-
};
|
|
14853
|
-
const updateMinMaxForPoint = (stepX, stepY) => {
|
|
14854
|
-
const x = Math.round((viewer.container.clientWidth / 100) * (stepX * NET_STEP_PERCENT));
|
|
14855
|
-
const y = Math.round((viewer.container.clientHeight / 100) * (stepY * NET_STEP_PERCENT));
|
|
14856
|
-
const winPos = new Cartesian2(x, y);
|
|
14857
|
-
try {
|
|
14858
|
-
const intersection = getAdjustedGroundIntersectionOfCameraRay(viewer, winPos);
|
|
14859
|
-
if (intersection) {
|
|
14860
|
-
const point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
14861
|
-
updateMinMax(point.longitude, point.latitude);
|
|
14862
|
-
found++;
|
|
15423
|
+
if (zoomControl === null || zoomControl === void 0 ? void 0 : zoomControl.length) {
|
|
15424
|
+
this.zoomControl = zoomControl;
|
|
15425
|
+
this.item.CameraZoomSettings = zoomControl;
|
|
15426
|
+
this.setEntityCheckQueue();
|
|
15427
|
+
}
|
|
15428
|
+
if (queueRerender != false) {
|
|
15429
|
+
const entityIds = Object.keys(this.renderedEntities);
|
|
15430
|
+
this.visualsManager.MarkStale({
|
|
15431
|
+
entityIds,
|
|
15432
|
+
menuItemIds: [this.item.id]
|
|
15433
|
+
});
|
|
15434
|
+
this.doEntityCheck(entityIds);
|
|
14863
15435
|
}
|
|
14864
15436
|
}
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
updateMinMaxForPoint(BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
14872
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS, (100 / NET_STEP_PERCENT) - BORDER_STEPS);
|
|
14873
|
-
updateMinMaxForPoint(BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
14874
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, BORDER_STEPS * 2);
|
|
14875
|
-
updateMinMaxForPoint(BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
14876
|
-
updateMinMaxForPoint((100 / NET_STEP_PERCENT) - BORDER_STEPS * 2, (100 / NET_STEP_PERCENT) - BORDER_STEPS * 2);
|
|
14877
|
-
if (center && found <= 0) {
|
|
14878
|
-
updateMinMax(Math$1.toRadians(center.longitude), Math$1.toRadians(center.latitude));
|
|
14879
|
-
found += 1;
|
|
14880
|
-
const size = viewer.camera.positionCartographic.height;
|
|
14881
|
-
const pitch = viewer.camera.pitch;
|
|
14882
|
-
const distance = size / Math.tan(pitch);
|
|
14883
|
-
const p1 = offsetPoint({
|
|
14884
|
-
altitude: center.altitude,
|
|
14885
|
-
latitude: center.latitude,
|
|
14886
|
-
longitude: center.longitude
|
|
14887
|
-
}, distance, 45);
|
|
14888
|
-
const p2 = offsetPoint({
|
|
14889
|
-
altitude: center.altitude,
|
|
14890
|
-
latitude: center.latitude,
|
|
14891
|
-
longitude: center.longitude
|
|
14892
|
-
}, -distance, 45);
|
|
14893
|
-
if (isDefined(p1 === null || p1 === void 0 ? void 0 : p1.latitude) && isDefined(p1 === null || p1 === void 0 ? void 0 : p1.longitude)) {
|
|
14894
|
-
updateMinMax(Math$1.toRadians(p1.longitude), Math$1.toRadians(p1.latitude));
|
|
14895
|
-
}
|
|
14896
|
-
if (isDefined(p2 === null || p2 === void 0 ? void 0 : p2.latitude) && isDefined(p2 === null || p2 === void 0 ? void 0 : p2.longitude)) {
|
|
14897
|
-
updateMinMax(Math$1.toRadians(p2.longitude), Math$1.toRadians(p2.latitude));
|
|
14898
|
-
}
|
|
14899
|
-
}
|
|
14900
|
-
if (found > 0) {
|
|
14901
|
-
return {
|
|
14902
|
-
east: maxLong,
|
|
14903
|
-
west: minLong,
|
|
14904
|
-
north: maxLat,
|
|
14905
|
-
south: minLat
|
|
14906
|
-
};
|
|
14907
|
-
}
|
|
14908
|
-
return null;
|
|
14909
|
-
}
|
|
14910
|
-
function offsetPoint(point, distance, heading) {
|
|
14911
|
-
const radius = 6371e3;
|
|
14912
|
-
const delta = distance / radius;
|
|
14913
|
-
const theta = Math$1.toRadians(heading);
|
|
14914
|
-
const phi1 = Math$1.toRadians(point.latitude);
|
|
14915
|
-
const lambda1 = Math$1.toRadians(point.longitude);
|
|
14916
|
-
const sinPhi2 = Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta);
|
|
14917
|
-
const phi2 = Math.asin(sinPhi2);
|
|
14918
|
-
const y = Math.sin(theta) * Math.sin(delta) * Math.cos(phi1);
|
|
14919
|
-
const x = Math.cos(delta) - Math.sin(phi1) * sinPhi2;
|
|
14920
|
-
const lambda2 = lambda1 + Math.atan2(y, x);
|
|
14921
|
-
return {
|
|
14922
|
-
altitude: point.altitude,
|
|
14923
|
-
latitude: Math$1.toDegrees(phi2),
|
|
14924
|
-
longitude: Math$1.toDegrees(lambda2)
|
|
14925
|
-
};
|
|
14926
|
-
}
|
|
14927
|
-
function offsetPos3d(pos3d, distance, heading) {
|
|
14928
|
-
const carto = Cartographic.fromCartesian(pos3d);
|
|
14929
|
-
const newCarto = offsetPoint({
|
|
14930
|
-
altitude: carto.height,
|
|
14931
|
-
latitude: Math$1.toDegrees(carto.latitude),
|
|
14932
|
-
longitude: Math$1.toDegrees(carto.longitude)
|
|
14933
|
-
}, distance, heading);
|
|
14934
|
-
return Cartesian3.fromDegrees(newCarto.longitude, newCarto.latitude, newCarto.altitude);
|
|
14935
|
-
}
|
|
14936
|
-
function getAdjustedGroundIntersectionOfCameraRay(viewer, screenPos) {
|
|
14937
|
-
const ray = viewer.camera.getPickRay(screenPos);
|
|
14938
|
-
const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
14939
|
-
return intersection || null;
|
|
14940
|
-
}
|
|
14941
|
-
function getGroundCenterOfCameraRay(viewer, screenPos) {
|
|
14942
|
-
var _a, _b;
|
|
14943
|
-
const ray = viewer.camera.getPickRay(screenPos);
|
|
14944
|
-
const intersection = ray ? viewer.scene.globe.pick(ray, viewer.scene) : null;
|
|
14945
|
-
if (intersection) {
|
|
14946
|
-
return intersection;
|
|
14947
|
-
}
|
|
14948
|
-
const cameraHeight = viewer.camera.positionCartographic.height;
|
|
14949
|
-
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)) {
|
|
14950
|
-
const cameraPos3d = viewer.camera.position.clone();
|
|
14951
|
-
const pitch = viewer.camera.pitch;
|
|
14952
|
-
const distance = cameraHeight / Math.tan(pitch);
|
|
14953
|
-
return offsetPos3d(cameraPos3d, -distance, Math$1.toDegrees(viewer.camera.heading));
|
|
14954
|
-
}
|
|
14955
|
-
return null;
|
|
14956
|
-
}
|
|
14957
|
-
var ViewGroundArea;
|
|
14958
|
-
(function (ViewGroundArea) {
|
|
14959
|
-
function ToBboxPolygon(bounds) {
|
|
14960
|
-
return `${bounds.west},${bounds.south} ${bounds.west},${bounds.north} ${bounds.east},${bounds.north} ${bounds.east},${bounds.south}`;
|
|
14961
|
-
}
|
|
14962
|
-
ViewGroundArea.ToBboxPolygon = ToBboxPolygon;
|
|
14963
|
-
function NormalizeBounds(bounds, altitude) {
|
|
14964
|
-
if (!bounds ||
|
|
14965
|
-
!isDefined(bounds.east) ||
|
|
14966
|
-
!isDefined(bounds.west) ||
|
|
14967
|
-
!isDefined(bounds.north) ||
|
|
14968
|
-
!isDefined(bounds.south)) {
|
|
14969
|
-
return null;
|
|
14970
|
-
}
|
|
14971
|
-
const viewRect = { ...bounds };
|
|
14972
|
-
const centerLong = (viewRect.east + viewRect.west) / 2;
|
|
14973
|
-
const centerLat = (viewRect.north + viewRect.south) / 2;
|
|
14974
|
-
viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14975
|
-
viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14976
|
-
viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14977
|
-
viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
|
|
14978
|
-
if (isDefined(altitude)) {
|
|
14979
|
-
viewRect.alt = altitude;
|
|
14980
|
-
}
|
|
14981
|
-
return viewRect;
|
|
14982
|
-
}
|
|
14983
|
-
ViewGroundArea.NormalizeBounds = NormalizeBounds;
|
|
14984
|
-
async function GetViewArea(viewer) {
|
|
14985
|
-
var _a, _b;
|
|
14986
|
-
if (!viewer || viewer.isDestroyed()) {
|
|
14987
|
-
return null;
|
|
14988
|
-
}
|
|
14989
|
-
if (!viewer.container || ((_a = viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
|
|
14990
|
-
return null;
|
|
14991
|
-
}
|
|
14992
|
-
let viewRect = null;
|
|
14993
|
-
let center = null;
|
|
14994
|
-
const camera = viewer.camera;
|
|
14995
|
-
const terrData = await DrawingUtils.GetTerrainHeight({
|
|
14996
|
-
pos3d: camera.position,
|
|
14997
|
-
viewer
|
|
14998
|
-
});
|
|
14999
|
-
const cameraPosition = viewer.camera.positionCartographic;
|
|
15000
|
-
const terrHeight = terrData.error ? cameraPosition.height + DEFAULT_GROUNDED_HEIGHT : terrData.height;
|
|
15001
|
-
if (terrHeight && ((cameraPosition.height - terrHeight) < DEFAULT_GROUNDED_HEIGHT)) {
|
|
15002
|
-
viewRect = {};
|
|
15003
|
-
const viewRectRad = netScanViewForBoundaries(viewer);
|
|
15004
|
-
if (viewRectRad &&
|
|
15005
|
-
isDefined(viewRectRad.east) &&
|
|
15006
|
-
isDefined(viewRectRad.west) &&
|
|
15007
|
-
isDefined(viewRectRad.north) &&
|
|
15008
|
-
isDefined(viewRectRad.south)) {
|
|
15009
|
-
viewRect.east = Math$1.toDegrees(Math.max(viewRectRad.east, cameraPosition.longitude));
|
|
15010
|
-
viewRect.west = Math$1.toDegrees(Math.min(viewRectRad.west, cameraPosition.longitude));
|
|
15011
|
-
viewRect.south = Math$1.toDegrees(Math.min(viewRectRad.south, cameraPosition.latitude));
|
|
15012
|
-
viewRect.north = Math$1.toDegrees(Math.max(viewRectRad.north, cameraPosition.latitude));
|
|
15437
|
+
async doEntityCheck(ids, force = false) {
|
|
15438
|
+
var _a, _b, _c, _d;
|
|
15439
|
+
if (this.isRunningCheck) {
|
|
15440
|
+
this.entityCheckQueueIds = this.entityCheckQueueIds.concat(ids);
|
|
15441
|
+
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Call();
|
|
15442
|
+
return;
|
|
15013
15443
|
}
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15444
|
+
ids = ids.concat(this.entityCheckQueueIds);
|
|
15445
|
+
this.entityCheckQueueIds = [];
|
|
15446
|
+
ids = ids.filter((id, index) => {
|
|
15447
|
+
return id && ids.indexOf(id) === index;
|
|
15448
|
+
});
|
|
15449
|
+
if (!ids.length) {
|
|
15450
|
+
return;
|
|
15451
|
+
}
|
|
15452
|
+
this.isRunningCheck = true;
|
|
15453
|
+
const runId = this.reRenderState.startCheckRun();
|
|
15454
|
+
const api = this.apiGetter.getApi();
|
|
15455
|
+
try {
|
|
15456
|
+
if (this.disposed) {
|
|
15457
|
+
return;
|
|
15458
|
+
}
|
|
15459
|
+
const maintained = this.reRenderState.getMaintainedEntities(ids);
|
|
15460
|
+
const maintainedLookup = {};
|
|
15461
|
+
for (let i = 0; i < maintained.length; i++) {
|
|
15462
|
+
const id = (_c = (_b = maintained[i]) === null || _b === void 0 ? void 0 : _b.Bruce) === null || _c === void 0 ? void 0 : _c.ID;
|
|
15463
|
+
if (id) {
|
|
15464
|
+
maintainedLookup[id] = true;
|
|
15465
|
+
}
|
|
15466
|
+
}
|
|
15467
|
+
if (maintained.length) {
|
|
15468
|
+
if (force) {
|
|
15469
|
+
await this.renderDataLabEntities(maintained, true);
|
|
15470
|
+
}
|
|
15471
|
+
else {
|
|
15472
|
+
this.distributeForRender(maintained);
|
|
15473
|
+
}
|
|
15474
|
+
}
|
|
15475
|
+
let apiIds = ids.filter((id) => {
|
|
15476
|
+
return !maintainedLookup[id] && !this.reRenderState.shouldSkipInRun(id, runId);
|
|
15477
|
+
});
|
|
15478
|
+
const checkBatch = async () => {
|
|
15479
|
+
apiIds = this.reRenderState.filterNonSkippedIds(apiIds, runId);
|
|
15480
|
+
const entityIds = apiIds.splice(0, CHECK_BATCH_SIZE$2);
|
|
15481
|
+
if (!entityIds.length) {
|
|
15482
|
+
return;
|
|
15483
|
+
}
|
|
15484
|
+
const revisions = this.reRenderState.captureApiRevisions(entityIds);
|
|
15485
|
+
const { entities } = await Entity$1.GetListByIds({
|
|
15486
|
+
api,
|
|
15487
|
+
entityIds,
|
|
15488
|
+
expandSources: true,
|
|
15489
|
+
expandLocation: true,
|
|
15490
|
+
migrated: true,
|
|
15491
|
+
maxSearchTimeSec: 60 * 2
|
|
15492
|
+
});
|
|
15493
|
+
if (this.disposed) {
|
|
15494
|
+
return;
|
|
15495
|
+
}
|
|
15496
|
+
const resolved = this.reRenderState.filterCurrentApiEntities({
|
|
15497
|
+
entities,
|
|
15498
|
+
revisions,
|
|
15499
|
+
runId
|
|
15500
|
+
});
|
|
15501
|
+
if (resolved.length) {
|
|
15502
|
+
if (force) {
|
|
15503
|
+
await this.renderDataLabEntities(resolved, true);
|
|
15504
|
+
}
|
|
15505
|
+
else {
|
|
15506
|
+
this.distributeForRender(resolved);
|
|
15507
|
+
}
|
|
15508
|
+
}
|
|
15509
|
+
};
|
|
15510
|
+
while (apiIds.length > 0) {
|
|
15511
|
+
await checkBatch();
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
catch (e) {
|
|
15515
|
+
console.error(e);
|
|
15516
|
+
}
|
|
15517
|
+
finally {
|
|
15518
|
+
this.isRunningCheck = false;
|
|
15519
|
+
if (this.entityCheckQueueIds.length) {
|
|
15520
|
+
(_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Call(true);
|
|
15521
|
+
}
|
|
15019
15522
|
}
|
|
15020
|
-
center = {
|
|
15021
|
-
altitude: camera.positionCartographic.height,
|
|
15022
|
-
latitude: Math$1.toDegrees(camera.positionCartographic.latitude),
|
|
15023
|
-
longitude: Math$1.toDegrees(camera.positionCartographic.longitude)
|
|
15024
|
-
};
|
|
15025
15523
|
}
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
let point = null;
|
|
15030
|
-
if (intersection) {
|
|
15031
|
-
point = Cartographic.fromCartesian(intersection, viewer.scene.globe.ellipsoid);
|
|
15524
|
+
distributeForRender(entities) {
|
|
15525
|
+
if (this.disposed || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
|
|
15526
|
+
return;
|
|
15032
15527
|
}
|
|
15033
|
-
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15528
|
+
this.renderQueue = this.renderQueue.concat(entities);
|
|
15529
|
+
if (!this.renderQueueInterval && this.renderQueue.length) {
|
|
15530
|
+
this.renderQueueInterval = setInterval(() => {
|
|
15531
|
+
const batch = this.deduplicateEntities(this.renderQueue.splice(0, BATCH_SIZE$3));
|
|
15532
|
+
this.renderDataLabEntities(batch);
|
|
15533
|
+
if (this.renderQueue.length <= 0) {
|
|
15534
|
+
clearInterval(this.renderQueueInterval);
|
|
15535
|
+
this.renderQueueInterval = null;
|
|
15536
|
+
}
|
|
15537
|
+
}, 50);
|
|
15538
|
+
}
|
|
15539
|
+
}
|
|
15540
|
+
deduplicateEntities(entities) {
|
|
15541
|
+
var _a;
|
|
15542
|
+
const entityMap = new Map();
|
|
15543
|
+
for (let i = 0; i < entities.length; i++) {
|
|
15544
|
+
const entity = entities[i];
|
|
15545
|
+
const id = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
15546
|
+
if (id) {
|
|
15547
|
+
entityMap.set(id, entity);
|
|
15046
15548
|
}
|
|
15047
15549
|
}
|
|
15550
|
+
return Array.from(entityMap.values());
|
|
15048
15551
|
}
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15552
|
+
async renderDataLabEntities(entities, force = false) {
|
|
15553
|
+
var _a, _b, _c;
|
|
15554
|
+
if (this.disposed || this.viewer.isDestroyed() || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
|
|
15555
|
+
return;
|
|
15556
|
+
}
|
|
15557
|
+
try {
|
|
15558
|
+
const { updated, entities: cEntities } = await EntityRenderEngine.Render({
|
|
15559
|
+
viewer: this.viewer,
|
|
15560
|
+
apiGetter: this.apiGetter,
|
|
15561
|
+
entities,
|
|
15562
|
+
menuItemId: this.item.id,
|
|
15563
|
+
visualRegister: this.visualsManager,
|
|
15564
|
+
zoomControl: this.zoomControl,
|
|
15565
|
+
force
|
|
15566
|
+
});
|
|
15567
|
+
if (this.disposed) {
|
|
15568
|
+
return;
|
|
15569
|
+
}
|
|
15570
|
+
for (let i = 0; i < entities.length; i++) {
|
|
15571
|
+
const entity = entities[i];
|
|
15572
|
+
const id = entity.Bruce.ID;
|
|
15573
|
+
const cEntity = cEntities.get(id);
|
|
15574
|
+
this.renderedEntities[id] = !!cEntity;
|
|
15575
|
+
if (cEntity) {
|
|
15576
|
+
const rego = this.visualsManager.GetRego({
|
|
15577
|
+
entityId: id,
|
|
15578
|
+
menuItemId: this.item.id
|
|
15579
|
+
});
|
|
15580
|
+
const canEdit = !((_a = entity.Bruce.Outline) === null || _a === void 0 ? void 0 : _a.find(x => x.Baseline && !x.Editable));
|
|
15581
|
+
const visual = rego === null || rego === void 0 ? void 0 : rego.visual;
|
|
15582
|
+
if (!visual || visual != cEntity) {
|
|
15583
|
+
this.visualsManager.AddRego({
|
|
15584
|
+
rego: {
|
|
15585
|
+
canEdit,
|
|
15586
|
+
entityId: id,
|
|
15587
|
+
schema: entity.Bruce.Schema,
|
|
15588
|
+
menuItemId: this.item.id,
|
|
15589
|
+
menuItemType: this.item.Type,
|
|
15590
|
+
visual: cEntity,
|
|
15591
|
+
priority: this.renderPriority,
|
|
15592
|
+
entityTypeId: entity.Bruce["EntityType.ID"],
|
|
15593
|
+
accountId: this.apiGetter.accountId,
|
|
15594
|
+
tagIds: entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [],
|
|
15595
|
+
name: cEntity.name,
|
|
15596
|
+
cdn: this.item.cdnEnabled,
|
|
15597
|
+
outline: entity.Bruce.Outline
|
|
15598
|
+
},
|
|
15599
|
+
requestRender: false
|
|
15600
|
+
});
|
|
15601
|
+
}
|
|
15602
|
+
else if (updated.get(id) && rego) {
|
|
15603
|
+
rego.name = cEntity.name;
|
|
15604
|
+
rego.visual = cEntity;
|
|
15605
|
+
rego.entityTypeId = entity.Bruce["EntityType.ID"];
|
|
15606
|
+
rego.tagIds = entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [];
|
|
15607
|
+
rego.outline = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.Outline;
|
|
15608
|
+
rego.cdn = this.item.cdnEnabled;
|
|
15609
|
+
rego.schema = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.Schema;
|
|
15610
|
+
rego.canEdit = canEdit;
|
|
15611
|
+
if (rego.stale) {
|
|
15612
|
+
this.visualsManager.RefreshMark({
|
|
15613
|
+
rego
|
|
15614
|
+
});
|
|
15615
|
+
this.visualsManager.ForceUpdate({
|
|
15616
|
+
entityIds: [id],
|
|
15617
|
+
refreshColors: true,
|
|
15618
|
+
requestRender: false
|
|
15619
|
+
});
|
|
15620
|
+
}
|
|
15621
|
+
this.visualsManager.OnUpdate.Trigger({
|
|
15622
|
+
type: VisualsRegister.EVisualUpdateType.Update,
|
|
15623
|
+
entityId: id,
|
|
15624
|
+
rego: rego
|
|
15625
|
+
});
|
|
15626
|
+
}
|
|
15627
|
+
}
|
|
15628
|
+
else {
|
|
15629
|
+
this.visualsManager.RemoveRegos({
|
|
15630
|
+
entityId: id,
|
|
15631
|
+
menuItemId: this.item.id,
|
|
15632
|
+
requestRender: false
|
|
15633
|
+
});
|
|
15634
|
+
}
|
|
15635
|
+
}
|
|
15636
|
+
this.viewer.scene.requestRender();
|
|
15637
|
+
}
|
|
15638
|
+
catch (e) {
|
|
15639
|
+
console.error("Failed to render DataLab entities:", e);
|
|
15640
|
+
}
|
|
15055
15641
|
}
|
|
15056
|
-
return null;
|
|
15057
15642
|
}
|
|
15058
|
-
|
|
15059
|
-
})(
|
|
15643
|
+
DataLabRenderManager.Manager = Manager;
|
|
15644
|
+
})(DataLabRenderManager || (DataLabRenderManager = {}));
|
|
15060
15645
|
|
|
15061
15646
|
const TIME_LAG = 300;
|
|
15062
15647
|
const POSITION_CHECK_TIMER = 950;
|
|
@@ -15213,7 +15798,7 @@ var CesiumViewMonitor;
|
|
|
15213
15798
|
})(CesiumViewMonitor || (CesiumViewMonitor = {}));
|
|
15214
15799
|
|
|
15215
15800
|
const MAX_BATCHES = 2;
|
|
15216
|
-
const BATCH_SIZE$
|
|
15801
|
+
const BATCH_SIZE$4 = 1000;
|
|
15217
15802
|
const BATCH_DELAY = 200;
|
|
15218
15803
|
const MAX_RANGE = 3000;
|
|
15219
15804
|
var TilesetOsmRenderManager;
|
|
@@ -15428,7 +16013,7 @@ var TilesetOsmRenderManager;
|
|
|
15428
16013
|
const isClose = this.getIsVisualWithinRange(feature, MAX_RANGE);
|
|
15429
16014
|
if (isClose) {
|
|
15430
16015
|
batch.push(feature);
|
|
15431
|
-
if (batch.length >= BATCH_SIZE$
|
|
16016
|
+
if (batch.length >= BATCH_SIZE$4) {
|
|
15432
16017
|
return batch;
|
|
15433
16018
|
}
|
|
15434
16019
|
}
|
|
@@ -15578,7 +16163,7 @@ var TilesetOsmRenderManager;
|
|
|
15578
16163
|
delete this._loadedCesiumEntities[key];
|
|
15579
16164
|
this.totalLoaded -= 1;
|
|
15580
16165
|
removed += 1;
|
|
15581
|
-
if (removed >= BATCH_SIZE$
|
|
16166
|
+
if (removed >= BATCH_SIZE$4) {
|
|
15582
16167
|
return true;
|
|
15583
16168
|
}
|
|
15584
16169
|
}
|
|
@@ -16342,6 +16927,10 @@ var XGridsRenderEngine;
|
|
|
16342
16927
|
}
|
|
16343
16928
|
}
|
|
16344
16929
|
});
|
|
16930
|
+
if (typeof (obj === null || obj === void 0 ? void 0 : obj.setVisible) === "function") {
|
|
16931
|
+
obj.setVisible(true);
|
|
16932
|
+
}
|
|
16933
|
+
TilesetRenderEngine.WatchDateRange(viewer, obj, tileset);
|
|
16345
16934
|
// Highest LOD.
|
|
16346
16935
|
obj.setStartLod(0);
|
|
16347
16936
|
// Max distance for rendering.
|
|
@@ -16361,6 +16950,7 @@ var XGridsRenderEngine;
|
|
|
16361
16950
|
console.warn("[XGridsRenderEngine] Remove() LCCRender library not available.");
|
|
16362
16951
|
return;
|
|
16363
16952
|
}
|
|
16953
|
+
TilesetRenderEngine.UnwatchDateRange(viewer, renderObject);
|
|
16364
16954
|
LCCRender.unload(renderObject);
|
|
16365
16955
|
}
|
|
16366
16956
|
XGridsRenderEngine.Remove = Remove;
|
|
@@ -35360,7 +35950,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
35360
35950
|
}
|
|
35361
35951
|
}
|
|
35362
35952
|
|
|
35363
|
-
const VERSION = "6.
|
|
35953
|
+
const VERSION = "6.6.1";
|
|
35364
35954
|
/**
|
|
35365
35955
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
35366
35956
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|