bruce-cesium 6.1.8 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +648 -127
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +647 -126
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/live-cursor.js +150 -4
- package/dist/lib/rendering/render-managers/common/live-cursor.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +213 -40
- 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 +32 -15
- 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 +223 -49
- package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +32 -17
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/live-cursor.d.ts +20 -0
- package/dist/types/rendering/render-managers/tilesets/tileset-arb-render-manager.d.ts +27 -2
- package/dist/types/rendering/render-managers/tilesets/tileset-cad-render-manager.d.ts +1 -0
- package/dist/types/rendering/render-managers/tilesets/tileset-entities-render-manager.d.ts +25 -1
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, HeadingPitchRange, Ion, Cesium3DTileStyle, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, OrthographicFrustum, EasingFunction, Cesium3DTileset, IonResource, PolygonPipeline, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
|
|
4
4
|
|
|
5
5
|
const TIME_LAG = 300;
|
|
6
6
|
const POSITION_CHECK_TIMER = 950;
|
|
@@ -10798,6 +10798,19 @@ var CesiumAnimatedInOut;
|
|
|
10798
10798
|
CesiumAnimatedInOut.AnimateOut = AnimateOut;
|
|
10799
10799
|
})(CesiumAnimatedInOut || (CesiumAnimatedInOut = {}));
|
|
10800
10800
|
|
|
10801
|
+
function isTilesetFeatureAlive(visual) {
|
|
10802
|
+
const cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
10803
|
+
if (!cTileset) {
|
|
10804
|
+
return false;
|
|
10805
|
+
}
|
|
10806
|
+
else if (cTileset.isDestroyed() || !cTileset.show || !cTileset.root) {
|
|
10807
|
+
return false;
|
|
10808
|
+
}
|
|
10809
|
+
else if (visual.primitive && visual.primitive.isDestroyed()) {
|
|
10810
|
+
return false;
|
|
10811
|
+
}
|
|
10812
|
+
return true;
|
|
10813
|
+
}
|
|
10801
10814
|
/**
|
|
10802
10815
|
* Returns if a given visual is alive and in the scene.
|
|
10803
10816
|
* @param viewer
|
|
@@ -10893,23 +10906,25 @@ function updateEntityShow(viewer, rego, show) {
|
|
|
10893
10906
|
}
|
|
10894
10907
|
}
|
|
10895
10908
|
else if (visual instanceof Cesium3DTileFeature) {
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10909
|
+
if (isTilesetFeatureAlive(visual)) {
|
|
10910
|
+
// No way to tell if changing show will crash it!
|
|
10911
|
+
// ^ We need to improve removing visuals from the register when tiles unload to avoid this :)
|
|
10912
|
+
try {
|
|
10913
|
+
visual.show = show;
|
|
10914
|
+
}
|
|
10915
|
+
catch (e) {
|
|
10916
|
+
console.error(e);
|
|
10917
|
+
}
|
|
10918
|
+
const ent = visual;
|
|
10919
|
+
if (ent._siblingGraphics) {
|
|
10920
|
+
for (let i = 0; i < ent._siblingGraphics.length; i++) {
|
|
10921
|
+
try {
|
|
10922
|
+
const sibling = ent._siblingGraphics[i];
|
|
10923
|
+
sibling.show = show;
|
|
10924
|
+
}
|
|
10925
|
+
catch (e) {
|
|
10926
|
+
console.error(e);
|
|
10927
|
+
}
|
|
10913
10928
|
}
|
|
10914
10929
|
}
|
|
10915
10930
|
}
|
|
@@ -18952,28 +18967,36 @@ var TilesetCadRenderManager;
|
|
|
18952
18967
|
}
|
|
18953
18968
|
}
|
|
18954
18969
|
}
|
|
18955
|
-
// Latest path.
|
|
18956
18970
|
if (!rego.entityId) {
|
|
18971
|
+
// Latest path.
|
|
18957
18972
|
const entityIdProp = this.featurePropCache.get("entityId");
|
|
18958
18973
|
if (entityIdProp) {
|
|
18959
18974
|
rego.entityId = feature.getProperty(entityIdProp);
|
|
18960
18975
|
}
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18976
|
+
// Super legacy.
|
|
18977
|
+
if (!rego.entityId) {
|
|
18978
|
+
const brucePathProp = this.featurePropCache.get("brucePath");
|
|
18979
|
+
if (brucePathProp) {
|
|
18980
|
+
const pathStr = feature.getProperty(brucePathProp);
|
|
18981
|
+
if (pathStr) {
|
|
18982
|
+
let path = pathStr.split("|");
|
|
18983
|
+
let entityTypeId = this.getEntityTypeByPath(path);
|
|
18984
|
+
rego.entityTypeId = entityTypeId;
|
|
18985
|
+
rego.entityId = path[path.length - 1];
|
|
18986
|
+
}
|
|
18972
18987
|
}
|
|
18973
18988
|
}
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18989
|
+
if (!rego.entityId) {
|
|
18990
|
+
return null;
|
|
18991
|
+
}
|
|
18992
|
+
const meta = this.getMetaByEntityId(rego.entityId);
|
|
18993
|
+
if (meta) {
|
|
18994
|
+
rego.entityTypeId = meta.typeId;
|
|
18995
|
+
rego.name = meta.name;
|
|
18996
|
+
rego.parentId = meta.parentId;
|
|
18997
|
+
// Might be a different ID due to collapsed parents.
|
|
18998
|
+
rego.entityId = meta.entityId;
|
|
18999
|
+
}
|
|
18977
19000
|
}
|
|
18978
19001
|
// Optional menu item restriction.
|
|
18979
19002
|
// Allows only showing certain entities from a tileset.
|
|
@@ -19038,6 +19061,15 @@ var TilesetCadRenderManager;
|
|
|
19038
19061
|
});
|
|
19039
19062
|
return rego;
|
|
19040
19063
|
}
|
|
19064
|
+
getMetaByEntityId(entityId) {
|
|
19065
|
+
if (this.treeNodeByEntityId == null) {
|
|
19066
|
+
if (!this.modelTree) {
|
|
19067
|
+
return null;
|
|
19068
|
+
}
|
|
19069
|
+
this.buildModelTreeNodes(this.modelTree);
|
|
19070
|
+
}
|
|
19071
|
+
return this.treeNodeByEntityId[entityId] || null;
|
|
19072
|
+
}
|
|
19041
19073
|
getMetaByGeomId(geomId) {
|
|
19042
19074
|
if (this.treeNodeByGeomId == null) {
|
|
19043
19075
|
if (!this.modelTree) {
|
|
@@ -20157,6 +20189,24 @@ var TilesetEntitiesRenderManager;
|
|
|
20157
20189
|
this.disposed = false;
|
|
20158
20190
|
this.cTileset = null;
|
|
20159
20191
|
this.styler = new TilesetRenderEngine.Styler();
|
|
20192
|
+
// Entity ID -> rego.
|
|
20193
|
+
// We retain this information as a quick look-up on what has been registered.
|
|
20194
|
+
// This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
|
|
20195
|
+
this.loadedCesiumEntities = {};
|
|
20196
|
+
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
20197
|
+
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
20198
|
+
this.somethingIsolated = null;
|
|
20199
|
+
this.somethingIsolatedDateTime = null;
|
|
20200
|
+
// Queue of loaded in features that we haven't processed yet.
|
|
20201
|
+
this.featureQueue = [];
|
|
20202
|
+
// State is true for 'add' or 'false' for 'remove'.
|
|
20203
|
+
this.featureQueueStates = new Map();
|
|
20204
|
+
this.featureQueueInterval = null;
|
|
20205
|
+
// Cache of feature properties we wanted to find vs what we found.
|
|
20206
|
+
// Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
|
|
20207
|
+
// Saves having to do a case-insensitive lookup every time.
|
|
20208
|
+
this.featurePropCache = new Map();
|
|
20209
|
+
this.featurePropsChecked = 0;
|
|
20160
20210
|
const { viewer, register: visualsManager, getters: apiGetter, item } = params;
|
|
20161
20211
|
this.viewer = viewer;
|
|
20162
20212
|
this.getters = apiGetter;
|
|
@@ -20283,7 +20333,20 @@ var TilesetEntitiesRenderManager;
|
|
|
20283
20333
|
}
|
|
20284
20334
|
});
|
|
20285
20335
|
cTileset.tileLoad.addEventListener((tile) => {
|
|
20286
|
-
|
|
20336
|
+
try {
|
|
20337
|
+
this.queueTile(tile, true);
|
|
20338
|
+
}
|
|
20339
|
+
catch (e) {
|
|
20340
|
+
console.error(e);
|
|
20341
|
+
}
|
|
20342
|
+
});
|
|
20343
|
+
cTileset.tileUnload.addEventListener((tile) => {
|
|
20344
|
+
try {
|
|
20345
|
+
this.queueTile(tile, false);
|
|
20346
|
+
}
|
|
20347
|
+
catch (e) {
|
|
20348
|
+
console.error(e);
|
|
20349
|
+
}
|
|
20287
20350
|
});
|
|
20288
20351
|
}
|
|
20289
20352
|
// Scaling points by default otherwise they're 1px in size.
|
|
@@ -20306,6 +20369,118 @@ var TilesetEntitiesRenderManager;
|
|
|
20306
20369
|
});
|
|
20307
20370
|
})();
|
|
20308
20371
|
}
|
|
20372
|
+
/**
|
|
20373
|
+
* @param tile
|
|
20374
|
+
* @param load indicates if we are loading or unloading the tile.
|
|
20375
|
+
* @returns
|
|
20376
|
+
*/
|
|
20377
|
+
queueTile(tile, load) {
|
|
20378
|
+
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20379
|
+
if (!content) {
|
|
20380
|
+
return;
|
|
20381
|
+
}
|
|
20382
|
+
for (let i = 0; i < content.featuresLength; i++) {
|
|
20383
|
+
const feature = content.getFeature(i);
|
|
20384
|
+
if (!this.featureQueue.includes(feature)) {
|
|
20385
|
+
this.featureQueue.push(feature);
|
|
20386
|
+
}
|
|
20387
|
+
this.featureQueueStates.set(feature, load);
|
|
20388
|
+
}
|
|
20389
|
+
this.pingFeatureQueue();
|
|
20390
|
+
}
|
|
20391
|
+
/**
|
|
20392
|
+
* Pings the feature queue to process any queued features.
|
|
20393
|
+
* Does nothing if we're already processing.
|
|
20394
|
+
* @returns
|
|
20395
|
+
*/
|
|
20396
|
+
pingFeatureQueue() {
|
|
20397
|
+
if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
|
|
20398
|
+
return;
|
|
20399
|
+
}
|
|
20400
|
+
this.featureQueueInterval = setInterval(() => {
|
|
20401
|
+
if (this.disposed) {
|
|
20402
|
+
clearInterval(this.featureQueueInterval);
|
|
20403
|
+
this.featureQueueInterval = null;
|
|
20404
|
+
return;
|
|
20405
|
+
}
|
|
20406
|
+
this.processFeatureQueueBatch();
|
|
20407
|
+
if (!this.featureQueue) {
|
|
20408
|
+
clearInterval(this.featureQueueInterval);
|
|
20409
|
+
this.featureQueueInterval = null;
|
|
20410
|
+
}
|
|
20411
|
+
}, 10);
|
|
20412
|
+
}
|
|
20413
|
+
/**
|
|
20414
|
+
* Process a batch of features from the feature queue.
|
|
20415
|
+
*/
|
|
20416
|
+
processFeatureQueueBatch() {
|
|
20417
|
+
if (!this.featureQueue.length) {
|
|
20418
|
+
return;
|
|
20419
|
+
}
|
|
20420
|
+
const BATCH_SIZE = 5000;
|
|
20421
|
+
const batch = this.featureQueue.splice(0, BATCH_SIZE);
|
|
20422
|
+
const regosToStyle = new Map();
|
|
20423
|
+
const featuresToRemove = [];
|
|
20424
|
+
for (const feature of batch) {
|
|
20425
|
+
const load = this.featureQueueStates.get(feature);
|
|
20426
|
+
this.featureQueueStates.delete(feature);
|
|
20427
|
+
if (!load) {
|
|
20428
|
+
featuresToRemove.push(feature);
|
|
20429
|
+
continue;
|
|
20430
|
+
}
|
|
20431
|
+
const result = this.mapTilesetFeature(feature);
|
|
20432
|
+
if (result === null) {
|
|
20433
|
+
// Override the default hide state set by the style.
|
|
20434
|
+
feature.show = true;
|
|
20435
|
+
continue;
|
|
20436
|
+
}
|
|
20437
|
+
else if (result) {
|
|
20438
|
+
regosToStyle.set(result.entityId, result);
|
|
20439
|
+
}
|
|
20440
|
+
}
|
|
20441
|
+
if (featuresToRemove.length) {
|
|
20442
|
+
const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
|
|
20443
|
+
visuals: featuresToRemove,
|
|
20444
|
+
requestRender: false,
|
|
20445
|
+
menuItemId: this.item.id,
|
|
20446
|
+
doRemove: false
|
|
20447
|
+
});
|
|
20448
|
+
for (const entityId of removedEntityIds) {
|
|
20449
|
+
delete this.loadedCesiumEntities[entityId];
|
|
20450
|
+
}
|
|
20451
|
+
}
|
|
20452
|
+
if (this.styler && regosToStyle.size) {
|
|
20453
|
+
this.styler.QueueEntities(Array.from(regosToStyle.values()));
|
|
20454
|
+
}
|
|
20455
|
+
}
|
|
20456
|
+
evaluateFeatureProps(feature) {
|
|
20457
|
+
var _a;
|
|
20458
|
+
// If we've checked 10 features then we should have a good handle on what props are available.
|
|
20459
|
+
if (this.featurePropsChecked >= 10) {
|
|
20460
|
+
return;
|
|
20461
|
+
}
|
|
20462
|
+
this.featurePropsChecked++;
|
|
20463
|
+
const featureAny = feature;
|
|
20464
|
+
const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
|
|
20465
|
+
if (!props) {
|
|
20466
|
+
return;
|
|
20467
|
+
}
|
|
20468
|
+
for (const prop of props) {
|
|
20469
|
+
if (!prop) {
|
|
20470
|
+
continue;
|
|
20471
|
+
}
|
|
20472
|
+
const lowered = prop.toLowerCase();
|
|
20473
|
+
if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
|
|
20474
|
+
this.featurePropCache.set("entityId", prop);
|
|
20475
|
+
}
|
|
20476
|
+
else if (lowered === "brucepath") {
|
|
20477
|
+
this.featurePropCache.set("BrucePath", prop);
|
|
20478
|
+
}
|
|
20479
|
+
else if (lowered === "building_id" || lowered === "buildingid") {
|
|
20480
|
+
this.featurePropCache.set("BuildingID", prop);
|
|
20481
|
+
}
|
|
20482
|
+
}
|
|
20483
|
+
}
|
|
20309
20484
|
Dispose() {
|
|
20310
20485
|
if (this.disposed) {
|
|
20311
20486
|
return;
|
|
@@ -20315,6 +20490,11 @@ var TilesetEntitiesRenderManager;
|
|
|
20315
20490
|
}
|
|
20316
20491
|
doDispose() {
|
|
20317
20492
|
var _a, _b;
|
|
20493
|
+
if (this.featureQueueInterval) {
|
|
20494
|
+
clearInterval(this.featureQueueInterval);
|
|
20495
|
+
this.featureQueueInterval = null;
|
|
20496
|
+
this.featureQueue = [];
|
|
20497
|
+
}
|
|
20318
20498
|
if (this.cTileset) {
|
|
20319
20499
|
const viewer = this.viewer;
|
|
20320
20500
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
|
|
@@ -20335,60 +20515,84 @@ var TilesetEntitiesRenderManager;
|
|
|
20335
20515
|
this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
|
|
20336
20516
|
}
|
|
20337
20517
|
}
|
|
20338
|
-
mapCTile(tile) {
|
|
20339
|
-
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20340
|
-
if (!content) {
|
|
20341
|
-
return;
|
|
20342
|
-
}
|
|
20343
|
-
const regosToQueue = new Map();
|
|
20344
|
-
for (let i = 0; i < content.featuresLength; i++) {
|
|
20345
|
-
const feature = content.getFeature(i);
|
|
20346
|
-
const rego = this.mapTilesetFeature(feature);
|
|
20347
|
-
if (rego === null || rego === void 0 ? void 0 : rego.entityId) {
|
|
20348
|
-
regosToQueue.set(rego.entityId, rego);
|
|
20349
|
-
}
|
|
20350
|
-
}
|
|
20351
|
-
if (this.styler && regosToQueue.size) {
|
|
20352
|
-
this.styler.QueueEntities(Array.from(regosToQueue.values()));
|
|
20353
|
-
}
|
|
20354
|
-
this.viewer.scene.requestRender();
|
|
20355
|
-
}
|
|
20356
20518
|
mapTilesetFeature(feature) {
|
|
20357
20519
|
var _a, _b, _c;
|
|
20358
|
-
|
|
20359
|
-
|
|
20520
|
+
this.evaluateFeatureProps(feature);
|
|
20521
|
+
const propToUse = this.featurePropCache.get("entityId");
|
|
20522
|
+
let id = propToUse ? feature.getProperty(propToUse) : null;
|
|
20523
|
+
if (id && typeof id == "string") {
|
|
20524
|
+
// Perhaps a relic of UTF-16 encoding after we stopped using it?
|
|
20525
|
+
if (id.endsWith("\u0000")) {
|
|
20526
|
+
id = id.substring(0, id.length - 1);
|
|
20527
|
+
}
|
|
20528
|
+
}
|
|
20360
20529
|
if (!id) {
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20530
|
+
return null;
|
|
20531
|
+
}
|
|
20532
|
+
const accountId = (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
|
|
20533
|
+
const canEdit = accountId === this.getters.GetAccountId();
|
|
20534
|
+
let rego = {
|
|
20535
|
+
canEdit: canEdit,
|
|
20536
|
+
entityId: id,
|
|
20537
|
+
entityTypeId: this.typeId,
|
|
20538
|
+
menuItemId: this.item.id,
|
|
20539
|
+
menuItemType: this.item.Type,
|
|
20540
|
+
priority: this.renderPriority,
|
|
20541
|
+
visual: feature,
|
|
20542
|
+
tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
|
|
20543
|
+
tilesetType: Tileset.EType.EntitiesSet,
|
|
20544
|
+
accountId: accountId
|
|
20545
|
+
};
|
|
20546
|
+
// Get the initial hide/show state.
|
|
20547
|
+
const state = this.visualsManager.GetState({
|
|
20548
|
+
entityId: rego.entityId,
|
|
20549
|
+
menuItemId: this.item.id,
|
|
20550
|
+
});
|
|
20551
|
+
if (this.somethingIsolated == null ||
|
|
20552
|
+
// 5s cache.
|
|
20553
|
+
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
20554
|
+
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
20555
|
+
this.somethingIsolatedDateTime = new Date();
|
|
20556
|
+
}
|
|
20557
|
+
// Override the default hide state set by the style.
|
|
20558
|
+
let hide = false;
|
|
20559
|
+
if (state) {
|
|
20560
|
+
if (state.hidden) {
|
|
20561
|
+
hide = true;
|
|
20562
|
+
}
|
|
20563
|
+
else if (state.opacity === 0) {
|
|
20564
|
+
hide = true;
|
|
20565
|
+
}
|
|
20566
|
+
else if (!state.isolated && this.somethingIsolated) {
|
|
20567
|
+
hide = true;
|
|
20368
20568
|
}
|
|
20369
20569
|
}
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
visual
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
}
|
|
20389
|
-
return rego;
|
|
20570
|
+
feature.show = !hide;
|
|
20571
|
+
// Already exists, so we add this graphic as a sibling.
|
|
20572
|
+
if (this.loadedCesiumEntities[rego.entityId]) {
|
|
20573
|
+
rego = this.loadedCesiumEntities[rego.entityId];
|
|
20574
|
+
if (!rego.visual) {
|
|
20575
|
+
// No parent graphic.
|
|
20576
|
+
rego.visual = feature;
|
|
20577
|
+
}
|
|
20578
|
+
else if (rego.visual == feature) ;
|
|
20579
|
+
else {
|
|
20580
|
+
const visual = rego.visual;
|
|
20581
|
+
// Sibling graphic.
|
|
20582
|
+
if (!visual._siblingGraphics) {
|
|
20583
|
+
visual._siblingGraphics = [];
|
|
20584
|
+
}
|
|
20585
|
+
if (visual._siblingGraphics.indexOf(feature) < 0) {
|
|
20586
|
+
visual._siblingGraphics.push(feature);
|
|
20587
|
+
}
|
|
20588
|
+
}
|
|
20390
20589
|
}
|
|
20391
|
-
|
|
20590
|
+
this.loadedCesiumEntities[rego.entityId] = rego;
|
|
20591
|
+
this.visualsManager.AddRego({
|
|
20592
|
+
rego,
|
|
20593
|
+
requestRender: false
|
|
20594
|
+
});
|
|
20595
|
+
return rego;
|
|
20392
20596
|
}
|
|
20393
20597
|
async ReRender(params) {
|
|
20394
20598
|
let { entityIds, force, entities } = params;
|
|
@@ -20671,6 +20875,24 @@ var TilesetArbRenderManager;
|
|
|
20671
20875
|
this.cTileset = null;
|
|
20672
20876
|
this.styler = new TilesetRenderEngine.Styler();
|
|
20673
20877
|
this.tilesetType = null;
|
|
20878
|
+
// Entity ID -> rego.
|
|
20879
|
+
// We retain this information as a quick look-up on what has been registered.
|
|
20880
|
+
// This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
|
|
20881
|
+
this.loadedCesiumEntities = {};
|
|
20882
|
+
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
20883
|
+
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
20884
|
+
this.somethingIsolated = null;
|
|
20885
|
+
this.somethingIsolatedDateTime = null;
|
|
20886
|
+
// Queue of loaded in features that we haven't processed yet.
|
|
20887
|
+
this.featureQueue = [];
|
|
20888
|
+
// State is true for 'add' or 'false' for 'remove'.
|
|
20889
|
+
this.featureQueueStates = new Map();
|
|
20890
|
+
this.featureQueueInterval = null;
|
|
20891
|
+
// Cache of feature properties we wanted to find vs what we found.
|
|
20892
|
+
// Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
|
|
20893
|
+
// Saves having to do a case-insensitive lookup every time.
|
|
20894
|
+
this.featurePropCache = new Map();
|
|
20895
|
+
this.featurePropsChecked = 0;
|
|
20674
20896
|
this.viewer = params.viewer;
|
|
20675
20897
|
this.getters = params.getters;
|
|
20676
20898
|
this.visualsManager = params.register;
|
|
@@ -20847,11 +21069,16 @@ var TilesetArbRenderManager;
|
|
|
20847
21069
|
}
|
|
20848
21070
|
});
|
|
20849
21071
|
this.cTileset.tileLoad.addEventListener((tile) => {
|
|
20850
|
-
|
|
20851
|
-
|
|
21072
|
+
try {
|
|
21073
|
+
this.queueTile(tile, true);
|
|
20852
21074
|
}
|
|
21075
|
+
catch (e) {
|
|
21076
|
+
console.error(e);
|
|
21077
|
+
}
|
|
21078
|
+
});
|
|
21079
|
+
this.cTileset.tileUnload.addEventListener((tile) => {
|
|
20853
21080
|
try {
|
|
20854
|
-
this.
|
|
21081
|
+
this.queueTile(tile, false);
|
|
20855
21082
|
}
|
|
20856
21083
|
catch (e) {
|
|
20857
21084
|
console.error(e);
|
|
@@ -20859,6 +21086,118 @@ var TilesetArbRenderManager;
|
|
|
20859
21086
|
});
|
|
20860
21087
|
})();
|
|
20861
21088
|
}
|
|
21089
|
+
/**
|
|
21090
|
+
* @param tile
|
|
21091
|
+
* @param load indicates if we are loading or unloading the tile.
|
|
21092
|
+
* @returns
|
|
21093
|
+
*/
|
|
21094
|
+
queueTile(tile, load) {
|
|
21095
|
+
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
21096
|
+
if (!content) {
|
|
21097
|
+
return;
|
|
21098
|
+
}
|
|
21099
|
+
for (let i = 0; i < content.featuresLength; i++) {
|
|
21100
|
+
const feature = content.getFeature(i);
|
|
21101
|
+
if (!this.featureQueue.includes(feature)) {
|
|
21102
|
+
this.featureQueue.push(feature);
|
|
21103
|
+
}
|
|
21104
|
+
this.featureQueueStates.set(feature, load);
|
|
21105
|
+
}
|
|
21106
|
+
this.pingFeatureQueue();
|
|
21107
|
+
}
|
|
21108
|
+
/**
|
|
21109
|
+
* Pings the feature queue to process any queued features.
|
|
21110
|
+
* Does nothing if we're already processing.
|
|
21111
|
+
* @returns
|
|
21112
|
+
*/
|
|
21113
|
+
pingFeatureQueue() {
|
|
21114
|
+
if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
|
|
21115
|
+
return;
|
|
21116
|
+
}
|
|
21117
|
+
this.featureQueueInterval = setInterval(() => {
|
|
21118
|
+
if (this.disposed) {
|
|
21119
|
+
clearInterval(this.featureQueueInterval);
|
|
21120
|
+
this.featureQueueInterval = null;
|
|
21121
|
+
return;
|
|
21122
|
+
}
|
|
21123
|
+
this.processFeatureQueueBatch();
|
|
21124
|
+
if (!this.featureQueue) {
|
|
21125
|
+
clearInterval(this.featureQueueInterval);
|
|
21126
|
+
this.featureQueueInterval = null;
|
|
21127
|
+
}
|
|
21128
|
+
}, 10);
|
|
21129
|
+
}
|
|
21130
|
+
/**
|
|
21131
|
+
* Process a batch of features from the feature queue.
|
|
21132
|
+
*/
|
|
21133
|
+
processFeatureQueueBatch() {
|
|
21134
|
+
if (!this.featureQueue.length) {
|
|
21135
|
+
return;
|
|
21136
|
+
}
|
|
21137
|
+
const BATCH_SIZE = 5000;
|
|
21138
|
+
const batch = this.featureQueue.splice(0, BATCH_SIZE);
|
|
21139
|
+
const regosToStyle = new Map();
|
|
21140
|
+
const featuresToRemove = [];
|
|
21141
|
+
for (const feature of batch) {
|
|
21142
|
+
const load = this.featureQueueStates.get(feature);
|
|
21143
|
+
this.featureQueueStates.delete(feature);
|
|
21144
|
+
if (!load) {
|
|
21145
|
+
featuresToRemove.push(feature);
|
|
21146
|
+
continue;
|
|
21147
|
+
}
|
|
21148
|
+
const result = this.mapTilesetFeature(feature);
|
|
21149
|
+
if (result === null) {
|
|
21150
|
+
// Override the default hide state set by the style.
|
|
21151
|
+
feature.show = true;
|
|
21152
|
+
continue;
|
|
21153
|
+
}
|
|
21154
|
+
else if (result) {
|
|
21155
|
+
regosToStyle.set(result.entityId, result);
|
|
21156
|
+
}
|
|
21157
|
+
}
|
|
21158
|
+
if (featuresToRemove.length) {
|
|
21159
|
+
const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
|
|
21160
|
+
visuals: featuresToRemove,
|
|
21161
|
+
requestRender: false,
|
|
21162
|
+
menuItemId: this.item.id,
|
|
21163
|
+
doRemove: false
|
|
21164
|
+
});
|
|
21165
|
+
for (const entityId of removedEntityIds) {
|
|
21166
|
+
delete this.loadedCesiumEntities[entityId];
|
|
21167
|
+
}
|
|
21168
|
+
}
|
|
21169
|
+
if (this.styler && regosToStyle.size) {
|
|
21170
|
+
this.styler.QueueEntities(Array.from(regosToStyle.values()));
|
|
21171
|
+
}
|
|
21172
|
+
}
|
|
21173
|
+
evaluateFeatureProps(feature) {
|
|
21174
|
+
var _a;
|
|
21175
|
+
// If we've checked 10 features then we should have a good handle on what props are available.
|
|
21176
|
+
if (this.featurePropsChecked >= 10) {
|
|
21177
|
+
return;
|
|
21178
|
+
}
|
|
21179
|
+
this.featurePropsChecked++;
|
|
21180
|
+
const featureAny = feature;
|
|
21181
|
+
const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
|
|
21182
|
+
if (!props) {
|
|
21183
|
+
return;
|
|
21184
|
+
}
|
|
21185
|
+
for (const prop of props) {
|
|
21186
|
+
if (!prop) {
|
|
21187
|
+
continue;
|
|
21188
|
+
}
|
|
21189
|
+
const lowered = prop.toLowerCase();
|
|
21190
|
+
if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
|
|
21191
|
+
this.featurePropCache.set("entityId", prop);
|
|
21192
|
+
}
|
|
21193
|
+
else if (lowered === "brucepath") {
|
|
21194
|
+
this.featurePropCache.set("BrucePath", prop);
|
|
21195
|
+
}
|
|
21196
|
+
else if (lowered === "building_id" || lowered === "buildingid") {
|
|
21197
|
+
this.featurePropCache.set("BuildingID", prop);
|
|
21198
|
+
}
|
|
21199
|
+
}
|
|
21200
|
+
}
|
|
20862
21201
|
onCTilesetLoad() {
|
|
20863
21202
|
if (this.item.FlyTo) {
|
|
20864
21203
|
this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
|
|
@@ -20873,6 +21212,11 @@ var TilesetArbRenderManager;
|
|
|
20873
21212
|
}
|
|
20874
21213
|
doDispose() {
|
|
20875
21214
|
var _a, _b;
|
|
21215
|
+
if (this.featureQueueInterval) {
|
|
21216
|
+
clearInterval(this.featureQueueInterval);
|
|
21217
|
+
this.featureQueueInterval = null;
|
|
21218
|
+
this.featureQueue = [];
|
|
21219
|
+
}
|
|
20876
21220
|
if (this.cTileset) {
|
|
20877
21221
|
const viewer = this.viewer;
|
|
20878
21222
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
|
|
@@ -20889,7 +21233,10 @@ var TilesetArbRenderManager;
|
|
|
20889
21233
|
});
|
|
20890
21234
|
}
|
|
20891
21235
|
async ReRender(params) {
|
|
20892
|
-
|
|
21236
|
+
let { entityIds, force, entities } = params;
|
|
21237
|
+
if (entities && !entityIds) {
|
|
21238
|
+
entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
21239
|
+
}
|
|
20893
21240
|
if (!this.styler) {
|
|
20894
21241
|
return;
|
|
20895
21242
|
}
|
|
@@ -20899,25 +21246,9 @@ var TilesetArbRenderManager;
|
|
|
20899
21246
|
if (entityIds != null) {
|
|
20900
21247
|
regos = regos.filter(r => entityIds.indexOf(r.entityId) >= 0);
|
|
20901
21248
|
}
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20906
|
-
if (!content) {
|
|
20907
|
-
return;
|
|
20908
|
-
}
|
|
20909
|
-
const regosToQueue = new Map();
|
|
20910
|
-
for (let i = 0; i < content.featuresLength; i++) {
|
|
20911
|
-
const feature = content.getFeature(i);
|
|
20912
|
-
let rego = this.mapTilesetFeature(feature);
|
|
20913
|
-
if (rego === null || rego === void 0 ? void 0 : rego.entityId) {
|
|
20914
|
-
regosToQueue.set(rego.entityId, rego);
|
|
20915
|
-
}
|
|
20916
|
-
}
|
|
20917
|
-
if (this.styler && regosToQueue.size) {
|
|
20918
|
-
this.styler.QueueEntities(Array.from(regosToQueue.values()));
|
|
20919
|
-
}
|
|
20920
|
-
this.viewer.scene.requestRender();
|
|
21249
|
+
// Update the cache so we use that data instead of requesting the records.
|
|
21250
|
+
this.styler.SetEntityCache(entityIds, entities);
|
|
21251
|
+
this.styler.QueueEntities(regos, true);
|
|
20921
21252
|
}
|
|
20922
21253
|
mapTilesetFeature(feature) {
|
|
20923
21254
|
var _a, _b, _c, _d;
|
|
@@ -20935,32 +21266,76 @@ var TilesetArbRenderManager;
|
|
|
20935
21266
|
tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
|
|
20936
21267
|
tilesetType: this.tilesetType
|
|
20937
21268
|
};
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
if (path === null || path === void 0 ? void 0 : path.length) {
|
|
20944
|
-
rego.entityId = path[path.length - 1];
|
|
21269
|
+
this.evaluateFeatureProps(feature);
|
|
21270
|
+
if (!rego.entityId) {
|
|
21271
|
+
const propToUse = this.featurePropCache.get("entityId");
|
|
21272
|
+
if (propToUse) {
|
|
21273
|
+
rego.entityId = feature.getProperty(propToUse);
|
|
20945
21274
|
}
|
|
20946
21275
|
}
|
|
20947
21276
|
if (!rego.entityId) {
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
if (props.indexOf(acceptableId) > -1) {
|
|
20954
|
-
rego.entityId = feature.getProperty(acceptableId);
|
|
20955
|
-
if (rego.entityId) {
|
|
20956
|
-
break;
|
|
20957
|
-
}
|
|
21277
|
+
const propToUse = this.featurePropCache.get("BrucePath");
|
|
21278
|
+
if (propToUse) {
|
|
21279
|
+
const path = (_d = feature.getProperty(propToUse)) === null || _d === void 0 ? void 0 : _d.split("|");
|
|
21280
|
+
if (path === null || path === void 0 ? void 0 : path.length) {
|
|
21281
|
+
rego.entityId = path[path.length - 1];
|
|
20958
21282
|
}
|
|
20959
21283
|
}
|
|
20960
21284
|
}
|
|
21285
|
+
if (!rego.entityId) {
|
|
21286
|
+
const propToUse = this.featurePropCache.get("BuildingID");
|
|
21287
|
+
if (propToUse) {
|
|
21288
|
+
rego.entityId = feature.getProperty(propToUse);
|
|
21289
|
+
}
|
|
21290
|
+
}
|
|
20961
21291
|
if (!rego.entityId) {
|
|
20962
21292
|
return null;
|
|
20963
21293
|
}
|
|
21294
|
+
// Get the initial hide/show state.
|
|
21295
|
+
const state = this.visualsManager.GetState({
|
|
21296
|
+
entityId: rego.entityId,
|
|
21297
|
+
menuItemId: this.item.id,
|
|
21298
|
+
});
|
|
21299
|
+
if (this.somethingIsolated == null ||
|
|
21300
|
+
// 5s cache.
|
|
21301
|
+
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
21302
|
+
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
21303
|
+
this.somethingIsolatedDateTime = new Date();
|
|
21304
|
+
}
|
|
21305
|
+
// Override the default hide state set by the style.
|
|
21306
|
+
let hide = false;
|
|
21307
|
+
if (state) {
|
|
21308
|
+
if (state.hidden) {
|
|
21309
|
+
hide = true;
|
|
21310
|
+
}
|
|
21311
|
+
else if (state.opacity === 0) {
|
|
21312
|
+
hide = true;
|
|
21313
|
+
}
|
|
21314
|
+
else if (!state.isolated && this.somethingIsolated) {
|
|
21315
|
+
hide = true;
|
|
21316
|
+
}
|
|
21317
|
+
}
|
|
21318
|
+
feature.show = !hide;
|
|
21319
|
+
// Already exists, so we add this graphic as a sibling.
|
|
21320
|
+
if (this.loadedCesiumEntities[rego.entityId]) {
|
|
21321
|
+
rego = this.loadedCesiumEntities[rego.entityId];
|
|
21322
|
+
if (!rego.visual) {
|
|
21323
|
+
// No parent graphic.
|
|
21324
|
+
rego.visual = feature;
|
|
21325
|
+
}
|
|
21326
|
+
else if (rego.visual == feature) ;
|
|
21327
|
+
else {
|
|
21328
|
+
const visual = rego.visual;
|
|
21329
|
+
// Sibling graphic.
|
|
21330
|
+
if (!visual._siblingGraphics) {
|
|
21331
|
+
visual._siblingGraphics = [];
|
|
21332
|
+
}
|
|
21333
|
+
if (visual._siblingGraphics.indexOf(feature) < 0) {
|
|
21334
|
+
visual._siblingGraphics.push(feature);
|
|
21335
|
+
}
|
|
21336
|
+
}
|
|
21337
|
+
}
|
|
21338
|
+
this.loadedCesiumEntities[rego.entityId] = rego;
|
|
20964
21339
|
this.visualsManager.AddRego({
|
|
20965
21340
|
rego,
|
|
20966
21341
|
requestRender: false
|
|
@@ -32831,6 +33206,9 @@ const colors = {};
|
|
|
32831
33206
|
const names = {};
|
|
32832
33207
|
const entities = {};
|
|
32833
33208
|
const viewers = {};
|
|
33209
|
+
// Global shift to move cursor + label down in pixels
|
|
33210
|
+
const CURSOR_SHIFT_Y = 22;
|
|
33211
|
+
const CURSOR_SHIFT_X = 10;
|
|
32834
33212
|
function createDOMLabel(viewer, id, name, colorCss) {
|
|
32835
33213
|
var _a;
|
|
32836
33214
|
const label = document.createElement("div");
|
|
@@ -32885,8 +33263,8 @@ function updateDOMLabel(viewer, label, pos3d) {
|
|
|
32885
33263
|
// Keep full opacity; no distance-based fading
|
|
32886
33264
|
// Keep the label close to the cursor regardless of zoom
|
|
32887
33265
|
// Use small, constant pixel offsets to bottom-right
|
|
32888
|
-
const offsetX =
|
|
32889
|
-
const offsetY =
|
|
33266
|
+
const offsetX = 6 + CURSOR_SHIFT_X; // px
|
|
33267
|
+
const offsetY = 4 + CURSOR_SHIFT_Y; // px (shift label further down)
|
|
32890
33268
|
let leftPx = screenPos.x + offsetX;
|
|
32891
33269
|
let topPx = screenPos.y + offsetY;
|
|
32892
33270
|
const pad = 8;
|
|
@@ -32937,7 +33315,9 @@ var LiveCursor;
|
|
|
32937
33315
|
distanceDisplayCondition: new DistanceDisplayCondition(0, 30000),
|
|
32938
33316
|
scaleByDistance: new NearFarScalar(100, 1.5, 10000, 0.8),
|
|
32939
33317
|
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
32940
|
-
horizontalOrigin: HorizontalOrigin.CENTER
|
|
33318
|
+
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
33319
|
+
// Shift billboard down; Cesium's +Y is up so use negative
|
|
33320
|
+
pixelOffset: new Cartesian2(CURSOR_SHIFT_X, CURSOR_SHIFT_Y)
|
|
32941
33321
|
} : undefined,
|
|
32942
33322
|
ellipse: showEllipse ? {
|
|
32943
33323
|
semiMajorAxis: 50.0,
|
|
@@ -32975,6 +33355,10 @@ var LiveCursor;
|
|
|
32975
33355
|
viewer: viewer
|
|
32976
33356
|
});
|
|
32977
33357
|
entity.position = new CallbackProperty(() => animated.GetValue(), false);
|
|
33358
|
+
// Ensure existing billboard is shifted consistently
|
|
33359
|
+
if (entity.billboard) {
|
|
33360
|
+
entity.billboard.pixelOffset = new Cartesian2(CURSOR_SHIFT_X, CURSOR_SHIFT_Y);
|
|
33361
|
+
}
|
|
32978
33362
|
}
|
|
32979
33363
|
if (!updaters[id]) {
|
|
32980
33364
|
const remover = viewer.scene.postUpdate.addEventListener(() => {
|
|
@@ -33002,6 +33386,14 @@ var LiveCursor;
|
|
|
33002
33386
|
}
|
|
33003
33387
|
LiveCursor.Upsert = Upsert;
|
|
33004
33388
|
function Remove(id) {
|
|
33389
|
+
// Also remove any camera visuals tracked for this cursor
|
|
33390
|
+
const viewer = viewers[id];
|
|
33391
|
+
if (viewer) {
|
|
33392
|
+
try {
|
|
33393
|
+
RemoveCameraVisuals(viewer, id);
|
|
33394
|
+
}
|
|
33395
|
+
catch { }
|
|
33396
|
+
}
|
|
33005
33397
|
const label = labels[id];
|
|
33006
33398
|
if (label && label.parentElement) {
|
|
33007
33399
|
label.parentElement.removeChild(label);
|
|
@@ -33019,7 +33411,6 @@ var LiveCursor;
|
|
|
33019
33411
|
}
|
|
33020
33412
|
// Remove entity if present
|
|
33021
33413
|
const entity = entities[id];
|
|
33022
|
-
const viewer = viewers[id];
|
|
33023
33414
|
if (entity && viewer && viewer.entities.contains(entity)) {
|
|
33024
33415
|
viewer.entities.remove(entity);
|
|
33025
33416
|
}
|
|
@@ -33027,6 +33418,136 @@ var LiveCursor;
|
|
|
33027
33418
|
delete viewers[id];
|
|
33028
33419
|
}
|
|
33029
33420
|
LiveCursor.Remove = Remove;
|
|
33421
|
+
const cameraVisuals = {};
|
|
33422
|
+
const cameraUpdateBuffer = {};
|
|
33423
|
+
const CAMERA_UPDATE_INTERVAL = 500; // ms
|
|
33424
|
+
const CAMERA_BUFFER_TIMEOUT = 1000; // ms
|
|
33425
|
+
function UpsertCameraVisuals(params) {
|
|
33426
|
+
if (params.throttled) {
|
|
33427
|
+
return throttledUpsertCameraVisuals(params);
|
|
33428
|
+
}
|
|
33429
|
+
return internalUpsertCameraVisuals(params);
|
|
33430
|
+
}
|
|
33431
|
+
LiveCursor.UpsertCameraVisuals = UpsertCameraVisuals;
|
|
33432
|
+
function throttledUpsertCameraVisuals(params) {
|
|
33433
|
+
var _a, _b;
|
|
33434
|
+
const { viewer, id, camera, color } = params;
|
|
33435
|
+
const now = Date.now();
|
|
33436
|
+
cameraUpdateBuffer[id] = {
|
|
33437
|
+
camera: { ...camera },
|
|
33438
|
+
color,
|
|
33439
|
+
lastBufferTime: now
|
|
33440
|
+
};
|
|
33441
|
+
const existing = cameraVisuals[id];
|
|
33442
|
+
if (!(existing === null || existing === void 0 ? void 0 : existing.cone) || (now - ((_a = existing.lastUpdate) !== null && _a !== void 0 ? _a : 0)) >= CAMERA_UPDATE_INTERVAL) {
|
|
33443
|
+
internalUpsertCameraVisuals(params);
|
|
33444
|
+
return;
|
|
33445
|
+
}
|
|
33446
|
+
setTimeout(() => {
|
|
33447
|
+
const buffered = cameraUpdateBuffer[id];
|
|
33448
|
+
if (buffered && (now - buffered.lastBufferTime) < CAMERA_BUFFER_TIMEOUT) {
|
|
33449
|
+
internalUpsertCameraVisuals({
|
|
33450
|
+
viewer,
|
|
33451
|
+
id,
|
|
33452
|
+
camera: buffered.camera,
|
|
33453
|
+
color: buffered.color
|
|
33454
|
+
});
|
|
33455
|
+
}
|
|
33456
|
+
}, Math.max(0, CAMERA_UPDATE_INTERVAL - (now - ((_b = existing.lastUpdate) !== null && _b !== void 0 ? _b : 0))));
|
|
33457
|
+
}
|
|
33458
|
+
function internalUpsertCameraVisuals(params) {
|
|
33459
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33460
|
+
const { viewer, id, camera, color } = params;
|
|
33461
|
+
if (!viewer || viewer.isDestroyed() || !(camera === null || camera === void 0 ? void 0 : camera.pos)) {
|
|
33462
|
+
return;
|
|
33463
|
+
}
|
|
33464
|
+
const camPos = new Cartesian3(camera.pos.x, camera.pos.y, camera.pos.z);
|
|
33465
|
+
// Adjust heading by -90 degrees to correct coordinate system mismatch
|
|
33466
|
+
const adjustedHeading = ((_a = camera.headingDeg) !== null && _a !== void 0 ? _a : 0) - 90;
|
|
33467
|
+
const headingRad = Math$1.toRadians(adjustedHeading);
|
|
33468
|
+
const pitchRad = Math$1.toRadians((_b = camera.pitchDeg) !== null && _b !== void 0 ? _b : 0);
|
|
33469
|
+
const rollRad = Math$1.toRadians((_c = camera.rollDeg) !== null && _c !== void 0 ? _c : 0);
|
|
33470
|
+
const hpr = new HeadingPitchRoll(headingRad, pitchRad, rollRad);
|
|
33471
|
+
const baseOrientation = Transforms.headingPitchRollQuaternion(camPos, hpr);
|
|
33472
|
+
// Cylinder axis is local +Z, but HPR 'forward' is along +X. Tilt so Z -> X.
|
|
33473
|
+
const tilt = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, Math$1.toRadians(-90));
|
|
33474
|
+
const orientation = Quaternion.multiply(baseOrientation, tilt, new Quaternion());
|
|
33475
|
+
const vFovDeg = Math.max(1, Math.min(170, (_d = camera.fovDeg) !== null && _d !== void 0 ? _d : 60));
|
|
33476
|
+
const aspect = (viewer.canvas && viewer.canvas.clientHeight > 0)
|
|
33477
|
+
? (viewer.canvas.clientWidth / viewer.canvas.clientHeight)
|
|
33478
|
+
: 16 / 9;
|
|
33479
|
+
const hFovDeg = Math$1.toDegrees(2 * Math.atan(Math.tan(Math$1.toRadians(vFovDeg) / 2) * aspect));
|
|
33480
|
+
const length = Math.max(10, (_e = camera.rangeMeters) !== null && _e !== void 0 ? _e : 200);
|
|
33481
|
+
// Use horizontal FOV to approximate viewing cone width
|
|
33482
|
+
const bottomRadius = Math.tan(Math$1.toRadians(hFovDeg / 2)) * length;
|
|
33483
|
+
// Offset position so cone extends forward from camera
|
|
33484
|
+
const rotation = Matrix3.fromQuaternion(orientation);
|
|
33485
|
+
const forward = Matrix3.multiplyByVector(rotation, Cartesian3.UNIT_Z, new Cartesian3());
|
|
33486
|
+
const offset = Cartesian3.multiplyByScalar(forward, length / 2, new Cartesian3());
|
|
33487
|
+
const conePos = Cartesian3.add(camPos, offset, new Cartesian3());
|
|
33488
|
+
const coneId = `user-camera-cone-${id}`;
|
|
33489
|
+
const now = Date.now();
|
|
33490
|
+
const existing = (_f = cameraVisuals[id]) !== null && _f !== void 0 ? _f : {};
|
|
33491
|
+
// Upsert cone entity
|
|
33492
|
+
if (!existing.cone) {
|
|
33493
|
+
const cone = viewer.entities.add({
|
|
33494
|
+
id: coneId,
|
|
33495
|
+
position: conePos,
|
|
33496
|
+
orientation: orientation,
|
|
33497
|
+
cylinder: {
|
|
33498
|
+
length,
|
|
33499
|
+
topRadius: 0,
|
|
33500
|
+
bottomRadius,
|
|
33501
|
+
material: color.withAlpha(0.25),
|
|
33502
|
+
outline: true,
|
|
33503
|
+
outlineColor: color.withAlpha(0.8),
|
|
33504
|
+
numberOfVerticalLines: 0,
|
|
33505
|
+
slices: 64,
|
|
33506
|
+
distanceDisplayCondition: new DistanceDisplayCondition(0, 50000)
|
|
33507
|
+
}
|
|
33508
|
+
});
|
|
33509
|
+
existing.cone = cone;
|
|
33510
|
+
existing.lastUpdate = now;
|
|
33511
|
+
}
|
|
33512
|
+
else {
|
|
33513
|
+
const needsUpdate = (!Cartesian3.equals(((_g = existing.cone.position) === null || _g === void 0 ? void 0 : _g.getValue(JulianDate.now())) || new Cartesian3(), conePos) ||
|
|
33514
|
+
!Quaternion.equals(((_h = existing.cone.orientation) === null || _h === void 0 ? void 0 : _h.getValue(JulianDate.now())) || new Quaternion(), orientation));
|
|
33515
|
+
if (needsUpdate) {
|
|
33516
|
+
viewer.entities.suspendEvents();
|
|
33517
|
+
try {
|
|
33518
|
+
existing.cone.position = conePos;
|
|
33519
|
+
existing.cone.orientation = orientation;
|
|
33520
|
+
const cylinder = existing.cone.cylinder;
|
|
33521
|
+
if (cylinder) {
|
|
33522
|
+
cylinder.length = length;
|
|
33523
|
+
cylinder.bottomRadius = bottomRadius;
|
|
33524
|
+
cylinder.material = color.withAlpha(0.25);
|
|
33525
|
+
cylinder.outlineColor = color.withAlpha(0.8);
|
|
33526
|
+
}
|
|
33527
|
+
}
|
|
33528
|
+
finally {
|
|
33529
|
+
viewer.entities.resumeEvents();
|
|
33530
|
+
}
|
|
33531
|
+
}
|
|
33532
|
+
existing.lastUpdate = now;
|
|
33533
|
+
}
|
|
33534
|
+
cameraVisuals[id] = existing;
|
|
33535
|
+
}
|
|
33536
|
+
function RemoveCameraVisuals(viewer, id) {
|
|
33537
|
+
const existing = cameraVisuals[id];
|
|
33538
|
+
if (!existing) {
|
|
33539
|
+
return;
|
|
33540
|
+
}
|
|
33541
|
+
if (existing.cone) {
|
|
33542
|
+
try {
|
|
33543
|
+
viewer.entities.remove(existing.cone);
|
|
33544
|
+
}
|
|
33545
|
+
catch { }
|
|
33546
|
+
}
|
|
33547
|
+
delete cameraVisuals[id];
|
|
33548
|
+
delete cameraUpdateBuffer[id];
|
|
33549
|
+
}
|
|
33550
|
+
LiveCursor.RemoveCameraVisuals = RemoveCameraVisuals;
|
|
33030
33551
|
})(LiveCursor || (LiveCursor = {}));
|
|
33031
33552
|
|
|
33032
33553
|
var WidgetControlViewBar;
|
|
@@ -33801,7 +34322,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
33801
34322
|
}
|
|
33802
34323
|
}
|
|
33803
34324
|
|
|
33804
|
-
const VERSION = "6.1
|
|
34325
|
+
const VERSION = "6.2.1";
|
|
33805
34326
|
|
|
33806
34327
|
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, LiveCursor, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
33807
34328
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|