bruce-cesium 7.0.2 → 7.0.4
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 +1376 -244
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1374 -242
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/internal/cesium-show-gate.js +100 -0
- package/dist/lib/internal/cesium-show-gate.js.map +1 -0
- package/dist/lib/internal/cesium-utils.js +207 -1
- package/dist/lib/internal/cesium-utils.js.map +1 -1
- package/dist/lib/internal/js-utils.js +25 -1
- package/dist/lib/internal/js-utils.js.map +1 -1
- package/dist/lib/rendering/cesium-animated-in-out.js +66 -7
- package/dist/lib/rendering/cesium-animated-in-out.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-model3d.js +17 -8
- package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-point.js +46 -12
- package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-polygon.js +107 -35
- package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-polyline.js +27 -8
- package/dist/lib/rendering/entity-render-engine-polyline.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +86 -14
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +30 -2
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/relation-render-engine.js +2 -1
- package/dist/lib/rendering/relation-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +10 -2
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js +45 -3
- package/dist/lib/rendering/render-managers/entities/entities-datalab-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +26 -15
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +50 -3
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/legacy-relations-render-manager.js +3 -2
- package/dist/lib/rendering/render-managers/other/legacy-relations-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js +3 -2
- package/dist/lib/rendering/render-managers/other/relations-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/render-manager.js +67 -3
- package/dist/lib/rendering/render-managers/render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +2 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +2 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +2 -0
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-pointcloud-render-manager.js +4 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-pointcloud-render-manager.js.map +1 -1
- package/dist/lib/rendering/texture-frame-series-animator.js +7 -0
- package/dist/lib/rendering/texture-frame-series-animator.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +18 -0
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/rendering/visual-register-culler.js +197 -98
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +263 -25
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +7 -3
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/internal/cesium-show-gate.d.ts +29 -0
- package/dist/types/internal/cesium-utils.d.ts +63 -0
- package/dist/types/internal/js-utils.d.ts +10 -0
- package/dist/types/rendering/cesium-animated-in-out.d.ts +5 -0
- package/dist/types/rendering/entity-render-engine-model3d.d.ts +2 -0
- package/dist/types/rendering/entity-render-engine-point.d.ts +2 -0
- package/dist/types/rendering/entity-render-engine-polygon.d.ts +2 -0
- package/dist/types/rendering/entity-render-engine-polyline.d.ts +2 -0
- package/dist/types/rendering/entity-render-engine.d.ts +17 -1
- package/dist/types/rendering/menu-item-manager.d.ts +6 -0
- package/dist/types/rendering/render-managers/entities/entities-datalab-render-manager.d.ts +11 -0
- package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +12 -0
- package/dist/types/rendering/render-managers/render-manager.d.ts +33 -0
- package/dist/types/rendering/render-managers/tilesets/tileset-pointcloud-render-manager.d.ts +3 -0
- package/dist/types/rendering/texture-frame-series-animator.d.ts +5 -0
- package/dist/types/rendering/tileset-render-engine.d.ts +14 -0
- package/dist/types/rendering/visual-register-culler.d.ts +7 -0
- package/dist/types/rendering/visuals-register.d.ts +65 -1
- package/dist/types/utils/cesium-entity-styler.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
|
-
import { Cartographic,
|
|
3
|
-
import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile,
|
|
2
|
+
import { Cartographic, Entity, Color, HeightReference, CallbackProperty, HorizontalOrigin, VerticalOrigin, ConstantProperty, Cartesian3, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Model, ColorMaterialProperty, Primitive, Cesium3DTileFeature, Cartesian2, DistanceDisplayCondition, SceneTransforms, NearFarScalar, JulianDate, Quaternion, Matrix3, Rectangle, KmlDataSource, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, GeoJsonDataSource, SceneMode, Ion, IonResource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Matrix4, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, Cesium3DTileset, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
|
|
3
|
+
import { Cartes, Entity as Entity$1, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry, EntityLod, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, Color as Color$1, DataLab, DelayQueue, BruceEvent, EntityRelation, BruceApi, EntityHistoricData, ProgramKey, EntitySource, EntityCoords, Camera, ProjectViewTile, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, AccountConcept, RecordChangeFeed, EntityRelationType } from 'bruce-models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -19,6 +19,28 @@ function EnsureNumber(value, defaultNum) {
|
|
|
19
19
|
}
|
|
20
20
|
return value;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns an entity's own name when it is good enough to use as-is, or null when it has to be resolved properly.
|
|
24
|
+
* @param entity
|
|
25
|
+
*/
|
|
26
|
+
function GetUsableEntityName(entity) {
|
|
27
|
+
var _a;
|
|
28
|
+
return IsUsableEntityName((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) ? String(entity.Bruce.Name).trim() : null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether a name is a real one rather than empty or a placeholder.
|
|
32
|
+
* @param name
|
|
33
|
+
*/
|
|
34
|
+
function IsUsableEntityName(name) {
|
|
35
|
+
if (typeof name !== "string") {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const trimmed = name.trim();
|
|
39
|
+
if (!trimmed) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return !trimmed.toLowerCase().includes("unnamed");
|
|
43
|
+
}
|
|
22
44
|
|
|
23
45
|
var MeasureUtils;
|
|
24
46
|
(function (MeasureUtils) {
|
|
@@ -1956,7 +1978,11 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1956
1978
|
}
|
|
1957
1979
|
}
|
|
1958
1980
|
else if (graphic instanceof CorridorGraphics) {
|
|
1959
|
-
|
|
1981
|
+
// See if it's changed before applying, same flicker/rebuild concern as the polyline above.
|
|
1982
|
+
const currentColor = calculateCurColor(viewer, graphic);
|
|
1983
|
+
if (currentColor == null || !currentColor.equals(color)) {
|
|
1984
|
+
graphic.material = new ColorMaterialProperty(color);
|
|
1985
|
+
}
|
|
1960
1986
|
}
|
|
1961
1987
|
else if (graphic instanceof PointGraphics) {
|
|
1962
1988
|
const animateColor = new CesiumAnimatedProperty.AnimateColor({
|
|
@@ -2204,11 +2230,11 @@ var CesiumEntityStyler;
|
|
|
2204
2230
|
* @returns
|
|
2205
2231
|
*/
|
|
2206
2232
|
function SetDefaultColor(params) {
|
|
2207
|
-
const { viewer, entity, requestRender, override } = params;
|
|
2233
|
+
const { viewer, entity, requestRender, override, includeSiblings } = params;
|
|
2208
2234
|
if (!entity) {
|
|
2209
2235
|
return;
|
|
2210
2236
|
}
|
|
2211
|
-
const parts = EntityUtils.GatherEntity({
|
|
2237
|
+
const parts = includeSiblings == false ? [entity] : EntityUtils.GatherEntity({
|
|
2212
2238
|
entity: entity,
|
|
2213
2239
|
selectable: true
|
|
2214
2240
|
});
|
|
@@ -3846,6 +3872,202 @@ function GetCValue(viewer, obj) {
|
|
|
3846
3872
|
}
|
|
3847
3873
|
return obj;
|
|
3848
3874
|
}
|
|
3875
|
+
/*
|
|
3876
|
+
* Marks an EntityCollection as one this library created and fully controls (a menu item's own data source).
|
|
3877
|
+
*/
|
|
3878
|
+
const OWNED_CCOLLECTION_KEY = "_bruceOwnedCollection";
|
|
3879
|
+
function MarkCCollectionOwned(collection) {
|
|
3880
|
+
if (collection) {
|
|
3881
|
+
collection[OWNED_CCOLLECTION_KEY] = true;
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
function IsCCollectionOwned(collection) {
|
|
3885
|
+
return Boolean(collection && collection[OWNED_CCOLLECTION_KEY]);
|
|
3886
|
+
}
|
|
3887
|
+
/**
|
|
3888
|
+
* Runs a bulk collection mutation with every given collection's events suspended, so Cesium raises one
|
|
3889
|
+
* collectionChanged per collection for the whole pass instead of one per entity.
|
|
3890
|
+
*
|
|
3891
|
+
* Takes a set of collections rather than assuming `viewer.entities`, because managed visuals live in their menu
|
|
3892
|
+
* item's own data source: suspending the wrong collection silently does nothing.
|
|
3893
|
+
* @param collections Duplicates and empty entries are ignored.
|
|
3894
|
+
* @param run
|
|
3895
|
+
*/
|
|
3896
|
+
function WithSuspendedCCollections(collections, run) {
|
|
3897
|
+
const unique = [];
|
|
3898
|
+
for (const collection of collections) {
|
|
3899
|
+
if (collection && unique.indexOf(collection) === -1) {
|
|
3900
|
+
unique.push(collection);
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
for (const collection of unique) {
|
|
3904
|
+
collection.suspendEvents();
|
|
3905
|
+
}
|
|
3906
|
+
try {
|
|
3907
|
+
return run();
|
|
3908
|
+
}
|
|
3909
|
+
finally {
|
|
3910
|
+
for (const collection of unique) {
|
|
3911
|
+
try {
|
|
3912
|
+
collection.resumeEvents();
|
|
3913
|
+
}
|
|
3914
|
+
catch (e) {
|
|
3915
|
+
console.error(e);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
/**
|
|
3921
|
+
* Returns the collection a graphic belongs to, falling back to the viewer's own when it has never been added.
|
|
3922
|
+
* @param viewer
|
|
3923
|
+
* @param entity
|
|
3924
|
+
*/
|
|
3925
|
+
function GetCEntityCollection(viewer, entity) {
|
|
3926
|
+
const owner = entity === null || entity === void 0 ? void 0 : entity.entityCollection;
|
|
3927
|
+
return owner ? owner : viewer === null || viewer === void 0 ? void 0 : viewer.entities;
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* Returns whether a graphic is currently in the scene, looking in whichever collection owns it.
|
|
3931
|
+
* @param viewer
|
|
3932
|
+
* @param entity
|
|
3933
|
+
*/
|
|
3934
|
+
function IsCEntityInScene(viewer, entity) {
|
|
3935
|
+
const collection = GetCEntityCollection(viewer, entity);
|
|
3936
|
+
return Boolean(collection && entity && collection.contains(entity));
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* Removes a graphic from whichever collection owns it. Returns whether it removed anything.
|
|
3940
|
+
* @param viewer
|
|
3941
|
+
* @param entity
|
|
3942
|
+
*/
|
|
3943
|
+
function RemoveCEntityFromScene(viewer, entity) {
|
|
3944
|
+
var _a;
|
|
3945
|
+
if (!entity) {
|
|
3946
|
+
return false;
|
|
3947
|
+
}
|
|
3948
|
+
const collection = GetCEntityCollection(viewer, entity);
|
|
3949
|
+
if (collection === null || collection === void 0 ? void 0 : collection.contains(entity)) {
|
|
3950
|
+
return collection.remove(entity);
|
|
3951
|
+
}
|
|
3952
|
+
// A stale owner reference and the graphic ended up in the viewer's collection anyway.
|
|
3953
|
+
if (collection !== (viewer === null || viewer === void 0 ? void 0 : viewer.entities) && ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.entities) === null || _a === void 0 ? void 0 : _a.contains(entity))) {
|
|
3954
|
+
return viewer.entities.remove(entity);
|
|
3955
|
+
}
|
|
3956
|
+
return false;
|
|
3957
|
+
}
|
|
3958
|
+
/**
|
|
3959
|
+
* Adds a graphic back into whichever collection owns it, or the viewer's if it has no owner yet.
|
|
3960
|
+
* @param viewer
|
|
3961
|
+
* @param entity
|
|
3962
|
+
*/
|
|
3963
|
+
function AddCEntityToScene(viewer, entity, fallbackCollection) {
|
|
3964
|
+
if (!entity) {
|
|
3965
|
+
return false;
|
|
3966
|
+
}
|
|
3967
|
+
// An existing owner always wins, so a graphic is never migrated out from under whoever holds it.
|
|
3968
|
+
const owner = entity.entityCollection;
|
|
3969
|
+
const collection = owner ? owner : (fallbackCollection ? fallbackCollection : viewer === null || viewer === void 0 ? void 0 : viewer.entities);
|
|
3970
|
+
if (!collection || collection.contains(entity)) {
|
|
3971
|
+
return false;
|
|
3972
|
+
}
|
|
3973
|
+
collection.add(entity);
|
|
3974
|
+
return true;
|
|
3975
|
+
}
|
|
3976
|
+
/**
|
|
3977
|
+
* Returns whether toggling `show` on these graphics is safe, rather than having to add/remove them from the
|
|
3978
|
+
* entity collection to hide them.
|
|
3979
|
+
*
|
|
3980
|
+
* Toggling show is far cheaper than re-adding the graphic to the viewer however a Cesium bug means we can't always use it.
|
|
3981
|
+
* See: https://github.com/CesiumGS/cesium/issues/9370
|
|
3982
|
+
* @param parts The graphic and any sibling graphics, eg. from EntityUtils.GatherEntity.
|
|
3983
|
+
*/
|
|
3984
|
+
function CanToggleShowSafely(parts) {
|
|
3985
|
+
if (!(parts === null || parts === void 0 ? void 0 : parts.length)) {
|
|
3986
|
+
return false;
|
|
3987
|
+
}
|
|
3988
|
+
for (const part of parts) {
|
|
3989
|
+
if (!(part instanceof Entity)) {
|
|
3990
|
+
// Not an Entity, so not something whose `show` we can drive.
|
|
3991
|
+
return false;
|
|
3992
|
+
}
|
|
3993
|
+
if (part.polyline && isTruthyCValue(part.polyline.clampToGround)) {
|
|
3994
|
+
return false;
|
|
3995
|
+
}
|
|
3996
|
+
const materialGraphics = [part.polygon, part.corridor, part.ellipse, part.rectangle, part.wall, part.polylineVolume];
|
|
3997
|
+
for (const graphic of materialGraphics) {
|
|
3998
|
+
if (graphic && !isPlainColorMaterial(graphic.material)) {
|
|
3999
|
+
return false;
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
return true;
|
|
4004
|
+
}
|
|
4005
|
+
/**
|
|
4006
|
+
* Returns whether a material is a plain colour, which is what keeps a graphic out of Cesium's per-material batches.
|
|
4007
|
+
* Anything unrecognised counts as not plain, so callers stay on the conservative side.
|
|
4008
|
+
* @param material
|
|
4009
|
+
*/
|
|
4010
|
+
function isPlainColorMaterial(material) {
|
|
4011
|
+
if (material == null) {
|
|
4012
|
+
// Cesium defaults an absent material to white, a plain colour.
|
|
4013
|
+
return true;
|
|
4014
|
+
}
|
|
4015
|
+
return material instanceof ColorMaterialProperty || material instanceof Color;
|
|
4016
|
+
}
|
|
4017
|
+
/**
|
|
4018
|
+
* Resolves a possibly-property boolean without needing a viewer clock, treating anything undeterminable as true
|
|
4019
|
+
* so callers stay on the conservative side.
|
|
4020
|
+
* @param value
|
|
4021
|
+
*/
|
|
4022
|
+
function isTruthyCValue(value) {
|
|
4023
|
+
if (value == null) {
|
|
4024
|
+
return false;
|
|
4025
|
+
}
|
|
4026
|
+
if (typeof value.getValue === "function") {
|
|
4027
|
+
if (value instanceof ConstantProperty) {
|
|
4028
|
+
return Boolean(value.valueOf());
|
|
4029
|
+
}
|
|
4030
|
+
// A non-constant property could be true at any moment, so assume it is.
|
|
4031
|
+
return true;
|
|
4032
|
+
}
|
|
4033
|
+
return Boolean(value);
|
|
4034
|
+
}
|
|
4035
|
+
/**
|
|
4036
|
+
* Returns if two resolved Cesium property values are equal, using the value's own equals() when it has one.
|
|
4037
|
+
* @param a
|
|
4038
|
+
* @param b
|
|
4039
|
+
*/
|
|
4040
|
+
function AreCValuesEqual(a, b) {
|
|
4041
|
+
if (a === b) {
|
|
4042
|
+
return true;
|
|
4043
|
+
}
|
|
4044
|
+
// One side is null/undefined and the other isn't.
|
|
4045
|
+
if (a == null || b == null) {
|
|
4046
|
+
return false;
|
|
4047
|
+
}
|
|
4048
|
+
if (typeof a.equals === "function") {
|
|
4049
|
+
return a.equals(b) === true;
|
|
4050
|
+
}
|
|
4051
|
+
return false;
|
|
4052
|
+
}
|
|
4053
|
+
/**
|
|
4054
|
+
* Wraps a value in a ConstantProperty and assigns it to a graphic's property, but only when the resolved
|
|
4055
|
+
* value actually differs. Returns whether it assigned.
|
|
4056
|
+
* @param params
|
|
4057
|
+
*/
|
|
4058
|
+
function SetCPropIfChanged(params) {
|
|
4059
|
+
const { viewer, graphic, property, value, compare } = params;
|
|
4060
|
+
if (!graphic) {
|
|
4061
|
+
return false;
|
|
4062
|
+
}
|
|
4063
|
+
const oldValue = GetCValue(viewer, graphic[property]);
|
|
4064
|
+
const isEqual = compare ? compare(oldValue, value) : AreCValuesEqual(oldValue, value);
|
|
4065
|
+
if (isEqual) {
|
|
4066
|
+
return false;
|
|
4067
|
+
}
|
|
4068
|
+
graphic[property] = new ConstantProperty(value);
|
|
4069
|
+
return true;
|
|
4070
|
+
}
|
|
3849
4071
|
function ColorToCColor(color) {
|
|
3850
4072
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
3851
4073
|
}
|
|
@@ -4334,6 +4556,85 @@ var ViewUtils;
|
|
|
4334
4556
|
ViewUtils.GetModelSpace = GetModelSpace;
|
|
4335
4557
|
})(ViewUtils || (ViewUtils = {}));
|
|
4336
4558
|
|
|
4559
|
+
/*
|
|
4560
|
+
* Lets something decide WHEN a `show` flag is honoured, without owning WHAT it should be.
|
|
4561
|
+
*/
|
|
4562
|
+
const SHOW_GATE_KEY = "_bruceShowGate";
|
|
4563
|
+
/**
|
|
4564
|
+
* Installs a show gate on an object, or returns the one already installed.
|
|
4565
|
+
* Returns null when the property cannot be intercepted or restored, in which case the caller must leave `show` alone rather than fall back to writing it directly.
|
|
4566
|
+
* @param target Anything with a plain, configurable `show` property.
|
|
4567
|
+
*/
|
|
4568
|
+
function InstallShowGate(target) {
|
|
4569
|
+
if (!target) {
|
|
4570
|
+
return null;
|
|
4571
|
+
}
|
|
4572
|
+
const existing = target[SHOW_GATE_KEY];
|
|
4573
|
+
if (existing) {
|
|
4574
|
+
return existing;
|
|
4575
|
+
}
|
|
4576
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, "show");
|
|
4577
|
+
// An accessor already, or something we could not put back, so refuse rather than half-apply.
|
|
4578
|
+
if (descriptor && (!descriptor.configurable || descriptor.get || descriptor.set)) {
|
|
4579
|
+
return null;
|
|
4580
|
+
}
|
|
4581
|
+
let intended = target.show !== false;
|
|
4582
|
+
let suppressed = false;
|
|
4583
|
+
try {
|
|
4584
|
+
Object.defineProperty(target, "show", {
|
|
4585
|
+
configurable: true,
|
|
4586
|
+
enumerable: descriptor ? descriptor.enumerable : true,
|
|
4587
|
+
get: () => intended && !suppressed,
|
|
4588
|
+
set: (value) => {
|
|
4589
|
+
intended = value !== false;
|
|
4590
|
+
}
|
|
4591
|
+
});
|
|
4592
|
+
}
|
|
4593
|
+
catch (e) {
|
|
4594
|
+
console.error("Failed to install a show gate.", e);
|
|
4595
|
+
return null;
|
|
4596
|
+
}
|
|
4597
|
+
const gate = {
|
|
4598
|
+
get Intended() {
|
|
4599
|
+
return intended;
|
|
4600
|
+
},
|
|
4601
|
+
get Suppressed() {
|
|
4602
|
+
return suppressed;
|
|
4603
|
+
},
|
|
4604
|
+
SetSuppressed(value) {
|
|
4605
|
+
const next = Boolean(value);
|
|
4606
|
+
if (next === suppressed) {
|
|
4607
|
+
return false;
|
|
4608
|
+
}
|
|
4609
|
+
const before = intended && !suppressed;
|
|
4610
|
+
suppressed = next;
|
|
4611
|
+
return (intended && !suppressed) !== before;
|
|
4612
|
+
},
|
|
4613
|
+
Release() {
|
|
4614
|
+
try {
|
|
4615
|
+
delete target[SHOW_GATE_KEY];
|
|
4616
|
+
Object.defineProperty(target, "show", {
|
|
4617
|
+
configurable: true,
|
|
4618
|
+
enumerable: descriptor ? descriptor.enumerable : true,
|
|
4619
|
+
writable: true,
|
|
4620
|
+
// The intent, not the gated value: releasing must not leave something culled forever.
|
|
4621
|
+
value: intended
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4624
|
+
catch (e) {
|
|
4625
|
+
console.error("Failed to release a show gate.", e);
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
};
|
|
4629
|
+
Object.defineProperty(target, SHOW_GATE_KEY, {
|
|
4630
|
+
value: gate,
|
|
4631
|
+
configurable: true,
|
|
4632
|
+
enumerable: false,
|
|
4633
|
+
writable: true
|
|
4634
|
+
});
|
|
4635
|
+
return gate;
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4337
4638
|
/**
|
|
4338
4639
|
* Returns cesium property's value.
|
|
4339
4640
|
* This will check if it's one that changes over time, or just a fixed value.
|
|
@@ -4411,10 +4712,17 @@ var EntityLabel;
|
|
|
4411
4712
|
* Loads the Entity's name and updates the corresponding visual rego.
|
|
4412
4713
|
*/
|
|
4413
4714
|
async loadName() {
|
|
4715
|
+
var _a;
|
|
4414
4716
|
if (this.loadedName) {
|
|
4415
4717
|
return;
|
|
4416
4718
|
}
|
|
4417
4719
|
try {
|
|
4720
|
+
// A rego that already holds a real name needs no lookup. Placeholders do not count, or a cached
|
|
4721
|
+
// "Unnamed Entity" would stop the real name ever being resolved.
|
|
4722
|
+
if (IsUsableEntityName((_a = this.rego) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
4723
|
+
this.loadedName = true;
|
|
4724
|
+
return;
|
|
4725
|
+
}
|
|
4418
4726
|
if (this.api) {
|
|
4419
4727
|
const rego = this.rego;
|
|
4420
4728
|
this.rego.name = await Entity$1.CalculateNameAsync({
|
|
@@ -5601,7 +5909,7 @@ var RelationRenderEngine;
|
|
|
5601
5909
|
return;
|
|
5602
5910
|
}
|
|
5603
5911
|
if (parabola) {
|
|
5604
|
-
const visible = cEntity && cEntity.show != false && params.viewer
|
|
5912
|
+
const visible = cEntity && cEntity.show != false && IsCEntityInScene(params.viewer, cEntity);
|
|
5605
5913
|
parabola.Hidden = !visible;
|
|
5606
5914
|
}
|
|
5607
5915
|
updatePosses();
|
|
@@ -5629,18 +5937,58 @@ const POINT_MIN_RADIUS = 15;
|
|
|
5629
5937
|
// If a shape has more than this amount of points, we'll avoid checking it because it will take too long.
|
|
5630
5938
|
// We will put responsibility on the bookmark creator to view shapes they can see.
|
|
5631
5939
|
const DO_NOT_CULL_AT_LEN_POINTS = 5000;
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
const
|
|
5639
|
-
|
|
5940
|
+
const _terrainCache = new LRUCache(20000);
|
|
5941
|
+
/*
|
|
5942
|
+
* Past this camera distance the terrain sample is skipped entirely (resolving a long-standing TODO here).
|
|
5943
|
+
* The sphere's radius is padded by TERRAIN_SKIP_RADIUS_PAD instead, which covers any plausible unresolved ground height.
|
|
5944
|
+
*/
|
|
5945
|
+
const TERRAIN_SKIP_DISTANCE = 60000;
|
|
5946
|
+
const TERRAIN_SKIP_RADIUS_PAD = 1500;
|
|
5947
|
+
// Edge length of a coarse grid cell, and of the finer cell used where the ground turns out to be varied.
|
|
5948
|
+
const TERRAIN_CELL_SIZE = 400;
|
|
5949
|
+
const TERRAIN_CELL_SIZE_FINE = 50;
|
|
5950
|
+
// A cell spanning more than this much height cannot be answered with a single average.
|
|
5951
|
+
const TERRAIN_CELL_MAX_SPREAD = 25;
|
|
5952
|
+
/**
|
|
5953
|
+
* Builds the grid key for a position at a given cell size.
|
|
5954
|
+
*/
|
|
5955
|
+
function terrainCellKey(terrainId, pos3d, cellSize) {
|
|
5956
|
+
const x = Math.floor(pos3d.x / cellSize);
|
|
5957
|
+
const y = Math.floor(pos3d.y / cellSize);
|
|
5958
|
+
const z = Math.floor(pos3d.z / cellSize);
|
|
5959
|
+
return `${terrainId}_${cellSize}_${x}_${y}_${z}`;
|
|
5960
|
+
}
|
|
5961
|
+
/**
|
|
5962
|
+
* Folds a sample into a cell, refining its estimate and noticing when the region is too varied to average.
|
|
5963
|
+
*/
|
|
5964
|
+
function recordTerrainSample(key, height) {
|
|
5965
|
+
const existing = _terrainCache.Get(key);
|
|
5966
|
+
if (!existing) {
|
|
5967
|
+
const cell = {
|
|
5968
|
+
offset: height,
|
|
5969
|
+
count: 1,
|
|
5970
|
+
min: height,
|
|
5971
|
+
max: height,
|
|
5972
|
+
needsDetail: false
|
|
5973
|
+
};
|
|
5974
|
+
_terrainCache.Set(key, cell);
|
|
5975
|
+
return cell;
|
|
5976
|
+
}
|
|
5977
|
+
existing.count++;
|
|
5978
|
+
// Running mean, so the estimate keeps improving rather than being whatever landed first.
|
|
5979
|
+
existing.offset += (height - existing.offset) / existing.count;
|
|
5980
|
+
existing.min = Math.min(existing.min, height);
|
|
5981
|
+
existing.max = Math.max(existing.max, height);
|
|
5982
|
+
if (existing.max - existing.min > TERRAIN_CELL_MAX_SPREAD) {
|
|
5983
|
+
existing.needsDetail = true;
|
|
5984
|
+
}
|
|
5985
|
+
_terrainCache.Set(key, existing);
|
|
5986
|
+
return existing;
|
|
5987
|
+
}
|
|
5640
5988
|
/**
|
|
5641
5989
|
* Returns the terrain height for a given position.
|
|
5642
5990
|
* This will not sample most-detailed and instead the current state of the terrain.
|
|
5643
|
-
*
|
|
5991
|
+
* Callers past TERRAIN_SKIP_DISTANCE should not be asking at all, see shouldCullEntity.
|
|
5644
5992
|
* @param viewer
|
|
5645
5993
|
* @param pos3d
|
|
5646
5994
|
* @returns
|
|
@@ -5657,37 +6005,36 @@ const getTerrainOffset = (viewer, pos3d) => {
|
|
|
5657
6005
|
return 0;
|
|
5658
6006
|
}
|
|
5659
6007
|
const terrainId = terrain.tilesetId;
|
|
5660
|
-
//
|
|
5661
|
-
|
|
5662
|
-
const
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
const pos3d2 = new Cartesian3(parseFloat(x), parseFloat(y), parseFloat(z));
|
|
5670
|
-
const distance = Cartesian3.distance(pos3d, pos3d2);
|
|
5671
|
-
if (distance < tolerance) {
|
|
5672
|
-
return offset;
|
|
5673
|
-
}
|
|
6008
|
+
// Always start coarse and let the region teach us where that is not good enough, rather than guessing from a scene-wide entity count.
|
|
6009
|
+
// A cell that turns out to span varied ground flags itself and its lookups move to the finer grid.
|
|
6010
|
+
const coarseKey = terrainCellKey(terrainId, pos3d, TERRAIN_CELL_SIZE);
|
|
6011
|
+
const coarseCell = _terrainCache.Get(coarseKey);
|
|
6012
|
+
const useFine = Boolean(coarseCell === null || coarseCell === void 0 ? void 0 : coarseCell.needsDetail);
|
|
6013
|
+
const key = useFine ? terrainCellKey(terrainId, pos3d, TERRAIN_CELL_SIZE_FINE) : coarseKey;
|
|
6014
|
+
const cell = useFine ? _terrainCache.Get(key) : coarseCell;
|
|
6015
|
+
if (cell && !cell.needsDetail) {
|
|
6016
|
+
return cell.offset;
|
|
5674
6017
|
}
|
|
5675
|
-
const
|
|
5676
|
-
let
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
let height = 0;
|
|
5680
|
-
try {
|
|
5681
|
-
height = viewer.scene.globe.getHeight(carto);
|
|
5682
|
-
}
|
|
5683
|
-
catch (e) {
|
|
5684
|
-
// Likely out of rendered area.
|
|
5685
|
-
// This means it's not our problem since the user isn't looking there :)
|
|
5686
|
-
}
|
|
5687
|
-
offset = height;
|
|
5688
|
-
_terrainCache.Set(key, offset);
|
|
6018
|
+
const carto = Cartographic.fromCartesian(pos3d);
|
|
6019
|
+
let height = 0;
|
|
6020
|
+
try {
|
|
6021
|
+
height = viewer.scene.globe.getHeight(carto);
|
|
5689
6022
|
}
|
|
5690
|
-
|
|
6023
|
+
catch (e) {
|
|
6024
|
+
// Likely out of rendered area.
|
|
6025
|
+
// This means it's not our problem since the user isn't looking there :)
|
|
6026
|
+
}
|
|
6027
|
+
if (height == null || isNaN(height)) {
|
|
6028
|
+
// Terrain tile not loaded yet. Don't record it, so a later pass can sample it properly.
|
|
6029
|
+
return coarseCell ? coarseCell.offset : 0;
|
|
6030
|
+
}
|
|
6031
|
+
// Always fold into the coarse cell as well, so its spread keeps being learned even while the finer grid is
|
|
6032
|
+
// answering lookups for this region.
|
|
6033
|
+
const recorded = recordTerrainSample(key, height);
|
|
6034
|
+
if (useFine) {
|
|
6035
|
+
recordTerrainSample(coarseKey, height);
|
|
6036
|
+
}
|
|
6037
|
+
return recorded.offset;
|
|
5691
6038
|
};
|
|
5692
6039
|
/**
|
|
5693
6040
|
* Converts given pos3d into a an absolute position.
|
|
@@ -5737,6 +6084,11 @@ function getValue$1(viewer, obj) {
|
|
|
5737
6084
|
}
|
|
5738
6085
|
return obj;
|
|
5739
6086
|
}
|
|
6087
|
+
/*
|
|
6088
|
+
* Cache identity for a terrain provider we cannot name, which is anything without our own metadata on it and not
|
|
6089
|
+
* Cesium's own flat ellipsoid. Deliberately not FlatTerrain, see shouldCullEntity.
|
|
6090
|
+
*/
|
|
6091
|
+
const UNRECOGNISED_TERRAIN_ID = "unrecognised-terrain";
|
|
5740
6092
|
const boundingSphereCache = new LRUCache(100000);
|
|
5741
6093
|
function getPositionsFromEntity(viewer, entity) {
|
|
5742
6094
|
let positions = [];
|
|
@@ -5854,7 +6206,7 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5854
6206
|
let boundingSphere;
|
|
5855
6207
|
const terrainId = (_c = (_b = (_a = ViewUtils.GatherTerrainTile({
|
|
5856
6208
|
viewer
|
|
5857
|
-
})) === null || _a === void 0 ? void 0 : _a.terrain) === null || _b === void 0 ? void 0 : _b.tilesetId) !== null && _c !== void 0 ? _c :
|
|
6209
|
+
})) === null || _a === void 0 ? void 0 : _a.terrain) === null || _b === void 0 ? void 0 : _b.tilesetId) !== null && _c !== void 0 ? _c : UNRECOGNISED_TERRAIN_ID;
|
|
5858
6210
|
const cacheKey = terrainId + cEntity.id;
|
|
5859
6211
|
const cacheData = boundingSphereCache.Get(cacheKey);
|
|
5860
6212
|
if (cacheData) {
|
|
@@ -5871,6 +6223,10 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5871
6223
|
if (cEntity.model) {
|
|
5872
6224
|
const model = cEntity.model;
|
|
5873
6225
|
if (model._radius && !isNaN(model._radius)) {
|
|
6226
|
+
// _radius is already measured from the model's origin rather than its own centre: the model3d
|
|
6227
|
+
// engine folds the bounding sphere's centre offset into it (plus padding for badly-centred
|
|
6228
|
+
// models), and measures it at the entity's scale. So it can be used as-is against a sphere
|
|
6229
|
+
// centred on the entity position.
|
|
5874
6230
|
sphere.radius = Math.max(model._radius, MODEL_MIN_RADIUS);
|
|
5875
6231
|
}
|
|
5876
6232
|
else {
|
|
@@ -5884,12 +6240,10 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5884
6240
|
let radius = getValue$1(viewer, cEntity.ellipse.semiMajorAxis);
|
|
5885
6241
|
const extrusion = getValue$1(viewer, cEntity.ellipse.extrudedHeight);
|
|
5886
6242
|
if (extrusion && !isNaN(extrusion)) {
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
radius = extrusion;
|
|
5892
|
-
}
|
|
6243
|
+
// Expand rather than replace: measured from the base centre, the top rim of an extruded ellipse
|
|
6244
|
+
// sits at sqrt(radius^2 + height^2). Taking whichever of the two is larger leaves the rim outside
|
|
6245
|
+
// the sphere, and for something both wide and tall it would actually shrink it.
|
|
6246
|
+
radius = radius ? Math.sqrt((radius * radius) + (extrusion * extrusion)) : extrusion;
|
|
5893
6247
|
}
|
|
5894
6248
|
if (radius && !isNaN(radius)) {
|
|
5895
6249
|
sphere.radius = radius;
|
|
@@ -5899,12 +6253,11 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5899
6253
|
else if (cEntity.polygon) {
|
|
5900
6254
|
const extrusion = getValue$1(viewer, cEntity.polygon.extrudedHeight);
|
|
5901
6255
|
if (extrusion && !isNaN(extrusion)) {
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
}
|
|
6256
|
+
// Same as the ellipse above: the footprint sphere has to grow to reach the extruded top corners,
|
|
6257
|
+
// at sqrt(footprint^2 + height^2) from the footprint centre.
|
|
6258
|
+
sphere.radius = sphere.radius
|
|
6259
|
+
? Math.sqrt((sphere.radius * sphere.radius) + (extrusion * extrusion))
|
|
6260
|
+
: extrusion;
|
|
5908
6261
|
}
|
|
5909
6262
|
}
|
|
5910
6263
|
else if (cEntity.point || cEntity.billboard) {
|
|
@@ -5926,7 +6279,15 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
5926
6279
|
return false;
|
|
5927
6280
|
}
|
|
5928
6281
|
const adjustedSphere = boundingSphere.sphere.clone();
|
|
5929
|
-
|
|
6282
|
+
// Terrain only matters here because it moves the sphere onto the ground.
|
|
6283
|
+
// Far enough away that a plausible ground height is a rounding error against the viewing distance, sampling it is wasted work.
|
|
6284
|
+
const cameraDistance = Cartesian3.distance(camera.position, adjustedSphere.center);
|
|
6285
|
+
if (cameraDistance > TERRAIN_SKIP_DISTANCE) {
|
|
6286
|
+
adjustedSphere.radius += TERRAIN_SKIP_RADIUS_PAD;
|
|
6287
|
+
}
|
|
6288
|
+
else {
|
|
6289
|
+
adjustedSphere.center = adjustPos3d(viewer, boundingSphere.heightRef, adjustedSphere.center);
|
|
6290
|
+
}
|
|
5930
6291
|
const cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up);
|
|
5931
6292
|
const visibility = cullingVolume.computeVisibility(adjustedSphere);
|
|
5932
6293
|
return visibility !== Intersect.INSIDE && visibility !== Intersect.INTERSECTING;
|
|
@@ -5999,38 +6360,67 @@ function isCullingIgnored(viewer, rego) {
|
|
|
5999
6360
|
rego.relation != null ||
|
|
6000
6361
|
// Explicitly being either shown or hidden.
|
|
6001
6362
|
rego.overrideShow != null ||
|
|
6002
|
-
// Part of
|
|
6003
|
-
//
|
|
6004
|
-
rego.collection ||
|
|
6363
|
+
// Part of a collection we did not create, eg. a geojson data source, which may have its own rules for
|
|
6364
|
+
// what is in the scene. Our own per-menu-item data sources are fair game.
|
|
6365
|
+
(rego.collection && !IsCCollectionOwned(rego.collection)) ||
|
|
6005
6366
|
// We won't cull historic records as they may be interpolating their locations.
|
|
6006
6367
|
Boolean(rego.outline && rego.outline.some(x => !!x.DateTime))) {
|
|
6007
6368
|
return true;
|
|
6008
6369
|
}
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6370
|
+
return false;
|
|
6371
|
+
}
|
|
6372
|
+
// A tileset's bounds are padded by this fraction before testing, so panning does not immediately evict something
|
|
6373
|
+
// at the edge of view and pay to re-traverse it moments later.
|
|
6374
|
+
const TILESET_CULL_PADDING = 0.25;
|
|
6375
|
+
/**
|
|
6376
|
+
* Suppresses tilesets whose padded bounds are outside the view, and restores ones that come back.
|
|
6377
|
+
*
|
|
6378
|
+
* Worth doing separately from entity culling because Cesium gates a tileset's whole update on its show flag: a
|
|
6379
|
+
* hidden tileset skips traversal, tile selection and request scheduling entirely, where hiding its features still
|
|
6380
|
+
* does all of that and merely draws nothing. There are only ever a handful of tilesets, so this needs no batching.
|
|
6381
|
+
* @param register
|
|
6382
|
+
*/
|
|
6383
|
+
function cullTilesets(register) {
|
|
6384
|
+
var _a;
|
|
6385
|
+
const viewer = register.Viewer;
|
|
6386
|
+
const tilesets = register.GetTilesets();
|
|
6387
|
+
if (!tilesets.length || viewer.isDestroyed() || !viewer.scene) {
|
|
6388
|
+
return;
|
|
6026
6389
|
}
|
|
6027
|
-
|
|
6028
|
-
|
|
6390
|
+
const camera = viewer.scene.camera;
|
|
6391
|
+
const cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up);
|
|
6392
|
+
let changed = false;
|
|
6393
|
+
for (const rego of tilesets) {
|
|
6394
|
+
const tileset = rego.tileset;
|
|
6395
|
+
if (!tileset || !rego.gate) {
|
|
6396
|
+
continue;
|
|
6397
|
+
}
|
|
6398
|
+
// A destroyed tileset should not be held onto, let alone culled.
|
|
6399
|
+
if ((_a = tileset.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(tileset)) {
|
|
6400
|
+
register.RemoveTileset(tileset);
|
|
6401
|
+
continue;
|
|
6402
|
+
}
|
|
6403
|
+
let sphere;
|
|
6404
|
+
try {
|
|
6405
|
+
sphere = tileset.boundingSphere;
|
|
6406
|
+
}
|
|
6407
|
+
catch (e) {
|
|
6408
|
+
// Not ready yet. Leave it alone rather than guessing.
|
|
6409
|
+
continue;
|
|
6410
|
+
}
|
|
6411
|
+
if (!sphere || isNaN(sphere.radius) || sphere.radius <= 0) {
|
|
6412
|
+
continue;
|
|
6413
|
+
}
|
|
6414
|
+
const padded = sphere.clone();
|
|
6415
|
+
padded.radius = sphere.radius * (1 + TILESET_CULL_PADDING);
|
|
6416
|
+
const visible = cullingVolume.computeVisibility(padded) !== Intersect.OUTSIDE;
|
|
6417
|
+
if (register.SetTilesetCulled(tileset, !visible)) {
|
|
6418
|
+
changed = true;
|
|
6419
|
+
}
|
|
6029
6420
|
}
|
|
6030
|
-
|
|
6031
|
-
|
|
6421
|
+
if (changed) {
|
|
6422
|
+
viewer.scene.requestRender();
|
|
6032
6423
|
}
|
|
6033
|
-
return heightRef != HeightReference.CLAMP_TO_GROUND;
|
|
6034
6424
|
}
|
|
6035
6425
|
/**
|
|
6036
6426
|
* Runs through all entities in the register and culls them if they are out of the viewport.
|
|
@@ -6046,6 +6436,7 @@ function runCullChecker(register) {
|
|
|
6046
6436
|
const entityIds = register.GetEntityIds();
|
|
6047
6437
|
// We'll use the terrain cache per culler cycle.
|
|
6048
6438
|
_terrainCache.Clear();
|
|
6439
|
+
cullTilesets(register);
|
|
6049
6440
|
checkInterval = setInterval(() => {
|
|
6050
6441
|
var _a;
|
|
6051
6442
|
if (viewer.isDestroyed() || !viewer.scene) {
|
|
@@ -6098,7 +6489,7 @@ function runCullChecker(register) {
|
|
|
6098
6489
|
else {
|
|
6099
6490
|
delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
|
|
6100
6491
|
if (rego.overrideShow != false &&
|
|
6101
|
-
!viewer
|
|
6492
|
+
!IsCEntityInScene(viewer, part) &&
|
|
6102
6493
|
!state.hidden &&
|
|
6103
6494
|
(!isIsolatedAny || state.isolated)) {
|
|
6104
6495
|
toAdd.push(part);
|
|
@@ -6138,16 +6529,17 @@ function removeEntities(viewer, entities) {
|
|
|
6138
6529
|
}
|
|
6139
6530
|
const removal = viewer.scene.postRender.addEventListener(() => {
|
|
6140
6531
|
removal();
|
|
6141
|
-
for
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6532
|
+
// Batched, so Cesium raises one collectionChanged for the whole cull pass instead of one per entity.
|
|
6533
|
+
WithSuspendedCCollections(entities.map(x => GetCEntityCollection(viewer, x)), () => {
|
|
6534
|
+
for (let i = 0; i < entities.length; i++) {
|
|
6535
|
+
const entity = entities[i];
|
|
6536
|
+
if (entityRemoveAddState.get(entity.id) != false) {
|
|
6537
|
+
continue;
|
|
6538
|
+
}
|
|
6539
|
+
entityRemoveAddState.delete(entity.id);
|
|
6540
|
+
RemoveCEntityFromScene(viewer, entity);
|
|
6149
6541
|
}
|
|
6150
|
-
}
|
|
6542
|
+
});
|
|
6151
6543
|
});
|
|
6152
6544
|
}
|
|
6153
6545
|
/**
|
|
@@ -6162,16 +6554,17 @@ function addEntities(viewer, entities) {
|
|
|
6162
6554
|
}
|
|
6163
6555
|
const removal = viewer.scene.postRender.addEventListener(() => {
|
|
6164
6556
|
removal();
|
|
6165
|
-
for
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6557
|
+
// Batched, so Cesium raises one collectionChanged for the whole cull pass instead of one per entity.
|
|
6558
|
+
WithSuspendedCCollections(entities.map(x => GetCEntityCollection(viewer, x)), () => {
|
|
6559
|
+
for (let i = 0; i < entities.length; i++) {
|
|
6560
|
+
const entity = entities[i];
|
|
6561
|
+
if (entityRemoveAddState.get(entity.id) != true) {
|
|
6562
|
+
continue;
|
|
6563
|
+
}
|
|
6564
|
+
entityRemoveAddState.delete(entity.id);
|
|
6565
|
+
AddCEntityToScene(viewer, entity);
|
|
6173
6566
|
}
|
|
6174
|
-
}
|
|
6567
|
+
});
|
|
6175
6568
|
});
|
|
6176
6569
|
}
|
|
6177
6570
|
var VisualRegisterCuller;
|
|
@@ -6242,6 +6635,19 @@ var VisualRegisterCuller;
|
|
|
6242
6635
|
};
|
|
6243
6636
|
}
|
|
6244
6637
|
VisualRegisterCuller.Monitor = Monitor;
|
|
6638
|
+
/**
|
|
6639
|
+
* Runs the tileset visibility pass immediately, rather than waiting for the next cull cycle.
|
|
6640
|
+
* Exposed so the behaviour is directly assertable, and for a caller that needs it applied now.
|
|
6641
|
+
* @param register
|
|
6642
|
+
*/
|
|
6643
|
+
function CullTilesets(register) {
|
|
6644
|
+
cullTilesets(register);
|
|
6645
|
+
}
|
|
6646
|
+
VisualRegisterCuller.CullTilesets = CullTilesets;
|
|
6647
|
+
function IsCullingIgnored(viewer, rego) {
|
|
6648
|
+
return isCullingIgnored(viewer, rego);
|
|
6649
|
+
}
|
|
6650
|
+
VisualRegisterCuller.IsCullingIgnored = IsCullingIgnored;
|
|
6245
6651
|
function IsCulled(viewer, rego, visual) {
|
|
6246
6652
|
if (isCullingIgnored(viewer, rego)) {
|
|
6247
6653
|
return false;
|
|
@@ -6289,7 +6695,7 @@ function isAlive$1(viewer, visual) {
|
|
|
6289
6695
|
return false;
|
|
6290
6696
|
}
|
|
6291
6697
|
if (visual instanceof Entity) {
|
|
6292
|
-
return viewer
|
|
6698
|
+
return IsCEntityInScene(viewer, visual);
|
|
6293
6699
|
}
|
|
6294
6700
|
else if (visual instanceof Primitive) {
|
|
6295
6701
|
return viewer.scene.primitives.contains(visual);
|
|
@@ -6316,6 +6722,32 @@ function removeEntity(viewer, visual) {
|
|
|
6316
6722
|
viewer
|
|
6317
6723
|
});
|
|
6318
6724
|
}
|
|
6725
|
+
/**
|
|
6726
|
+
* Returns the highest zIndex across a graphic and its siblings, or null when none of them set one.
|
|
6727
|
+
* @param viewer
|
|
6728
|
+
* @param visual
|
|
6729
|
+
*/
|
|
6730
|
+
function getHighestZIndex(viewer, visual) {
|
|
6731
|
+
if (!(visual instanceof Entity)) {
|
|
6732
|
+
return null;
|
|
6733
|
+
}
|
|
6734
|
+
let highest = null;
|
|
6735
|
+
const parts = EntityUtils.GatherEntity({
|
|
6736
|
+
entity: visual
|
|
6737
|
+
});
|
|
6738
|
+
for (const part of parts) {
|
|
6739
|
+
if (!(part instanceof Entity)) {
|
|
6740
|
+
continue;
|
|
6741
|
+
}
|
|
6742
|
+
for (const graphic of [part.polygon, part.polyline, part.corridor, part.ellipse, part.rectangle]) {
|
|
6743
|
+
const zIndex = graphic ? GetCValue(viewer, graphic.zIndex) : null;
|
|
6744
|
+
if (zIndex != null && !isNaN(zIndex) && (highest == null || zIndex > highest)) {
|
|
6745
|
+
highest = zIndex;
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
return highest;
|
|
6750
|
+
}
|
|
6319
6751
|
const MAX_SHOW_DEPTH = 10;
|
|
6320
6752
|
function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth = 0) {
|
|
6321
6753
|
if (depth > MAX_SHOW_DEPTH) {
|
|
@@ -6334,26 +6766,24 @@ function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth = 0)
|
|
|
6334
6766
|
updateCEntityShow(viewer, sibling, rego, show, true, depth + 1);
|
|
6335
6767
|
}
|
|
6336
6768
|
}
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
rego.collection.remove(visual);
|
|
6344
|
-
}
|
|
6345
|
-
else if (show && !rego.collection.contains(visual)) {
|
|
6346
|
-
rego.collection.add(visual);
|
|
6769
|
+
if (show) {
|
|
6770
|
+
// Always restore membership on the way back in. Something else may have evicted this graphic while it
|
|
6771
|
+
// was hidden (the culler removes outright), and `show` alone would leave it invisible.
|
|
6772
|
+
AddCEntityToScene(viewer, visual, rego.collection);
|
|
6773
|
+
if (visual.show !== true) {
|
|
6774
|
+
visual.show = true;
|
|
6347
6775
|
}
|
|
6776
|
+
return;
|
|
6348
6777
|
}
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
viewer.entities.add(visual);
|
|
6778
|
+
// Hiding via `show` only updates a per-instance attribute, where leaving the collection rebuilds the whole
|
|
6779
|
+
// geometry batch. But it is not safe for every graphic, see CanToggleShowSafely for exactly why.
|
|
6780
|
+
if (CanToggleShowSafely([visual])) {
|
|
6781
|
+
if (visual.show !== false) {
|
|
6782
|
+
visual.show = false;
|
|
6355
6783
|
}
|
|
6784
|
+
return;
|
|
6356
6785
|
}
|
|
6786
|
+
RemoveCEntityFromScene(viewer, visual);
|
|
6357
6787
|
}
|
|
6358
6788
|
function updateEntityShow(viewer, rego, show) {
|
|
6359
6789
|
const visual = rego.visual;
|
|
@@ -6666,12 +7096,128 @@ var VisualsRegister;
|
|
|
6666
7096
|
// This lets us modify the update without re-adding the item to the queue if it's already in it.
|
|
6667
7097
|
this.updateQueueSettings = {};
|
|
6668
7098
|
this.updateQueueInterval = null;
|
|
7099
|
+
// Per menu item collections so we can refresh sets of Entities without affecting others.
|
|
7100
|
+
this.menuItemSources = new Map();
|
|
7101
|
+
// Set when the data source order no longer matches the zIndexes seen, so it is re-applied once.
|
|
7102
|
+
this.sourceOrderDirty = false;
|
|
7103
|
+
/*
|
|
7104
|
+
* Tilesets in the scene, keyed by the tileset itself.
|
|
7105
|
+
*/
|
|
7106
|
+
this.tilesets = new Map();
|
|
6669
7107
|
this.viewer = params.viewer;
|
|
6670
7108
|
this.apiGetters = params.apiGetters;
|
|
6671
7109
|
this.cameraCullerDispose = VisualRegisterCuller.Monitor({
|
|
6672
7110
|
register: this
|
|
6673
7111
|
});
|
|
6674
7112
|
}
|
|
7113
|
+
/**
|
|
7114
|
+
* Returns the collection a menu item's visuals belong in, creating its data source on first use.
|
|
7115
|
+
* Returns null when there is nothing to key off, leaving the caller on the viewer's own collection.
|
|
7116
|
+
* @param menuItemId
|
|
7117
|
+
*/
|
|
7118
|
+
ensureMenuItemCollection(menuItemId) {
|
|
7119
|
+
var _a;
|
|
7120
|
+
if (!menuItemId || this.disposed || !((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.dataSources)) {
|
|
7121
|
+
return null;
|
|
7122
|
+
}
|
|
7123
|
+
const existing = this.menuItemSources.get(menuItemId);
|
|
7124
|
+
if (existing) {
|
|
7125
|
+
return existing.source.entities;
|
|
7126
|
+
}
|
|
7127
|
+
const source = new CustomDataSource(`menu-item-${menuItemId}`);
|
|
7128
|
+
const record = {
|
|
7129
|
+
source,
|
|
7130
|
+
maxZIndex: 0,
|
|
7131
|
+
added: false
|
|
7132
|
+
};
|
|
7133
|
+
MarkCCollectionOwned(source.entities);
|
|
7134
|
+
this.menuItemSources.set(menuItemId, record);
|
|
7135
|
+
// Adding is asynchronous, so ordering has to wait until it is actually in the collection.
|
|
7136
|
+
Promise.resolve(this.viewer.dataSources.add(source))
|
|
7137
|
+
.then(() => {
|
|
7138
|
+
record.added = true;
|
|
7139
|
+
this.applySourceOrder();
|
|
7140
|
+
})
|
|
7141
|
+
.catch((e) => {
|
|
7142
|
+
console.error(e);
|
|
7143
|
+
});
|
|
7144
|
+
return source.entities;
|
|
7145
|
+
}
|
|
7146
|
+
/**
|
|
7147
|
+
* Notes the highest zIndex seen for a menu item, since that is what its data source has to sort by.
|
|
7148
|
+
* zIndex orders geometry within a data source but not between them, so a whole layer stacks by the
|
|
7149
|
+
* highest value anything in it asked for.
|
|
7150
|
+
* @param menuItemId
|
|
7151
|
+
* @param visual
|
|
7152
|
+
*/
|
|
7153
|
+
trackSourceZIndex(menuItemId, visual) {
|
|
7154
|
+
const record = this.menuItemSources.get(menuItemId);
|
|
7155
|
+
if (!record) {
|
|
7156
|
+
return;
|
|
7157
|
+
}
|
|
7158
|
+
const zIndex = getHighestZIndex(this.viewer, visual);
|
|
7159
|
+
if (zIndex == null || zIndex <= record.maxZIndex) {
|
|
7160
|
+
return;
|
|
7161
|
+
}
|
|
7162
|
+
record.maxZIndex = zIndex;
|
|
7163
|
+
this.sourceOrderDirty = true;
|
|
7164
|
+
this.applySourceOrder();
|
|
7165
|
+
}
|
|
7166
|
+
/**
|
|
7167
|
+
* Re-stacks the menu item data sources so a higher zIndex sits above a lower one.
|
|
7168
|
+
*/
|
|
7169
|
+
applySourceOrder() {
|
|
7170
|
+
var _a;
|
|
7171
|
+
if (this.disposed || !this.sourceOrderDirty || !((_a = this.viewer) === null || _a === void 0 ? void 0 : _a.dataSources)) {
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7174
|
+
const records = Array.from(this.menuItemSources.values()).filter(x => x.added);
|
|
7175
|
+
if (records.length < 2) {
|
|
7176
|
+
// Nothing to order against yet, so leave the flag set for when there is.
|
|
7177
|
+
return;
|
|
7178
|
+
}
|
|
7179
|
+
this.sourceOrderDirty = false;
|
|
7180
|
+
// Raising each in ascending order leaves the highest on top.
|
|
7181
|
+
records.sort((a, b) => a.maxZIndex - b.maxZIndex);
|
|
7182
|
+
for (const record of records) {
|
|
7183
|
+
try {
|
|
7184
|
+
this.viewer.dataSources.raiseToTop(record.source);
|
|
7185
|
+
}
|
|
7186
|
+
catch (e) {
|
|
7187
|
+
console.error(e);
|
|
7188
|
+
}
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
/**
|
|
7192
|
+
* Drops a menu item's data source once nothing is registered under it any more.
|
|
7193
|
+
* @param menuItemId
|
|
7194
|
+
*/
|
|
7195
|
+
releaseMenuItemCollection(menuItemId) {
|
|
7196
|
+
var _a, _b, _c;
|
|
7197
|
+
const record = this.menuItemSources.get(menuItemId);
|
|
7198
|
+
if (!record) {
|
|
7199
|
+
return;
|
|
7200
|
+
}
|
|
7201
|
+
if ((_a = this.entityIdsByMenuItem[menuItemId]) === null || _a === void 0 ? void 0 : _a.size) {
|
|
7202
|
+
return;
|
|
7203
|
+
}
|
|
7204
|
+
this.menuItemSources.delete(menuItemId);
|
|
7205
|
+
try {
|
|
7206
|
+
(_c = (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.dataSources) === null || _c === void 0 ? void 0 : _c.remove(record.source, true);
|
|
7207
|
+
}
|
|
7208
|
+
catch (e) {
|
|
7209
|
+
console.error(e);
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
/** Every collection a bulk pass over this register's visuals could mutate. */
|
|
7213
|
+
allSceneCollections() {
|
|
7214
|
+
var _a;
|
|
7215
|
+
const collections = [(_a = this.viewer) === null || _a === void 0 ? void 0 : _a.entities];
|
|
7216
|
+
for (const record of Array.from(this.menuItemSources.values())) {
|
|
7217
|
+
collections.push(record.source.entities);
|
|
7218
|
+
}
|
|
7219
|
+
return collections;
|
|
7220
|
+
}
|
|
6675
7221
|
indexMenuItemEntity(menuItemId, entityId) {
|
|
6676
7222
|
if (!menuItemId) {
|
|
6677
7223
|
return;
|
|
@@ -7261,9 +7807,11 @@ var VisualsRegister;
|
|
|
7261
7807
|
return;
|
|
7262
7808
|
}
|
|
7263
7809
|
const end = Math.min(index + BATCH_SIZE, items.length);
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7810
|
+
WithSuspendedCCollections(this.allSceneCollections(), () => {
|
|
7811
|
+
for (; index < end; index++) {
|
|
7812
|
+
perItem(items[index]);
|
|
7813
|
+
}
|
|
7814
|
+
});
|
|
7267
7815
|
this.viewer.scene.requestRender();
|
|
7268
7816
|
if (index >= items.length) {
|
|
7269
7817
|
clearInterval(interval);
|
|
@@ -7420,7 +7968,7 @@ var VisualsRegister;
|
|
|
7420
7968
|
markEntity(this, rego, rego.visual, false);
|
|
7421
7969
|
}
|
|
7422
7970
|
Dispose() {
|
|
7423
|
-
var _a;
|
|
7971
|
+
var _a, _b, _c, _d;
|
|
7424
7972
|
(_a = this.cameraCullerDispose) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
7425
7973
|
uncull: false
|
|
7426
7974
|
});
|
|
@@ -7435,6 +7983,20 @@ var VisualsRegister;
|
|
|
7435
7983
|
}
|
|
7436
7984
|
this.activeChunkedIntervals.clear();
|
|
7437
7985
|
this.disposed = true;
|
|
7986
|
+
for (const record of Array.from(this.menuItemSources.values())) {
|
|
7987
|
+
try {
|
|
7988
|
+
(_c = (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.dataSources) === null || _c === void 0 ? void 0 : _c.remove(record.source, true);
|
|
7989
|
+
}
|
|
7990
|
+
catch (e) {
|
|
7991
|
+
console.error(e);
|
|
7992
|
+
}
|
|
7993
|
+
}
|
|
7994
|
+
this.menuItemSources.clear();
|
|
7995
|
+
// Hand every tileset's show flag back to its owner, holding whatever the owner last asked for.
|
|
7996
|
+
for (const rego of Array.from(this.tilesets.values())) {
|
|
7997
|
+
(_d = rego.gate) === null || _d === void 0 ? void 0 : _d.Release();
|
|
7998
|
+
}
|
|
7999
|
+
this.tilesets.clear();
|
|
7438
8000
|
}
|
|
7439
8001
|
ForceUpdate(params) {
|
|
7440
8002
|
var _a;
|
|
@@ -8030,6 +8592,14 @@ var VisualsRegister;
|
|
|
8030
8592
|
});
|
|
8031
8593
|
}
|
|
8032
8594
|
const entityId = rego.entityId;
|
|
8595
|
+
// Scope this visual to its menu item's own data source, so a rebuild of it cannot re-tessellate
|
|
8596
|
+
// other layers. A caller that already picked a collection (eg. geojson) keeps its own.
|
|
8597
|
+
if (!rego.collection && rego.menuItemId) {
|
|
8598
|
+
const collection = this.ensureMenuItemCollection(rego.menuItemId);
|
|
8599
|
+
if (collection) {
|
|
8600
|
+
rego.collection = collection;
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8033
8603
|
// Add the new visual to the register.
|
|
8034
8604
|
const entityRegos = (_a = this.rego[entityId]) !== null && _a !== void 0 ? _a : [];
|
|
8035
8605
|
entityRegos.push(rego);
|
|
@@ -8037,6 +8607,7 @@ var VisualsRegister;
|
|
|
8037
8607
|
this.indexMenuItemEntity(rego.menuItemId, entityId);
|
|
8038
8608
|
// Mark the visual as part of this register so selection works.
|
|
8039
8609
|
markEntity(this, rego, rego.visual, false);
|
|
8610
|
+
this.trackSourceZIndex(rego.menuItemId, rego.visual);
|
|
8040
8611
|
// Run any updates on the visual based on the calculated state.
|
|
8041
8612
|
// Eg: visibility, opacity, selection, etc.
|
|
8042
8613
|
this.queueUpdate({
|
|
@@ -8341,9 +8912,13 @@ var VisualsRegister;
|
|
|
8341
8912
|
this.startLazyRemoval(entityIds, removeOne, onComplete);
|
|
8342
8913
|
return;
|
|
8343
8914
|
}
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8915
|
+
WithSuspendedCCollections(this.allSceneCollections(), () => {
|
|
8916
|
+
for (const entityId of entityIds) {
|
|
8917
|
+
removeOne(entityId);
|
|
8918
|
+
}
|
|
8919
|
+
});
|
|
8920
|
+
this.releaseMenuItemCollection(menuItemId);
|
|
8921
|
+
this.RemoveTilesetsByMenuItem(menuItemId);
|
|
8347
8922
|
}
|
|
8348
8923
|
else if (entityId) {
|
|
8349
8924
|
const entityRegos = this.rego[entityId];
|
|
@@ -8526,8 +9101,75 @@ var VisualsRegister;
|
|
|
8526
9101
|
};
|
|
8527
9102
|
}
|
|
8528
9103
|
/**
|
|
8529
|
-
*
|
|
9104
|
+
* Registers a tileset so the register can decide when it is worth drawing.
|
|
9105
|
+
* @param params
|
|
9106
|
+
*/
|
|
9107
|
+
AddTileset(params) {
|
|
9108
|
+
const { tileset, menuItemId } = params;
|
|
9109
|
+
if (!tileset || this.disposed) {
|
|
9110
|
+
return;
|
|
9111
|
+
}
|
|
9112
|
+
const existing = this.tilesets.get(tileset);
|
|
9113
|
+
if (existing) {
|
|
9114
|
+
existing.menuItemId = menuItemId !== null && menuItemId !== void 0 ? menuItemId : existing.menuItemId;
|
|
9115
|
+
return;
|
|
9116
|
+
}
|
|
9117
|
+
this.tilesets.set(tileset, {
|
|
9118
|
+
tileset,
|
|
9119
|
+
menuItemId,
|
|
9120
|
+
// Null when the property could not be intercepted, in which case this tileset simply never gets
|
|
9121
|
+
// culled rather than us fighting its owner over the same field.
|
|
9122
|
+
gate: InstallShowGate(tileset),
|
|
9123
|
+
culled: false
|
|
9124
|
+
});
|
|
9125
|
+
}
|
|
9126
|
+
/**
|
|
9127
|
+
* Stops tracking a tileset and hands its show flag back to its owner.
|
|
9128
|
+
* @param tileset
|
|
9129
|
+
*/
|
|
9130
|
+
RemoveTileset(tileset) {
|
|
9131
|
+
var _a;
|
|
9132
|
+
const rego = this.tilesets.get(tileset);
|
|
9133
|
+
if (!rego) {
|
|
9134
|
+
return;
|
|
9135
|
+
}
|
|
9136
|
+
this.tilesets.delete(tileset);
|
|
9137
|
+
(_a = rego.gate) === null || _a === void 0 ? void 0 : _a.Release();
|
|
9138
|
+
}
|
|
9139
|
+
/**
|
|
9140
|
+
* Stops tracking every tileset belonging to a menu item.
|
|
9141
|
+
* @param menuItemId
|
|
8530
9142
|
*/
|
|
9143
|
+
RemoveTilesetsByMenuItem(menuItemId) {
|
|
9144
|
+
if (!menuItemId) {
|
|
9145
|
+
return;
|
|
9146
|
+
}
|
|
9147
|
+
for (const rego of Array.from(this.tilesets.values())) {
|
|
9148
|
+
if (rego.menuItemId === menuItemId) {
|
|
9149
|
+
this.RemoveTileset(rego.tileset);
|
|
9150
|
+
}
|
|
9151
|
+
}
|
|
9152
|
+
}
|
|
9153
|
+
/**
|
|
9154
|
+
* Every tileset currently tracked.
|
|
9155
|
+
*/
|
|
9156
|
+
GetTilesets() {
|
|
9157
|
+
return Array.from(this.tilesets.values());
|
|
9158
|
+
}
|
|
9159
|
+
/**
|
|
9160
|
+
* Suppresses or restores a tileset.
|
|
9161
|
+
* Returns whether its effective visibility changed, so a caller can skip requesting a render when nothing did.
|
|
9162
|
+
* @param tileset
|
|
9163
|
+
* @param culled
|
|
9164
|
+
*/
|
|
9165
|
+
SetTilesetCulled(tileset, culled) {
|
|
9166
|
+
const rego = this.tilesets.get(tileset);
|
|
9167
|
+
if (!(rego === null || rego === void 0 ? void 0 : rego.gate)) {
|
|
9168
|
+
return false;
|
|
9169
|
+
}
|
|
9170
|
+
rego.culled = Boolean(culled);
|
|
9171
|
+
return rego.gate.SetSuppressed(rego.culled);
|
|
9172
|
+
}
|
|
8531
9173
|
GetEntityIds() {
|
|
8532
9174
|
const ids = [];
|
|
8533
9175
|
for (const entityId in this.rego) {
|
|
@@ -9901,7 +10543,11 @@ var EntitiesRenderManager;
|
|
|
9901
10543
|
const displayItems = this.zoomControl ? (_d = this.zoomControl) === null || _d === void 0 ? void 0 : _d.filter(x => x.DisplayType != ZoomControl.EDisplayType.Hidden) : [];
|
|
9902
10544
|
const shouldCheck = displayItems.length > 1;
|
|
9903
10545
|
this.entityCheckQueue = new DelayQueue(() => {
|
|
9904
|
-
this.
|
|
10546
|
+
// With a single band this pass is not looking for band changes at all, it is the periodic registry cleanup, so it always runs over everything.
|
|
10547
|
+
const ids = shouldCheck
|
|
10548
|
+
? this.filterPossibleBandChanges(Object.keys(this.renderedEntities))
|
|
10549
|
+
: Object.keys(this.renderedEntities);
|
|
10550
|
+
this.doEntityCheck(ids);
|
|
9905
10551
|
}, shouldCheck ? 3000 : 30000);
|
|
9906
10552
|
const feed = (_e = this.apiGetter.getApi()) === null || _e === void 0 ? void 0 : _e.RecordChangeFeed;
|
|
9907
10553
|
if (feed) {
|
|
@@ -10144,6 +10790,30 @@ var EntitiesRenderManager;
|
|
|
10144
10790
|
this.doEntityCheck(entityIds);
|
|
10145
10791
|
}
|
|
10146
10792
|
}
|
|
10793
|
+
/**
|
|
10794
|
+
* Narrows a camera-driven check to the entities whose zoom band could actually have changed.
|
|
10795
|
+
* @param ids
|
|
10796
|
+
*/
|
|
10797
|
+
filterPossibleBandChanges(ids) {
|
|
10798
|
+
return ids.filter((id) => {
|
|
10799
|
+
const rego = this.visualsManager.GetRego({
|
|
10800
|
+
entityId: id,
|
|
10801
|
+
menuItemId: this.item.id
|
|
10802
|
+
});
|
|
10803
|
+
// Anything without a live graphic to measure against has to be checked.
|
|
10804
|
+
if (!(rego === null || rego === void 0 ? void 0 : rego.visual) || rego.stale) {
|
|
10805
|
+
return true;
|
|
10806
|
+
}
|
|
10807
|
+
const bandCheck = rego.visual._bandCheck;
|
|
10808
|
+
if (!bandCheck) {
|
|
10809
|
+
return true;
|
|
10810
|
+
}
|
|
10811
|
+
return RenderManager.CouldBandHaveChanged({
|
|
10812
|
+
viewer: this.viewer,
|
|
10813
|
+
bandCheck
|
|
10814
|
+
});
|
|
10815
|
+
});
|
|
10816
|
+
}
|
|
10147
10817
|
async doEntityCheck(ids) {
|
|
10148
10818
|
var _a, _b;
|
|
10149
10819
|
if (this.isRunningCheck) {
|
|
@@ -10815,6 +11485,19 @@ var EntitiesRenderManager;
|
|
|
10815
11485
|
optimizeTolerance: (_o = item.optimizeTolerance) !== null && _o !== void 0 ? _o : ""
|
|
10816
11486
|
});
|
|
10817
11487
|
}
|
|
11488
|
+
/**
|
|
11489
|
+
* Everything about a menu item that changes how its entities are drawn, as a comparable string.
|
|
11490
|
+
* Two items with the same signature produce identical graphics, so a hand-off between them needs no
|
|
11491
|
+
* re-render (and so no re-fetch of entity data the hand-off just avoided requesting).
|
|
11492
|
+
* A false mismatch only costs the optimization, so key ordering inside an inline Style is not normalized.
|
|
11493
|
+
*/
|
|
11494
|
+
static GetRenderSignature(item) {
|
|
11495
|
+
return JSON.stringify({
|
|
11496
|
+
zoomControl: RenderManager.GetZoomControlSignature(item.CameraZoomSettings),
|
|
11497
|
+
historicDrawTrack: Boolean(item.historicDrawTrack),
|
|
11498
|
+
historicInterpolation: Boolean(item.historicInterpolation)
|
|
11499
|
+
});
|
|
11500
|
+
}
|
|
10818
11501
|
PrepareHandoff() {
|
|
10819
11502
|
var _a;
|
|
10820
11503
|
if (this.disposed || this.useGeojson || this.item.enableClustering) {
|
|
@@ -10826,7 +11509,8 @@ var EntitiesRenderManager;
|
|
|
10826
11509
|
internalByEntityId: new Map(this.internalByEntityId),
|
|
10827
11510
|
allowedTypeIDs: [...this.allowedTypeIDs],
|
|
10828
11511
|
renderQueue: [...this.renderQueue],
|
|
10829
|
-
sourceMenuItemId: this.item.id
|
|
11512
|
+
sourceMenuItemId: this.item.id,
|
|
11513
|
+
renderSignature: Manager.GetRenderSignature(this.item)
|
|
10830
11514
|
};
|
|
10831
11515
|
this.unsetGetter();
|
|
10832
11516
|
(_a = this.viewMonitorRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
@@ -10866,7 +11550,12 @@ var EntitiesRenderManager;
|
|
|
10866
11550
|
if ((_a = payload.renderQueue) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10867
11551
|
this.distributeForRender(payload.renderQueue);
|
|
10868
11552
|
}
|
|
10869
|
-
this
|
|
11553
|
+
// Adopted graphics are already drawn the way this item wants them, so re-rendering would only
|
|
11554
|
+
// re-request every entity from the API, which is the cost the hand-off exists to avoid.
|
|
11555
|
+
const needsRestyle = payload.renderSignature !== Manager.GetRenderSignature(this.item);
|
|
11556
|
+
if (needsRestyle) {
|
|
11557
|
+
this.ReRender({ entityIds: Object.keys(this.renderedEntities), force: true });
|
|
11558
|
+
}
|
|
10870
11559
|
this.viewer.scene.requestRender();
|
|
10871
11560
|
}
|
|
10872
11561
|
}
|
|
@@ -11314,7 +12003,7 @@ var EntitiesLoadedRenderManager;
|
|
|
11314
12003
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
11315
12004
|
*/
|
|
11316
12005
|
async renderAsGeojson(entities, force) {
|
|
11317
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
12006
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11318
12007
|
entities = entities.filter((entity) => {
|
|
11319
12008
|
var _a;
|
|
11320
12009
|
return !this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
@@ -11365,38 +12054,42 @@ var EntitiesLoadedRenderManager;
|
|
|
11365
12054
|
if (!entities.length) {
|
|
11366
12055
|
return;
|
|
11367
12056
|
}
|
|
12057
|
+
// A menu item can declare that nothing about its render may touch the API. Styling then has to come from
|
|
12058
|
+
// the zoom item's inline Style, and names from what the entities already carry.
|
|
12059
|
+
const offline = Boolean((_a = this.item) === null || _a === void 0 ? void 0 : _a.offline);
|
|
11368
12060
|
let style = null;
|
|
11369
|
-
if ((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && zoomItem.StyleID != -1) {
|
|
12061
|
+
if (!offline && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && zoomItem.StyleID != -1) {
|
|
11370
12062
|
try {
|
|
11371
|
-
style = (
|
|
12063
|
+
style = (_b = (await Style.Get({
|
|
11372
12064
|
api: this.apiGetter.getApi(),
|
|
11373
12065
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
11374
|
-
})).style) === null ||
|
|
12066
|
+
})).style) === null || _b === void 0 ? void 0 : _b.Settings;
|
|
11375
12067
|
}
|
|
11376
12068
|
// Probably deleted.
|
|
11377
12069
|
catch (e) {
|
|
11378
12070
|
console.error(e);
|
|
11379
12071
|
}
|
|
11380
12072
|
}
|
|
11381
|
-
let entityTypeId = (
|
|
12073
|
+
let entityTypeId = (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"];
|
|
11382
12074
|
if (!entityTypeId) {
|
|
11383
|
-
entityTypeId = (
|
|
12075
|
+
entityTypeId = (_e = (_d = entities.find(x => { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _d === void 0 ? void 0 : _d.Bruce) === null || _e === void 0 ? void 0 : _e["EntityType.ID"];
|
|
11384
12076
|
}
|
|
11385
|
-
//
|
|
12077
|
+
// Normally fetched regardless, since name calculation needs it. Offline callers take the names the
|
|
12078
|
+
// entities already carry instead.
|
|
11386
12079
|
let entityType;
|
|
11387
|
-
if (entityTypeId) {
|
|
12080
|
+
if (entityTypeId && !offline) {
|
|
11388
12081
|
// Try using the Entity Type default if one is specified in the menu item.
|
|
11389
12082
|
try {
|
|
11390
|
-
entityType = (
|
|
12083
|
+
entityType = (_f = (await EntityType.Get({
|
|
11391
12084
|
entityTypeId: entityTypeId,
|
|
11392
12085
|
api: this.apiGetter.getApi()
|
|
11393
|
-
}))) === null ||
|
|
12086
|
+
}))) === null || _f === void 0 ? void 0 : _f.entityType;
|
|
11394
12087
|
if (!style && entityType) {
|
|
11395
12088
|
if (entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0) {
|
|
11396
|
-
style = (
|
|
12089
|
+
style = (_g = (await Style.Get({
|
|
11397
12090
|
api: this.apiGetter.getApi(),
|
|
11398
12091
|
styleId: entityType["DisplaySetting.ID"]
|
|
11399
|
-
})).style) === null ||
|
|
12092
|
+
})).style) === null || _g === void 0 ? void 0 : _g.Settings;
|
|
11400
12093
|
}
|
|
11401
12094
|
}
|
|
11402
12095
|
}
|
|
@@ -11404,9 +12097,13 @@ var EntitiesLoadedRenderManager;
|
|
|
11404
12097
|
console.error(e);
|
|
11405
12098
|
}
|
|
11406
12099
|
}
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
12100
|
+
// Fall back to whatever the zoom item carried inline, which is the only source offline.
|
|
12101
|
+
if (!style) {
|
|
12102
|
+
style = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style;
|
|
12103
|
+
}
|
|
12104
|
+
const pStyle = (_h = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _h !== void 0 ? _h : {};
|
|
12105
|
+
const lStyle = (_j = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _j !== void 0 ? _j : {};
|
|
12106
|
+
const polygonsClamped = ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == null ? true : ((_l = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _l === void 0 ? void 0 : _l.id) == 0;
|
|
11410
12107
|
const bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
11411
12108
|
const cFillColor = bFillColor ? colorToCColor$2(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
11412
12109
|
const bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
@@ -11640,6 +12337,7 @@ var EntitiesLoadedRenderManager;
|
|
|
11640
12337
|
return next;
|
|
11641
12338
|
}
|
|
11642
12339
|
async doRenderAsIndividuals(entities, force = false) {
|
|
12340
|
+
var _a;
|
|
11643
12341
|
const { updated, entities: cEntities } = await EntityRenderEngine.Render({
|
|
11644
12342
|
viewer: this.viewer,
|
|
11645
12343
|
apiGetter: this.apiGetter,
|
|
@@ -11647,6 +12345,8 @@ var EntitiesLoadedRenderManager;
|
|
|
11647
12345
|
menuItemId: this.item.id,
|
|
11648
12346
|
visualRegister: this.visualsManager,
|
|
11649
12347
|
zoomControl: this.item.CameraZoomSettings,
|
|
12348
|
+
// Carries the promise through to the engines, which do the rest of the API avoidance.
|
|
12349
|
+
offline: Boolean((_a = this.item) === null || _a === void 0 ? void 0 : _a.offline),
|
|
11650
12350
|
force
|
|
11651
12351
|
});
|
|
11652
12352
|
if (this.disposed) {
|
|
@@ -13877,6 +14577,7 @@ var TilesetRenderEngine;
|
|
|
13877
14577
|
}
|
|
13878
14578
|
TilesetRenderEngine.ApplySettings = ApplySettings;
|
|
13879
14579
|
async function Render(params) {
|
|
14580
|
+
var _a, _b, _c;
|
|
13880
14581
|
const api = params.apiGetter.getApi(params.accountId);
|
|
13881
14582
|
// Ensure regional url is loaded.
|
|
13882
14583
|
await api.Loading;
|
|
@@ -13940,6 +14641,10 @@ var TilesetRenderEngine;
|
|
|
13940
14641
|
console.error(e);
|
|
13941
14642
|
}
|
|
13942
14643
|
});
|
|
14644
|
+
(_a = params.register) === null || _a === void 0 ? void 0 : _a.AddTileset({
|
|
14645
|
+
tileset: cTileset,
|
|
14646
|
+
menuItemId: params.menuItemId
|
|
14647
|
+
});
|
|
13943
14648
|
return cTileset;
|
|
13944
14649
|
}
|
|
13945
14650
|
else if (params.tileset.type === Tileset.EType.EntitiesSet) {
|
|
@@ -13956,6 +14661,10 @@ var TilesetRenderEngine;
|
|
|
13956
14661
|
const cTileset = await createTileset(loadUrl, null, params.noMemoryLimit);
|
|
13957
14662
|
params.viewer.scene.primitives.add(cTileset);
|
|
13958
14663
|
watchTilesetDateRange(params.viewer, cTileset, params.tileset);
|
|
14664
|
+
(_b = params.register) === null || _b === void 0 ? void 0 : _b.AddTileset({
|
|
14665
|
+
tileset: cTileset,
|
|
14666
|
+
menuItemId: params.menuItemId
|
|
14667
|
+
});
|
|
13959
14668
|
return cTileset;
|
|
13960
14669
|
}
|
|
13961
14670
|
else if (params.tileset.type == Tileset.EType.PointCloud) {
|
|
@@ -14001,6 +14710,10 @@ var TilesetRenderEngine;
|
|
|
14001
14710
|
console.error(e);
|
|
14002
14711
|
}
|
|
14003
14712
|
});
|
|
14713
|
+
(_c = params.register) === null || _c === void 0 ? void 0 : _c.AddTileset({
|
|
14714
|
+
tileset: cTileset,
|
|
14715
|
+
menuItemId: params.menuItemId
|
|
14716
|
+
});
|
|
14004
14717
|
return cTileset;
|
|
14005
14718
|
}
|
|
14006
14719
|
else {
|
|
@@ -14009,6 +14722,7 @@ var TilesetRenderEngine;
|
|
|
14009
14722
|
}
|
|
14010
14723
|
TilesetRenderEngine.Render = Render;
|
|
14011
14724
|
async function RenderLegacy(params) {
|
|
14725
|
+
var _a;
|
|
14012
14726
|
let { apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, accountId, noMemoryLimit, backFaceCulling } = params;
|
|
14013
14727
|
let settings = tileset === null || tileset === void 0 ? void 0 : tileset.Settings;
|
|
14014
14728
|
settings = {
|
|
@@ -14131,6 +14845,10 @@ var TilesetRenderEngine;
|
|
|
14131
14845
|
console.error(e);
|
|
14132
14846
|
}
|
|
14133
14847
|
});
|
|
14848
|
+
(_a = params.register) === null || _a === void 0 ? void 0 : _a.AddTileset({
|
|
14849
|
+
tileset: cTileset,
|
|
14850
|
+
menuItemId: params.menuItemId
|
|
14851
|
+
});
|
|
14134
14852
|
return cTileset;
|
|
14135
14853
|
}
|
|
14136
14854
|
TilesetRenderEngine.RenderLegacy = RenderLegacy;
|
|
@@ -14645,6 +15363,8 @@ var TilesetCadRenderManager;
|
|
|
14645
15363
|
}
|
|
14646
15364
|
// Render outside the shared process because we can't control file requests from Cesium.
|
|
14647
15365
|
const cTileset = this.cTileset = await TilesetRenderEngine.Render({
|
|
15366
|
+
register: this.visualsManager,
|
|
15367
|
+
menuItemId: this.item.id,
|
|
14648
15368
|
loadUrl: loadUrl,
|
|
14649
15369
|
apiGetter: this.getters.GetBruceGetter(),
|
|
14650
15370
|
tileset: tileset,
|
|
@@ -16978,7 +17698,12 @@ var DataLabRenderManager;
|
|
|
16978
17698
|
const displayItems = this.zoomControl ? this.zoomControl.filter(x => x.DisplayType != ZoomControl.EDisplayType.Hidden) : [];
|
|
16979
17699
|
const shouldCheck = displayItems.length > 1;
|
|
16980
17700
|
this.entityCheckQueue = new DelayQueue(() => {
|
|
16981
|
-
this
|
|
17701
|
+
// With a single band this pass is not looking for band changes at all, so it always runs over
|
|
17702
|
+
// everything. With more than one, most entities can be ruled out without asking the server.
|
|
17703
|
+
const ids = shouldCheck
|
|
17704
|
+
? this.filterPossibleBandChanges(Object.keys(this.renderedEntities))
|
|
17705
|
+
: Object.keys(this.renderedEntities);
|
|
17706
|
+
this.doEntityCheck(ids);
|
|
16982
17707
|
}, shouldCheck ? 3000 : 30000);
|
|
16983
17708
|
(_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
16984
17709
|
this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
|
|
@@ -16986,6 +17711,30 @@ var DataLabRenderManager;
|
|
|
16986
17711
|
(_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Call();
|
|
16987
17712
|
});
|
|
16988
17713
|
}
|
|
17714
|
+
/**
|
|
17715
|
+
* Narrows a camera-driven check to the entities whose zoom band could actually have changed, so a pan or
|
|
17716
|
+
* zoom stops re-requesting the whole rendered set. See RenderManager.CouldBandHaveChanged.
|
|
17717
|
+
* @param ids
|
|
17718
|
+
*/
|
|
17719
|
+
filterPossibleBandChanges(ids) {
|
|
17720
|
+
return ids.filter((id) => {
|
|
17721
|
+
const rego = this.visualsManager.GetRego({
|
|
17722
|
+
entityId: id,
|
|
17723
|
+
menuItemId: this.item.id
|
|
17724
|
+
});
|
|
17725
|
+
if (!(rego === null || rego === void 0 ? void 0 : rego.visual) || rego.stale) {
|
|
17726
|
+
return true;
|
|
17727
|
+
}
|
|
17728
|
+
const bandCheck = rego.visual._bandCheck;
|
|
17729
|
+
if (!bandCheck) {
|
|
17730
|
+
return true;
|
|
17731
|
+
}
|
|
17732
|
+
return RenderManager.CouldBandHaveChanged({
|
|
17733
|
+
viewer: this.viewer,
|
|
17734
|
+
bandCheck
|
|
17735
|
+
});
|
|
17736
|
+
});
|
|
17737
|
+
}
|
|
16989
17738
|
preventCurrentCheckApiRefresh(entityIds) {
|
|
16990
17739
|
var _a;
|
|
16991
17740
|
this.reRenderState.markSkipForCurrentRun(entityIds, this.isRunningCheck);
|
|
@@ -17312,6 +18061,15 @@ var DataLabRenderManager;
|
|
|
17312
18061
|
}
|
|
17313
18062
|
return `datalab:${queryId}`;
|
|
17314
18063
|
}
|
|
18064
|
+
/**
|
|
18065
|
+
* Everything about this menu item that changes how its entities are drawn, as a comparable string.
|
|
18066
|
+
* The hand-off key is only the query id, so this is what catches a styling difference between two items sharing that query.
|
|
18067
|
+
*/
|
|
18068
|
+
static GetRenderSignature(item) {
|
|
18069
|
+
return JSON.stringify({
|
|
18070
|
+
zoomControl: RenderManager.GetZoomControlSignature(item.CameraZoomSettings)
|
|
18071
|
+
});
|
|
18072
|
+
}
|
|
17315
18073
|
PrepareHandoff() {
|
|
17316
18074
|
var _a, _b, _c;
|
|
17317
18075
|
if (this.disposed || !this.getter) {
|
|
@@ -17332,7 +18090,8 @@ var DataLabRenderManager;
|
|
|
17332
18090
|
getter,
|
|
17333
18091
|
renderedEntities: this.renderedEntities,
|
|
17334
18092
|
renderQueue: [...this.renderQueue],
|
|
17335
|
-
sourceMenuItemId: this.item.id
|
|
18093
|
+
sourceMenuItemId: this.item.id,
|
|
18094
|
+
renderSignature: Manager.GetRenderSignature(this.item)
|
|
17336
18095
|
};
|
|
17337
18096
|
this.renderQueue = [];
|
|
17338
18097
|
this.queryLoadId += 1;
|
|
@@ -17355,7 +18114,10 @@ var DataLabRenderManager;
|
|
|
17355
18114
|
if ((_a = payload.renderQueue) === null || _a === void 0 ? void 0 : _a.length) {
|
|
17356
18115
|
this.distributeForRender(payload.renderQueue);
|
|
17357
18116
|
}
|
|
17358
|
-
|
|
18117
|
+
const needsRestyle = payload.renderSignature !== Manager.GetRenderSignature(this.item);
|
|
18118
|
+
if (needsRestyle) {
|
|
18119
|
+
this.ReRender({ entityIds: Object.keys(this.renderedEntities), force: true });
|
|
18120
|
+
}
|
|
17359
18121
|
this.viewer.scene.requestRender();
|
|
17360
18122
|
}
|
|
17361
18123
|
}
|
|
@@ -18340,6 +19102,8 @@ var TilesetEntitiesRenderManager;
|
|
|
18340
19102
|
}
|
|
18341
19103
|
}
|
|
18342
19104
|
const cTileset = this.cTileset = await TilesetRenderEngine.Render({
|
|
19105
|
+
register: this.visualsManager,
|
|
19106
|
+
menuItemId: this.item.id,
|
|
18343
19107
|
apiGetter: this.getters.GetBruceGetter(),
|
|
18344
19108
|
tileset: tileset,
|
|
18345
19109
|
viewer: this.viewer,
|
|
@@ -18831,11 +19595,12 @@ var TilesetPointcloudRenderManager;
|
|
|
18831
19595
|
constructor(params) {
|
|
18832
19596
|
this.disposed = false;
|
|
18833
19597
|
this.cTileset = null;
|
|
18834
|
-
const { viewer, getters: apiGetter, item, initQueue } = params;
|
|
19598
|
+
const { viewer, getters: apiGetter, item, initQueue, register } = params;
|
|
18835
19599
|
this.viewer = viewer;
|
|
18836
19600
|
this.getters = apiGetter;
|
|
18837
19601
|
this.item = item;
|
|
18838
19602
|
this.initQueue = initQueue;
|
|
19603
|
+
this.visualsManager = register;
|
|
18839
19604
|
}
|
|
18840
19605
|
Init() {
|
|
18841
19606
|
var _a;
|
|
@@ -18886,6 +19651,8 @@ var TilesetPointcloudRenderManager;
|
|
|
18886
19651
|
return;
|
|
18887
19652
|
}
|
|
18888
19653
|
this.cTileset = await TilesetRenderEngine.Render({
|
|
19654
|
+
register: this.visualsManager,
|
|
19655
|
+
menuItemId: this.item.id,
|
|
18889
19656
|
apiGetter: this.getters.GetBruceGetter(),
|
|
18890
19657
|
tileset: tileset,
|
|
18891
19658
|
viewer: this.viewer,
|
|
@@ -19478,6 +20245,8 @@ var TilesetArbRenderManager;
|
|
|
19478
20245
|
if (!accountId) {
|
|
19479
20246
|
accountId = this.getters.GetAccountId();
|
|
19480
20247
|
}
|
|
20248
|
+
// Deliberately NOT registered with the visuals register, so it is never whole-tileset culled.
|
|
20249
|
+
// An arbitrary tileset can be produced outside our system and its declared bounds cannot be trusted.
|
|
19481
20250
|
this.cTileset = await TilesetRenderEngine.RenderLegacy({
|
|
19482
20251
|
apiGetter: this.getters.GetBruceGetter(),
|
|
19483
20252
|
tileset: legacyTileset,
|
|
@@ -20146,8 +20915,8 @@ var RelationsRenderManager;
|
|
|
20146
20915
|
* @param cEntity
|
|
20147
20916
|
*/
|
|
20148
20917
|
const killCEntity = (cEntity) => {
|
|
20149
|
-
if (cEntity && !this.viewer.isDestroyed()
|
|
20150
|
-
this.viewer
|
|
20918
|
+
if (cEntity && !this.viewer.isDestroyed()) {
|
|
20919
|
+
RemoveCEntityFromScene(this.viewer, cEntity);
|
|
20151
20920
|
}
|
|
20152
20921
|
if (cEntity === null || cEntity === void 0 ? void 0 : cEntity._dispose) {
|
|
20153
20922
|
cEntity._dispose();
|
|
@@ -20626,8 +21395,8 @@ var LegacyRelationsRenderManager;
|
|
|
20626
21395
|
* @param cEntity
|
|
20627
21396
|
*/
|
|
20628
21397
|
const killCEntity = (cEntity) => {
|
|
20629
|
-
if (cEntity && !this.viewer.isDestroyed()
|
|
20630
|
-
this.viewer
|
|
21398
|
+
if (cEntity && !this.viewer.isDestroyed()) {
|
|
21399
|
+
RemoveCEntityFromScene(this.viewer, cEntity);
|
|
20631
21400
|
}
|
|
20632
21401
|
if (cEntity === null || cEntity === void 0 ? void 0 : cEntity._dispose) {
|
|
20633
21402
|
cEntity._dispose();
|
|
@@ -22658,6 +23427,7 @@ var MenuItemManager;
|
|
|
22658
23427
|
rItem.renderManager = new TilesetPointcloudRenderManager.Manager({
|
|
22659
23428
|
viewer: this.viewer,
|
|
22660
23429
|
getters: this.getters,
|
|
23430
|
+
register: this.visualsRegister,
|
|
22661
23431
|
item: params.item,
|
|
22662
23432
|
initQueue: this.tilesetInitQueue
|
|
22663
23433
|
});
|
|
@@ -22812,6 +23582,8 @@ var MenuItemManager;
|
|
|
22812
23582
|
}
|
|
22813
23583
|
if (allowHandoff && this.isHandoffCapable(item.renderManager)) {
|
|
22814
23584
|
this.pendingHandoffPool.push(item);
|
|
23585
|
+
// Series segments stay recorded under the pooled id for now. A claimed hand-off
|
|
23586
|
+
// transfers them to the claiming item, and a flushed one clears them.
|
|
22815
23587
|
}
|
|
22816
23588
|
else {
|
|
22817
23589
|
try {
|
|
@@ -22820,9 +23592,9 @@ var MenuItemManager;
|
|
|
22820
23592
|
catch (e) {
|
|
22821
23593
|
console.error(e);
|
|
22822
23594
|
}
|
|
23595
|
+
this.ClearSeriesSegments(item.id);
|
|
22823
23596
|
}
|
|
22824
23597
|
this.items = this.items.filter(x => x.id !== id);
|
|
22825
|
-
this.ClearSeriesSegments(item.id);
|
|
22826
23598
|
(_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: false, itemId: item.id });
|
|
22827
23599
|
}
|
|
22828
23600
|
}
|
|
@@ -22870,14 +23642,38 @@ var MenuItemManager;
|
|
|
22870
23642
|
if (poolIndex < 0) {
|
|
22871
23643
|
return null;
|
|
22872
23644
|
}
|
|
22873
|
-
const
|
|
23645
|
+
const pooledItem = this.pendingHandoffPool[poolIndex];
|
|
23646
|
+
const pooled = pooledItem.renderManager;
|
|
22874
23647
|
const payload = pooled.PrepareHandoff();
|
|
22875
23648
|
if (!payload) {
|
|
22876
23649
|
return null;
|
|
22877
23650
|
}
|
|
22878
23651
|
this.pendingHandoffPool.splice(poolIndex, 1);
|
|
23652
|
+
this.transferSeriesSegments(pooledItem.id, item.id);
|
|
22879
23653
|
return payload;
|
|
22880
23654
|
}
|
|
23655
|
+
/**
|
|
23656
|
+
* Moves any series segments recorded for one menu item over to another, for a claimed hand-off.
|
|
23657
|
+
* The adopting manager may legitimately skip re-rendering (nothing to restyle), and segments are only
|
|
23658
|
+
* ever reported from inside a render, so without this the claiming item would end up with none.
|
|
23659
|
+
*/
|
|
23660
|
+
transferSeriesSegments(fromItemId, toItemId) {
|
|
23661
|
+
const segments = this.seriesSegments.get(fromItemId);
|
|
23662
|
+
if (!(segments === null || segments === void 0 ? void 0 : segments.length)) {
|
|
23663
|
+
this.ClearSeriesSegments(fromItemId);
|
|
23664
|
+
return;
|
|
23665
|
+
}
|
|
23666
|
+
this.seriesSegments.delete(fromItemId);
|
|
23667
|
+
this.OnSeriesUpdated.Trigger({ itemId: fromItemId, segments: [] });
|
|
23668
|
+
const existing = this.seriesSegments.get(toItemId) || [];
|
|
23669
|
+
for (const segment of segments) {
|
|
23670
|
+
if (!existing.some((s) => s.key === segment.key)) {
|
|
23671
|
+
existing.push(segment);
|
|
23672
|
+
}
|
|
23673
|
+
}
|
|
23674
|
+
this.seriesSegments.set(toItemId, existing);
|
|
23675
|
+
this.OnSeriesUpdated.Trigger({ itemId: toItemId, segments: existing });
|
|
23676
|
+
}
|
|
22881
23677
|
// Disposes everything left unclaimed in the pending-hand-off pool.
|
|
22882
23678
|
FlushPendingHandoffs() {
|
|
22883
23679
|
var _a;
|
|
@@ -22893,6 +23689,7 @@ var MenuItemManager;
|
|
|
22893
23689
|
catch (e) {
|
|
22894
23690
|
console.error(e);
|
|
22895
23691
|
}
|
|
23692
|
+
this.ClearSeriesSegments(item.id);
|
|
22896
23693
|
}
|
|
22897
23694
|
}
|
|
22898
23695
|
GetEnabledItemIds() {
|
|
@@ -34269,6 +35066,10 @@ function distanceToPolygon(point, polygon) {
|
|
|
34269
35066
|
}
|
|
34270
35067
|
return minDistance;
|
|
34271
35068
|
}
|
|
35069
|
+
// Slack added when proving a zoom band cannot have changed.
|
|
35070
|
+
// See CouldBandHaveChanged: an entity's measured distance can jump by its altitude spread as the camera crosses over its footprint,
|
|
35071
|
+
// so being this close to a band edge means re-checking rather than trusting the bound.
|
|
35072
|
+
const BAND_EDGE_MARGIN_METERS = 500;
|
|
34272
35073
|
// Cache for distance calculations.
|
|
34273
35074
|
// It will keep only the most recent 3000 entries.
|
|
34274
35075
|
const distanceCache = new LRUCache(3000);
|
|
@@ -34412,7 +35213,7 @@ function calculateDistance(point, entity) {
|
|
|
34412
35213
|
var RenderManager;
|
|
34413
35214
|
(function (RenderManager) {
|
|
34414
35215
|
function DetermineZoomItem(params) {
|
|
34415
|
-
const { viewer, entity, zoomControl } = params;
|
|
35216
|
+
const { viewer, entity, zoomControl, out } = params;
|
|
34416
35217
|
const pos = EntityUtils.GetPos({
|
|
34417
35218
|
viewer,
|
|
34418
35219
|
entity
|
|
@@ -34425,11 +35226,16 @@ var RenderManager;
|
|
|
34425
35226
|
if (!cameraPos || !cameraPos.latitude) {
|
|
34426
35227
|
return null;
|
|
34427
35228
|
}
|
|
34428
|
-
const
|
|
35229
|
+
const cameraCarto = {
|
|
34429
35230
|
altitude: cameraPos.height,
|
|
34430
35231
|
latitude: Math$1.toDegrees(cameraPos.latitude),
|
|
34431
35232
|
longitude: Math$1.toDegrees(cameraPos.longitude)
|
|
34432
|
-
}
|
|
35233
|
+
};
|
|
35234
|
+
const distance = calculateDistance(cameraCarto, entity);
|
|
35235
|
+
if (out) {
|
|
35236
|
+
out.distance = distance;
|
|
35237
|
+
out.cameraPos = Cartesian3.fromDegrees(cameraCarto.longitude, cameraCarto.latitude, cameraCarto.altitude);
|
|
35238
|
+
}
|
|
34433
35239
|
let zoomItem = (!distance && distance != 0) ? null : GetZoomControlFromDistance({
|
|
34434
35240
|
zoomControl,
|
|
34435
35241
|
distance
|
|
@@ -34442,6 +35248,41 @@ var RenderManager;
|
|
|
34442
35248
|
return zoomItem;
|
|
34443
35249
|
}
|
|
34444
35250
|
RenderManager.DetermineZoomItem = DetermineZoomItem;
|
|
35251
|
+
/**
|
|
35252
|
+
* Returns whether an entity could have moved into a different zoom band since its graphic was rendered,
|
|
35253
|
+
* given where the camera is now.
|
|
35254
|
+
*
|
|
35255
|
+
* Answers true whenever it cannot prove otherwise, so a caller may safely skip only on a false.
|
|
35256
|
+
*/
|
|
35257
|
+
function CouldBandHaveChanged(params) {
|
|
35258
|
+
var _a;
|
|
35259
|
+
const { viewer, bandCheck } = params;
|
|
35260
|
+
if (!bandCheck || bandCheck.distance == null || !bandCheck.cameraPos) {
|
|
35261
|
+
return true;
|
|
35262
|
+
}
|
|
35263
|
+
// An absent range is not something to reason about. Values that ARE present go through EnsureNumber so
|
|
35264
|
+
// this agrees with how GetZoomControlFromDistance matched the band in the first place.
|
|
35265
|
+
if (bandCheck.min == null || bandCheck.max == null) {
|
|
35266
|
+
return true;
|
|
35267
|
+
}
|
|
35268
|
+
const min = EnsureNumber(bandCheck.min);
|
|
35269
|
+
const max = EnsureNumber(bandCheck.max);
|
|
35270
|
+
if (!(max > min)) {
|
|
35271
|
+
return true;
|
|
35272
|
+
}
|
|
35273
|
+
const cameraPos = (_a = viewer.camera) === null || _a === void 0 ? void 0 : _a.positionCartographic;
|
|
35274
|
+
if (!cameraPos || !cameraPos.latitude) {
|
|
35275
|
+
return true;
|
|
35276
|
+
}
|
|
35277
|
+
const nowPos = Cartesian3.fromDegrees(Math$1.toDegrees(cameraPos.longitude), Math$1.toDegrees(cameraPos.latitude), cameraPos.height);
|
|
35278
|
+
const travelled = Cartesian3.distance(nowPos, bandCheck.cameraPos);
|
|
35279
|
+
if (isNaN(travelled)) {
|
|
35280
|
+
return true;
|
|
35281
|
+
}
|
|
35282
|
+
const slack = travelled + BAND_EDGE_MARGIN_METERS;
|
|
35283
|
+
return (bandCheck.distance - slack) < min || (bandCheck.distance + slack) > max;
|
|
35284
|
+
}
|
|
35285
|
+
RenderManager.CouldBandHaveChanged = CouldBandHaveChanged;
|
|
34445
35286
|
function GetZoomControlFromDistance(params) {
|
|
34446
35287
|
const { zoomControl, distance } = params;
|
|
34447
35288
|
for (let i = 0; i < zoomControl.length; i++) {
|
|
@@ -34453,6 +35294,26 @@ var RenderManager;
|
|
|
34453
35294
|
return null;
|
|
34454
35295
|
}
|
|
34455
35296
|
RenderManager.GetZoomControlFromDistance = GetZoomControlFromDistance;
|
|
35297
|
+
/**
|
|
35298
|
+
* Everything in a zoom control that changes how an entity is drawn, as a comparable string.
|
|
35299
|
+
* Used to tell whether two menu items would produce identical graphics (see a manager's GetRenderSignature).
|
|
35300
|
+
* A false mismatch only costs an optimization, so key ordering inside an inline Style is not normalized.
|
|
35301
|
+
*/
|
|
35302
|
+
function GetZoomControlSignature(zoomControl) {
|
|
35303
|
+
return JSON.stringify([].concat(zoomControl !== null && zoomControl !== void 0 ? zoomControl : []).map((zoomItem) => {
|
|
35304
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
35305
|
+
return ({
|
|
35306
|
+
MinZoom: (_a = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.MinZoom) !== null && _a !== void 0 ? _a : null,
|
|
35307
|
+
MaxZoom: (_b = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.MaxZoom) !== null && _b !== void 0 ? _b : null,
|
|
35308
|
+
DisplayType: (_c = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.DisplayType) !== null && _c !== void 0 ? _c : null,
|
|
35309
|
+
StyleID: (_d = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) !== null && _d !== void 0 ? _d : null,
|
|
35310
|
+
Style: (_e = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style) !== null && _e !== void 0 ? _e : null,
|
|
35311
|
+
LODCategoryID: (_f = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODCategoryID) !== null && _f !== void 0 ? _f : null,
|
|
35312
|
+
LODLevel: (_g = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.LODLevel) !== null && _g !== void 0 ? _g : null
|
|
35313
|
+
});
|
|
35314
|
+
}));
|
|
35315
|
+
}
|
|
35316
|
+
RenderManager.GetZoomControlSignature = GetZoomControlSignature;
|
|
34456
35317
|
function GetZoomMinMax(params) {
|
|
34457
35318
|
const { zoomControl } = params;
|
|
34458
35319
|
let min = 0;
|
|
@@ -34541,8 +35402,8 @@ var EntityRenderEnginePoint;
|
|
|
34541
35402
|
// We'll remove all that aren't in the allowed (direct) list.
|
|
34542
35403
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
34543
35404
|
const part = parts[i];
|
|
34544
|
-
if (part && part instanceof Entity &&
|
|
34545
|
-
params.viewer
|
|
35405
|
+
if (part && part instanceof Entity && !cEntity._siblingGraphics.includes(part)) {
|
|
35406
|
+
RemoveCEntityFromScene(params.viewer, part);
|
|
34546
35407
|
}
|
|
34547
35408
|
}
|
|
34548
35409
|
if (cEntity._parentEntity) {
|
|
@@ -34886,7 +35747,6 @@ var EntityRenderEnginePoint;
|
|
|
34886
35747
|
cEntity.ellipse.semiMajorAxis = new ConstantProperty(radius);
|
|
34887
35748
|
cEntity.ellipse.semiMinorAxis = new ConstantProperty(radius);
|
|
34888
35749
|
}
|
|
34889
|
-
cEntity.ellipse.outlineWidth = undefined;
|
|
34890
35750
|
{
|
|
34891
35751
|
const curHeightRef = GetCValue(params.viewer, cEntity.ellipse.heightReference);
|
|
34892
35752
|
if (curHeightRef != heightRef) {
|
|
@@ -34907,13 +35767,26 @@ var EntityRenderEnginePoint;
|
|
|
34907
35767
|
cEntity.ellipse.extrudedHeight = new ConstantProperty(extrusion.value);
|
|
34908
35768
|
}
|
|
34909
35769
|
}
|
|
34910
|
-
|
|
34911
|
-
|
|
35770
|
+
SetCPropIfChanged({
|
|
35771
|
+
viewer: params.viewer,
|
|
35772
|
+
graphic: cEntity.ellipse,
|
|
35773
|
+
property: "zIndex",
|
|
35774
|
+
value: 1
|
|
35775
|
+
});
|
|
35776
|
+
SetCPropIfChanged({
|
|
35777
|
+
viewer: params.viewer,
|
|
35778
|
+
graphic: cEntity.ellipse,
|
|
35779
|
+
property: "distanceDisplayCondition",
|
|
35780
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
|
|
35781
|
+
});
|
|
34912
35782
|
const curClassification = GetCValue(params.viewer, cEntity.ellipse.classificationType);
|
|
34913
35783
|
if (curClassification != classification) {
|
|
34914
35784
|
cEntity.ellipse.classificationType = new ConstantProperty(classification);
|
|
34915
35785
|
}
|
|
34916
|
-
|
|
35786
|
+
const curPos = GetCValue(params.viewer, cEntity.position);
|
|
35787
|
+
if (!curPos || !pos3d || !Cartesian3.equals(curPos, pos3d)) {
|
|
35788
|
+
cEntity.position = new ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
|
|
35789
|
+
}
|
|
34917
35790
|
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
34918
35791
|
// WARNING: ellipse does not support animation (yet?).
|
|
34919
35792
|
CesiumEntityStyler.SetDefaultColor({
|
|
@@ -34921,6 +35794,8 @@ var EntityRenderEnginePoint;
|
|
|
34921
35794
|
entity: cEntity,
|
|
34922
35795
|
viewer: params.viewer,
|
|
34923
35796
|
override: true,
|
|
35797
|
+
// Fill colour only. The outline sibling gets its own cOutline baked below.
|
|
35798
|
+
includeSiblings: false,
|
|
34924
35799
|
requestRender: false
|
|
34925
35800
|
});
|
|
34926
35801
|
cEntity.show = true;
|
|
@@ -34959,8 +35834,18 @@ var EntityRenderEnginePoint;
|
|
|
34959
35834
|
outlineEntity.ellipse.extrudedHeight = new ConstantProperty(outlineExtrusion.value);
|
|
34960
35835
|
}
|
|
34961
35836
|
}
|
|
34962
|
-
|
|
34963
|
-
|
|
35837
|
+
SetCPropIfChanged({
|
|
35838
|
+
viewer: params.viewer,
|
|
35839
|
+
graphic: outlineEntity.ellipse,
|
|
35840
|
+
property: "zIndex",
|
|
35841
|
+
value: 2
|
|
35842
|
+
});
|
|
35843
|
+
SetCPropIfChanged({
|
|
35844
|
+
viewer: params.viewer,
|
|
35845
|
+
graphic: outlineEntity.ellipse,
|
|
35846
|
+
property: "distanceDisplayCondition",
|
|
35847
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
|
|
35848
|
+
});
|
|
34964
35849
|
const curClassification = GetCValue(params.viewer, outlineEntity.ellipse.classificationType);
|
|
34965
35850
|
if (curClassification != classification) {
|
|
34966
35851
|
outlineEntity.ellipse.classificationType = new ConstantProperty(classification);
|
|
@@ -34972,6 +35857,7 @@ var EntityRenderEnginePoint;
|
|
|
34972
35857
|
entity: outlineEntity,
|
|
34973
35858
|
viewer: params.viewer,
|
|
34974
35859
|
override: true,
|
|
35860
|
+
includeSiblings: false,
|
|
34975
35861
|
requestRender: false
|
|
34976
35862
|
});
|
|
34977
35863
|
outlineEntity.show = true;
|
|
@@ -35236,7 +36122,7 @@ var EntityRenderEnginePoint;
|
|
|
35236
36122
|
// De-dupe the tag IDs.
|
|
35237
36123
|
tagIds = Array.from(new Set(tagIds));
|
|
35238
36124
|
// Request if at least one then create a quick lookup map for tags.
|
|
35239
|
-
const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
|
|
36125
|
+
const tags = (!params.offline && tagIds.length > 0) ? (await EntityTag.GetListByIds({
|
|
35240
36126
|
api,
|
|
35241
36127
|
tagIds
|
|
35242
36128
|
})).tags : [];
|
|
@@ -35248,7 +36134,7 @@ var EntityRenderEnginePoint;
|
|
|
35248
36134
|
for (let i = 0; i < params.entities.length; i++) {
|
|
35249
36135
|
const entity = params.entities[i];
|
|
35250
36136
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
35251
|
-
const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
36137
|
+
const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
35252
36138
|
// Pass through tags that may be needed for styling.
|
|
35253
36139
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
35254
36140
|
const tags = [];
|
|
@@ -35286,7 +36172,7 @@ var EntityRenderEnginePoint;
|
|
|
35286
36172
|
rego: rego
|
|
35287
36173
|
});
|
|
35288
36174
|
if (cEntity) {
|
|
35289
|
-
const name = await getName(api, entity);
|
|
36175
|
+
const name = await getName(api, entity, params.offline);
|
|
35290
36176
|
cEntity.name = name;
|
|
35291
36177
|
cEntity._renderGroup = EntityRenderEngine.GetRenderGroupId(zoomItem);
|
|
35292
36178
|
cEntity.styleId = zoomItem.StyleID == -1 ? -1 : (+zoomItem.StyleID || null);
|
|
@@ -35457,7 +36343,16 @@ function getCylinderExtrusion(entity, tags, heightRef, style) {
|
|
|
35457
36343
|
}
|
|
35458
36344
|
return data;
|
|
35459
36345
|
}
|
|
35460
|
-
async function getName(api, entity) {
|
|
36346
|
+
async function getName(api, entity, offline) {
|
|
36347
|
+
var _a;
|
|
36348
|
+
const ownName = GetUsableEntityName(entity);
|
|
36349
|
+
if (ownName) {
|
|
36350
|
+
return ownName;
|
|
36351
|
+
}
|
|
36352
|
+
if (offline) {
|
|
36353
|
+
// Anything further needs a request, so offline callers take what the entity carries, placeholder or not.
|
|
36354
|
+
return ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) || "Unnamed Entity";
|
|
36355
|
+
}
|
|
35461
36356
|
try {
|
|
35462
36357
|
const typeId = entity.Bruce["EntityType.ID"];
|
|
35463
36358
|
let type = null;
|
|
@@ -35637,8 +36532,8 @@ var EntityRenderEngineModel3d;
|
|
|
35637
36532
|
// We'll remove all that aren't in the allowed (direct) list.
|
|
35638
36533
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
35639
36534
|
const part = parts[i];
|
|
35640
|
-
if (part && part instanceof Entity &&
|
|
35641
|
-
params.viewer
|
|
36535
|
+
if (part && part instanceof Entity && !cEntity._siblingGraphics.includes(part)) {
|
|
36536
|
+
RemoveCEntityFromScene(params.viewer, part);
|
|
35642
36537
|
}
|
|
35643
36538
|
}
|
|
35644
36539
|
if (cEntity._parentEntity) {
|
|
@@ -36131,7 +37026,7 @@ var EntityRenderEngineModel3d;
|
|
|
36131
37026
|
// De-dupe the tag IDs.
|
|
36132
37027
|
tagIds = Array.from(new Set(tagIds));
|
|
36133
37028
|
// Request if at least one then create a quick lookup map for tags.
|
|
36134
|
-
const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
|
|
37029
|
+
const tags = (!params.offline && tagIds.length > 0) ? (await EntityTag.GetListByIds({
|
|
36135
37030
|
api,
|
|
36136
37031
|
tagIds
|
|
36137
37032
|
})).tags : [];
|
|
@@ -36143,7 +37038,7 @@ var EntityRenderEngineModel3d;
|
|
|
36143
37038
|
for (let i = 0; i < params.entities.length; i++) {
|
|
36144
37039
|
const entity = params.entities[i];
|
|
36145
37040
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
36146
|
-
const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
37041
|
+
const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
36147
37042
|
// Pass through tags that may be needed for styling.
|
|
36148
37043
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
36149
37044
|
const tags = [];
|
|
@@ -36182,8 +37077,8 @@ var EntityRenderEngineModel3d;
|
|
|
36182
37077
|
for (let i = 0; i < params.entities.length; i++) {
|
|
36183
37078
|
const entity = params.entities[i];
|
|
36184
37079
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
36185
|
-
const styleRecord = zoomItem.StyleID != -1 ? (await getStyle$2(api, entity, zoomItem.StyleID)) : null;
|
|
36186
|
-
const style = zoomItem.StyleID != -1 ? styleRecord === null || styleRecord === void 0 ? void 0 : styleRecord.Settings : zoomItem.Style;
|
|
37080
|
+
const styleRecord = (!params.offline && zoomItem.StyleID != -1) ? (await getStyle$2(api, entity, zoomItem.StyleID)) : null;
|
|
37081
|
+
const style = (!params.offline && zoomItem.StyleID != -1) ? styleRecord === null || styleRecord === void 0 ? void 0 : styleRecord.Settings : zoomItem.Style;
|
|
36187
37082
|
const lod = lodData.find(x => x.entityId == entity.Bruce.ID);
|
|
36188
37083
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
36189
37084
|
continue;
|
|
@@ -36229,7 +37124,7 @@ var EntityRenderEngineModel3d;
|
|
|
36229
37124
|
rego: rego
|
|
36230
37125
|
});
|
|
36231
37126
|
if (cEntity) {
|
|
36232
|
-
const name = await getName$1(api, entity);
|
|
37127
|
+
const name = await getName$1(api, entity, params.offline);
|
|
36233
37128
|
cEntity.name = name;
|
|
36234
37129
|
cEntity._renderGroup = EntityRenderEngine.GetRenderGroupId(zoomItem);
|
|
36235
37130
|
cEntity.styleId = zoomItem.StyleID == -1 ? -1 : styleRecord === null || styleRecord === void 0 ? void 0 : styleRecord.ID;
|
|
@@ -36255,7 +37150,16 @@ function getHeightRef$1(style, defaultStyle) {
|
|
|
36255
37150
|
}
|
|
36256
37151
|
return heightRef;
|
|
36257
37152
|
}
|
|
36258
|
-
async function getName$1(api, entity) {
|
|
37153
|
+
async function getName$1(api, entity, offline) {
|
|
37154
|
+
var _a;
|
|
37155
|
+
const ownName = GetUsableEntityName(entity);
|
|
37156
|
+
if (ownName) {
|
|
37157
|
+
return ownName;
|
|
37158
|
+
}
|
|
37159
|
+
if (offline) {
|
|
37160
|
+
// Anything further needs a request, so offline callers take what the entity carries, placeholder or not.
|
|
37161
|
+
return ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) || "Unnamed Entity";
|
|
37162
|
+
}
|
|
36259
37163
|
try {
|
|
36260
37164
|
const typeId = entity.Bruce["EntityType.ID"];
|
|
36261
37165
|
let type = null;
|
|
@@ -36528,8 +37432,8 @@ var EntityRenderEnginePolyline;
|
|
|
36528
37432
|
// Kill all expect last part. Last one is the primary entity.
|
|
36529
37433
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
36530
37434
|
const part = parts[i];
|
|
36531
|
-
if (part && part instanceof Entity
|
|
36532
|
-
params.viewer
|
|
37435
|
+
if (part && part instanceof Entity) {
|
|
37436
|
+
RemoveCEntityFromScene(params.viewer, part);
|
|
36533
37437
|
}
|
|
36534
37438
|
}
|
|
36535
37439
|
cEntity._siblingGraphics = [];
|
|
@@ -36560,7 +37464,12 @@ var EntityRenderEnginePolyline;
|
|
|
36560
37464
|
if (oldClampToGround != newClampToGround) {
|
|
36561
37465
|
cEntity.polyline.clampToGround = new ConstantProperty(newClampToGround);
|
|
36562
37466
|
}
|
|
36563
|
-
|
|
37467
|
+
SetCPropIfChanged({
|
|
37468
|
+
viewer: params.viewer,
|
|
37469
|
+
graphic: cEntity.polyline,
|
|
37470
|
+
property: "distanceDisplayCondition",
|
|
37471
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
|
|
37472
|
+
});
|
|
36564
37473
|
cEntity.corridor = undefined;
|
|
36565
37474
|
}
|
|
36566
37475
|
else {
|
|
@@ -36584,7 +37493,12 @@ var EntityRenderEnginePolyline;
|
|
|
36584
37493
|
if (oldZIndex != getZIndex(style, entity, params.tags)) {
|
|
36585
37494
|
cEntity.corridor.zIndex = new ConstantProperty(getZIndex(style, entity, params.tags));
|
|
36586
37495
|
}
|
|
36587
|
-
|
|
37496
|
+
SetCPropIfChanged({
|
|
37497
|
+
viewer: params.viewer,
|
|
37498
|
+
graphic: cEntity.corridor,
|
|
37499
|
+
property: "distanceDisplayCondition",
|
|
37500
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width)
|
|
37501
|
+
});
|
|
36588
37502
|
cEntity.polyline = undefined;
|
|
36589
37503
|
}
|
|
36590
37504
|
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
@@ -36652,7 +37566,7 @@ var EntityRenderEnginePolyline;
|
|
|
36652
37566
|
// De-dupe the tag IDs.
|
|
36653
37567
|
tagIds = Array.from(new Set(tagIds));
|
|
36654
37568
|
// Request if at least one then create a quick lookup map for tags.
|
|
36655
|
-
const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
|
|
37569
|
+
const tags = (!params.offline && tagIds.length > 0) ? (await EntityTag.GetListByIds({
|
|
36656
37570
|
api,
|
|
36657
37571
|
tagIds
|
|
36658
37572
|
})).tags : [];
|
|
@@ -36664,7 +37578,7 @@ var EntityRenderEnginePolyline;
|
|
|
36664
37578
|
for (let i = 0; i < params.entities.length; i++) {
|
|
36665
37579
|
const entity = params.entities[i];
|
|
36666
37580
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
36667
|
-
const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
37581
|
+
const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
36668
37582
|
// Pass through tags that may be needed for styling.
|
|
36669
37583
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
36670
37584
|
const tags = [];
|
|
@@ -36687,7 +37601,7 @@ var EntityRenderEnginePolyline;
|
|
|
36687
37601
|
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID)
|
|
36688
37602
|
});
|
|
36689
37603
|
if (cEntity) {
|
|
36690
|
-
const name = await getName$2(api, entity);
|
|
37604
|
+
const name = await getName$2(api, entity, params.offline);
|
|
36691
37605
|
cEntity.name = name;
|
|
36692
37606
|
cEntity._renderGroup = EntityRenderEngine.GetRenderGroupId(zoomItem);
|
|
36693
37607
|
cEntity.styleId = zoomItem.StyleID == -1 ? -1 : (+zoomItem.StyleID || null);
|
|
@@ -36698,7 +37612,16 @@ var EntityRenderEnginePolyline;
|
|
|
36698
37612
|
}
|
|
36699
37613
|
EntityRenderEnginePolyline.RenderGroup = RenderGroup;
|
|
36700
37614
|
})(EntityRenderEnginePolyline || (EntityRenderEnginePolyline = {}));
|
|
36701
|
-
async function getName$2(api, entity) {
|
|
37615
|
+
async function getName$2(api, entity, offline) {
|
|
37616
|
+
var _a;
|
|
37617
|
+
const ownName = GetUsableEntityName(entity);
|
|
37618
|
+
if (ownName) {
|
|
37619
|
+
return ownName;
|
|
37620
|
+
}
|
|
37621
|
+
if (offline) {
|
|
37622
|
+
// Anything further needs a request, so offline callers take what the entity carries, placeholder or not.
|
|
37623
|
+
return ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) || "Unnamed Entity";
|
|
37624
|
+
}
|
|
36702
37625
|
try {
|
|
36703
37626
|
const typeId = entity.Bruce["EntityType.ID"];
|
|
36704
37627
|
let type = null;
|
|
@@ -36940,6 +37863,13 @@ var TextureFrameSeriesAnimator;
|
|
|
36940
37863
|
GetArchiveUrl() {
|
|
36941
37864
|
return this.archiveUrl;
|
|
36942
37865
|
}
|
|
37866
|
+
/**
|
|
37867
|
+
* The property this instance presents frames through, for a caller that needs to rebuild the entity's
|
|
37868
|
+
* material (eg: re-tinting for opacity/selection) without detaching the animation.
|
|
37869
|
+
*/
|
|
37870
|
+
GetImageProperty() {
|
|
37871
|
+
return this.imageProperty;
|
|
37872
|
+
}
|
|
36943
37873
|
onClockTick(currentTime) {
|
|
36944
37874
|
if (this.disposed) {
|
|
36945
37875
|
return;
|
|
@@ -37146,7 +38076,7 @@ var EntityRenderEnginePolygon;
|
|
|
37146
38076
|
let textureDataUri = null;
|
|
37147
38077
|
let textureTraceEffective = null;
|
|
37148
38078
|
let frameArchive = null;
|
|
37149
|
-
if (fillType === Style.EPolygonFillType.Texture) {
|
|
38079
|
+
if (fillType === Style.EPolygonFillType.Texture && !params.offline) {
|
|
37150
38080
|
try {
|
|
37151
38081
|
const resolved = await resolveTexturedFill({
|
|
37152
38082
|
api: params.api,
|
|
@@ -37227,8 +38157,8 @@ var EntityRenderEnginePolygon;
|
|
|
37227
38157
|
// We'll remove all that aren't in the allowed (direct) list.
|
|
37228
38158
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
37229
38159
|
const part = parts[i];
|
|
37230
|
-
if (part && part instanceof Entity &&
|
|
37231
|
-
params.viewer
|
|
38160
|
+
if (part && part instanceof Entity && !cEntity._siblingGraphics.includes(part)) {
|
|
38161
|
+
RemoveCEntityFromScene(params.viewer, part);
|
|
37232
38162
|
}
|
|
37233
38163
|
}
|
|
37234
38164
|
if (cEntity._parentEntity) {
|
|
@@ -37238,7 +38168,8 @@ var EntityRenderEnginePolygon;
|
|
|
37238
38168
|
};
|
|
37239
38169
|
const hasOutline = width > 0 && cLineColor;
|
|
37240
38170
|
let cEntity = null;
|
|
37241
|
-
|
|
38171
|
+
const isExistingGraphic = Boolean(params.rendered && params.rendered.polygon);
|
|
38172
|
+
if (!isExistingGraphic) {
|
|
37242
38173
|
cEntity = new Entity({
|
|
37243
38174
|
id: ObjectUtils.UId(15),
|
|
37244
38175
|
polygon: {
|
|
@@ -37251,7 +38182,7 @@ var EntityRenderEnginePolygon;
|
|
|
37251
38182
|
classificationType: classification,
|
|
37252
38183
|
perPositionHeight: heightRef == HeightReference.CLAMP_TO_GROUND ? false : true,
|
|
37253
38184
|
zIndex: zIndex,
|
|
37254
|
-
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
|
|
38185
|
+
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
|
|
37255
38186
|
},
|
|
37256
38187
|
position: EntityUtils.GetPos({
|
|
37257
38188
|
viewer: params.viewer,
|
|
@@ -37305,9 +38236,38 @@ var EntityRenderEnginePolygon;
|
|
|
37305
38236
|
if (oldZIndex != zIndex) {
|
|
37306
38237
|
cEntity.polygon.zIndex = new ConstantProperty(zIndex);
|
|
37307
38238
|
}
|
|
37308
|
-
|
|
37309
|
-
|
|
37310
|
-
|
|
38239
|
+
SetCPropIfChanged({
|
|
38240
|
+
viewer: params.viewer,
|
|
38241
|
+
graphic: cEntity.polygon,
|
|
38242
|
+
property: "distanceDisplayCondition",
|
|
38243
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true, size)
|
|
38244
|
+
});
|
|
38245
|
+
SetCPropIfChanged({
|
|
38246
|
+
viewer: params.viewer,
|
|
38247
|
+
graphic: cEntity.polygon,
|
|
38248
|
+
property: "shadows",
|
|
38249
|
+
value: ShadowMode.ENABLED
|
|
38250
|
+
});
|
|
38251
|
+
SetCPropIfChanged({
|
|
38252
|
+
viewer: params.viewer,
|
|
38253
|
+
graphic: cEntity.polygon,
|
|
38254
|
+
property: "classificationType",
|
|
38255
|
+
value: classification
|
|
38256
|
+
});
|
|
38257
|
+
cEntity.show = true;
|
|
38258
|
+
}
|
|
38259
|
+
// Must run before any material is baked below: the Animator takes over polygon.material, so a bake
|
|
38260
|
+
// has to know whether it is baking over a live animation or over a disposed one's restored material.
|
|
38261
|
+
const animator = syncTextureFrameArchive(cEntity, frameArchive, params.viewer, style.textureColorMask);
|
|
38262
|
+
if (animator) {
|
|
38263
|
+
CesiumEntityStyler.SetDefaultTextureImage({
|
|
38264
|
+
entity: cEntity,
|
|
38265
|
+
image: animator.GetImageProperty(),
|
|
38266
|
+
viewer: params.viewer,
|
|
38267
|
+
requestRender: false
|
|
38268
|
+
});
|
|
38269
|
+
}
|
|
38270
|
+
else if (isExistingGraphic) {
|
|
37311
38271
|
// TODO: animate the texture!
|
|
37312
38272
|
if (textureDataUri) {
|
|
37313
38273
|
// Rebaking texture to ensure we don't revert to the wrong one later.
|
|
@@ -37334,12 +38294,12 @@ var EntityRenderEnginePolygon;
|
|
|
37334
38294
|
entity: cEntity,
|
|
37335
38295
|
viewer: params.viewer,
|
|
37336
38296
|
override: true,
|
|
38297
|
+
// Fill colour only. The outline sibling gets its own line colour baked below.
|
|
38298
|
+
includeSiblings: false,
|
|
37337
38299
|
requestRender: false
|
|
37338
38300
|
});
|
|
37339
38301
|
}
|
|
37340
|
-
cEntity.show = true;
|
|
37341
38302
|
}
|
|
37342
|
-
syncTextureFrameArchive(cEntity, frameArchive, params.viewer, style.textureColorMask);
|
|
37343
38303
|
if (frameArchive && params.onSeriesDiscovered) {
|
|
37344
38304
|
const segment = frameArchiveToSeriesSegment(frameArchive, params.entity);
|
|
37345
38305
|
if (segment) {
|
|
@@ -37372,7 +38332,7 @@ var EntityRenderEnginePolygon;
|
|
|
37372
38332
|
classificationType: ClassificationType.TERRAIN,
|
|
37373
38333
|
arcType: ArcType.GEODESIC,
|
|
37374
38334
|
zIndex: zIndex,
|
|
37375
|
-
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
|
|
38335
|
+
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, null, false, size)
|
|
37376
38336
|
}) : null,
|
|
37377
38337
|
corridor: units == "m" ? {
|
|
37378
38338
|
positions: borderPosses,
|
|
@@ -37384,7 +38344,7 @@ var EntityRenderEnginePolygon;
|
|
|
37384
38344
|
zIndex: zIndex + 1,
|
|
37385
38345
|
cornerType: CornerType.MITERED,
|
|
37386
38346
|
classificationType: classification,
|
|
37387
|
-
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
38347
|
+
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width, false, size),
|
|
37388
38348
|
shadows: ShadowMode.ENABLED
|
|
37389
38349
|
} : null,
|
|
37390
38350
|
show: true
|
|
@@ -37411,11 +38371,21 @@ var EntityRenderEnginePolygon;
|
|
|
37411
38371
|
}
|
|
37412
38372
|
const oldMaterial = GetCValue(params.viewer, cEntityBorder.polyline.material);
|
|
37413
38373
|
const newMaterial = new ColorMaterialProperty(cLineColor);
|
|
37414
|
-
if (
|
|
38374
|
+
if (!areColorMaterialsEqual(params.viewer, oldMaterial, newMaterial)) {
|
|
37415
38375
|
cEntityBorder.polyline.material = newMaterial;
|
|
37416
38376
|
}
|
|
37417
|
-
|
|
37418
|
-
|
|
38377
|
+
SetCPropIfChanged({
|
|
38378
|
+
viewer: params.viewer,
|
|
38379
|
+
graphic: cEntityBorder.polyline,
|
|
38380
|
+
property: "classificationType",
|
|
38381
|
+
value: ClassificationType.TERRAIN
|
|
38382
|
+
});
|
|
38383
|
+
SetCPropIfChanged({
|
|
38384
|
+
viewer: params.viewer,
|
|
38385
|
+
graphic: cEntityBorder.polyline,
|
|
38386
|
+
property: "distanceDisplayCondition",
|
|
38387
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, null, false, size)
|
|
38388
|
+
});
|
|
37419
38389
|
cEntityBorder.corridor = undefined;
|
|
37420
38390
|
}
|
|
37421
38391
|
else {
|
|
@@ -37441,15 +38411,35 @@ var EntityRenderEnginePolygon;
|
|
|
37441
38411
|
}
|
|
37442
38412
|
const oldMaterial = GetCValue(params.viewer, cEntityBorder.corridor.material);
|
|
37443
38413
|
const newMaterial = new ColorMaterialProperty(cLineColor);
|
|
37444
|
-
if (
|
|
38414
|
+
if (!areColorMaterialsEqual(params.viewer, oldMaterial, newMaterial)) {
|
|
37445
38415
|
cEntityBorder.corridor.material = newMaterial;
|
|
37446
38416
|
}
|
|
37447
|
-
|
|
37448
|
-
|
|
38417
|
+
SetCPropIfChanged({
|
|
38418
|
+
viewer: params.viewer,
|
|
38419
|
+
graphic: cEntityBorder.corridor,
|
|
38420
|
+
property: "fill",
|
|
38421
|
+
value: true
|
|
38422
|
+
});
|
|
38423
|
+
SetCPropIfChanged({
|
|
38424
|
+
viewer: params.viewer,
|
|
38425
|
+
graphic: cEntityBorder.corridor,
|
|
38426
|
+
property: "distanceDisplayCondition",
|
|
38427
|
+
value: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width, false, size)
|
|
38428
|
+
});
|
|
37449
38429
|
cEntityBorder.polyline = undefined;
|
|
37450
38430
|
}
|
|
37451
38431
|
cEntityBorder.show = true;
|
|
37452
38432
|
}
|
|
38433
|
+
// Bake the outline's own colour as its default, so a deselect/opacity refresh restores the line
|
|
38434
|
+
// colour rather than falling back to the fill's.
|
|
38435
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
38436
|
+
color: cLineColor,
|
|
38437
|
+
entity: cEntityBorder,
|
|
38438
|
+
viewer: params.viewer,
|
|
38439
|
+
override: true,
|
|
38440
|
+
includeSiblings: false,
|
|
38441
|
+
requestRender: false
|
|
38442
|
+
});
|
|
37453
38443
|
cEntityBorder._parentEntity = cEntity;
|
|
37454
38444
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
37455
38445
|
for (let i = 0; i < holePosses.length; i++) {
|
|
@@ -37465,7 +38455,7 @@ var EntityRenderEnginePolygon;
|
|
|
37465
38455
|
classificationType: ClassificationType.TERRAIN,
|
|
37466
38456
|
arcType: ArcType.GEODESIC,
|
|
37467
38457
|
zIndex: zIndex,
|
|
37468
|
-
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
|
|
38458
|
+
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, null, false, size)
|
|
37469
38459
|
}) : null,
|
|
37470
38460
|
corridor: units == "m" ? {
|
|
37471
38461
|
positions: borderPosses,
|
|
@@ -37477,7 +38467,7 @@ var EntityRenderEnginePolygon;
|
|
|
37477
38467
|
zIndex: zIndex + 1,
|
|
37478
38468
|
cornerType: CornerType.MITERED,
|
|
37479
38469
|
classificationType: classification,
|
|
37480
|
-
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
38470
|
+
distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width, false, size),
|
|
37481
38471
|
shadows: ShadowMode.ENABLED,
|
|
37482
38472
|
} : null,
|
|
37483
38473
|
show: true
|
|
@@ -37518,7 +38508,7 @@ var EntityRenderEnginePolygon;
|
|
|
37518
38508
|
// De-dupe the tag IDs.
|
|
37519
38509
|
tagIds = Array.from(new Set(tagIds));
|
|
37520
38510
|
// Request if at least one then create a quick lookup map for tags.
|
|
37521
|
-
const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
|
|
38511
|
+
const tags = (!params.offline && tagIds.length > 0) ? (await EntityTag.GetListByIds({
|
|
37522
38512
|
api,
|
|
37523
38513
|
tagIds
|
|
37524
38514
|
})).tags : [];
|
|
@@ -37530,7 +38520,7 @@ var EntityRenderEnginePolygon;
|
|
|
37530
38520
|
for (let i = 0; i < params.entities.length; i++) {
|
|
37531
38521
|
const entity = params.entities[i];
|
|
37532
38522
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
37533
|
-
const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
38523
|
+
const style = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
37534
38524
|
// Pass through tags that may be needed for styling.
|
|
37535
38525
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
37536
38526
|
const tags = [];
|
|
@@ -37565,7 +38555,7 @@ var EntityRenderEnginePolygon;
|
|
|
37565
38555
|
console.error(`Polygon.RenderGroup: failed to render entity ${((_d = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _d === void 0 ? void 0 : _d.ID) || "<NONE>"}:`, e);
|
|
37566
38556
|
}
|
|
37567
38557
|
if (cEntity) {
|
|
37568
|
-
const name = await getName$3(api, entity);
|
|
38558
|
+
const name = await getName$3(api, entity, params.offline);
|
|
37569
38559
|
cEntity.name = name;
|
|
37570
38560
|
cEntity._renderGroup = EntityRenderEngine.GetRenderGroupId(zoomItem);
|
|
37571
38561
|
cEntity.styleId = zoomItem.StyleID == -1 ? -1 : (+zoomItem.StyleID || null);
|
|
@@ -37587,7 +38577,16 @@ var EntityRenderEnginePolygon;
|
|
|
37587
38577
|
}
|
|
37588
38578
|
EntityRenderEnginePolygon.DisposeTextureFrameSeriesAnimator = DisposeTextureFrameSeriesAnimator;
|
|
37589
38579
|
})(EntityRenderEnginePolygon || (EntityRenderEnginePolygon = {}));
|
|
37590
|
-
async function getName$3(api, entity) {
|
|
38580
|
+
async function getName$3(api, entity, offline) {
|
|
38581
|
+
var _a;
|
|
38582
|
+
const ownName = GetUsableEntityName(entity);
|
|
38583
|
+
if (ownName) {
|
|
38584
|
+
return ownName;
|
|
38585
|
+
}
|
|
38586
|
+
if (offline) {
|
|
38587
|
+
// Anything further needs a request, so offline callers take what the entity carries, placeholder or not.
|
|
38588
|
+
return ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.Name) || "Unnamed Entity";
|
|
38589
|
+
}
|
|
37591
38590
|
try {
|
|
37592
38591
|
const typeId = entity.Bruce["EntityType.ID"];
|
|
37593
38592
|
let type = null;
|
|
@@ -37691,6 +38690,7 @@ const _textureCache = new LRUCache(50);
|
|
|
37691
38690
|
/**
|
|
37692
38691
|
* Reconciles cEntity's TextureFrameSeriesAnimator.Animator (if any) against this render's resolved texture.
|
|
37693
38692
|
* Called once cEntity is fully created/updated and definitely has a `polygon` graphics.
|
|
38693
|
+
* Returns the animator now driving the entity, or null if this render has no frame series.
|
|
37694
38694
|
* @param cEntity
|
|
37695
38695
|
* @param frameArchive
|
|
37696
38696
|
* @param viewer
|
|
@@ -37699,22 +38699,24 @@ const _textureCache = new LRUCache(50);
|
|
|
37699
38699
|
function syncTextureFrameArchive(cEntity, frameArchive, viewer, textureColorMask) {
|
|
37700
38700
|
const existing = cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY];
|
|
37701
38701
|
if (frameArchive && existing && !existing.IsDisposed() && existing.GetArchiveUrl() === frameArchive.url) {
|
|
37702
|
-
return;
|
|
38702
|
+
return existing;
|
|
37703
38703
|
}
|
|
37704
38704
|
if (existing && !existing.IsDisposed()) {
|
|
37705
38705
|
existing.Dispose();
|
|
37706
38706
|
cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY] = null;
|
|
37707
38707
|
}
|
|
37708
|
-
if (frameArchive) {
|
|
37709
|
-
|
|
37710
|
-
viewer,
|
|
37711
|
-
entity: cEntity,
|
|
37712
|
-
archiveUrl: frameArchive.url,
|
|
37713
|
-
frames: frameArchive.metadata.Frames,
|
|
37714
|
-
textureColorMask
|
|
37715
|
-
});
|
|
37716
|
-
cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY] = animator;
|
|
38708
|
+
if (!frameArchive) {
|
|
38709
|
+
return null;
|
|
37717
38710
|
}
|
|
38711
|
+
const animator = new TextureFrameSeriesAnimator.Animator({
|
|
38712
|
+
viewer,
|
|
38713
|
+
entity: cEntity,
|
|
38714
|
+
archiveUrl: frameArchive.url,
|
|
38715
|
+
frames: frameArchive.metadata.Frames,
|
|
38716
|
+
textureColorMask
|
|
38717
|
+
});
|
|
38718
|
+
cEntity[TEXTURE_FRAME_SERIES_ANIMATOR_KEY] = animator;
|
|
38719
|
+
return animator;
|
|
37718
38720
|
}
|
|
37719
38721
|
/**
|
|
37720
38722
|
* Derives a min/max/label time-range segment from a resolved frame archive's Frames metadata,
|
|
@@ -37881,7 +38883,7 @@ async function buildTintedTextureDataUri(url, mask) {
|
|
|
37881
38883
|
* @param b
|
|
37882
38884
|
* @returns
|
|
37883
38885
|
*/
|
|
37884
|
-
function
|
|
38886
|
+
function areColorMaterialsEqual(viewer, a, b) {
|
|
37885
38887
|
// Same reference.
|
|
37886
38888
|
if (a == b) {
|
|
37887
38889
|
return true;
|
|
@@ -38202,15 +39204,44 @@ var StyleEffective;
|
|
|
38202
39204
|
})(StyleEffective || (StyleEffective = {}));
|
|
38203
39205
|
var EntityRenderEngine;
|
|
38204
39206
|
(function (EntityRenderEngine) {
|
|
39207
|
+
/**
|
|
39208
|
+
* Identifies the zoom band a graphic was last rendered for, covering everything in that band which
|
|
39209
|
+
* changes how the entity is drawn. Used to decide whether a re-render is needed at all.
|
|
39210
|
+
*
|
|
39211
|
+
* Deliberately NOT the reuse key: most of a band's identity is plain graphics properties that can be
|
|
39212
|
+
* patched onto the existing graphic, so see GetGraphicShapeId for that decision.
|
|
39213
|
+
*/
|
|
38205
39214
|
function GetRenderGroupId(zoomItem) {
|
|
38206
39215
|
if (!zoomItem) {
|
|
38207
39216
|
return null;
|
|
38208
39217
|
}
|
|
38209
|
-
return
|
|
39218
|
+
return RenderManager.GetZoomControlSignature([zoomItem]);
|
|
38210
39219
|
}
|
|
38211
39220
|
EntityRenderEngine.GetRenderGroupId = GetRenderGroupId;
|
|
39221
|
+
/**
|
|
39222
|
+
* Identifies the kind of Cesium graphic a zoom item + entity resolves to, ignoring anything that is merely a property on it.
|
|
39223
|
+
*/
|
|
39224
|
+
function GetGraphicShapeId(zoomItem, entity) {
|
|
39225
|
+
var _a;
|
|
39226
|
+
let displayType = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.DisplayType;
|
|
39227
|
+
if (!displayType) {
|
|
39228
|
+
displayType = ZoomControl.EDisplayType.Hidden;
|
|
39229
|
+
}
|
|
39230
|
+
// Backwards compatibility, same mapping the render pass applies.
|
|
39231
|
+
else if (displayType == "polygon") {
|
|
39232
|
+
displayType = ZoomControl.EDisplayType.Geometry;
|
|
39233
|
+
}
|
|
39234
|
+
// Multi-geometry builds a container graphic holding sibling graphics rather than a flat one.
|
|
39235
|
+
const geometry = Entity$1.GetValue({
|
|
39236
|
+
entity: entity,
|
|
39237
|
+
path: ["Bruce", "VectorGeometry"]
|
|
39238
|
+
});
|
|
39239
|
+
const isMulti = ((_a = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _a === void 0 ? void 0 : _a.length) > 1;
|
|
39240
|
+
return displayType + "|" + (isMulti ? "multi" : "single");
|
|
39241
|
+
}
|
|
39242
|
+
EntityRenderEngine.GetGraphicShapeId = GetGraphicShapeId;
|
|
38212
39243
|
async function Render(params) {
|
|
38213
|
-
var _a, _b, _c
|
|
39244
|
+
var _a, _b, _c;
|
|
38214
39245
|
const groupRenderParams = {
|
|
38215
39246
|
apiGetter: params.apiGetter,
|
|
38216
39247
|
viewer: params.viewer,
|
|
@@ -38218,10 +39249,15 @@ var EntityRenderEngine;
|
|
|
38218
39249
|
zoomItems: {},
|
|
38219
39250
|
menuItemId: params.menuItemId,
|
|
38220
39251
|
onSeriesDiscovered: params.onSeriesDiscovered,
|
|
38221
|
-
visualRegister: params.visualRegister
|
|
39252
|
+
visualRegister: params.visualRegister,
|
|
39253
|
+
offline: params.offline
|
|
38222
39254
|
};
|
|
38223
39255
|
const updated = new Map();
|
|
38224
39256
|
const cEntities = new Map();
|
|
39257
|
+
// Entity ID -> the graphic shape resolved for this pass, stamped onto the results at the end.
|
|
39258
|
+
const shapeIds = new Map();
|
|
39259
|
+
// Entity ID -> what its zoom band was resolved from, stamped alongside the shape.
|
|
39260
|
+
const bandChecks = new Map();
|
|
38225
39261
|
const models = [];
|
|
38226
39262
|
const multiGeometry = [];
|
|
38227
39263
|
const polygons = [];
|
|
@@ -38271,11 +39307,21 @@ var EntityRenderEngine;
|
|
|
38271
39307
|
for (let i = 0; i < params.entities.length; i++) {
|
|
38272
39308
|
let entity = params.entities[i];
|
|
38273
39309
|
const id = entity.Bruce.ID;
|
|
39310
|
+
const resolution = {};
|
|
38274
39311
|
const zoomItem = RenderManager.DetermineZoomItem({
|
|
38275
39312
|
viewer: params.viewer,
|
|
38276
39313
|
entity,
|
|
38277
|
-
zoomControl: params.zoomControl
|
|
38278
|
-
|
|
39314
|
+
zoomControl: params.zoomControl,
|
|
39315
|
+
out: resolution
|
|
39316
|
+
});
|
|
39317
|
+
if (zoomItem && resolution.distance != null && resolution.cameraPos) {
|
|
39318
|
+
bandChecks.set(id, {
|
|
39319
|
+
distance: resolution.distance,
|
|
39320
|
+
cameraPos: resolution.cameraPos,
|
|
39321
|
+
min: zoomItem.MinZoom,
|
|
39322
|
+
max: zoomItem.MaxZoom
|
|
39323
|
+
});
|
|
39324
|
+
}
|
|
38279
39325
|
let displayType = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.DisplayType;
|
|
38280
39326
|
if (!displayType) {
|
|
38281
39327
|
displayType = ZoomControl.EDisplayType.Hidden;
|
|
@@ -38289,8 +39335,13 @@ var EntityRenderEngine;
|
|
|
38289
39335
|
entityId: id,
|
|
38290
39336
|
menuItemId: params.menuItemId
|
|
38291
39337
|
});
|
|
39338
|
+
const existingVisual = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual;
|
|
38292
39339
|
const newRenderId = GetRenderGroupId(zoomItem);
|
|
38293
|
-
const oldRenderId =
|
|
39340
|
+
const oldRenderId = existingVisual === null || existingVisual === void 0 ? void 0 : existingVisual._renderGroup;
|
|
39341
|
+
// Resolved before prepareGeometry() below, which flattens a single-item MultiGeometry and
|
|
39342
|
+
// would otherwise make the same entity resolve to a different shape than it was stamped with.
|
|
39343
|
+
const newShapeId = GetGraphicShapeId(zoomItem, entity);
|
|
39344
|
+
shapeIds.set(id, newShapeId);
|
|
38294
39345
|
if (!params.force &&
|
|
38295
39346
|
newRenderId == oldRenderId &&
|
|
38296
39347
|
!(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
|
|
@@ -38300,13 +39351,13 @@ var EntityRenderEngine;
|
|
|
38300
39351
|
cEntities.set(id, existingRego.visual);
|
|
38301
39352
|
}
|
|
38302
39353
|
else {
|
|
38303
|
-
|
|
38304
|
-
if (existingRego &&
|
|
39354
|
+
const oldShapeId = existingVisual === null || existingVisual === void 0 ? void 0 : existingVisual._graphicShape;
|
|
39355
|
+
if (existingRego && newShapeId == oldShapeId) {
|
|
38305
39356
|
cEntities.set(id, existingRego.visual);
|
|
38306
39357
|
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
38307
39358
|
existingRego.stale = false;
|
|
38308
39359
|
// Update metadata for the same reason.
|
|
38309
|
-
existingRego.outline = (
|
|
39360
|
+
existingRego.outline = (_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.Outline;
|
|
38310
39361
|
existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
|
|
38311
39362
|
updated.set(id, true);
|
|
38312
39363
|
}
|
|
@@ -38320,7 +39371,7 @@ var EntityRenderEngine;
|
|
|
38320
39371
|
entity: entity,
|
|
38321
39372
|
path: ["Bruce", "VectorGeometry"]
|
|
38322
39373
|
});
|
|
38323
|
-
if ((
|
|
39374
|
+
if ((_b = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _b === void 0 ? void 0 : _b.length) {
|
|
38324
39375
|
multiGeometry.push(entity);
|
|
38325
39376
|
}
|
|
38326
39377
|
else {
|
|
@@ -38363,7 +39414,7 @@ var EntityRenderEngine;
|
|
|
38363
39414
|
entity: entity,
|
|
38364
39415
|
path: ["Bruce", "VectorGeometry"]
|
|
38365
39416
|
});
|
|
38366
|
-
if (!((
|
|
39417
|
+
if (!((_c = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
38367
39418
|
polygons.push(entity);
|
|
38368
39419
|
continue;
|
|
38369
39420
|
}
|
|
@@ -38482,6 +39533,21 @@ var EntityRenderEngine;
|
|
|
38482
39533
|
}
|
|
38483
39534
|
}
|
|
38484
39535
|
}
|
|
39536
|
+
// Stamped centrally rather than per-engine so the value always matches what the gate above compared,
|
|
39537
|
+
// regardless of which engine (or fallback engine) ended up producing the graphic.
|
|
39538
|
+
cEntities.forEach((cEntity, id) => {
|
|
39539
|
+
if (!cEntity) {
|
|
39540
|
+
return;
|
|
39541
|
+
}
|
|
39542
|
+
const shapeId = shapeIds.get(id);
|
|
39543
|
+
if (shapeId) {
|
|
39544
|
+
cEntity._graphicShape = shapeId;
|
|
39545
|
+
}
|
|
39546
|
+
const bandCheck = bandChecks.get(id);
|
|
39547
|
+
if (bandCheck) {
|
|
39548
|
+
cEntity._bandCheck = bandCheck;
|
|
39549
|
+
}
|
|
39550
|
+
});
|
|
38485
39551
|
return {
|
|
38486
39552
|
entities: cEntities,
|
|
38487
39553
|
updated
|
|
@@ -38517,9 +39583,7 @@ var EntityRenderEngine;
|
|
|
38517
39583
|
});
|
|
38518
39584
|
}
|
|
38519
39585
|
}
|
|
38520
|
-
|
|
38521
|
-
viewer.entities.remove(entity);
|
|
38522
|
-
}
|
|
39586
|
+
RemoveCEntityFromScene(viewer, entity);
|
|
38523
39587
|
}
|
|
38524
39588
|
doRemove({
|
|
38525
39589
|
viewer: params.viewer,
|
|
@@ -38554,9 +39618,10 @@ var EntityRenderEngine;
|
|
|
38554
39618
|
* @param max
|
|
38555
39619
|
* @param meterSize size of "thing" in meters, eg polyline is 0.5 meters width. If size is provided we can potentially cull it earlier.
|
|
38556
39620
|
* @param isPolygon
|
|
39621
|
+
* @param fitMeterSize overall extent of the "thing" in meters, eg a parcel's bounding-box diagonal. If provided we keep it visible far enough out to actually fit on screen.
|
|
38557
39622
|
* @returns
|
|
38558
39623
|
*/
|
|
38559
|
-
function GetDisplayCondition(min, max, meterSize, isPolygon) {
|
|
39624
|
+
function GetDisplayCondition(min, max, meterSize, isPolygon, fitMeterSize) {
|
|
38560
39625
|
// Max is required.
|
|
38561
39626
|
if (isNaN(+max)) {
|
|
38562
39627
|
return undefined;
|
|
@@ -38586,6 +39651,15 @@ var EntityRenderEngine;
|
|
|
38586
39651
|
return undefined;
|
|
38587
39652
|
}
|
|
38588
39653
|
}
|
|
39654
|
+
// The configured max is a guess about viewing distance, and for a large thing that guess is often short:
|
|
39655
|
+
// it vanishes while still overflowing the screen, so you can never see all of it at once.
|
|
39656
|
+
// A thing of size S needs roughly S * 0.87 of camera distance to fit a 60deg vertical fov, so we
|
|
39657
|
+
// floor the max at a margin above that rather than culling something you haven't finished zooming out to.
|
|
39658
|
+
fitMeterSize = +fitMeterSize;
|
|
39659
|
+
if (!isNaN(fitMeterSize) && fitMeterSize > 0) {
|
|
39660
|
+
const FIT_DISTANCE_PER_METER = 1.4;
|
|
39661
|
+
max = Math.max(max, fitMeterSize * FIT_DISTANCE_PER_METER);
|
|
39662
|
+
}
|
|
38589
39663
|
return new DistanceDisplayCondition(min, max);
|
|
38590
39664
|
}
|
|
38591
39665
|
EntityRenderEngine.GetDisplayCondition = GetDisplayCondition;
|
|
@@ -38608,8 +39682,72 @@ function getColor$3(viewer, obj) {
|
|
|
38608
39682
|
}
|
|
38609
39683
|
return value;
|
|
38610
39684
|
}
|
|
39685
|
+
const pendingRemovalsByViewer = new WeakMap();
|
|
39686
|
+
function scheduleEntityRemoval(viewer, entity) {
|
|
39687
|
+
let pending = pendingRemovalsByViewer.get(viewer);
|
|
39688
|
+
if (!pending) {
|
|
39689
|
+
pending = { entities: new Set(), hook: null };
|
|
39690
|
+
pendingRemovalsByViewer.set(viewer, pending);
|
|
39691
|
+
}
|
|
39692
|
+
pending.entities.add(entity);
|
|
39693
|
+
if (pending.hook) {
|
|
39694
|
+
return;
|
|
39695
|
+
}
|
|
39696
|
+
pending.hook = viewer.scene.postRender.addEventListener(() => {
|
|
39697
|
+
var _a;
|
|
39698
|
+
(_a = pending.hook) === null || _a === void 0 ? void 0 : _a.call(pending);
|
|
39699
|
+
pending.hook = null;
|
|
39700
|
+
const batch = Array.from(pending.entities);
|
|
39701
|
+
pending.entities.clear();
|
|
39702
|
+
if (!batch.length) {
|
|
39703
|
+
return;
|
|
39704
|
+
}
|
|
39705
|
+
WithSuspendedCCollections(batch.map(x => GetCEntityCollection(viewer, x)), () => {
|
|
39706
|
+
for (const item of batch) {
|
|
39707
|
+
try {
|
|
39708
|
+
EntityRenderEngine.Remove({
|
|
39709
|
+
viewer,
|
|
39710
|
+
entity: item
|
|
39711
|
+
});
|
|
39712
|
+
}
|
|
39713
|
+
catch (e) {
|
|
39714
|
+
console.error(e);
|
|
39715
|
+
}
|
|
39716
|
+
}
|
|
39717
|
+
});
|
|
39718
|
+
});
|
|
39719
|
+
}
|
|
38611
39720
|
var CesiumAnimatedInOut;
|
|
38612
39721
|
(function (CesiumAnimatedInOut) {
|
|
39722
|
+
/**
|
|
39723
|
+
* Runs any removals already queued for this viewer immediately, instead of waiting for the next render.
|
|
39724
|
+
* For teardown paths that need the scene emptied synchronously.
|
|
39725
|
+
*/
|
|
39726
|
+
function FlushPendingRemovals(viewer) {
|
|
39727
|
+
var _a;
|
|
39728
|
+
const pending = pendingRemovalsByViewer.get(viewer);
|
|
39729
|
+
if (!(pending === null || pending === void 0 ? void 0 : pending.entities.size)) {
|
|
39730
|
+
return;
|
|
39731
|
+
}
|
|
39732
|
+
const batch = Array.from(pending.entities);
|
|
39733
|
+
pending.entities.clear();
|
|
39734
|
+
(_a = pending.hook) === null || _a === void 0 ? void 0 : _a.call(pending);
|
|
39735
|
+
pending.hook = null;
|
|
39736
|
+
WithSuspendedCCollections(batch.map(x => GetCEntityCollection(viewer, x)), () => {
|
|
39737
|
+
for (const item of batch) {
|
|
39738
|
+
try {
|
|
39739
|
+
EntityRenderEngine.Remove({
|
|
39740
|
+
viewer,
|
|
39741
|
+
entity: item
|
|
39742
|
+
});
|
|
39743
|
+
}
|
|
39744
|
+
catch (e) {
|
|
39745
|
+
console.error(e);
|
|
39746
|
+
}
|
|
39747
|
+
}
|
|
39748
|
+
});
|
|
39749
|
+
}
|
|
39750
|
+
CesiumAnimatedInOut.FlushPendingRemovals = FlushPendingRemovals;
|
|
38613
39751
|
/**
|
|
38614
39752
|
* Animates an Entity out of the scene.
|
|
38615
39753
|
* Removes it from the scene at the end of the animation.
|
|
@@ -38628,13 +39766,7 @@ var CesiumAnimatedInOut;
|
|
|
38628
39766
|
return;
|
|
38629
39767
|
}
|
|
38630
39768
|
removed = true;
|
|
38631
|
-
|
|
38632
|
-
removal();
|
|
38633
|
-
EntityRenderEngine.Remove({
|
|
38634
|
-
viewer,
|
|
38635
|
-
entity
|
|
38636
|
-
});
|
|
38637
|
-
});
|
|
39769
|
+
scheduleEntityRemoval(viewer, entity);
|
|
38638
39770
|
};
|
|
38639
39771
|
for (let i = 0; i < pieces.length; i++) {
|
|
38640
39772
|
const piece = pieces[i];
|
|
@@ -39184,7 +40316,7 @@ var StyleUtils;
|
|
|
39184
40316
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
39185
40317
|
})(StyleUtils || (StyleUtils = {}));
|
|
39186
40318
|
|
|
39187
|
-
const VERSION = "7.0.
|
|
40319
|
+
const VERSION = "7.0.4";
|
|
39188
40320
|
/**
|
|
39189
40321
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
39190
40322
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|