bruce-cesium 6.1.7 → 6.2.0
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 +653 -115
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +652 -114
- 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-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/tileset-styler.js +37 -3
- package/dist/lib/rendering/tileset-styler.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-entities-render-manager.d.ts +25 -1
- package/dist/types/rendering/tileset-styler.d.ts +1 -0
- 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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, PolygonHierarchy, ShadowMode, PolylineGraphics, ArcType, CornerType, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, 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
|
}
|
|
@@ -16305,6 +16320,7 @@ class TilesetStyler {
|
|
|
16305
16320
|
// Once the style is loaded, we can queue the set for styling.
|
|
16306
16321
|
this.stylePendingEntityIds = new Map();
|
|
16307
16322
|
this.fallbackStyle = null;
|
|
16323
|
+
this.styleFallbackLoaded = false;
|
|
16308
16324
|
this.loadingCounter = 0;
|
|
16309
16325
|
// Entity IDs -> boolean to indicate if we should override the feature colour.
|
|
16310
16326
|
this.overrideFeatureColor = new Map();
|
|
@@ -16542,6 +16558,7 @@ class TilesetStyler {
|
|
|
16542
16558
|
var _a, _b;
|
|
16543
16559
|
const counter = ++this.loadingCounter;
|
|
16544
16560
|
this.styleMappingLoaded = false;
|
|
16561
|
+
this.styleFallbackLoaded = false;
|
|
16545
16562
|
this.styleMappingsLoaded.clear();
|
|
16546
16563
|
// Apply state changes.
|
|
16547
16564
|
this.entityGatherer.Empty();
|
|
@@ -16553,7 +16570,11 @@ class TilesetStyler {
|
|
|
16553
16570
|
api: this.api,
|
|
16554
16571
|
styleId: fallbackStyleId
|
|
16555
16572
|
});
|
|
16573
|
+
if (this.loadingCounter != counter) {
|
|
16574
|
+
return;
|
|
16575
|
+
}
|
|
16556
16576
|
this.fallbackStyle = data;
|
|
16577
|
+
this.styleFallbackLoaded = true;
|
|
16557
16578
|
}
|
|
16558
16579
|
catch (e) {
|
|
16559
16580
|
console.error(e);
|
|
@@ -16661,7 +16682,17 @@ class TilesetStyler {
|
|
|
16661
16682
|
// then we can pass them to the gatherer now.
|
|
16662
16683
|
const relatedIds = this.stylePendingEntityIds.get(styleMap.EntityTypeID);
|
|
16663
16684
|
if (relatedIds) {
|
|
16664
|
-
this.
|
|
16685
|
+
if (this.getTilesetFeatureNeedsFullData(styleMap.EntityTypeID)) {
|
|
16686
|
+
this.entityGatherer.Queue(Array.from(relatedIds));
|
|
16687
|
+
}
|
|
16688
|
+
else {
|
|
16689
|
+
relatedIds.forEach(id => {
|
|
16690
|
+
const rego = this.getEntityRego(id);
|
|
16691
|
+
if (rego) {
|
|
16692
|
+
this.styleTilesetFeature(rego);
|
|
16693
|
+
}
|
|
16694
|
+
});
|
|
16695
|
+
}
|
|
16665
16696
|
this.stylePendingEntityIds.delete(styleMap.EntityTypeID);
|
|
16666
16697
|
}
|
|
16667
16698
|
}
|
|
@@ -16677,9 +16708,19 @@ class TilesetStyler {
|
|
|
16677
16708
|
// Queue all Entities that are pending styling.
|
|
16678
16709
|
const pendingKeys = this.stylePendingEntityIds.keys();
|
|
16679
16710
|
for (const key of pendingKeys) {
|
|
16680
|
-
const relatedIds = this.stylePendingEntityIds
|
|
16711
|
+
const relatedIds = this.stylePendingEntityIds.get(key);
|
|
16681
16712
|
if (relatedIds) {
|
|
16682
|
-
this.
|
|
16713
|
+
if (this.getTilesetFeatureNeedsFullData(key)) {
|
|
16714
|
+
this.entityGatherer.Queue(Array.from(relatedIds));
|
|
16715
|
+
}
|
|
16716
|
+
else {
|
|
16717
|
+
relatedIds.forEach(id => {
|
|
16718
|
+
const rego = this.getEntityRego(id);
|
|
16719
|
+
if (rego) {
|
|
16720
|
+
this.styleTilesetFeature(rego);
|
|
16721
|
+
}
|
|
16722
|
+
});
|
|
16723
|
+
}
|
|
16683
16724
|
}
|
|
16684
16725
|
}
|
|
16685
16726
|
this.stylePendingEntityIds.clear();
|
|
@@ -16725,6 +16766,14 @@ class TilesetStyler {
|
|
|
16725
16766
|
this.styleTilesetFeature(rego);
|
|
16726
16767
|
}
|
|
16727
16768
|
}
|
|
16769
|
+
else if (!this.styleMappingsLoaded.has(typeId) && this.styleFallbackLoaded) {
|
|
16770
|
+
if (this.getTilesetFeatureNeedsFullData(typeId)) {
|
|
16771
|
+
needsDataIds.push(rego.entityId);
|
|
16772
|
+
}
|
|
16773
|
+
else {
|
|
16774
|
+
this.styleTilesetFeature(rego);
|
|
16775
|
+
}
|
|
16776
|
+
}
|
|
16728
16777
|
else {
|
|
16729
16778
|
if (!this.stylePendingEntityIds.has(typeId)) {
|
|
16730
16779
|
this.stylePendingEntityIds.set(typeId, new Set());
|
|
@@ -20123,6 +20172,24 @@ var TilesetEntitiesRenderManager;
|
|
|
20123
20172
|
this.disposed = false;
|
|
20124
20173
|
this.cTileset = null;
|
|
20125
20174
|
this.styler = new TilesetRenderEngine.Styler();
|
|
20175
|
+
// Entity ID -> rego.
|
|
20176
|
+
// We retain this information as a quick look-up on what has been registered.
|
|
20177
|
+
// This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
|
|
20178
|
+
this.loadedCesiumEntities = {};
|
|
20179
|
+
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
20180
|
+
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
20181
|
+
this.somethingIsolated = null;
|
|
20182
|
+
this.somethingIsolatedDateTime = null;
|
|
20183
|
+
// Queue of loaded in features that we haven't processed yet.
|
|
20184
|
+
this.featureQueue = [];
|
|
20185
|
+
// State is true for 'add' or 'false' for 'remove'.
|
|
20186
|
+
this.featureQueueStates = new Map();
|
|
20187
|
+
this.featureQueueInterval = null;
|
|
20188
|
+
// Cache of feature properties we wanted to find vs what we found.
|
|
20189
|
+
// Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
|
|
20190
|
+
// Saves having to do a case-insensitive lookup every time.
|
|
20191
|
+
this.featurePropCache = new Map();
|
|
20192
|
+
this.featurePropsChecked = 0;
|
|
20126
20193
|
const { viewer, register: visualsManager, getters: apiGetter, item } = params;
|
|
20127
20194
|
this.viewer = viewer;
|
|
20128
20195
|
this.getters = apiGetter;
|
|
@@ -20249,7 +20316,20 @@ var TilesetEntitiesRenderManager;
|
|
|
20249
20316
|
}
|
|
20250
20317
|
});
|
|
20251
20318
|
cTileset.tileLoad.addEventListener((tile) => {
|
|
20252
|
-
|
|
20319
|
+
try {
|
|
20320
|
+
this.queueTile(tile, true);
|
|
20321
|
+
}
|
|
20322
|
+
catch (e) {
|
|
20323
|
+
console.error(e);
|
|
20324
|
+
}
|
|
20325
|
+
});
|
|
20326
|
+
cTileset.tileUnload.addEventListener((tile) => {
|
|
20327
|
+
try {
|
|
20328
|
+
this.queueTile(tile, false);
|
|
20329
|
+
}
|
|
20330
|
+
catch (e) {
|
|
20331
|
+
console.error(e);
|
|
20332
|
+
}
|
|
20253
20333
|
});
|
|
20254
20334
|
}
|
|
20255
20335
|
// Scaling points by default otherwise they're 1px in size.
|
|
@@ -20272,6 +20352,118 @@ var TilesetEntitiesRenderManager;
|
|
|
20272
20352
|
});
|
|
20273
20353
|
})();
|
|
20274
20354
|
}
|
|
20355
|
+
/**
|
|
20356
|
+
* @param tile
|
|
20357
|
+
* @param load indicates if we are loading or unloading the tile.
|
|
20358
|
+
* @returns
|
|
20359
|
+
*/
|
|
20360
|
+
queueTile(tile, load) {
|
|
20361
|
+
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20362
|
+
if (!content) {
|
|
20363
|
+
return;
|
|
20364
|
+
}
|
|
20365
|
+
for (let i = 0; i < content.featuresLength; i++) {
|
|
20366
|
+
const feature = content.getFeature(i);
|
|
20367
|
+
if (!this.featureQueue.includes(feature)) {
|
|
20368
|
+
this.featureQueue.push(feature);
|
|
20369
|
+
}
|
|
20370
|
+
this.featureQueueStates.set(feature, load);
|
|
20371
|
+
}
|
|
20372
|
+
this.pingFeatureQueue();
|
|
20373
|
+
}
|
|
20374
|
+
/**
|
|
20375
|
+
* Pings the feature queue to process any queued features.
|
|
20376
|
+
* Does nothing if we're already processing.
|
|
20377
|
+
* @returns
|
|
20378
|
+
*/
|
|
20379
|
+
pingFeatureQueue() {
|
|
20380
|
+
if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
|
|
20381
|
+
return;
|
|
20382
|
+
}
|
|
20383
|
+
this.featureQueueInterval = setInterval(() => {
|
|
20384
|
+
if (this.disposed) {
|
|
20385
|
+
clearInterval(this.featureQueueInterval);
|
|
20386
|
+
this.featureQueueInterval = null;
|
|
20387
|
+
return;
|
|
20388
|
+
}
|
|
20389
|
+
this.processFeatureQueueBatch();
|
|
20390
|
+
if (!this.featureQueue) {
|
|
20391
|
+
clearInterval(this.featureQueueInterval);
|
|
20392
|
+
this.featureQueueInterval = null;
|
|
20393
|
+
}
|
|
20394
|
+
}, 10);
|
|
20395
|
+
}
|
|
20396
|
+
/**
|
|
20397
|
+
* Process a batch of features from the feature queue.
|
|
20398
|
+
*/
|
|
20399
|
+
processFeatureQueueBatch() {
|
|
20400
|
+
if (!this.featureQueue.length) {
|
|
20401
|
+
return;
|
|
20402
|
+
}
|
|
20403
|
+
const BATCH_SIZE = 5000;
|
|
20404
|
+
const batch = this.featureQueue.splice(0, BATCH_SIZE);
|
|
20405
|
+
const regosToStyle = new Map();
|
|
20406
|
+
const featuresToRemove = [];
|
|
20407
|
+
for (const feature of batch) {
|
|
20408
|
+
const load = this.featureQueueStates.get(feature);
|
|
20409
|
+
this.featureQueueStates.delete(feature);
|
|
20410
|
+
if (!load) {
|
|
20411
|
+
featuresToRemove.push(feature);
|
|
20412
|
+
continue;
|
|
20413
|
+
}
|
|
20414
|
+
const result = this.mapTilesetFeature(feature);
|
|
20415
|
+
if (result === null) {
|
|
20416
|
+
// Override the default hide state set by the style.
|
|
20417
|
+
feature.show = true;
|
|
20418
|
+
continue;
|
|
20419
|
+
}
|
|
20420
|
+
else if (result) {
|
|
20421
|
+
regosToStyle.set(result.entityId, result);
|
|
20422
|
+
}
|
|
20423
|
+
}
|
|
20424
|
+
if (featuresToRemove.length) {
|
|
20425
|
+
const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
|
|
20426
|
+
visuals: featuresToRemove,
|
|
20427
|
+
requestRender: false,
|
|
20428
|
+
menuItemId: this.item.id,
|
|
20429
|
+
doRemove: false
|
|
20430
|
+
});
|
|
20431
|
+
for (const entityId of removedEntityIds) {
|
|
20432
|
+
delete this.loadedCesiumEntities[entityId];
|
|
20433
|
+
}
|
|
20434
|
+
}
|
|
20435
|
+
if (this.styler && regosToStyle.size) {
|
|
20436
|
+
this.styler.QueueEntities(Array.from(regosToStyle.values()));
|
|
20437
|
+
}
|
|
20438
|
+
}
|
|
20439
|
+
evaluateFeatureProps(feature) {
|
|
20440
|
+
var _a;
|
|
20441
|
+
// If we've checked 10 features then we should have a good handle on what props are available.
|
|
20442
|
+
if (this.featurePropsChecked >= 10) {
|
|
20443
|
+
return;
|
|
20444
|
+
}
|
|
20445
|
+
this.featurePropsChecked++;
|
|
20446
|
+
const featureAny = feature;
|
|
20447
|
+
const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
|
|
20448
|
+
if (!props) {
|
|
20449
|
+
return;
|
|
20450
|
+
}
|
|
20451
|
+
for (const prop of props) {
|
|
20452
|
+
if (!prop) {
|
|
20453
|
+
continue;
|
|
20454
|
+
}
|
|
20455
|
+
const lowered = prop.toLowerCase();
|
|
20456
|
+
if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
|
|
20457
|
+
this.featurePropCache.set("entityId", prop);
|
|
20458
|
+
}
|
|
20459
|
+
else if (lowered === "brucepath") {
|
|
20460
|
+
this.featurePropCache.set("BrucePath", prop);
|
|
20461
|
+
}
|
|
20462
|
+
else if (lowered === "building_id" || lowered === "buildingid") {
|
|
20463
|
+
this.featurePropCache.set("BuildingID", prop);
|
|
20464
|
+
}
|
|
20465
|
+
}
|
|
20466
|
+
}
|
|
20275
20467
|
Dispose() {
|
|
20276
20468
|
if (this.disposed) {
|
|
20277
20469
|
return;
|
|
@@ -20281,6 +20473,11 @@ var TilesetEntitiesRenderManager;
|
|
|
20281
20473
|
}
|
|
20282
20474
|
doDispose() {
|
|
20283
20475
|
var _a, _b;
|
|
20476
|
+
if (this.featureQueueInterval) {
|
|
20477
|
+
clearInterval(this.featureQueueInterval);
|
|
20478
|
+
this.featureQueueInterval = null;
|
|
20479
|
+
this.featureQueue = [];
|
|
20480
|
+
}
|
|
20284
20481
|
if (this.cTileset) {
|
|
20285
20482
|
const viewer = this.viewer;
|
|
20286
20483
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
|
|
@@ -20301,60 +20498,84 @@ var TilesetEntitiesRenderManager;
|
|
|
20301
20498
|
this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
|
|
20302
20499
|
}
|
|
20303
20500
|
}
|
|
20304
|
-
mapCTile(tile) {
|
|
20305
|
-
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20306
|
-
if (!content) {
|
|
20307
|
-
return;
|
|
20308
|
-
}
|
|
20309
|
-
const regosToQueue = new Map();
|
|
20310
|
-
for (let i = 0; i < content.featuresLength; i++) {
|
|
20311
|
-
const feature = content.getFeature(i);
|
|
20312
|
-
const rego = this.mapTilesetFeature(feature);
|
|
20313
|
-
if (rego === null || rego === void 0 ? void 0 : rego.entityId) {
|
|
20314
|
-
regosToQueue.set(rego.entityId, rego);
|
|
20315
|
-
}
|
|
20316
|
-
}
|
|
20317
|
-
if (this.styler && regosToQueue.size) {
|
|
20318
|
-
this.styler.QueueEntities(Array.from(regosToQueue.values()));
|
|
20319
|
-
}
|
|
20320
|
-
this.viewer.scene.requestRender();
|
|
20321
|
-
}
|
|
20322
20501
|
mapTilesetFeature(feature) {
|
|
20323
20502
|
var _a, _b, _c;
|
|
20324
|
-
|
|
20325
|
-
|
|
20503
|
+
this.evaluateFeatureProps(feature);
|
|
20504
|
+
const propToUse = this.featurePropCache.get("entityId");
|
|
20505
|
+
let id = propToUse ? feature.getProperty(propToUse) : null;
|
|
20506
|
+
if (id && typeof id == "string") {
|
|
20507
|
+
// Perhaps a relic of UTF-16 encoding after we stopped using it?
|
|
20508
|
+
if (id.endsWith("\u0000")) {
|
|
20509
|
+
id = id.substring(0, id.length - 1);
|
|
20510
|
+
}
|
|
20511
|
+
}
|
|
20326
20512
|
if (!id) {
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20333
|
-
|
|
20513
|
+
return null;
|
|
20514
|
+
}
|
|
20515
|
+
const accountId = (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
|
|
20516
|
+
const canEdit = accountId === this.getters.GetAccountId();
|
|
20517
|
+
let rego = {
|
|
20518
|
+
canEdit: canEdit,
|
|
20519
|
+
entityId: id,
|
|
20520
|
+
entityTypeId: this.typeId,
|
|
20521
|
+
menuItemId: this.item.id,
|
|
20522
|
+
menuItemType: this.item.Type,
|
|
20523
|
+
priority: this.renderPriority,
|
|
20524
|
+
visual: feature,
|
|
20525
|
+
tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
|
|
20526
|
+
tilesetType: Tileset.EType.EntitiesSet,
|
|
20527
|
+
accountId: accountId
|
|
20528
|
+
};
|
|
20529
|
+
// Get the initial hide/show state.
|
|
20530
|
+
const state = this.visualsManager.GetState({
|
|
20531
|
+
entityId: rego.entityId,
|
|
20532
|
+
menuItemId: this.item.id,
|
|
20533
|
+
});
|
|
20534
|
+
if (this.somethingIsolated == null ||
|
|
20535
|
+
// 5s cache.
|
|
20536
|
+
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
20537
|
+
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
20538
|
+
this.somethingIsolatedDateTime = new Date();
|
|
20539
|
+
}
|
|
20540
|
+
// Override the default hide state set by the style.
|
|
20541
|
+
let hide = false;
|
|
20542
|
+
if (state) {
|
|
20543
|
+
if (state.hidden) {
|
|
20544
|
+
hide = true;
|
|
20545
|
+
}
|
|
20546
|
+
else if (state.opacity === 0) {
|
|
20547
|
+
hide = true;
|
|
20548
|
+
}
|
|
20549
|
+
else if (!state.isolated && this.somethingIsolated) {
|
|
20550
|
+
hide = true;
|
|
20334
20551
|
}
|
|
20335
20552
|
}
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
visual
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20350
|
-
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
}
|
|
20355
|
-
return rego;
|
|
20553
|
+
feature.show = !hide;
|
|
20554
|
+
// Already exists, so we add this graphic as a sibling.
|
|
20555
|
+
if (this.loadedCesiumEntities[rego.entityId]) {
|
|
20556
|
+
rego = this.loadedCesiumEntities[rego.entityId];
|
|
20557
|
+
if (!rego.visual) {
|
|
20558
|
+
// No parent graphic.
|
|
20559
|
+
rego.visual = feature;
|
|
20560
|
+
}
|
|
20561
|
+
else if (rego.visual == feature) ;
|
|
20562
|
+
else {
|
|
20563
|
+
const visual = rego.visual;
|
|
20564
|
+
// Sibling graphic.
|
|
20565
|
+
if (!visual._siblingGraphics) {
|
|
20566
|
+
visual._siblingGraphics = [];
|
|
20567
|
+
}
|
|
20568
|
+
if (visual._siblingGraphics.indexOf(feature) < 0) {
|
|
20569
|
+
visual._siblingGraphics.push(feature);
|
|
20570
|
+
}
|
|
20571
|
+
}
|
|
20356
20572
|
}
|
|
20357
|
-
|
|
20573
|
+
this.loadedCesiumEntities[rego.entityId] = rego;
|
|
20574
|
+
this.visualsManager.AddRego({
|
|
20575
|
+
rego,
|
|
20576
|
+
requestRender: false
|
|
20577
|
+
});
|
|
20578
|
+
return rego;
|
|
20358
20579
|
}
|
|
20359
20580
|
async ReRender(params) {
|
|
20360
20581
|
let { entityIds, force, entities } = params;
|
|
@@ -20637,6 +20858,24 @@ var TilesetArbRenderManager;
|
|
|
20637
20858
|
this.cTileset = null;
|
|
20638
20859
|
this.styler = new TilesetRenderEngine.Styler();
|
|
20639
20860
|
this.tilesetType = null;
|
|
20861
|
+
// Entity ID -> rego.
|
|
20862
|
+
// We retain this information as a quick look-up on what has been registered.
|
|
20863
|
+
// This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
|
|
20864
|
+
this.loadedCesiumEntities = {};
|
|
20865
|
+
// Cache of 'something isolated' that we detect and use to calculate a default show state.
|
|
20866
|
+
// It's pretty expensive so we save it for a few seconds inbetween checks.
|
|
20867
|
+
this.somethingIsolated = null;
|
|
20868
|
+
this.somethingIsolatedDateTime = null;
|
|
20869
|
+
// Queue of loaded in features that we haven't processed yet.
|
|
20870
|
+
this.featureQueue = [];
|
|
20871
|
+
// State is true for 'add' or 'false' for 'remove'.
|
|
20872
|
+
this.featureQueueStates = new Map();
|
|
20873
|
+
this.featureQueueInterval = null;
|
|
20874
|
+
// Cache of feature properties we wanted to find vs what we found.
|
|
20875
|
+
// Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
|
|
20876
|
+
// Saves having to do a case-insensitive lookup every time.
|
|
20877
|
+
this.featurePropCache = new Map();
|
|
20878
|
+
this.featurePropsChecked = 0;
|
|
20640
20879
|
this.viewer = params.viewer;
|
|
20641
20880
|
this.getters = params.getters;
|
|
20642
20881
|
this.visualsManager = params.register;
|
|
@@ -20813,11 +21052,16 @@ var TilesetArbRenderManager;
|
|
|
20813
21052
|
}
|
|
20814
21053
|
});
|
|
20815
21054
|
this.cTileset.tileLoad.addEventListener((tile) => {
|
|
20816
|
-
|
|
20817
|
-
|
|
21055
|
+
try {
|
|
21056
|
+
this.queueTile(tile, true);
|
|
20818
21057
|
}
|
|
21058
|
+
catch (e) {
|
|
21059
|
+
console.error(e);
|
|
21060
|
+
}
|
|
21061
|
+
});
|
|
21062
|
+
this.cTileset.tileUnload.addEventListener((tile) => {
|
|
20819
21063
|
try {
|
|
20820
|
-
this.
|
|
21064
|
+
this.queueTile(tile, false);
|
|
20821
21065
|
}
|
|
20822
21066
|
catch (e) {
|
|
20823
21067
|
console.error(e);
|
|
@@ -20825,6 +21069,118 @@ var TilesetArbRenderManager;
|
|
|
20825
21069
|
});
|
|
20826
21070
|
})();
|
|
20827
21071
|
}
|
|
21072
|
+
/**
|
|
21073
|
+
* @param tile
|
|
21074
|
+
* @param load indicates if we are loading or unloading the tile.
|
|
21075
|
+
* @returns
|
|
21076
|
+
*/
|
|
21077
|
+
queueTile(tile, load) {
|
|
21078
|
+
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
21079
|
+
if (!content) {
|
|
21080
|
+
return;
|
|
21081
|
+
}
|
|
21082
|
+
for (let i = 0; i < content.featuresLength; i++) {
|
|
21083
|
+
const feature = content.getFeature(i);
|
|
21084
|
+
if (!this.featureQueue.includes(feature)) {
|
|
21085
|
+
this.featureQueue.push(feature);
|
|
21086
|
+
}
|
|
21087
|
+
this.featureQueueStates.set(feature, load);
|
|
21088
|
+
}
|
|
21089
|
+
this.pingFeatureQueue();
|
|
21090
|
+
}
|
|
21091
|
+
/**
|
|
21092
|
+
* Pings the feature queue to process any queued features.
|
|
21093
|
+
* Does nothing if we're already processing.
|
|
21094
|
+
* @returns
|
|
21095
|
+
*/
|
|
21096
|
+
pingFeatureQueue() {
|
|
21097
|
+
if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
|
|
21098
|
+
return;
|
|
21099
|
+
}
|
|
21100
|
+
this.featureQueueInterval = setInterval(() => {
|
|
21101
|
+
if (this.disposed) {
|
|
21102
|
+
clearInterval(this.featureQueueInterval);
|
|
21103
|
+
this.featureQueueInterval = null;
|
|
21104
|
+
return;
|
|
21105
|
+
}
|
|
21106
|
+
this.processFeatureQueueBatch();
|
|
21107
|
+
if (!this.featureQueue) {
|
|
21108
|
+
clearInterval(this.featureQueueInterval);
|
|
21109
|
+
this.featureQueueInterval = null;
|
|
21110
|
+
}
|
|
21111
|
+
}, 10);
|
|
21112
|
+
}
|
|
21113
|
+
/**
|
|
21114
|
+
* Process a batch of features from the feature queue.
|
|
21115
|
+
*/
|
|
21116
|
+
processFeatureQueueBatch() {
|
|
21117
|
+
if (!this.featureQueue.length) {
|
|
21118
|
+
return;
|
|
21119
|
+
}
|
|
21120
|
+
const BATCH_SIZE = 5000;
|
|
21121
|
+
const batch = this.featureQueue.splice(0, BATCH_SIZE);
|
|
21122
|
+
const regosToStyle = new Map();
|
|
21123
|
+
const featuresToRemove = [];
|
|
21124
|
+
for (const feature of batch) {
|
|
21125
|
+
const load = this.featureQueueStates.get(feature);
|
|
21126
|
+
this.featureQueueStates.delete(feature);
|
|
21127
|
+
if (!load) {
|
|
21128
|
+
featuresToRemove.push(feature);
|
|
21129
|
+
continue;
|
|
21130
|
+
}
|
|
21131
|
+
const result = this.mapTilesetFeature(feature);
|
|
21132
|
+
if (result === null) {
|
|
21133
|
+
// Override the default hide state set by the style.
|
|
21134
|
+
feature.show = true;
|
|
21135
|
+
continue;
|
|
21136
|
+
}
|
|
21137
|
+
else if (result) {
|
|
21138
|
+
regosToStyle.set(result.entityId, result);
|
|
21139
|
+
}
|
|
21140
|
+
}
|
|
21141
|
+
if (featuresToRemove.length) {
|
|
21142
|
+
const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
|
|
21143
|
+
visuals: featuresToRemove,
|
|
21144
|
+
requestRender: false,
|
|
21145
|
+
menuItemId: this.item.id,
|
|
21146
|
+
doRemove: false
|
|
21147
|
+
});
|
|
21148
|
+
for (const entityId of removedEntityIds) {
|
|
21149
|
+
delete this.loadedCesiumEntities[entityId];
|
|
21150
|
+
}
|
|
21151
|
+
}
|
|
21152
|
+
if (this.styler && regosToStyle.size) {
|
|
21153
|
+
this.styler.QueueEntities(Array.from(regosToStyle.values()));
|
|
21154
|
+
}
|
|
21155
|
+
}
|
|
21156
|
+
evaluateFeatureProps(feature) {
|
|
21157
|
+
var _a;
|
|
21158
|
+
// If we've checked 10 features then we should have a good handle on what props are available.
|
|
21159
|
+
if (this.featurePropsChecked >= 10) {
|
|
21160
|
+
return;
|
|
21161
|
+
}
|
|
21162
|
+
this.featurePropsChecked++;
|
|
21163
|
+
const featureAny = feature;
|
|
21164
|
+
const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
|
|
21165
|
+
if (!props) {
|
|
21166
|
+
return;
|
|
21167
|
+
}
|
|
21168
|
+
for (const prop of props) {
|
|
21169
|
+
if (!prop) {
|
|
21170
|
+
continue;
|
|
21171
|
+
}
|
|
21172
|
+
const lowered = prop.toLowerCase();
|
|
21173
|
+
if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
|
|
21174
|
+
this.featurePropCache.set("entityId", prop);
|
|
21175
|
+
}
|
|
21176
|
+
else if (lowered === "brucepath") {
|
|
21177
|
+
this.featurePropCache.set("BrucePath", prop);
|
|
21178
|
+
}
|
|
21179
|
+
else if (lowered === "building_id" || lowered === "buildingid") {
|
|
21180
|
+
this.featurePropCache.set("BuildingID", prop);
|
|
21181
|
+
}
|
|
21182
|
+
}
|
|
21183
|
+
}
|
|
20828
21184
|
onCTilesetLoad() {
|
|
20829
21185
|
if (this.item.FlyTo) {
|
|
20830
21186
|
this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
|
|
@@ -20839,6 +21195,11 @@ var TilesetArbRenderManager;
|
|
|
20839
21195
|
}
|
|
20840
21196
|
doDispose() {
|
|
20841
21197
|
var _a, _b;
|
|
21198
|
+
if (this.featureQueueInterval) {
|
|
21199
|
+
clearInterval(this.featureQueueInterval);
|
|
21200
|
+
this.featureQueueInterval = null;
|
|
21201
|
+
this.featureQueue = [];
|
|
21202
|
+
}
|
|
20842
21203
|
if (this.cTileset) {
|
|
20843
21204
|
const viewer = this.viewer;
|
|
20844
21205
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
|
|
@@ -20855,7 +21216,10 @@ var TilesetArbRenderManager;
|
|
|
20855
21216
|
});
|
|
20856
21217
|
}
|
|
20857
21218
|
async ReRender(params) {
|
|
20858
|
-
|
|
21219
|
+
let { entityIds, force, entities } = params;
|
|
21220
|
+
if (entities && !entityIds) {
|
|
21221
|
+
entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
21222
|
+
}
|
|
20859
21223
|
if (!this.styler) {
|
|
20860
21224
|
return;
|
|
20861
21225
|
}
|
|
@@ -20865,25 +21229,9 @@ var TilesetArbRenderManager;
|
|
|
20865
21229
|
if (entityIds != null) {
|
|
20866
21230
|
regos = regos.filter(r => entityIds.indexOf(r.entityId) >= 0);
|
|
20867
21231
|
}
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
const content = tile === null || tile === void 0 ? void 0 : tile.content;
|
|
20872
|
-
if (!content) {
|
|
20873
|
-
return;
|
|
20874
|
-
}
|
|
20875
|
-
const regosToQueue = new Map();
|
|
20876
|
-
for (let i = 0; i < content.featuresLength; i++) {
|
|
20877
|
-
const feature = content.getFeature(i);
|
|
20878
|
-
let rego = this.mapTilesetFeature(feature);
|
|
20879
|
-
if (rego === null || rego === void 0 ? void 0 : rego.entityId) {
|
|
20880
|
-
regosToQueue.set(rego.entityId, rego);
|
|
20881
|
-
}
|
|
20882
|
-
}
|
|
20883
|
-
if (this.styler && regosToQueue.size) {
|
|
20884
|
-
this.styler.QueueEntities(Array.from(regosToQueue.values()));
|
|
20885
|
-
}
|
|
20886
|
-
this.viewer.scene.requestRender();
|
|
21232
|
+
// Update the cache so we use that data instead of requesting the records.
|
|
21233
|
+
this.styler.SetEntityCache(entityIds, entities);
|
|
21234
|
+
this.styler.QueueEntities(regos, true);
|
|
20887
21235
|
}
|
|
20888
21236
|
mapTilesetFeature(feature) {
|
|
20889
21237
|
var _a, _b, _c, _d;
|
|
@@ -20901,32 +21249,76 @@ var TilesetArbRenderManager;
|
|
|
20901
21249
|
tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
|
|
20902
21250
|
tilesetType: this.tilesetType
|
|
20903
21251
|
};
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
if (path === null || path === void 0 ? void 0 : path.length) {
|
|
20910
|
-
rego.entityId = path[path.length - 1];
|
|
21252
|
+
this.evaluateFeatureProps(feature);
|
|
21253
|
+
if (!rego.entityId) {
|
|
21254
|
+
const propToUse = this.featurePropCache.get("entityId");
|
|
21255
|
+
if (propToUse) {
|
|
21256
|
+
rego.entityId = feature.getProperty(propToUse);
|
|
20911
21257
|
}
|
|
20912
21258
|
}
|
|
20913
21259
|
if (!rego.entityId) {
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
if (props.indexOf(acceptableId) > -1) {
|
|
20920
|
-
rego.entityId = feature.getProperty(acceptableId);
|
|
20921
|
-
if (rego.entityId) {
|
|
20922
|
-
break;
|
|
20923
|
-
}
|
|
21260
|
+
const propToUse = this.featurePropCache.get("BrucePath");
|
|
21261
|
+
if (propToUse) {
|
|
21262
|
+
const path = (_d = feature.getProperty(propToUse)) === null || _d === void 0 ? void 0 : _d.split("|");
|
|
21263
|
+
if (path === null || path === void 0 ? void 0 : path.length) {
|
|
21264
|
+
rego.entityId = path[path.length - 1];
|
|
20924
21265
|
}
|
|
20925
21266
|
}
|
|
20926
21267
|
}
|
|
21268
|
+
if (!rego.entityId) {
|
|
21269
|
+
const propToUse = this.featurePropCache.get("BuildingID");
|
|
21270
|
+
if (propToUse) {
|
|
21271
|
+
rego.entityId = feature.getProperty(propToUse);
|
|
21272
|
+
}
|
|
21273
|
+
}
|
|
20927
21274
|
if (!rego.entityId) {
|
|
20928
21275
|
return null;
|
|
20929
21276
|
}
|
|
21277
|
+
// Get the initial hide/show state.
|
|
21278
|
+
const state = this.visualsManager.GetState({
|
|
21279
|
+
entityId: rego.entityId,
|
|
21280
|
+
menuItemId: this.item.id,
|
|
21281
|
+
});
|
|
21282
|
+
if (this.somethingIsolated == null ||
|
|
21283
|
+
// 5s cache.
|
|
21284
|
+
(this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
|
|
21285
|
+
this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
|
|
21286
|
+
this.somethingIsolatedDateTime = new Date();
|
|
21287
|
+
}
|
|
21288
|
+
// Override the default hide state set by the style.
|
|
21289
|
+
let hide = false;
|
|
21290
|
+
if (state) {
|
|
21291
|
+
if (state.hidden) {
|
|
21292
|
+
hide = true;
|
|
21293
|
+
}
|
|
21294
|
+
else if (state.opacity === 0) {
|
|
21295
|
+
hide = true;
|
|
21296
|
+
}
|
|
21297
|
+
else if (!state.isolated && this.somethingIsolated) {
|
|
21298
|
+
hide = true;
|
|
21299
|
+
}
|
|
21300
|
+
}
|
|
21301
|
+
feature.show = !hide;
|
|
21302
|
+
// Already exists, so we add this graphic as a sibling.
|
|
21303
|
+
if (this.loadedCesiumEntities[rego.entityId]) {
|
|
21304
|
+
rego = this.loadedCesiumEntities[rego.entityId];
|
|
21305
|
+
if (!rego.visual) {
|
|
21306
|
+
// No parent graphic.
|
|
21307
|
+
rego.visual = feature;
|
|
21308
|
+
}
|
|
21309
|
+
else if (rego.visual == feature) ;
|
|
21310
|
+
else {
|
|
21311
|
+
const visual = rego.visual;
|
|
21312
|
+
// Sibling graphic.
|
|
21313
|
+
if (!visual._siblingGraphics) {
|
|
21314
|
+
visual._siblingGraphics = [];
|
|
21315
|
+
}
|
|
21316
|
+
if (visual._siblingGraphics.indexOf(feature) < 0) {
|
|
21317
|
+
visual._siblingGraphics.push(feature);
|
|
21318
|
+
}
|
|
21319
|
+
}
|
|
21320
|
+
}
|
|
21321
|
+
this.loadedCesiumEntities[rego.entityId] = rego;
|
|
20930
21322
|
this.visualsManager.AddRego({
|
|
20931
21323
|
rego,
|
|
20932
21324
|
requestRender: false
|
|
@@ -32797,6 +33189,9 @@ const colors = {};
|
|
|
32797
33189
|
const names = {};
|
|
32798
33190
|
const entities = {};
|
|
32799
33191
|
const viewers = {};
|
|
33192
|
+
// Global shift to move cursor + label down in pixels
|
|
33193
|
+
const CURSOR_SHIFT_Y = 22;
|
|
33194
|
+
const CURSOR_SHIFT_X = 10;
|
|
32800
33195
|
function createDOMLabel(viewer, id, name, colorCss) {
|
|
32801
33196
|
var _a;
|
|
32802
33197
|
const label = document.createElement("div");
|
|
@@ -32851,8 +33246,8 @@ function updateDOMLabel(viewer, label, pos3d) {
|
|
|
32851
33246
|
// Keep full opacity; no distance-based fading
|
|
32852
33247
|
// Keep the label close to the cursor regardless of zoom
|
|
32853
33248
|
// Use small, constant pixel offsets to bottom-right
|
|
32854
|
-
const offsetX =
|
|
32855
|
-
const offsetY =
|
|
33249
|
+
const offsetX = 6 + CURSOR_SHIFT_X; // px
|
|
33250
|
+
const offsetY = 4 + CURSOR_SHIFT_Y; // px (shift label further down)
|
|
32856
33251
|
let leftPx = screenPos.x + offsetX;
|
|
32857
33252
|
let topPx = screenPos.y + offsetY;
|
|
32858
33253
|
const pad = 8;
|
|
@@ -32903,7 +33298,9 @@ var LiveCursor;
|
|
|
32903
33298
|
distanceDisplayCondition: new DistanceDisplayCondition(0, 30000),
|
|
32904
33299
|
scaleByDistance: new NearFarScalar(100, 1.5, 10000, 0.8),
|
|
32905
33300
|
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
32906
|
-
horizontalOrigin: HorizontalOrigin.CENTER
|
|
33301
|
+
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
33302
|
+
// Shift billboard down; Cesium's +Y is up so use negative
|
|
33303
|
+
pixelOffset: new Cartesian2(CURSOR_SHIFT_X, CURSOR_SHIFT_Y)
|
|
32907
33304
|
} : undefined,
|
|
32908
33305
|
ellipse: showEllipse ? {
|
|
32909
33306
|
semiMajorAxis: 50.0,
|
|
@@ -32941,6 +33338,10 @@ var LiveCursor;
|
|
|
32941
33338
|
viewer: viewer
|
|
32942
33339
|
});
|
|
32943
33340
|
entity.position = new CallbackProperty(() => animated.GetValue(), false);
|
|
33341
|
+
// Ensure existing billboard is shifted consistently
|
|
33342
|
+
if (entity.billboard) {
|
|
33343
|
+
entity.billboard.pixelOffset = new Cartesian2(CURSOR_SHIFT_X, CURSOR_SHIFT_Y);
|
|
33344
|
+
}
|
|
32944
33345
|
}
|
|
32945
33346
|
if (!updaters[id]) {
|
|
32946
33347
|
const remover = viewer.scene.postUpdate.addEventListener(() => {
|
|
@@ -32968,6 +33369,14 @@ var LiveCursor;
|
|
|
32968
33369
|
}
|
|
32969
33370
|
LiveCursor.Upsert = Upsert;
|
|
32970
33371
|
function Remove(id) {
|
|
33372
|
+
// Also remove any camera visuals tracked for this cursor
|
|
33373
|
+
const viewer = viewers[id];
|
|
33374
|
+
if (viewer) {
|
|
33375
|
+
try {
|
|
33376
|
+
RemoveCameraVisuals(viewer, id);
|
|
33377
|
+
}
|
|
33378
|
+
catch { }
|
|
33379
|
+
}
|
|
32971
33380
|
const label = labels[id];
|
|
32972
33381
|
if (label && label.parentElement) {
|
|
32973
33382
|
label.parentElement.removeChild(label);
|
|
@@ -32985,7 +33394,6 @@ var LiveCursor;
|
|
|
32985
33394
|
}
|
|
32986
33395
|
// Remove entity if present
|
|
32987
33396
|
const entity = entities[id];
|
|
32988
|
-
const viewer = viewers[id];
|
|
32989
33397
|
if (entity && viewer && viewer.entities.contains(entity)) {
|
|
32990
33398
|
viewer.entities.remove(entity);
|
|
32991
33399
|
}
|
|
@@ -32993,6 +33401,136 @@ var LiveCursor;
|
|
|
32993
33401
|
delete viewers[id];
|
|
32994
33402
|
}
|
|
32995
33403
|
LiveCursor.Remove = Remove;
|
|
33404
|
+
const cameraVisuals = {};
|
|
33405
|
+
const cameraUpdateBuffer = {};
|
|
33406
|
+
const CAMERA_UPDATE_INTERVAL = 500; // ms
|
|
33407
|
+
const CAMERA_BUFFER_TIMEOUT = 1000; // ms
|
|
33408
|
+
function UpsertCameraVisuals(params) {
|
|
33409
|
+
if (params.throttled) {
|
|
33410
|
+
return throttledUpsertCameraVisuals(params);
|
|
33411
|
+
}
|
|
33412
|
+
return internalUpsertCameraVisuals(params);
|
|
33413
|
+
}
|
|
33414
|
+
LiveCursor.UpsertCameraVisuals = UpsertCameraVisuals;
|
|
33415
|
+
function throttledUpsertCameraVisuals(params) {
|
|
33416
|
+
var _a, _b;
|
|
33417
|
+
const { viewer, id, camera, color } = params;
|
|
33418
|
+
const now = Date.now();
|
|
33419
|
+
cameraUpdateBuffer[id] = {
|
|
33420
|
+
camera: { ...camera },
|
|
33421
|
+
color,
|
|
33422
|
+
lastBufferTime: now
|
|
33423
|
+
};
|
|
33424
|
+
const existing = cameraVisuals[id];
|
|
33425
|
+
if (!(existing === null || existing === void 0 ? void 0 : existing.cone) || (now - ((_a = existing.lastUpdate) !== null && _a !== void 0 ? _a : 0)) >= CAMERA_UPDATE_INTERVAL) {
|
|
33426
|
+
internalUpsertCameraVisuals(params);
|
|
33427
|
+
return;
|
|
33428
|
+
}
|
|
33429
|
+
setTimeout(() => {
|
|
33430
|
+
const buffered = cameraUpdateBuffer[id];
|
|
33431
|
+
if (buffered && (now - buffered.lastBufferTime) < CAMERA_BUFFER_TIMEOUT) {
|
|
33432
|
+
internalUpsertCameraVisuals({
|
|
33433
|
+
viewer,
|
|
33434
|
+
id,
|
|
33435
|
+
camera: buffered.camera,
|
|
33436
|
+
color: buffered.color
|
|
33437
|
+
});
|
|
33438
|
+
}
|
|
33439
|
+
}, Math.max(0, CAMERA_UPDATE_INTERVAL - (now - ((_b = existing.lastUpdate) !== null && _b !== void 0 ? _b : 0))));
|
|
33440
|
+
}
|
|
33441
|
+
function internalUpsertCameraVisuals(params) {
|
|
33442
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33443
|
+
const { viewer, id, camera, color } = params;
|
|
33444
|
+
if (!viewer || viewer.isDestroyed() || !(camera === null || camera === void 0 ? void 0 : camera.pos)) {
|
|
33445
|
+
return;
|
|
33446
|
+
}
|
|
33447
|
+
const camPos = new Cartesian3(camera.pos.x, camera.pos.y, camera.pos.z);
|
|
33448
|
+
// Adjust heading by -90 degrees to correct coordinate system mismatch
|
|
33449
|
+
const adjustedHeading = ((_a = camera.headingDeg) !== null && _a !== void 0 ? _a : 0) - 90;
|
|
33450
|
+
const headingRad = Math$1.toRadians(adjustedHeading);
|
|
33451
|
+
const pitchRad = Math$1.toRadians((_b = camera.pitchDeg) !== null && _b !== void 0 ? _b : 0);
|
|
33452
|
+
const rollRad = Math$1.toRadians((_c = camera.rollDeg) !== null && _c !== void 0 ? _c : 0);
|
|
33453
|
+
const hpr = new HeadingPitchRoll(headingRad, pitchRad, rollRad);
|
|
33454
|
+
const baseOrientation = Transforms.headingPitchRollQuaternion(camPos, hpr);
|
|
33455
|
+
// Cylinder axis is local +Z, but HPR 'forward' is along +X. Tilt so Z -> X.
|
|
33456
|
+
const tilt = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, Math$1.toRadians(-90));
|
|
33457
|
+
const orientation = Quaternion.multiply(baseOrientation, tilt, new Quaternion());
|
|
33458
|
+
const vFovDeg = Math.max(1, Math.min(170, (_d = camera.fovDeg) !== null && _d !== void 0 ? _d : 60));
|
|
33459
|
+
const aspect = (viewer.canvas && viewer.canvas.clientHeight > 0)
|
|
33460
|
+
? (viewer.canvas.clientWidth / viewer.canvas.clientHeight)
|
|
33461
|
+
: 16 / 9;
|
|
33462
|
+
const hFovDeg = Math$1.toDegrees(2 * Math.atan(Math.tan(Math$1.toRadians(vFovDeg) / 2) * aspect));
|
|
33463
|
+
const length = Math.max(10, (_e = camera.rangeMeters) !== null && _e !== void 0 ? _e : 200);
|
|
33464
|
+
// Use horizontal FOV to approximate viewing cone width
|
|
33465
|
+
const bottomRadius = Math.tan(Math$1.toRadians(hFovDeg / 2)) * length;
|
|
33466
|
+
// Offset position so cone extends forward from camera
|
|
33467
|
+
const rotation = Matrix3.fromQuaternion(orientation);
|
|
33468
|
+
const forward = Matrix3.multiplyByVector(rotation, Cartesian3.UNIT_Z, new Cartesian3());
|
|
33469
|
+
const offset = Cartesian3.multiplyByScalar(forward, length / 2, new Cartesian3());
|
|
33470
|
+
const conePos = Cartesian3.add(camPos, offset, new Cartesian3());
|
|
33471
|
+
const coneId = `user-camera-cone-${id}`;
|
|
33472
|
+
const now = Date.now();
|
|
33473
|
+
const existing = (_f = cameraVisuals[id]) !== null && _f !== void 0 ? _f : {};
|
|
33474
|
+
// Upsert cone entity
|
|
33475
|
+
if (!existing.cone) {
|
|
33476
|
+
const cone = viewer.entities.add({
|
|
33477
|
+
id: coneId,
|
|
33478
|
+
position: conePos,
|
|
33479
|
+
orientation: orientation,
|
|
33480
|
+
cylinder: {
|
|
33481
|
+
length,
|
|
33482
|
+
topRadius: 0,
|
|
33483
|
+
bottomRadius,
|
|
33484
|
+
material: color.withAlpha(0.25),
|
|
33485
|
+
outline: true,
|
|
33486
|
+
outlineColor: color.withAlpha(0.8),
|
|
33487
|
+
numberOfVerticalLines: 0,
|
|
33488
|
+
slices: 64,
|
|
33489
|
+
distanceDisplayCondition: new DistanceDisplayCondition(0, 50000)
|
|
33490
|
+
}
|
|
33491
|
+
});
|
|
33492
|
+
existing.cone = cone;
|
|
33493
|
+
existing.lastUpdate = now;
|
|
33494
|
+
}
|
|
33495
|
+
else {
|
|
33496
|
+
const needsUpdate = (!Cartesian3.equals(((_g = existing.cone.position) === null || _g === void 0 ? void 0 : _g.getValue(JulianDate.now())) || new Cartesian3(), conePos) ||
|
|
33497
|
+
!Quaternion.equals(((_h = existing.cone.orientation) === null || _h === void 0 ? void 0 : _h.getValue(JulianDate.now())) || new Quaternion(), orientation));
|
|
33498
|
+
if (needsUpdate) {
|
|
33499
|
+
viewer.entities.suspendEvents();
|
|
33500
|
+
try {
|
|
33501
|
+
existing.cone.position = conePos;
|
|
33502
|
+
existing.cone.orientation = orientation;
|
|
33503
|
+
const cylinder = existing.cone.cylinder;
|
|
33504
|
+
if (cylinder) {
|
|
33505
|
+
cylinder.length = length;
|
|
33506
|
+
cylinder.bottomRadius = bottomRadius;
|
|
33507
|
+
cylinder.material = color.withAlpha(0.25);
|
|
33508
|
+
cylinder.outlineColor = color.withAlpha(0.8);
|
|
33509
|
+
}
|
|
33510
|
+
}
|
|
33511
|
+
finally {
|
|
33512
|
+
viewer.entities.resumeEvents();
|
|
33513
|
+
}
|
|
33514
|
+
}
|
|
33515
|
+
existing.lastUpdate = now;
|
|
33516
|
+
}
|
|
33517
|
+
cameraVisuals[id] = existing;
|
|
33518
|
+
}
|
|
33519
|
+
function RemoveCameraVisuals(viewer, id) {
|
|
33520
|
+
const existing = cameraVisuals[id];
|
|
33521
|
+
if (!existing) {
|
|
33522
|
+
return;
|
|
33523
|
+
}
|
|
33524
|
+
if (existing.cone) {
|
|
33525
|
+
try {
|
|
33526
|
+
viewer.entities.remove(existing.cone);
|
|
33527
|
+
}
|
|
33528
|
+
catch { }
|
|
33529
|
+
}
|
|
33530
|
+
delete cameraVisuals[id];
|
|
33531
|
+
delete cameraUpdateBuffer[id];
|
|
33532
|
+
}
|
|
33533
|
+
LiveCursor.RemoveCameraVisuals = RemoveCameraVisuals;
|
|
32996
33534
|
})(LiveCursor || (LiveCursor = {}));
|
|
32997
33535
|
|
|
32998
33536
|
var WidgetControlViewBar;
|
|
@@ -33767,7 +34305,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
33767
34305
|
}
|
|
33768
34306
|
}
|
|
33769
34307
|
|
|
33770
|
-
const VERSION = "6.
|
|
34308
|
+
const VERSION = "6.2.0";
|
|
33771
34309
|
|
|
33772
34310
|
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 };
|
|
33773
34311
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|