bruce-cesium 4.9.1 → 4.9.3
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 +211 -343
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +210 -342
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/visual-register-culler.js +12 -0
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +197 -344
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/visuals-register.d.ts +3 -19
- 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, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, 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,
|
|
3
|
+
import { Cartographic, JulianDate, Entity, DistanceDisplayCondition, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, Matrix4, Matrix3, IonResource, Quaternion, 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;
|
|
@@ -5684,6 +5684,7 @@ function runCullChecker(register) {
|
|
|
5684
5684
|
// We'll use the terrain cache per culler cycle.
|
|
5685
5685
|
_terrainCache.Clear();
|
|
5686
5686
|
checkInterval = setInterval(() => {
|
|
5687
|
+
var _a;
|
|
5687
5688
|
if (viewer.isDestroyed() || !viewer.scene) {
|
|
5688
5689
|
clearInterval(checkInterval);
|
|
5689
5690
|
checkInterval = null;
|
|
@@ -5698,11 +5699,22 @@ function runCullChecker(register) {
|
|
|
5698
5699
|
const regos = register.GetRegos({
|
|
5699
5700
|
entityId
|
|
5700
5701
|
});
|
|
5702
|
+
regos.sort((a, b) => {
|
|
5703
|
+
return b.priority - a.priority;
|
|
5704
|
+
});
|
|
5705
|
+
let highestPriority = (_a = regos[0]) === null || _a === void 0 ? void 0 : _a.priority;
|
|
5706
|
+
if (!highestPriority) {
|
|
5707
|
+
highestPriority = 0;
|
|
5708
|
+
}
|
|
5701
5709
|
for (let j = 0; j < regos.length; j++) {
|
|
5702
5710
|
const rego = regos[j];
|
|
5703
5711
|
if (isCullingIgnored(viewer, rego)) {
|
|
5704
5712
|
continue;
|
|
5705
5713
|
}
|
|
5714
|
+
// We skip if it's hidden due to being under the highest priority.
|
|
5715
|
+
else if (rego.priority < highestPriority) {
|
|
5716
|
+
continue;
|
|
5717
|
+
}
|
|
5706
5718
|
const state = register.GetState({
|
|
5707
5719
|
entityId: entityId,
|
|
5708
5720
|
menuItemId: rego.menuItemId
|
|
@@ -9362,19 +9374,6 @@ var CesiumAnimatedInOut;
|
|
|
9362
9374
|
CesiumAnimatedInOut.AnimateOut = AnimateOut;
|
|
9363
9375
|
})(CesiumAnimatedInOut || (CesiumAnimatedInOut = {}));
|
|
9364
9376
|
|
|
9365
|
-
function debounce(fn, delay) {
|
|
9366
|
-
let timeout = null;
|
|
9367
|
-
let lastArgs;
|
|
9368
|
-
return function (...args) {
|
|
9369
|
-
lastArgs = args;
|
|
9370
|
-
if (timeout !== null)
|
|
9371
|
-
clearTimeout(timeout);
|
|
9372
|
-
timeout = window.setTimeout(() => {
|
|
9373
|
-
timeout = null;
|
|
9374
|
-
fn(...lastArgs);
|
|
9375
|
-
}, delay);
|
|
9376
|
-
};
|
|
9377
|
-
}
|
|
9378
9377
|
/**
|
|
9379
9378
|
* Returns if a given visual is alive and in the scene.
|
|
9380
9379
|
* @param viewer
|
|
@@ -9521,7 +9520,7 @@ function updateEntity(viewer, entityId, register, refresh, cache = {}) {
|
|
|
9521
9520
|
// So if a new visual is added that's higher priority, all lower ones get hidden.
|
|
9522
9521
|
// By default, everything has 0 priority unless explicitly set.
|
|
9523
9522
|
const priority = rego.priority ? rego.priority : 0;
|
|
9524
|
-
return priority
|
|
9523
|
+
return priority >= highestPriority;
|
|
9525
9524
|
}
|
|
9526
9525
|
for (let i = 0; i < regos.length; i++) {
|
|
9527
9526
|
const rego = regos[i];
|
|
@@ -9647,16 +9646,7 @@ function unmarkEntity(visual, ignoreParent) {
|
|
|
9647
9646
|
}
|
|
9648
9647
|
}
|
|
9649
9648
|
}
|
|
9650
|
-
const
|
|
9651
|
-
function parseStateKey(key) {
|
|
9652
|
-
return key.split(STATE_DELIMITER);
|
|
9653
|
-
}
|
|
9654
|
-
function constructStateKey(entityId, menuItemId) {
|
|
9655
|
-
if (!menuItemId) {
|
|
9656
|
-
return entityId;
|
|
9657
|
-
}
|
|
9658
|
-
return entityId + STATE_DELIMITER + menuItemId;
|
|
9659
|
-
}
|
|
9649
|
+
const NO_MENU_ITEM_KEY = "";
|
|
9660
9650
|
function getBlankState(entityId, menuItemId) {
|
|
9661
9651
|
const state = {
|
|
9662
9652
|
entityId: entityId
|
|
@@ -9706,7 +9696,8 @@ var VisualsRegister;
|
|
|
9706
9696
|
this.disposed = false;
|
|
9707
9697
|
this.rego = {};
|
|
9708
9698
|
this.onUpdate = null;
|
|
9709
|
-
// Entity ID
|
|
9699
|
+
// Entity ID -> Menu Item ID -> State.
|
|
9700
|
+
// When no Menu Item ID is set, then the second key is a blank string.
|
|
9710
9701
|
// If an Entity ID state is set without a Menu Item ID, then it acts as a default for all Menu Items.
|
|
9711
9702
|
this.states = {};
|
|
9712
9703
|
// Queue of Entity updates to process in batches to avoid overloading the render loop.
|
|
@@ -9715,47 +9706,6 @@ var VisualsRegister;
|
|
|
9715
9706
|
// This lets us modify the update without re-adding the item to the queue if it's already in it.
|
|
9716
9707
|
this.updateQueueSettings = {};
|
|
9717
9708
|
this.updateQueueInterval = null;
|
|
9718
|
-
// public ClearHighlighted(params?: {
|
|
9719
|
-
// // Default is true.
|
|
9720
|
-
// requestRender?: boolean
|
|
9721
|
-
// }): void {
|
|
9722
|
-
// // Null all states.
|
|
9723
|
-
// let entityIds: string[] = [];
|
|
9724
|
-
// console.log("Clearing highlighted");
|
|
9725
|
-
// this.ForEachState((state) => {
|
|
9726
|
-
// if (state.highlighted) {
|
|
9727
|
-
// delete state.highlighted;
|
|
9728
|
-
// if (!entityIds.includes(state.entityId)) {
|
|
9729
|
-
// entityIds.push(state.entityId);
|
|
9730
|
-
// }
|
|
9731
|
-
// }
|
|
9732
|
-
// });
|
|
9733
|
-
// console.log("Revert needed visual changes");
|
|
9734
|
-
// // Revert needed visual changes.
|
|
9735
|
-
// for (let i = 0; i < entityIds.length; i++) {
|
|
9736
|
-
// const id = entityIds[i];
|
|
9737
|
-
// const regos = this.rego[id];
|
|
9738
|
-
// if (regos) {
|
|
9739
|
-
// for (let i = 0; i < regos.length; i++) {
|
|
9740
|
-
// const rego = regos[i];
|
|
9741
|
-
// CesiumEntityStyler.Unhighlight({
|
|
9742
|
-
// entity: rego.visual,
|
|
9743
|
-
// viewer: this.viewer,
|
|
9744
|
-
// requestRender: false
|
|
9745
|
-
// });
|
|
9746
|
-
// }
|
|
9747
|
-
// }
|
|
9748
|
-
// }
|
|
9749
|
-
// console.log("Requesting render");
|
|
9750
|
-
// if (params?.requestRender != false) {
|
|
9751
|
-
// this.viewer.scene.requestRender();
|
|
9752
|
-
// }
|
|
9753
|
-
// console.log("Triggering update");
|
|
9754
|
-
// }
|
|
9755
|
-
// Debounced method to apply highlight changes
|
|
9756
|
-
this.applyHighlightChanges = debounce((newEntitiesToHighlight) => {
|
|
9757
|
-
this.updateHighlightedEntities(newEntitiesToHighlight);
|
|
9758
|
-
}, 50);
|
|
9759
9709
|
this.viewer = params.viewer;
|
|
9760
9710
|
this.apiGetters = params.apiGetters;
|
|
9761
9711
|
this.cameraCullerDispose = VisualRegisterCuller.Monitor({
|
|
@@ -9837,20 +9787,19 @@ var VisualsRegister;
|
|
|
9837
9787
|
* @param params
|
|
9838
9788
|
*/
|
|
9839
9789
|
GetState(params) {
|
|
9790
|
+
var _a, _b;
|
|
9840
9791
|
const { entityId, menuItemId } = params;
|
|
9841
|
-
|
|
9842
|
-
let eState = this.states[eStateKey];
|
|
9792
|
+
let eState = (_a = this.states[entityId]) === null || _a === void 0 ? void 0 : _a[NO_MENU_ITEM_KEY];
|
|
9843
9793
|
if (eState && isBlankState(eState)) {
|
|
9844
9794
|
eState = null;
|
|
9845
|
-
delete this.states[
|
|
9795
|
+
delete this.states[entityId][NO_MENU_ITEM_KEY];
|
|
9846
9796
|
}
|
|
9847
9797
|
let mState;
|
|
9848
9798
|
if (menuItemId) {
|
|
9849
|
-
|
|
9850
|
-
mState = this.states[mStateKey];
|
|
9799
|
+
mState = (_b = this.states[entityId]) === null || _b === void 0 ? void 0 : _b[menuItemId];
|
|
9851
9800
|
if (mState && isBlankState(mState)) {
|
|
9852
9801
|
mState = null;
|
|
9853
|
-
delete this.states[
|
|
9802
|
+
delete this.states[entityId][menuItemId];
|
|
9854
9803
|
}
|
|
9855
9804
|
}
|
|
9856
9805
|
if (!mState && eState) {
|
|
@@ -10018,11 +9967,22 @@ var VisualsRegister;
|
|
|
10018
9967
|
let keys = Object.keys(values);
|
|
10019
9968
|
keys = keys.filter(k => k !== "entityId" && k !== "menuItemId");
|
|
10020
9969
|
let changed = false;
|
|
10021
|
-
const update = (
|
|
10022
|
-
|
|
9970
|
+
const update = (entityId, menuItemId) => {
|
|
9971
|
+
if (!menuItemId) {
|
|
9972
|
+
menuItemId = NO_MENU_ITEM_KEY;
|
|
9973
|
+
}
|
|
9974
|
+
let state;
|
|
9975
|
+
let eStates = this.states[entityId];
|
|
9976
|
+
if (eStates) {
|
|
9977
|
+
state = eStates[menuItemId];
|
|
9978
|
+
}
|
|
10023
9979
|
if (!state) {
|
|
10024
9980
|
state = getBlankState(values.entityId, values.menuItemId);
|
|
10025
|
-
|
|
9981
|
+
if (!eStates) {
|
|
9982
|
+
eStates = {};
|
|
9983
|
+
this.states[entityId] = eStates;
|
|
9984
|
+
}
|
|
9985
|
+
eStates[menuItemId] = state;
|
|
10026
9986
|
}
|
|
10027
9987
|
for (let i = 0; i < keys.length; i++) {
|
|
10028
9988
|
const k = keys[i];
|
|
@@ -10035,11 +9995,21 @@ var VisualsRegister;
|
|
|
10035
9995
|
}
|
|
10036
9996
|
}
|
|
10037
9997
|
if (isBlankState(state)) {
|
|
10038
|
-
delete
|
|
9998
|
+
delete eStates[menuItemId];
|
|
9999
|
+
if (Object.keys(eStates).length === 0) {
|
|
10000
|
+
delete this.states[entityId];
|
|
10001
|
+
}
|
|
10039
10002
|
}
|
|
10040
10003
|
};
|
|
10041
|
-
const strip = (
|
|
10042
|
-
|
|
10004
|
+
const strip = (entityId, menuItemId) => {
|
|
10005
|
+
if (!menuItemId) {
|
|
10006
|
+
menuItemId = NO_MENU_ITEM_KEY;
|
|
10007
|
+
}
|
|
10008
|
+
const eStates = this.states[entityId];
|
|
10009
|
+
if (!eStates) {
|
|
10010
|
+
return;
|
|
10011
|
+
}
|
|
10012
|
+
const state = eStates[menuItemId];
|
|
10043
10013
|
if (!state) {
|
|
10044
10014
|
return;
|
|
10045
10015
|
}
|
|
@@ -10050,17 +10020,21 @@ var VisualsRegister;
|
|
|
10050
10020
|
}
|
|
10051
10021
|
}
|
|
10052
10022
|
if (isBlankState(state)) {
|
|
10053
|
-
delete
|
|
10023
|
+
delete eStates[menuItemId];
|
|
10024
|
+
if (Object.keys(eStates).length === 0) {
|
|
10025
|
+
delete this.states[entityId];
|
|
10026
|
+
}
|
|
10054
10027
|
}
|
|
10055
10028
|
};
|
|
10056
|
-
update(
|
|
10029
|
+
update(values.entityId, values.menuItemId);
|
|
10057
10030
|
// If there is no Menu Item ID, then we want to strip the settings we updated from the Menu Item specific settings.
|
|
10058
10031
|
if (!values.menuItemId) {
|
|
10059
|
-
const
|
|
10060
|
-
|
|
10061
|
-
const
|
|
10062
|
-
|
|
10063
|
-
|
|
10032
|
+
const eStates = this.states[values.entityId];
|
|
10033
|
+
if (eStates) {
|
|
10034
|
+
for (const key in eStates) {
|
|
10035
|
+
if (key !== NO_MENU_ITEM_KEY) {
|
|
10036
|
+
strip(values.entityId, key);
|
|
10037
|
+
}
|
|
10064
10038
|
}
|
|
10065
10039
|
}
|
|
10066
10040
|
}
|
|
@@ -10071,14 +10045,31 @@ var VisualsRegister;
|
|
|
10071
10045
|
* This is typically used for saving.
|
|
10072
10046
|
*/
|
|
10073
10047
|
GetStates(params) {
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
}
|
|
10077
|
-
const newStates = {};
|
|
10048
|
+
const states = [];
|
|
10049
|
+
// We flatten the dictionary into an array.
|
|
10078
10050
|
const keys = Object.keys(this.states);
|
|
10079
10051
|
for (let i = 0; i < keys.length; i++) {
|
|
10080
|
-
const
|
|
10081
|
-
|
|
10052
|
+
const entityId = keys[i];
|
|
10053
|
+
const eStates = this.states[entityId];
|
|
10054
|
+
if (!eStates) {
|
|
10055
|
+
continue;
|
|
10056
|
+
}
|
|
10057
|
+
const mKeys = Object.keys(eStates);
|
|
10058
|
+
for (let j = 0; j < mKeys.length; j++) {
|
|
10059
|
+
const menuItemId = mKeys[j];
|
|
10060
|
+
const state = eStates[menuItemId];
|
|
10061
|
+
if (!state) {
|
|
10062
|
+
continue;
|
|
10063
|
+
}
|
|
10064
|
+
states.push(state);
|
|
10065
|
+
}
|
|
10066
|
+
}
|
|
10067
|
+
if (!(params === null || params === void 0 ? void 0 : params.optimized)) {
|
|
10068
|
+
return states;
|
|
10069
|
+
}
|
|
10070
|
+
const newStates = [];
|
|
10071
|
+
for (let i = 0; i < states.length; i++) {
|
|
10072
|
+
let state = states[i];
|
|
10082
10073
|
// Dereference.
|
|
10083
10074
|
state = {
|
|
10084
10075
|
...state
|
|
@@ -10104,7 +10095,7 @@ var VisualsRegister;
|
|
|
10104
10095
|
if (isBlankState(state)) {
|
|
10105
10096
|
continue;
|
|
10106
10097
|
}
|
|
10107
|
-
newStates
|
|
10098
|
+
newStates.push(state);
|
|
10108
10099
|
}
|
|
10109
10100
|
return newStates;
|
|
10110
10101
|
}
|
|
@@ -10123,20 +10114,25 @@ var VisualsRegister;
|
|
|
10123
10114
|
this.ClearHidden();
|
|
10124
10115
|
this.states = {};
|
|
10125
10116
|
let newStates = {};
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
delete state.menuItemId;
|
|
10131
|
-
}
|
|
10132
|
-
const key = constructStateKey(state.entityId, state.menuItemId);
|
|
10133
|
-
newStates[key] = state;
|
|
10117
|
+
for (let i = 0; i < states.length; i++) {
|
|
10118
|
+
const state = states[i];
|
|
10119
|
+
if (!state.menuItemId && state.hasOwnProperty("menuItemId")) {
|
|
10120
|
+
delete state.menuItemId;
|
|
10134
10121
|
}
|
|
10122
|
+
if (!state.entityId) {
|
|
10123
|
+
continue;
|
|
10124
|
+
}
|
|
10125
|
+
if (isBlankState(state)) {
|
|
10126
|
+
continue;
|
|
10127
|
+
}
|
|
10128
|
+
if (!newStates[state.entityId]) {
|
|
10129
|
+
newStates[state.entityId] = {};
|
|
10130
|
+
}
|
|
10131
|
+
newStates[state.entityId][state.menuItemId ? state.menuItemId : NO_MENU_ITEM_KEY] = {
|
|
10132
|
+
...state
|
|
10133
|
+
};
|
|
10135
10134
|
}
|
|
10136
|
-
|
|
10137
|
-
newStates = states;
|
|
10138
|
-
}
|
|
10139
|
-
this.states = JSON.parse(JSON.stringify(newStates));
|
|
10135
|
+
this.states = newStates;
|
|
10140
10136
|
// Reflect the rest of the changes.
|
|
10141
10137
|
this.updateAllEntities();
|
|
10142
10138
|
}
|
|
@@ -10150,13 +10146,20 @@ var VisualsRegister;
|
|
|
10150
10146
|
const states = {};
|
|
10151
10147
|
let entityIds = [];
|
|
10152
10148
|
let entityIdsMenuItem = {};
|
|
10153
|
-
for (const
|
|
10154
|
-
const
|
|
10155
|
-
if (!
|
|
10156
|
-
|
|
10149
|
+
for (const entityId in this.states) {
|
|
10150
|
+
const eStates = this.states[entityId];
|
|
10151
|
+
if (!eStates) {
|
|
10152
|
+
continue;
|
|
10153
|
+
}
|
|
10154
|
+
if (!entityIds.includes(entityId)) {
|
|
10155
|
+
entityIds.push(entityId);
|
|
10157
10156
|
}
|
|
10158
|
-
|
|
10159
|
-
|
|
10157
|
+
const mKeys = Object.keys(eStates);
|
|
10158
|
+
for (let i = 0; i < mKeys.length; i++) {
|
|
10159
|
+
const menuItemId = mKeys[i];
|
|
10160
|
+
if (menuItemId) {
|
|
10161
|
+
entityIdsMenuItem[entityId] = menuItemId;
|
|
10162
|
+
}
|
|
10160
10163
|
}
|
|
10161
10164
|
}
|
|
10162
10165
|
for (let i = 0; i < entityIds.length; i++) {
|
|
@@ -10185,20 +10188,22 @@ var VisualsRegister;
|
|
|
10185
10188
|
* @param callback
|
|
10186
10189
|
*/
|
|
10187
10190
|
ForEachState(callback) {
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10191
|
+
// Flatten and iterate.
|
|
10192
|
+
const keys = Object.keys(this.states);
|
|
10193
|
+
for (let i = 0; i < keys.length; i++) {
|
|
10194
|
+
const entityId = keys[i];
|
|
10195
|
+
const eStates = this.states[entityId];
|
|
10196
|
+
if (!eStates) {
|
|
10197
|
+
continue;
|
|
10198
|
+
}
|
|
10199
|
+
const mKeys = Object.keys(eStates);
|
|
10200
|
+
for (let j = 0; j < mKeys.length; j++) {
|
|
10201
|
+
const menuItemId = mKeys[j];
|
|
10202
|
+
const state = eStates[menuItemId];
|
|
10203
|
+
if (!state) {
|
|
10204
|
+
continue;
|
|
10205
|
+
}
|
|
10206
|
+
callback(state);
|
|
10202
10207
|
}
|
|
10203
10208
|
}
|
|
10204
10209
|
}
|
|
@@ -10328,131 +10333,71 @@ var VisualsRegister;
|
|
|
10328
10333
|
CesiumEntityStyler.UpdateColorSetting("highlight", color);
|
|
10329
10334
|
}
|
|
10330
10335
|
}
|
|
10331
|
-
// public SetSelected(params: {
|
|
10332
|
-
// selected: boolean;
|
|
10333
|
-
// entityIds: string[];
|
|
10334
|
-
// menuItemId?: string;
|
|
10335
|
-
// refreshIfSelected?: boolean;
|
|
10336
|
-
// // Default is true.
|
|
10337
|
-
// requestRender?: boolean;
|
|
10338
|
-
// }): void {
|
|
10339
|
-
// let { entityIds, selected, refreshIfSelected, requestRender, menuItemId } = params;
|
|
10340
|
-
// if (refreshIfSelected == null || refreshIfSelected === undefined) {
|
|
10341
|
-
// refreshIfSelected = true;
|
|
10342
|
-
// }
|
|
10343
|
-
// for (let i = 0; i < entityIds.length; i++) {
|
|
10344
|
-
// const id = entityIds[i];
|
|
10345
|
-
// const state = this.GetState({
|
|
10346
|
-
// entityId: id,
|
|
10347
|
-
// menuItemId
|
|
10348
|
-
// });
|
|
10349
|
-
// // Checking if we need to refresh the selection.
|
|
10350
|
-
// const doSelect = refreshIfSelected || (Boolean(state.selected) != selected);
|
|
10351
|
-
// this.setStateValues({
|
|
10352
|
-
// entityId: id,
|
|
10353
|
-
// menuItemId: menuItemId,
|
|
10354
|
-
// // Null means it will be deleted from the object.
|
|
10355
|
-
// selected: selected ? true : null
|
|
10356
|
-
// })
|
|
10357
|
-
// if (selected) {
|
|
10358
|
-
// if (doSelect) {
|
|
10359
|
-
// const regos = this.rego[id];
|
|
10360
|
-
// if (regos) {
|
|
10361
|
-
// for (let i = 0; i < regos.length; i++) {
|
|
10362
|
-
// const rego = regos[i];
|
|
10363
|
-
// if (menuItemId && rego.menuItemId !== menuItemId) {
|
|
10364
|
-
// continue;
|
|
10365
|
-
// }
|
|
10366
|
-
// CesiumEntityStyler.Select({
|
|
10367
|
-
// entity: rego.visual,
|
|
10368
|
-
// viewer: this.viewer,
|
|
10369
|
-
// requestRender: false
|
|
10370
|
-
// });
|
|
10371
|
-
// }
|
|
10372
|
-
// }
|
|
10373
|
-
// }
|
|
10374
|
-
// }
|
|
10375
|
-
// else {
|
|
10376
|
-
// if (doSelect) {
|
|
10377
|
-
// const regos = this.rego[id];
|
|
10378
|
-
// if (regos) {
|
|
10379
|
-
// for (let i = 0; i < regos.length; i++) {
|
|
10380
|
-
// const rego = regos[i];
|
|
10381
|
-
// if (menuItemId && rego.menuItemId !== menuItemId) {
|
|
10382
|
-
// continue;
|
|
10383
|
-
// }
|
|
10384
|
-
// CesiumEntityStyler.Deselect({
|
|
10385
|
-
// entity: rego.visual,
|
|
10386
|
-
// viewer: this.viewer,
|
|
10387
|
-
// requestRender: false
|
|
10388
|
-
// });
|
|
10389
|
-
// }
|
|
10390
|
-
// }
|
|
10391
|
-
// }
|
|
10392
|
-
// }
|
|
10393
|
-
// this.onUpdate?.Trigger({
|
|
10394
|
-
// entityId: id,
|
|
10395
|
-
// type: EVisualUpdateType.Update,
|
|
10396
|
-
// selected: selected
|
|
10397
|
-
// });
|
|
10398
|
-
// }
|
|
10399
|
-
// if (requestRender != false) {
|
|
10400
|
-
// this.viewer.scene.requestRender();
|
|
10401
|
-
// }
|
|
10402
|
-
// }
|
|
10403
10336
|
SetSelected(params) {
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10337
|
+
var _a;
|
|
10338
|
+
let { entityIds, selected, refreshIfSelected, requestRender, menuItemId } = params;
|
|
10339
|
+
if (refreshIfSelected == null || refreshIfSelected === undefined) {
|
|
10340
|
+
refreshIfSelected = true;
|
|
10341
|
+
}
|
|
10342
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
10343
|
+
const id = entityIds[i];
|
|
10344
|
+
const state = this.GetState({
|
|
10345
|
+
entityId: id,
|
|
10346
|
+
menuItemId
|
|
10347
|
+
});
|
|
10348
|
+
// Checking if we need to refresh the selection.
|
|
10349
|
+
const doSelect = refreshIfSelected || (Boolean(state.selected) != selected);
|
|
10350
|
+
this.setStateValues({
|
|
10351
|
+
entityId: id,
|
|
10352
|
+
menuItemId: menuItemId,
|
|
10353
|
+
// Null means it will be deleted from the object.
|
|
10354
|
+
selected: selected ? true : null
|
|
10355
|
+
});
|
|
10356
|
+
if (selected) {
|
|
10357
|
+
if (doSelect) {
|
|
10358
|
+
const regos = this.rego[id];
|
|
10359
|
+
if (regos) {
|
|
10360
|
+
for (let i = 0; i < regos.length; i++) {
|
|
10361
|
+
const rego = regos[i];
|
|
10362
|
+
if (menuItemId && rego.menuItemId !== menuItemId) {
|
|
10363
|
+
continue;
|
|
10364
|
+
}
|
|
10365
|
+
CesiumEntityStyler.Select({
|
|
10366
|
+
entity: rego.visual,
|
|
10367
|
+
viewer: this.viewer,
|
|
10368
|
+
requestRender: false
|
|
10369
|
+
});
|
|
10430
10370
|
}
|
|
10431
10371
|
}
|
|
10432
10372
|
}
|
|
10433
|
-
if (!updatedEntities.has(id)) {
|
|
10434
|
-
updatedEntities.add(id);
|
|
10435
|
-
updatedEntitiesInfo.push({ entityId: id, type: EVisualUpdateType.Update, selected });
|
|
10436
|
-
}
|
|
10437
|
-
}
|
|
10438
|
-
index = end;
|
|
10439
|
-
if (index < entityIds.length) {
|
|
10440
|
-
setTimeout(processBatch, 0);
|
|
10441
10373
|
}
|
|
10442
10374
|
else {
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10375
|
+
if (doSelect) {
|
|
10376
|
+
const regos = this.rego[id];
|
|
10377
|
+
if (regos) {
|
|
10378
|
+
for (let i = 0; i < regos.length; i++) {
|
|
10379
|
+
const rego = regos[i];
|
|
10380
|
+
if (menuItemId && rego.menuItemId !== menuItemId) {
|
|
10381
|
+
continue;
|
|
10382
|
+
}
|
|
10383
|
+
CesiumEntityStyler.Deselect({
|
|
10384
|
+
entity: rego.visual,
|
|
10385
|
+
viewer: this.viewer,
|
|
10386
|
+
requestRender: false
|
|
10387
|
+
});
|
|
10388
|
+
}
|
|
10389
|
+
}
|
|
10452
10390
|
}
|
|
10453
10391
|
}
|
|
10454
|
-
|
|
10455
|
-
|
|
10392
|
+
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
|
|
10393
|
+
entityId: id,
|
|
10394
|
+
type: EVisualUpdateType.Update,
|
|
10395
|
+
selected: selected
|
|
10396
|
+
});
|
|
10397
|
+
}
|
|
10398
|
+
if (requestRender != false) {
|
|
10399
|
+
this.viewer.scene.requestRender();
|
|
10400
|
+
}
|
|
10456
10401
|
}
|
|
10457
10402
|
GetIsSelected(params) {
|
|
10458
10403
|
const { entityId: id, menuItemId } = params;
|
|
@@ -10465,7 +10410,7 @@ var VisualsRegister;
|
|
|
10465
10410
|
ClearSelected(params) {
|
|
10466
10411
|
var _a;
|
|
10467
10412
|
const cleared = [];
|
|
10468
|
-
this.ForEachState((state
|
|
10413
|
+
this.ForEachState((state) => {
|
|
10469
10414
|
if (state.selected == null || state.selected === undefined) {
|
|
10470
10415
|
return;
|
|
10471
10416
|
}
|
|
@@ -10573,110 +10518,33 @@ var VisualsRegister;
|
|
|
10573
10518
|
});
|
|
10574
10519
|
return state.highlighted === true;
|
|
10575
10520
|
}
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
// and newly required highlight sets.
|
|
10580
|
-
HoverHighlight(params) {
|
|
10581
|
-
const { newEntities } = params;
|
|
10582
|
-
const newSet = new Set(newEntities);
|
|
10583
|
-
// If very large updates happen frequently, rely on debounce to prevent rapid firing
|
|
10584
|
-
if (newEntities.length > 1000) {
|
|
10585
|
-
this.applyHighlightChanges(newSet);
|
|
10586
|
-
}
|
|
10587
|
-
else {
|
|
10588
|
-
// Smaller updates can be processed immediately (or still use debounce if desired)
|
|
10589
|
-
this.updateHighlightedEntities(newSet);
|
|
10590
|
-
}
|
|
10591
|
-
}
|
|
10592
|
-
// Retrieve all currently highlighted entities by scanning states
|
|
10593
|
-
getCurrentlyHighlightedEntities() {
|
|
10594
|
-
const highlighted = new Set();
|
|
10521
|
+
ClearHighlighted(params) {
|
|
10522
|
+
// Null all states.
|
|
10523
|
+
let entityIds = [];
|
|
10595
10524
|
this.ForEachState((state) => {
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10525
|
+
if (state.highlighted) {
|
|
10526
|
+
delete state.highlighted;
|
|
10527
|
+
if (!entityIds.includes(state.entityId)) {
|
|
10528
|
+
entityIds.push(state.entityId);
|
|
10529
|
+
}
|
|
10600
10530
|
}
|
|
10601
10531
|
});
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
updateHighlightedEntities(newSet) {
|
|
10606
|
-
// Get the current highlight set by scanning states
|
|
10607
|
-
const currentlyHighlighted = this.getCurrentlyHighlightedEntities();
|
|
10608
|
-
// Determine what needs to be unhighlighted
|
|
10609
|
-
const entitiesToUnhighlight = new Set();
|
|
10610
|
-
for (const oldId of currentlyHighlighted) {
|
|
10611
|
-
if (!newSet.has(oldId)) {
|
|
10612
|
-
entitiesToUnhighlight.add(oldId);
|
|
10613
|
-
}
|
|
10614
|
-
}
|
|
10615
|
-
// Determine what needs to be highlighted
|
|
10616
|
-
const entitiesToHighlight = new Set();
|
|
10617
|
-
for (const newId of newSet) {
|
|
10618
|
-
if (!currentlyHighlighted.has(newId)) {
|
|
10619
|
-
entitiesToHighlight.add(newId);
|
|
10620
|
-
}
|
|
10621
|
-
}
|
|
10622
|
-
// If no changes needed, return early
|
|
10623
|
-
if (entitiesToUnhighlight.size === 0 && entitiesToHighlight.size === 0) {
|
|
10624
|
-
return;
|
|
10625
|
-
}
|
|
10626
|
-
// Apply visual changes in batches
|
|
10627
|
-
this.applyUnhighlight(entitiesToUnhighlight);
|
|
10628
|
-
this.applyHighlight(entitiesToHighlight);
|
|
10629
|
-
// Request one render after all updates
|
|
10630
|
-
this.viewer.scene.requestRender();
|
|
10631
|
-
}
|
|
10632
|
-
// Apply Unhighlight in batch
|
|
10633
|
-
applyUnhighlight(entityIds) {
|
|
10634
|
-
if (entityIds.size === 0)
|
|
10635
|
-
return;
|
|
10636
|
-
const unhighlightBatch = [];
|
|
10637
|
-
for (const id of entityIds) {
|
|
10638
|
-
const regos = this.rego[id];
|
|
10639
|
-
if (!regos)
|
|
10640
|
-
continue;
|
|
10641
|
-
for (const rego of regos) {
|
|
10642
|
-
unhighlightBatch.push(rego.visual);
|
|
10643
|
-
}
|
|
10644
|
-
}
|
|
10645
|
-
for (const entity of unhighlightBatch) {
|
|
10646
|
-
CesiumEntityStyler.Unhighlight({
|
|
10647
|
-
entity,
|
|
10648
|
-
viewer: this.viewer,
|
|
10649
|
-
requestRender: false
|
|
10650
|
-
});
|
|
10651
|
-
}
|
|
10652
|
-
}
|
|
10653
|
-
// Apply Highlight in batch
|
|
10654
|
-
applyHighlight(entityIds) {
|
|
10655
|
-
if (entityIds.size === 0)
|
|
10656
|
-
return;
|
|
10657
|
-
const highlightBatch = [];
|
|
10658
|
-
for (const id of entityIds) {
|
|
10532
|
+
// Revert needed visual changes.
|
|
10533
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
10534
|
+
const id = entityIds[i];
|
|
10659
10535
|
const regos = this.rego[id];
|
|
10660
|
-
if (
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10536
|
+
if (regos) {
|
|
10537
|
+
for (let i = 0; i < regos.length; i++) {
|
|
10538
|
+
const rego = regos[i];
|
|
10539
|
+
CesiumEntityStyler.Unhighlight({
|
|
10540
|
+
entity: rego.visual,
|
|
10541
|
+
viewer: this.viewer,
|
|
10542
|
+
requestRender: false
|
|
10543
|
+
});
|
|
10544
|
+
}
|
|
10664
10545
|
}
|
|
10665
10546
|
}
|
|
10666
|
-
|
|
10667
|
-
CesiumEntityStyler.Highlight({
|
|
10668
|
-
entity,
|
|
10669
|
-
viewer: this.viewer,
|
|
10670
|
-
requestRender: false
|
|
10671
|
-
});
|
|
10672
|
-
}
|
|
10673
|
-
}
|
|
10674
|
-
// Clear all highlighted entities
|
|
10675
|
-
ClearHighlighted(params) {
|
|
10676
|
-
// Get all currently highlighted entities from states
|
|
10677
|
-
const currentlyHighlighted = this.getCurrentlyHighlightedEntities();
|
|
10678
|
-
this.applyUnhighlight(currentlyHighlighted);
|
|
10679
|
-
if ((params === null || params === void 0 ? void 0 : params.requestRender) !== false) {
|
|
10547
|
+
if ((params === null || params === void 0 ? void 0 : params.requestRender) != false) {
|
|
10680
10548
|
this.viewer.scene.requestRender();
|
|
10681
10549
|
}
|
|
10682
10550
|
}
|
|
@@ -11178,7 +11046,7 @@ var VisualsRegister;
|
|
|
11178
11046
|
}
|
|
11179
11047
|
ClearOpacity(params) {
|
|
11180
11048
|
const clearedIds = [];
|
|
11181
|
-
this.ForEachState((state
|
|
11049
|
+
this.ForEachState((state) => {
|
|
11182
11050
|
if (!clearedIds.includes(state.entityId) && state.opacity != null) {
|
|
11183
11051
|
this.queueUpdate({
|
|
11184
11052
|
entityId: state.entityId,
|
|
@@ -28477,7 +28345,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
28477
28345
|
}
|
|
28478
28346
|
}
|
|
28479
28347
|
|
|
28480
|
-
const VERSION = "4.9.
|
|
28348
|
+
const VERSION = "4.9.3";
|
|
28481
28349
|
|
|
28482
28350
|
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, 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 };
|
|
28483
28351
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|