bruce-cesium 7.8.6 → 7.8.8
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 +199 -8
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +197 -6
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/internal/cesium-patch-pick-ground.js +56 -0
- package/dist/lib/internal/cesium-patch-pick-ground.js.map +1 -0
- package/dist/lib/internal/cesium-patch-pick-lighting.js +51 -0
- package/dist/lib/internal/cesium-patch-pick-lighting.js.map +1 -0
- package/dist/lib/rendering/render-managers/common/entity-label-group.js +52 -2
- package/dist/lib/rendering/render-managers/common/entity-label-group.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +13 -3
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +32 -0
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/viewer/viewer-utils.js +4 -0
- package/dist/lib/viewer/viewer-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/internal/cesium-patch-pick-ground.d.ts +8 -0
- package/dist/types/internal/cesium-patch-pick-lighting.d.ts +8 -0
- package/dist/types/rendering/render-managers/common/entity-label-group.d.ts +11 -0
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +5 -0
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
|
-
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature,
|
|
3
|
-
import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Api, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords,
|
|
2
|
+
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, JulianDate, Quaternion, HeadingPitchRoll, HeightReference, ConstantPositionProperty, DistanceDisplayCondition, ColorBlendMode, Model, ClassificationType, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, FeatureDetection, Matrix3, NearFarScalar, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, Intersect, ShadowMode, CustomDataSource, WebGLConstants, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, GeometryInstance, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, Event, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CzmlDataSource } from 'cesium';
|
|
3
|
+
import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Api, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, BruceApi, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -9689,6 +9689,11 @@ var EntityLabel;
|
|
|
9689
9689
|
if (!entityIds.length) {
|
|
9690
9690
|
return;
|
|
9691
9691
|
}
|
|
9692
|
+
if (this.options.reportClick) {
|
|
9693
|
+
const keys = event;
|
|
9694
|
+
this.visualRegister.ClickLabelEntities(entityIds, Boolean(keys.ctrlKey || keys.metaKey || keys.shiftKey));
|
|
9695
|
+
return;
|
|
9696
|
+
}
|
|
9692
9697
|
this.visualRegister.ClearSelected({ requestRender: false });
|
|
9693
9698
|
this.visualRegister.SetSelected({ entityIds, selected: true });
|
|
9694
9699
|
};
|
|
@@ -10359,7 +10364,7 @@ var EntityLabel;
|
|
|
10359
10364
|
let displacement = { x: 0, y: 0 };
|
|
10360
10365
|
let nudge = { x: 0, y: 0, fromX: 0, fromY: 0, targetX: 0, targetY: 0, start: 0 };
|
|
10361
10366
|
const apply = (placement) => {
|
|
10362
|
-
var _a, _b, _c, _d, _e;
|
|
10367
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10363
10368
|
const show = (placement === null || placement === void 0 ? void 0 : placement.visible) && placement.opacity > 0;
|
|
10364
10369
|
if (!show && hiddenLast) {
|
|
10365
10370
|
return;
|
|
@@ -10420,6 +10425,11 @@ var EntityLabel;
|
|
|
10420
10425
|
ele.style.opacity = String(opacity);
|
|
10421
10426
|
ele.style.zIndex = String(placement.zIndex);
|
|
10422
10427
|
ele.dataset.clusterCount = String(placement.members.length || 1);
|
|
10428
|
+
// Every Entity a cluster stands for, so a box selection takes them all, not only the one drawn.
|
|
10429
|
+
const clusterIds = placement.members.length ? placement.entityIds.join(" ") : "";
|
|
10430
|
+
if (((_d = ele.dataset.clusterIds) !== null && _d !== void 0 ? _d : "") !== clusterIds) {
|
|
10431
|
+
ele.dataset.clusterIds = clusterIds;
|
|
10432
|
+
}
|
|
10423
10433
|
countElement.style.display = placement.members.length ? "block" : "none";
|
|
10424
10434
|
countElement.style.order = placement.textSide === "left" ? "-1" : "0";
|
|
10425
10435
|
const count = placement.members.length ? String(placement.members.length) : "";
|
|
@@ -10432,9 +10442,9 @@ var EntityLabel;
|
|
|
10432
10442
|
const stack = JSON.stringify(placement.icons || []);
|
|
10433
10443
|
if (iconStack && stack !== displayedStack) {
|
|
10434
10444
|
displayedStack = stack;
|
|
10435
|
-
const looks = ((
|
|
10445
|
+
const looks = ((_e = placement.icons) === null || _e === void 0 ? void 0 : _e.length) ? [iconLook(this.options), ...placement.icons] : [];
|
|
10436
10446
|
// One small size for all, so no icon in the arrangement reads as more important than another.
|
|
10437
|
-
const size = (this.options.iconSize || 24) * ((
|
|
10447
|
+
const size = (this.options.iconSize || 24) * ((_f = this.options.iconScale) !== null && _f !== void 0 ? _f : 1) * ICON_STACK_SCALE;
|
|
10438
10448
|
const built = looks.map(look => this.buildIcon({ ...(pin ? pinLook(look) : look), iconSize: size }, counter));
|
|
10439
10449
|
// A stack is on show already, so its photos load straight away.
|
|
10440
10450
|
built.forEach(({ start }) => start === null || start === void 0 ? void 0 : start());
|
|
@@ -11444,6 +11454,10 @@ var EntityLabelGroup;
|
|
|
11444
11454
|
this.imagesAsking = new Set();
|
|
11445
11455
|
this.imagesTimer = null;
|
|
11446
11456
|
this.placesInteractive = false;
|
|
11457
|
+
// Whether a click on an Entity label is reported to the app instead of selecting the Entity.
|
|
11458
|
+
this.entitiesInteractive = false;
|
|
11459
|
+
// The Entity labels the app has picked, by group, drawn with the same glow as a picked place.
|
|
11460
|
+
this.selectedEntities = new Map();
|
|
11447
11461
|
}
|
|
11448
11462
|
notify() {
|
|
11449
11463
|
try {
|
|
@@ -11646,6 +11660,42 @@ var EntityLabelGroup;
|
|
|
11646
11660
|
}
|
|
11647
11661
|
this.refresh(keys);
|
|
11648
11662
|
}
|
|
11663
|
+
/*
|
|
11664
|
+
* Whether a click on an Entity label is reported to the app rather than selecting its Entity.
|
|
11665
|
+
*/
|
|
11666
|
+
SetEntitiesInteractive(on) {
|
|
11667
|
+
if (this.entitiesInteractive === on) {
|
|
11668
|
+
return;
|
|
11669
|
+
}
|
|
11670
|
+
this.entitiesInteractive = on;
|
|
11671
|
+
const keys = new Set();
|
|
11672
|
+
for (const group of this.active.values()) {
|
|
11673
|
+
for (const [key, item] of group.items) {
|
|
11674
|
+
if (!item.placeId) {
|
|
11675
|
+
keys.add(key);
|
|
11676
|
+
}
|
|
11677
|
+
}
|
|
11678
|
+
}
|
|
11679
|
+
this.refresh(keys);
|
|
11680
|
+
}
|
|
11681
|
+
/*
|
|
11682
|
+
* Replaces which of a group's Entity labels glow as picked, redrawing only those that changed.
|
|
11683
|
+
*/
|
|
11684
|
+
SetSelectedEntities(id, entityIds) {
|
|
11685
|
+
var _a;
|
|
11686
|
+
const before = (_a = this.selectedEntities.get(id)) !== null && _a !== void 0 ? _a : new Set();
|
|
11687
|
+
const after = new Set((entityIds !== null && entityIds !== void 0 ? entityIds : []).filter(key => typeof key === "string" && key && !IsPlaceKey(key)));
|
|
11688
|
+
const changed = new Set([...before, ...after].filter(key => before.has(key) !== after.has(key)));
|
|
11689
|
+
if (after.size) {
|
|
11690
|
+
this.selectedEntities.set(id, after);
|
|
11691
|
+
}
|
|
11692
|
+
else {
|
|
11693
|
+
this.selectedEntities.delete(id);
|
|
11694
|
+
}
|
|
11695
|
+
if (changed.size && this.active.has(id)) {
|
|
11696
|
+
this.refresh(changed);
|
|
11697
|
+
}
|
|
11698
|
+
}
|
|
11649
11699
|
Get() {
|
|
11650
11700
|
return Array.from(this.definitions.keys(), id => {
|
|
11651
11701
|
var _a;
|
|
@@ -11696,7 +11746,7 @@ var EntityLabelGroup;
|
|
|
11696
11746
|
* One member's label settings, with any image its own text links to but before its default image.
|
|
11697
11747
|
*/
|
|
11698
11748
|
compose(group, entityId, menuItemId) {
|
|
11699
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
11749
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
11700
11750
|
const item = group.items.get(entityId);
|
|
11701
11751
|
const entity = (_a = item.entity) !== null && _a !== void 0 ? _a : { Bruce: { ID: entityId, Name: item.text } };
|
|
11702
11752
|
let iconPriority = (_b = group.definition.options) === null || _b === void 0 ? void 0 : _b.iconPriority;
|
|
@@ -11754,6 +11804,13 @@ var EntityLabelGroup;
|
|
|
11754
11804
|
options.iconClass = named.iconClass;
|
|
11755
11805
|
options.iconUrl = named.iconUrl;
|
|
11756
11806
|
}
|
|
11807
|
+
if (!item.placeId && this.entitiesInteractive) {
|
|
11808
|
+
options.selectOnClick = true;
|
|
11809
|
+
options.reportClick = true;
|
|
11810
|
+
}
|
|
11811
|
+
if (!item.placeId && ((_r = this.selectedEntities.get(group.definition.id)) === null || _r === void 0 ? void 0 : _r.has(entityId))) {
|
|
11812
|
+
options.highlightColor = PLACE_SELECTED_COLOR;
|
|
11813
|
+
}
|
|
11757
11814
|
if (item.placeId) {
|
|
11758
11815
|
// Clickable only when the app asks, and reported then, as there is no Entity to select.
|
|
11759
11816
|
options.selectOnClick = this.placesInteractive;
|
|
@@ -11776,7 +11833,7 @@ var EntityLabelGroup;
|
|
|
11776
11833
|
}
|
|
11777
11834
|
if (options.attributes && item.entity && !(expression && resolvedText != null)) {
|
|
11778
11835
|
options.text = [
|
|
11779
|
-
(
|
|
11836
|
+
(_u = (_s = options.text) !== null && _s !== void 0 ? _s : (_t = item.entity.Bruce) === null || _t === void 0 ? void 0 : _t.Name) !== null && _u !== void 0 ? _u : entityId,
|
|
11780
11837
|
...options.attributes.map(path => Entity$1.GetValue({ entity: item.entity, path })).filter(value => value != null).map(String)
|
|
11781
11838
|
].join("\n");
|
|
11782
11839
|
}
|
|
@@ -11938,6 +11995,7 @@ var EntityLabelGroup;
|
|
|
11938
11995
|
Remove(id) {
|
|
11939
11996
|
var _a;
|
|
11940
11997
|
const known = this.definitions.delete(id);
|
|
11998
|
+
this.selectedEntities.delete(id);
|
|
11941
11999
|
this.visibility.delete(id);
|
|
11942
12000
|
this.errors.delete(id);
|
|
11943
12001
|
(_a = this.pending.get(id)) === null || _a === void 0 ? void 0 : _a.abort();
|
|
@@ -11970,6 +12028,7 @@ var EntityLabelGroup;
|
|
|
11970
12028
|
this.active.clear();
|
|
11971
12029
|
this.members.clear();
|
|
11972
12030
|
this.definitions.clear();
|
|
12031
|
+
this.selectedEntities.clear();
|
|
11973
12032
|
this.visibility.clear();
|
|
11974
12033
|
this.errors.clear();
|
|
11975
12034
|
this.refresh(affected);
|
|
@@ -11989,6 +12048,7 @@ var EntityLabelGroup;
|
|
|
11989
12048
|
this.active.clear();
|
|
11990
12049
|
this.members.clear();
|
|
11991
12050
|
this.definitions.clear();
|
|
12051
|
+
this.selectedEntities.clear();
|
|
11992
12052
|
this.visibility.clear();
|
|
11993
12053
|
this.errors.clear();
|
|
11994
12054
|
}
|
|
@@ -13927,6 +13987,7 @@ var VisualsRegister;
|
|
|
13927
13987
|
}
|
|
13928
13988
|
get OnLabelGroupsChanged() { return this.labelGroupsChanged; }
|
|
13929
13989
|
get OnLabelPlaceClick() { return this.labelPlaceClicked; }
|
|
13990
|
+
get OnLabelEntityClick() { return this.labelEntityClicked; }
|
|
13930
13991
|
constructor(params) {
|
|
13931
13992
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13932
13993
|
this.id = ObjectUtils.UId();
|
|
@@ -13981,6 +14042,7 @@ var VisualsRegister;
|
|
|
13981
14042
|
this.shadowsRemoval = null;
|
|
13982
14043
|
this.labelGroupsChanged = new BruceEvent();
|
|
13983
14044
|
this.labelPlaceClicked = new BruceEvent();
|
|
14045
|
+
this.labelEntityClicked = new BruceEvent();
|
|
13984
14046
|
this.hoverRingState = {};
|
|
13985
14047
|
this.retiringHoverLabels = new Map();
|
|
13986
14048
|
/*
|
|
@@ -14981,6 +15043,7 @@ var VisualsRegister;
|
|
|
14981
15043
|
(_c = this.labelGroups) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
14982
15044
|
this.labelGroupsChanged.Clear();
|
|
14983
15045
|
this.labelPlaceClicked.Clear();
|
|
15046
|
+
this.labelEntityClicked.Clear();
|
|
14984
15047
|
for (const regos of Object.values(this.rego)) {
|
|
14985
15048
|
for (const rego of regos)
|
|
14986
15049
|
EntityLabel.Detatch({ rego, force: true });
|
|
@@ -16776,6 +16839,35 @@ var VisualsRegister;
|
|
|
16776
16839
|
this.labelPlaceClicked.Trigger({ places, additive });
|
|
16777
16840
|
}
|
|
16778
16841
|
}
|
|
16842
|
+
/*
|
|
16843
|
+
* Whether Entity label clicks go to OnLabelEntityClick rather than selecting. Off by default.
|
|
16844
|
+
*/
|
|
16845
|
+
SetLabelEntitiesInteractive(on) {
|
|
16846
|
+
if (this.disposed) {
|
|
16847
|
+
return;
|
|
16848
|
+
}
|
|
16849
|
+
if (!this.labelGroups) {
|
|
16850
|
+
this.labelGroups = new EntityLabelGroup.Manager(this, () => this.labelGroupsChanged.Trigger(undefined));
|
|
16851
|
+
}
|
|
16852
|
+
this.labelGroups.SetEntitiesInteractive(on);
|
|
16853
|
+
}
|
|
16854
|
+
/*
|
|
16855
|
+
* Called by a label clicked while Entity labels are interactive, with the Entities it stands for.
|
|
16856
|
+
*/
|
|
16857
|
+
ClickLabelEntities(entityIds, additive) {
|
|
16858
|
+
const labels = entityIds.map(entityId => { var _a; return ({ groupId: (_a = this.GetLabelGroupFor(entityId)) === null || _a === void 0 ? void 0 : _a.groupId, entityId }); })
|
|
16859
|
+
.filter(label => label.groupId);
|
|
16860
|
+
if (labels.length) {
|
|
16861
|
+
this.labelEntityClicked.Trigger({ labels, additive });
|
|
16862
|
+
}
|
|
16863
|
+
}
|
|
16864
|
+
/*
|
|
16865
|
+
* Which of a group's Entity labels glow as picked by the app.
|
|
16866
|
+
*/
|
|
16867
|
+
SetLabelGroupSelected(id, entityIds) {
|
|
16868
|
+
var _a;
|
|
16869
|
+
(_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.SetSelectedEntities(id, entityIds);
|
|
16870
|
+
}
|
|
16779
16871
|
/*
|
|
16780
16872
|
* Replaces a group's places without reading its source again. False when no such group was set.
|
|
16781
16873
|
*/
|
|
@@ -48782,6 +48874,103 @@ class WidgetNavCompass$$1 extends Widget.AWidget {
|
|
|
48782
48874
|
}
|
|
48783
48875
|
}
|
|
48784
48876
|
|
|
48877
|
+
/*
|
|
48878
|
+
* Keeps glTF and 3D Tiles pickable where a GPU shader compiler mangles CesiumJS's lit pick shaders.
|
|
48879
|
+
*/
|
|
48880
|
+
const PICK_LIGHTING_PATCH_KEY = "_nextspacePickLightingPatch";
|
|
48881
|
+
// Added by CesiumJS's ImageBasedLightingPipelineStage; every use in its shaders sits behind an #ifdef.
|
|
48882
|
+
const IBL_DEFINE = "USE_IBL_LIGHTING";
|
|
48883
|
+
/**
|
|
48884
|
+
* Removes image based lighting from a derived "pick" shader's fragment options, returning whether it did.
|
|
48885
|
+
*/
|
|
48886
|
+
function StripPickLighting(keyword, options) {
|
|
48887
|
+
const fragment = options === null || options === void 0 ? void 0 : options.fragmentShaderSource;
|
|
48888
|
+
const defines = fragment === null || fragment === void 0 ? void 0 : fragment.defines;
|
|
48889
|
+
if (keyword !== "pick" ||
|
|
48890
|
+
!Array.isArray(defines) ||
|
|
48891
|
+
!defines.includes(IBL_DEFINE)) {
|
|
48892
|
+
return false;
|
|
48893
|
+
}
|
|
48894
|
+
fragment.defines = defines.filter(x => x !== IBL_DEFINE);
|
|
48895
|
+
return true;
|
|
48896
|
+
}
|
|
48897
|
+
/**
|
|
48898
|
+
* Compiles a viewer's pick shaders unlit, since NVIDIA via ANGLE (Edge 155, CesiumJS 1.120) drops every lit pick.
|
|
48899
|
+
*/
|
|
48900
|
+
function InstallPickLightingPatch(viewer) {
|
|
48901
|
+
var _a, _b;
|
|
48902
|
+
const cache = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.shaderCache;
|
|
48903
|
+
if (!cache || typeof cache.createDerivedShaderProgram !== "function") {
|
|
48904
|
+
return false;
|
|
48905
|
+
}
|
|
48906
|
+
if (cache[PICK_LIGHTING_PATCH_KEY]) {
|
|
48907
|
+
return true;
|
|
48908
|
+
}
|
|
48909
|
+
const original = cache.createDerivedShaderProgram;
|
|
48910
|
+
cache.createDerivedShaderProgram = function (shaderProgram, keyword, options) {
|
|
48911
|
+
try {
|
|
48912
|
+
StripPickLighting(keyword, options);
|
|
48913
|
+
}
|
|
48914
|
+
catch (e) {
|
|
48915
|
+
console.error("Failed to strip lighting from a pick shader.", e);
|
|
48916
|
+
}
|
|
48917
|
+
return original.call(this, shaderProgram, keyword, options);
|
|
48918
|
+
};
|
|
48919
|
+
cache[PICK_LIGHTING_PATCH_KEY] = true;
|
|
48920
|
+
return true;
|
|
48921
|
+
}
|
|
48922
|
+
|
|
48923
|
+
/*
|
|
48924
|
+
* Makes a click on a ground clamped polygon pick that polygon rather than another one batched with it.
|
|
48925
|
+
*/
|
|
48926
|
+
const PICK_GROUND_PATCH_KEY = "_nextspacePickGroundPatch";
|
|
48927
|
+
// Before CesiumJS 1.135 this keeps any pick fragment over the globe, so far batched polygons win the pick.
|
|
48928
|
+
const BROKEN_CULL = "uv.y <= 1.0 || logDepthOrDepth != 0.0)";
|
|
48929
|
+
// The same test the render path uses: the ground under the pixel lies within this polygon's extents.
|
|
48930
|
+
const FIXED_CULL = "uv.y <= 1.0 && logDepthOrDepth != 0.0)";
|
|
48931
|
+
/**
|
|
48932
|
+
* Corrects the extents cull in a ground primitive pick shader's fragment options, returning whether it did.
|
|
48933
|
+
*/
|
|
48934
|
+
function FixPickGround(options) {
|
|
48935
|
+
const fragment = options === null || options === void 0 ? void 0 : options.fragmentShaderSource;
|
|
48936
|
+
const defines = fragment === null || fragment === void 0 ? void 0 : fragment.defines;
|
|
48937
|
+
const sources = fragment === null || fragment === void 0 ? void 0 : fragment.sources;
|
|
48938
|
+
if (!Array.isArray(defines) ||
|
|
48939
|
+
!Array.isArray(sources) ||
|
|
48940
|
+
!defines.includes("PICK") ||
|
|
48941
|
+
!defines.includes("CULL_FRAGMENTS") ||
|
|
48942
|
+
!sources.some(x => typeof x === "string" && x.includes(BROKEN_CULL))) {
|
|
48943
|
+
return false;
|
|
48944
|
+
}
|
|
48945
|
+
fragment.sources = sources.map(x => typeof x === "string" ? x.replace(BROKEN_CULL, FIXED_CULL) : x);
|
|
48946
|
+
return true;
|
|
48947
|
+
}
|
|
48948
|
+
/**
|
|
48949
|
+
* Patches a viewer's shader cache so batched ground clamped polygons pick only where they cover the ground.
|
|
48950
|
+
*/
|
|
48951
|
+
function InstallPickGroundPatch(viewer) {
|
|
48952
|
+
var _a, _b;
|
|
48953
|
+
const cache = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.scene) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.shaderCache;
|
|
48954
|
+
if (!cache || typeof cache.getShaderProgram !== "function") {
|
|
48955
|
+
return false;
|
|
48956
|
+
}
|
|
48957
|
+
if (cache[PICK_GROUND_PATCH_KEY]) {
|
|
48958
|
+
return true;
|
|
48959
|
+
}
|
|
48960
|
+
const original = cache.getShaderProgram;
|
|
48961
|
+
cache.getShaderProgram = function (options) {
|
|
48962
|
+
try {
|
|
48963
|
+
FixPickGround(options);
|
|
48964
|
+
}
|
|
48965
|
+
catch (e) {
|
|
48966
|
+
console.error("Failed to fix a ground pick shader.", e);
|
|
48967
|
+
}
|
|
48968
|
+
return original.call(this, options);
|
|
48969
|
+
};
|
|
48970
|
+
cache[PICK_GROUND_PATCH_KEY] = true;
|
|
48971
|
+
return true;
|
|
48972
|
+
}
|
|
48973
|
+
|
|
48785
48974
|
const CESIUM_VIEWER_MANAGER_KEY = "_cesiumViewerManager";
|
|
48786
48975
|
const CESIUM_VIEWER_EVENT_TRACKER_KEY = "_cesiumViewerEventTracker";
|
|
48787
48976
|
const BACKGROUND_RENDERING_KEY = "_backgroundRendering";
|
|
@@ -48867,6 +49056,8 @@ var ViewerUtils;
|
|
|
48867
49056
|
// Newer cesium is much dimmer by default so we shift brightness a bit.
|
|
48868
49057
|
ViewUtils.ApplyDefaultBrightness(viewer);
|
|
48869
49058
|
backgroundRendering(viewer);
|
|
49059
|
+
InstallPickLightingPatch(viewer);
|
|
49060
|
+
InstallPickGroundPatch(viewer);
|
|
48870
49061
|
if (cameraControls != false) {
|
|
48871
49062
|
CameraControls.Attach(viewer);
|
|
48872
49063
|
if (ViewUtils.GetModelSpace(viewer)) {
|
|
@@ -61068,7 +61259,7 @@ var StyleUtils;
|
|
|
61068
61259
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
61069
61260
|
})(StyleUtils || (StyleUtils = {}));
|
|
61070
61261
|
|
|
61071
|
-
const VERSION = "7.8.
|
|
61262
|
+
const VERSION = "7.8.8";
|
|
61072
61263
|
/**
|
|
61073
61264
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
61074
61265
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|