bruce-cesium 7.5.9 → 7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bruce-cesium.es5.js +58 -20
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +56 -18
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +55 -17
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +1 -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,
|
|
3
|
-
import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT,
|
|
2
|
+
import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ArcType, CornerType, SceneMode, IntersectionTests, Ray, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, Matrix3, NearFarScalar, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, GeometryInstance, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
|
|
3
|
+
import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1, EntityLod, EntityTag, EntityType, ObjectUtils, Style, UrlUtils, Api, Carto, Geometry as Geometry$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, BruceApi, EntityRelation, RecordChangeFeed, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Ensures a number is returned from a given value.
|
|
@@ -6436,6 +6436,22 @@ var EntityLabel;
|
|
|
6436
6436
|
return centre && half && (axes === null || axes === void 0 ? void 0 : axes.every(Boolean)) ? { centre, axes, half } : null;
|
|
6437
6437
|
}
|
|
6438
6438
|
EntityLabel.ReadOrientedBox = ReadOrientedBox;
|
|
6439
|
+
/*
|
|
6440
|
+
* Whether a placement turns what it places. Scale alone does not count.
|
|
6441
|
+
*/
|
|
6442
|
+
function isRotated(matrix) {
|
|
6443
|
+
for (let column = 0; column < 3; column++) {
|
|
6444
|
+
const axis = [0, 1, 2].map(row => Number(matrix[row][column]));
|
|
6445
|
+
const length = Math.hypot(...axis);
|
|
6446
|
+
if (!(length > 0)) {
|
|
6447
|
+
return false;
|
|
6448
|
+
}
|
|
6449
|
+
if (axis.some((value, row) => Math.abs(value / length - Number(row === column)) > 1e-5)) {
|
|
6450
|
+
return true;
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
return false;
|
|
6454
|
+
}
|
|
6439
6455
|
/*
|
|
6440
6456
|
* The eight padded world corners of an assembly Entity's geometry box, or null when the record cannot give one.
|
|
6441
6457
|
*
|
|
@@ -6454,6 +6470,10 @@ var EntityLabel;
|
|
|
6454
6470
|
if ((matrix === null || matrix === void 0 ? void 0 : matrix.length) !== 4 || !matrix.every(row => (row === null || row === void 0 ? void 0 : row.length) === 4) || !Number.isFinite(+(root === null || root === void 0 ? void 0 : root.latitude)) || !Number.isFinite(+(root === null || root === void 0 ? void 0 : root.longitude))) {
|
|
6455
6471
|
return null;
|
|
6456
6472
|
}
|
|
6473
|
+
// A pure translation can hide a rotation baked into the vertices, which leaves the extents loose.
|
|
6474
|
+
if (!shape && !isRotated(matrix)) {
|
|
6475
|
+
return null;
|
|
6476
|
+
}
|
|
6457
6477
|
const pivot = ((_c = bruce.GeometryPivot) === null || _c === void 0 ? void 0 : _c.length) >= 3 ? bruce.GeometryPivot.slice(0, 3).map(Number) : [0, 0, 0];
|
|
6458
6478
|
// Without an oriented box the record's own extents are an axis-aligned box about the pivot.
|
|
6459
6479
|
const box = shape || { centre: pivot, axes: [[1, 0, 0], [0, 1, 0], [0, 0, 1]], half: half };
|
|
@@ -7904,6 +7924,22 @@ var EntityLabel;
|
|
|
7904
7924
|
radius: Math.max(width, height) / 2
|
|
7905
7925
|
};
|
|
7906
7926
|
};
|
|
7927
|
+
/*
|
|
7928
|
+
* The on-screen centre and half-size of a model too small for its box, so the box is ringed like a glyph.
|
|
7929
|
+
*/
|
|
7930
|
+
const measureModel = (anchor) => {
|
|
7931
|
+
const hull = layer.modelBoxes.Hull(this.id);
|
|
7932
|
+
if (!(hull === null || hull === void 0 ? void 0 : hull.length)) {
|
|
7933
|
+
return null;
|
|
7934
|
+
}
|
|
7935
|
+
const xs = hull.map(point => point.x), ys = hull.map(point => point.y);
|
|
7936
|
+
const left = Math.min(...xs), top = Math.min(...ys);
|
|
7937
|
+
const width = Math.max(...xs) - left, height = Math.max(...ys) - top;
|
|
7938
|
+
if (Math.max(width, height) >= MODEL_BOX_MIN_SIZE) {
|
|
7939
|
+
return null;
|
|
7940
|
+
}
|
|
7941
|
+
return { x: left + width / 2 - anchor.x, y: top + height / 2 - anchor.y, radius: Math.max(width, height) / 2 };
|
|
7942
|
+
};
|
|
7907
7943
|
// Only CAD tilesets and model Entities are assembly parts with a geometry box; anything else stays a point.
|
|
7908
7944
|
const boxable = Boolean(normalLeader && ((_r = this.rego) === null || _r === void 0 ? void 0 : _r.entityId) && ((visual instanceof Cesium3DTileFeature && this.rego.tilesetType === Tileset.EType.Cad) ||
|
|
7909
7945
|
(visual instanceof Entity && Boolean(visual.model))));
|
|
@@ -7962,7 +7998,7 @@ var EntityLabel;
|
|
|
7962
7998
|
}
|
|
7963
7999
|
let cursorMotion = this.cursorMotion;
|
|
7964
8000
|
const project = () => {
|
|
7965
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
8001
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
7966
8002
|
if (this.disposed || !this.viewer || this.viewer.isDestroyed() || ((_a = this.visible) === null || _a === void 0 ? void 0 : _a.call(this)) === false ||
|
|
7967
8003
|
(presentation === "icon" && this.options.iconScale === 0)) {
|
|
7968
8004
|
return null;
|
|
@@ -8005,7 +8041,8 @@ var EntityLabel;
|
|
|
8005
8041
|
const boxBlend = this.morphToBox(boxed, shownOnce ? (_f = (_e = this.options.anchorRing) === null || _e === void 0 ? void 0 : _e.transitionDuration) !== null && _f !== void 0 ? _f : 200 : 0);
|
|
8006
8042
|
// Eased between the ring and where the stem meets the box, so gaining or losing a box never jumps.
|
|
8007
8043
|
const boxTarget = this.boxMorph.anchor;
|
|
8008
|
-
const
|
|
8044
|
+
const model = ((_g = this.modelBox) === null || _g === void 0 ? void 0 : _g.corners) ? measureModel(anchor) : null;
|
|
8045
|
+
const ringPoint = { x: anchor.x + (model || pixelOffset).x, y: anchor.y + (model || pixelOffset).y };
|
|
8009
8046
|
const boxAnchor = boxBlend > 0 && boxTarget ? {
|
|
8010
8047
|
x: ringPoint.x + (boxTarget.x - ringPoint.x) * boxBlend,
|
|
8011
8048
|
y: ringPoint.y + (boxTarget.y - ringPoint.y) * boxBlend
|
|
@@ -8016,13 +8053,13 @@ var EntityLabel;
|
|
|
8016
8053
|
return null;
|
|
8017
8054
|
if (onScreen && !this.imageAsked && this.groupId && !HasIcon(this.options) && !this.options.photo) {
|
|
8018
8055
|
this.imageAsked = true;
|
|
8019
|
-
(
|
|
8056
|
+
(_h = this.visualRegister) === null || _h === void 0 ? void 0 : _h.RequestLabelImage((_j = this.rego) === null || _j === void 0 ? void 0 : _j.entityId);
|
|
8020
8057
|
}
|
|
8021
8058
|
const transientPivot = (this.Transient && !this.Persistent ?
|
|
8022
|
-
(this.hoverFade.to === 0 ? this.retainedHoverPosition : (
|
|
8059
|
+
(this.hoverFade.to === 0 ? this.retainedHoverPosition : (_k = this.visualRegister) === null || _k === void 0 ? void 0 : _k.GetLabelHoverPosition((_l = this.rego) === null || _l === void 0 ? void 0 : _l.entityId, (_m = this.rego) === null || _m === void 0 ? void 0 : _m.menuItemId)) : undefined);
|
|
8023
8060
|
const hover = (presentation !== "icon" ?
|
|
8024
8061
|
(this.Transient && !this.Persistent && this.hoverFade.to === 0 ? this.retainedHoverPosition :
|
|
8025
|
-
(
|
|
8062
|
+
(_o = this.visualRegister) === null || _o === void 0 ? void 0 : _o.GetLabelHoverPosition((_p = this.rego) === null || _p === void 0 ? void 0 : _p.entityId, (_q = this.rego) === null || _q === void 0 ? void 0 : _q.menuItemId)) : undefined);
|
|
8026
8063
|
const reused = !this.Transient || this.Persistent;
|
|
8027
8064
|
const now = Date.now();
|
|
8028
8065
|
const animateCursor = () => {
|
|
@@ -8046,13 +8083,13 @@ var EntityLabel;
|
|
|
8046
8083
|
const cursorAmount = cursorMotion.amount;
|
|
8047
8084
|
leader = normalLeader || cursorAmount > 0;
|
|
8048
8085
|
// An icon keeps its callout centred on the glyph rather than following the cursor across it.
|
|
8049
|
-
const icon = boxAnchor ? null : measureIcon();
|
|
8086
|
+
const icon = boxAnchor ? null : measureIcon() || model;
|
|
8050
8087
|
const iconRing = icon ? Math.max(ICON_RING_MIN, icon.radius + ICON_RING_PADDING) : 0;
|
|
8051
8088
|
// A boxed model is pinned the same way, with its stem leaving the top of the box outline.
|
|
8052
8089
|
const pinned = Boolean(icon || boxAnchor);
|
|
8053
8090
|
const pivot = pinned ? undefined : transientPivot;
|
|
8054
|
-
let x = boxAnchor ? boxAnchor.x : ((
|
|
8055
|
-
let y = boxAnchor ? boxAnchor.y : ((
|
|
8091
|
+
let x = boxAnchor ? boxAnchor.x : ((_r = pivot === null || pivot === void 0 ? void 0 : pivot.x) !== null && _r !== void 0 ? _r : anchor.x) + (icon || pixelOffset).x;
|
|
8092
|
+
let y = boxAnchor ? boxAnchor.y : ((_s = pivot === null || pivot === void 0 ? void 0 : pivot.y) !== null && _s !== void 0 ? _s : anchor.y) + (icon || pixelOffset).y;
|
|
8056
8093
|
if (cursorAmount > 0 && !pinned) {
|
|
8057
8094
|
// A leader-less label starts centred on its anchor; preserve that box as it lifts away.
|
|
8058
8095
|
if (!normalLeader) {
|
|
@@ -8107,7 +8144,7 @@ var EntityLabel;
|
|
|
8107
8144
|
const width = ele.offsetWidth / coordinates.scaleX;
|
|
8108
8145
|
const height = ele.offsetHeight / coordinates.scaleY;
|
|
8109
8146
|
let clusterBounds;
|
|
8110
|
-
if ((
|
|
8147
|
+
if ((_t = this.options.cluster) === null || _t === void 0 ? void 0 : _t.enabled) {
|
|
8111
8148
|
const textWidth = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetWidth) || 0;
|
|
8112
8149
|
const textHeight = (sourceText === null || sourceText === void 0 ? void 0 : sourceText.offsetHeight) || 0;
|
|
8113
8150
|
// A photo is never part of the footprint, so its arrival cannot change which cluster a label joins.
|
|
@@ -8141,7 +8178,7 @@ var EntityLabel;
|
|
|
8141
8178
|
if (!leader && (bounds.x + bounds.width < 0 || bounds.y + bounds.height < 0 || bounds.x > this.viewer.canvas.clientWidth || bounds.y > this.viewer.canvas.clientHeight)) {
|
|
8142
8179
|
return null;
|
|
8143
8180
|
}
|
|
8144
|
-
const state = (
|
|
8181
|
+
const state = (_u = this.visualRegister) === null || _u === void 0 ? void 0 : _u.GetState({ entityId: (_v = this.rego) === null || _v === void 0 ? void 0 : _v.entityId, menuItemId: (_w = this.rego) === null || _w === void 0 ? void 0 : _w.menuItemId });
|
|
8145
8182
|
const opacity = this.prePositioned || hoverOnly || MAX_DISTANCE === Infinity ? 1 : 1 - distance / MAX_DISTANCE;
|
|
8146
8183
|
return {
|
|
8147
8184
|
canFlip: leader && presentation !== "icon", hasLeader: leader,
|
|
@@ -8149,9 +8186,9 @@ var EntityLabel;
|
|
|
8149
8186
|
transient: this.Transient || Boolean(hover) || cursorAmount > 0,
|
|
8150
8187
|
extendedGeometry: visual instanceof Entity && Boolean(visual.polygon || visual.polyline || visual.corridor),
|
|
8151
8188
|
viewportWidth: this.viewer.canvas.clientWidth,
|
|
8152
|
-
id: this.id, entityKey: ((
|
|
8153
|
-
entityId: (
|
|
8154
|
-
iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend,
|
|
8189
|
+
id: this.id, entityKey: ((_x = this.rego) === null || _x === void 0 ? void 0 : _x.entityId) ? JSON.stringify([this.rego.entityId, this.rego.menuItemId || "", this.Transient && !this.Persistent ? "hover" : ""]) : undefined,
|
|
8190
|
+
entityId: (_y = this.rego) === null || _y === void 0 ? void 0 : _y.entityId, group: this.groupId, x, y, width, height, anchorX, anchorY, depth, leaderLength, leaderRun, leaderSide, distance,
|
|
8191
|
+
iconRadius: icon === null || icon === void 0 ? void 0 : icon.radius, modelBox: boxed || undefined, boxBlend, follows: !pinned && Boolean(transientPivot || cursorMotion.target),
|
|
8155
8192
|
// Priority shows the hovered member individually without dragging its cluster along.
|
|
8156
8193
|
opacity: waiting ? 0 : opacity, priority: hover || cursorAmount > 0 || (state === null || state === void 0 ? void 0 : state.highlighted) ? 1 : 0, options: this.options, text: originalText, clusterBounds
|
|
8157
8194
|
};
|
|
@@ -8278,15 +8315,16 @@ var EntityLabel;
|
|
|
8278
8315
|
const normalRadius = (!leader || (ring === null || ring === void 0 ? void 0 : ring.enabled) === false ? 0 : Math.max(frame.distance <= ((_l = ring === null || ring === void 0 ? void 0 : ring.nearDistance) !== null && _l !== void 0 ? _l : 100) ? ((_m = ring === null || ring === void 0 ? void 0 : ring.nearRadius) !== null && _m !== void 0 ? _m : 10) : 0, hovered ? ((_o = ring === null || ring === void 0 ? void 0 : ring.hoverRadius) !== null && _o !== void 0 ? _o : (this.Transient && !this.Persistent ? 15.4 : 22)) : 0));
|
|
8279
8316
|
const targetRadius = normalRadius + (15.4 - normalRadius) * cursorMotion.amount;
|
|
8280
8317
|
// Around a glyph the ring keeps the glyph's size and only fades its stroke in, so it never covers the icon.
|
|
8281
|
-
|
|
8282
|
-
const
|
|
8318
|
+
// A ring around the cursor marks nothing, so a riding label keeps only its leader.
|
|
8319
|
+
const targetOuter = frame.follows ? 0 : iconRing || targetRadius || 2.5;
|
|
8320
|
+
const targetInner = frame.follows ? 0 : iconRing ? (targetRadius > 0 ? iconRing - 2 : iconRing) : Math.max(0, targetRadius - 2);
|
|
8283
8321
|
const now = Date.now();
|
|
8284
8322
|
const duration = (_p = ring === null || ring === void 0 ? void 0 : ring.transitionDuration) !== null && _p !== void 0 ? _p : 200;
|
|
8285
8323
|
const sharedRing = this.Transient && !this.Persistent && this.hoverFade.to === 1 ? this.hoverRingState : undefined;
|
|
8286
8324
|
let ringAnimation = sharedRing ? sharedRing.animation : this.ringAnimation;
|
|
8287
8325
|
if (!ringAnimation) {
|
|
8288
|
-
const outer = iconRing || 2.5;
|
|
8289
|
-
const inner = iconRing;
|
|
8326
|
+
const outer = frame.follows ? 0 : iconRing || 2.5;
|
|
8327
|
+
const inner = frame.follows ? 0 : iconRing;
|
|
8290
8328
|
ringAnimation = { target: outer, targetInner: inner, start: now, outer, inner, fromOuter: outer, fromInner: inner };
|
|
8291
8329
|
}
|
|
8292
8330
|
const animateRing = () => {
|
|
@@ -53396,7 +53434,7 @@ var StyleUtils;
|
|
|
53396
53434
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
53397
53435
|
})(StyleUtils || (StyleUtils = {}));
|
|
53398
53436
|
|
|
53399
|
-
const VERSION = "7.
|
|
53437
|
+
const VERSION = "7.6.1";
|
|
53400
53438
|
/**
|
|
53401
53439
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
53402
53440
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|