bruce-cesium 7.0.3 → 7.0.5
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 +111 -7
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +109 -5
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +2 -0
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/visual-register-culler.js +55 -4
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +52 -0
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/visual-register-culler.d.ts +5 -0
- package/dist/types/rendering/visuals-register.d.ts +10 -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, Entity,
|
|
3
|
-
import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator,
|
|
2
|
+
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, ClassificationType, ConstantPositionProperty, ImageMaterialProperty, PolygonHierarchy, ShadowMode, PolylineGraphics, ArcType, CornerType, ColorBlendMode, Model, SceneTransforms, NearFarScalar, Cartesian2, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Cesium3DTileset, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CustomDataSource, BoundingSphere, GeometryInstance, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
|
|
3
|
+
import { Cartes, Entity as Entity$1, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Bounds, Color as Color$1, Geometry, EntityLod, Carto, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, EntityRelation, BruceApi, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -6084,7 +6084,22 @@ function getValue$1(viewer, obj) {
|
|
|
6084
6084
|
}
|
|
6085
6085
|
return obj;
|
|
6086
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";
|
|
6092
|
+
// Keyed by entity id alone. A cached sphere is only as good as the geometry it was measured from, so anything
|
|
6093
|
+
// changing that geometry has to call InvalidateBounds, see it for why nothing can be inferred instead.
|
|
6087
6094
|
const boundingSphereCache = new LRUCache(100000);
|
|
6095
|
+
/*
|
|
6096
|
+
* Forgets what is known about an entity's extent, so the next check measures it again.
|
|
6097
|
+
*/
|
|
6098
|
+
function invalidateBounds(entityIds) {
|
|
6099
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
6100
|
+
boundingSphereCache.Delete(entityIds[i]);
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6088
6103
|
function getPositionsFromEntity(viewer, entity) {
|
|
6089
6104
|
let positions = [];
|
|
6090
6105
|
let heightRef;
|
|
@@ -6201,10 +6216,11 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
6201
6216
|
let boundingSphere;
|
|
6202
6217
|
const terrainId = (_c = (_b = (_a = ViewUtils.GatherTerrainTile({
|
|
6203
6218
|
viewer
|
|
6204
|
-
})) === null || _a === void 0 ? void 0 : _a.terrain) === null || _b === void 0 ? void 0 : _b.tilesetId) !== null && _c !== void 0 ? _c :
|
|
6205
|
-
const cacheKey =
|
|
6219
|
+
})) === null || _a === void 0 ? void 0 : _a.terrain) === null || _b === void 0 ? void 0 : _b.tilesetId) !== null && _c !== void 0 ? _c : UNRECOGNISED_TERRAIN_ID;
|
|
6220
|
+
const cacheKey = cEntity.id;
|
|
6206
6221
|
const cacheData = boundingSphereCache.Get(cacheKey);
|
|
6207
|
-
|
|
6222
|
+
// A sphere measured under different terrain cannot be reused, since the height treatment differs.
|
|
6223
|
+
if (cacheData && (cacheData == -1 || cacheData.terrainId == terrainId)) {
|
|
6208
6224
|
boundingSphere = cacheData;
|
|
6209
6225
|
}
|
|
6210
6226
|
else {
|
|
@@ -6260,7 +6276,8 @@ function shouldCullEntity(viewer, cEntity) {
|
|
|
6260
6276
|
}
|
|
6261
6277
|
boundingSphere = {
|
|
6262
6278
|
heightRef: positions.heightRef,
|
|
6263
|
-
sphere: sphere
|
|
6279
|
+
sphere: sphere,
|
|
6280
|
+
terrainId: terrainId
|
|
6264
6281
|
};
|
|
6265
6282
|
if (!doNotCache) {
|
|
6266
6283
|
boundingSphereCache.Set(cacheKey, boundingSphere);
|
|
@@ -6355,6 +6372,8 @@ function isCullingIgnored(viewer, rego) {
|
|
|
6355
6372
|
rego.relation != null ||
|
|
6356
6373
|
// Explicitly being either shown or hidden.
|
|
6357
6374
|
rego.overrideShow != null ||
|
|
6375
|
+
// Being dragged around right now, so its extent is changing faster than we could measure it.
|
|
6376
|
+
rego.editing == true ||
|
|
6358
6377
|
// Part of a collection we did not create, eg. a geojson data source, which may have its own rules for
|
|
6359
6378
|
// what is in the scene. Our own per-menu-item data sources are fair game.
|
|
6360
6379
|
(rego.collection && !IsCCollectionOwned(rego.collection)) ||
|
|
@@ -6643,6 +6662,38 @@ var VisualRegisterCuller;
|
|
|
6643
6662
|
return isCullingIgnored(viewer, rego);
|
|
6644
6663
|
}
|
|
6645
6664
|
VisualRegisterCuller.IsCullingIgnored = IsCullingIgnored;
|
|
6665
|
+
/**
|
|
6666
|
+
* Discards what the culler knows about an entity's extent, so its next check measures the geometry again.
|
|
6667
|
+
* @param visuals an entity, an entity id, or an array of either.
|
|
6668
|
+
*/
|
|
6669
|
+
function InvalidateBounds(visuals) {
|
|
6670
|
+
const list = Array.isArray(visuals) ? visuals : [visuals];
|
|
6671
|
+
const ids = [];
|
|
6672
|
+
for (let i = 0; i < list.length; i++) {
|
|
6673
|
+
const item = list[i];
|
|
6674
|
+
if (!item) {
|
|
6675
|
+
continue;
|
|
6676
|
+
}
|
|
6677
|
+
if (typeof item == "string") {
|
|
6678
|
+
ids.push(item);
|
|
6679
|
+
continue;
|
|
6680
|
+
}
|
|
6681
|
+
const parts = EntityUtils.GatherEntity({
|
|
6682
|
+
entity: item
|
|
6683
|
+
});
|
|
6684
|
+
for (let j = 0; j < parts.length; j++) {
|
|
6685
|
+
const part = parts[j];
|
|
6686
|
+
if (!(part instanceof Entity)) {
|
|
6687
|
+
continue;
|
|
6688
|
+
}
|
|
6689
|
+
ids.push(part.id);
|
|
6690
|
+
// The per-entity answer is derived from the sphere, so it goes stale with it.
|
|
6691
|
+
delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
|
|
6692
|
+
}
|
|
6693
|
+
}
|
|
6694
|
+
invalidateBounds(ids);
|
|
6695
|
+
}
|
|
6696
|
+
VisualRegisterCuller.InvalidateBounds = InvalidateBounds;
|
|
6646
6697
|
function IsCulled(viewer, rego, visual) {
|
|
6647
6698
|
if (isCullingIgnored(viewer, rego)) {
|
|
6648
6699
|
return false;
|
|
@@ -8113,6 +8164,58 @@ var VisualsRegister;
|
|
|
8113
8164
|
CesiumEntityStyler.UpdateColorSetting("highlight", color);
|
|
8114
8165
|
}
|
|
8115
8166
|
}
|
|
8167
|
+
/**
|
|
8168
|
+
* Marks visuals as being actively edited, which exempts them from culling until it is turned back off.
|
|
8169
|
+
*/
|
|
8170
|
+
SetEditing(params) {
|
|
8171
|
+
var _a, _b;
|
|
8172
|
+
const { entityIds, editing, menuItemId, requestRender } = params;
|
|
8173
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
8174
|
+
return;
|
|
8175
|
+
}
|
|
8176
|
+
let changed = false;
|
|
8177
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
8178
|
+
const regos = this.rego[entityIds[i]];
|
|
8179
|
+
if (!regos) {
|
|
8180
|
+
continue;
|
|
8181
|
+
}
|
|
8182
|
+
for (let j = 0; j < regos.length; j++) {
|
|
8183
|
+
const rego = regos[j];
|
|
8184
|
+
if (menuItemId && rego.menuItemId !== menuItemId) {
|
|
8185
|
+
continue;
|
|
8186
|
+
}
|
|
8187
|
+
if (Boolean(rego.editing) == Boolean(editing)) {
|
|
8188
|
+
continue;
|
|
8189
|
+
}
|
|
8190
|
+
// Null rather than false, so the rego does not carry a key for every visual ever edited.
|
|
8191
|
+
rego.editing = editing ? true : null;
|
|
8192
|
+
changed = true;
|
|
8193
|
+
if (editing) {
|
|
8194
|
+
const parts = EntityUtils.GatherEntity({
|
|
8195
|
+
entity: rego.visual
|
|
8196
|
+
});
|
|
8197
|
+
for (let k = 0; k < parts.length; k++) {
|
|
8198
|
+
const part = parts[k];
|
|
8199
|
+
if (!(part instanceof Entity)) {
|
|
8200
|
+
continue;
|
|
8201
|
+
}
|
|
8202
|
+
const wasCulled = part[VisualRegisterCuller.VISUAL_CULL_KEY];
|
|
8203
|
+
delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
|
|
8204
|
+
if (wasCulled && !IsCEntityInScene(this.viewer, part)) {
|
|
8205
|
+
AddCEntityToScene(this.viewer, part, rego.collection);
|
|
8206
|
+
}
|
|
8207
|
+
}
|
|
8208
|
+
}
|
|
8209
|
+
else {
|
|
8210
|
+
// The geometry almost certainly moved, so what was measured before is worthless.
|
|
8211
|
+
VisualRegisterCuller.InvalidateBounds(rego.visual);
|
|
8212
|
+
}
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8215
|
+
if (changed && requestRender != false) {
|
|
8216
|
+
(_b = (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.scene) === null || _b === void 0 ? void 0 : _b.requestRender();
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
8116
8219
|
SetSelected(params) {
|
|
8117
8220
|
var _a;
|
|
8118
8221
|
let { entityIds, selected, refreshIfSelected, requestRender, menuItemId, source } = params;
|
|
@@ -39542,6 +39645,7 @@ var EntityRenderEngine;
|
|
|
39542
39645
|
if (bandCheck) {
|
|
39543
39646
|
cEntity._bandCheck = bandCheck;
|
|
39544
39647
|
}
|
|
39648
|
+
VisualRegisterCuller.InvalidateBounds(cEntity);
|
|
39545
39649
|
});
|
|
39546
39650
|
return {
|
|
39547
39651
|
entities: cEntities,
|
|
@@ -40311,7 +40415,7 @@ var StyleUtils;
|
|
|
40311
40415
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
40312
40416
|
})(StyleUtils || (StyleUtils = {}));
|
|
40313
40417
|
|
|
40314
|
-
const VERSION = "7.0.
|
|
40418
|
+
const VERSION = "7.0.5";
|
|
40315
40419
|
/**
|
|
40316
40420
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
40317
40421
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|