bruce-cesium 7.9.2 → 7.9.4
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 +451 -92
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +450 -89
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/displaced-surface-primitive.js +17 -0
- package/dist/lib/rendering/displaced-surface-primitive.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-model3d.js +10 -10
- package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-point.js +6 -6
- package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-polygon.js +30 -12
- package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-polyline.js +4 -4
- package/dist/lib/rendering/entity-render-engine-polyline.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +16 -2
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/menu-item-style-overlay.js +51 -11
- package/dist/lib/rendering/menu-item-style-overlay.js.map +1 -1
- package/dist/lib/rendering/menu-item-styles.js +9 -1
- package/dist/lib/rendering/menu-item-styles.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-styler.js +14 -9
- package/dist/lib/rendering/tileset-styler.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +36 -5
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/viewer/camera-controls.js +255 -27
- package/dist/lib/viewer/camera-controls.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/displaced-surface-primitive.d.ts +6 -2
- package/dist/types/rendering/menu-item-manager.d.ts +1 -0
- package/dist/types/rendering/menu-item-style-overlay.d.ts +22 -4
- package/dist/types/rendering/tileset-styler.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +11 -0
- package/dist/types/viewer/camera-controls.d.ts +11 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -1367,6 +1367,11 @@ void main()
|
|
|
1367
1367
|
const PUSH_NOTCHES_NOTHING_BELOW = 10;
|
|
1368
1368
|
// Pushes further apart than this start counting again.
|
|
1369
1369
|
const PUSH_WINDOW_MS = 1200;
|
|
1370
|
+
// How long after a zoom newly loaded terrain may lift the camera, and how much longer while loading.
|
|
1371
|
+
const SURFACE_HOLD_MS = 4000;
|
|
1372
|
+
const SURFACE_LOADING_MS = 30000;
|
|
1373
|
+
// No visible ground lies lower; a stand-in tileset below this is a coarse tile cutting under the curve.
|
|
1374
|
+
const GROUND_FLOOR = -500;
|
|
1370
1375
|
// How far below the ground something must reach to count as data underground, in metres.
|
|
1371
1376
|
const UNDERGROUND_MARGIN = 3;
|
|
1372
1377
|
// How long a scan of the scene for underground data and stand-in ground is trusted, in milliseconds.
|
|
@@ -1412,6 +1417,7 @@ void main()
|
|
|
1412
1417
|
push: { notches: 0, at: 0 },
|
|
1413
1418
|
scan: null,
|
|
1414
1419
|
undergroundOverride: null,
|
|
1420
|
+
surface: { above: false, through: false, until: 0, at: null },
|
|
1415
1421
|
saved: {
|
|
1416
1422
|
rotateEventTypes: controller.rotateEventTypes,
|
|
1417
1423
|
zoomEventTypes: controller.zoomEventTypes,
|
|
@@ -1436,7 +1442,10 @@ void main()
|
|
|
1436
1442
|
listen(window, "pointerup", (e) => onPointerUp(state, e));
|
|
1437
1443
|
listen(window, "pointercancel", (e) => onPointerUp(state, e));
|
|
1438
1444
|
listen(canvas, "wheel", (e) => onWheel(state, e), { passive: true });
|
|
1439
|
-
state.removals.push(scene.preUpdate.addEventListener(() =>
|
|
1445
|
+
state.removals.push(scene.preUpdate.addEventListener(() => {
|
|
1446
|
+
syncController(state);
|
|
1447
|
+
keepAboveGround(state);
|
|
1448
|
+
}));
|
|
1440
1449
|
syncController(state);
|
|
1441
1450
|
scene.requestRender();
|
|
1442
1451
|
}
|
|
@@ -1588,6 +1597,38 @@ void main()
|
|
|
1588
1597
|
const height = globe.getHeight(carto);
|
|
1589
1598
|
return Number.isFinite(height) ? height : undefined;
|
|
1590
1599
|
}
|
|
1600
|
+
/*
|
|
1601
|
+
* The ground's height at a place: the loaded terrain, or the tileset standing in for a hidden globe.
|
|
1602
|
+
*/
|
|
1603
|
+
function groundHeightAt(state, carto) {
|
|
1604
|
+
var _a;
|
|
1605
|
+
if (globeShown(state)) {
|
|
1606
|
+
return terrainHeightAt(state, carto);
|
|
1607
|
+
}
|
|
1608
|
+
const tileset = scanScene(state).ground;
|
|
1609
|
+
if (!carto || !tileset || ((_a = tileset.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(tileset)) || typeof tileset.getHeight !== "function") {
|
|
1610
|
+
return undefined;
|
|
1611
|
+
}
|
|
1612
|
+
try {
|
|
1613
|
+
// Only tiles drawn this frame answer, which near the camera are the finest loaded.
|
|
1614
|
+
const height = tileset.getHeight(carto, state.viewer.scene);
|
|
1615
|
+
return Number.isFinite(height) && height > GROUND_FLOOR ? height : undefined;
|
|
1616
|
+
}
|
|
1617
|
+
catch (e) {
|
|
1618
|
+
return undefined;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
/*
|
|
1622
|
+
* Whether the ground is still loading: the globe's tiles, or the stand-in tileset's.
|
|
1623
|
+
*/
|
|
1624
|
+
function groundLoading(state) {
|
|
1625
|
+
var _a;
|
|
1626
|
+
if (globeShown(state)) {
|
|
1627
|
+
return state.viewer.scene.globe.tilesLoaded === false;
|
|
1628
|
+
}
|
|
1629
|
+
const tileset = scanScene(state).ground;
|
|
1630
|
+
return Boolean(tileset && !((_a = tileset.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(tileset)) && tileset.tilesLoaded === false);
|
|
1631
|
+
}
|
|
1591
1632
|
function ellipsoidOf(state) {
|
|
1592
1633
|
var _a, _b;
|
|
1593
1634
|
return (_b = (_a = state.viewer.scene.globe) === null || _a === void 0 ? void 0 : _a.ellipsoid) !== null && _b !== void 0 ? _b : Cesium.Ellipsoid.WGS84;
|
|
@@ -1625,8 +1666,8 @@ void main()
|
|
|
1625
1666
|
if (!carto) {
|
|
1626
1667
|
return null;
|
|
1627
1668
|
}
|
|
1628
|
-
// Level with the
|
|
1629
|
-
const surface = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, (_a =
|
|
1669
|
+
// Level with the ground under the camera, not sea level, so a guess over high ground is not far too deep.
|
|
1670
|
+
const surface = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, (_a = groundHeightAt(state, carto)) !== null && _a !== void 0 ? _a : 0, ellipsoid);
|
|
1630
1671
|
return Cesium.Plane.fromPointNormal(surface, ellipsoid.geodeticSurfaceNormal(surface, new Cesium.Cartesian3()));
|
|
1631
1672
|
}
|
|
1632
1673
|
/*
|
|
@@ -1650,6 +1691,15 @@ void main()
|
|
|
1650
1691
|
// Directions around the centre, and how many must hold nearer pixels for the centre to be surrounded.
|
|
1651
1692
|
const GAP_SECTORS = 8;
|
|
1652
1693
|
const GAP_SECTORS_NEAR = 6;
|
|
1694
|
+
// How far around the cursor, in CSS pixels, nearer parts limit a zoom, and the most buffer pixels read.
|
|
1695
|
+
const CLEARANCE_RADIUS_PX = 24;
|
|
1696
|
+
const CLEARANCE_RADIUS_MAX = 64;
|
|
1697
|
+
// The share of that window that must be nearer, so a stray pixel or a thin cable does not slow the zoom.
|
|
1698
|
+
const CLEARANCE_SHARE = 0.05;
|
|
1699
|
+
// A pixel at least this share of the level ground's distance on its ray is ground, and never limits.
|
|
1700
|
+
const CLEARANCE_GROUND = 0.9;
|
|
1701
|
+
// A pan or orbit grabbing this many times farther than the reach grabs at the reach instead.
|
|
1702
|
+
const CLEARANCE_GRAB = 2;
|
|
1653
1703
|
const PACKED_DEPTH = new Cesium.Cartesian4(1, 1 / 255, 1 / 65025, 1 / 16581375);
|
|
1654
1704
|
/*
|
|
1655
1705
|
* Distances along the view axis drawn around a window position, rows bottom-up, Infinity where nothing is drawn.
|
|
@@ -1698,6 +1748,21 @@ void main()
|
|
|
1698
1748
|
}
|
|
1699
1749
|
return distances;
|
|
1700
1750
|
}
|
|
1751
|
+
/*
|
|
1752
|
+
* The depth window around a position for the gap search and the reach, or null when unreadable.
|
|
1753
|
+
*/
|
|
1754
|
+
function readWindow(scene, position) {
|
|
1755
|
+
const scale = scene.drawingBufferWidth / scene.canvas.clientWidth;
|
|
1756
|
+
const clearance = Math.min(Math.round(CLEARANCE_RADIUS_PX * (Number.isFinite(scale) ? scale : 1)), CLEARANCE_RADIUS_MAX);
|
|
1757
|
+
const radius = Math.max(GAP_RADII[GAP_RADII.length - 1], clearance);
|
|
1758
|
+
try {
|
|
1759
|
+
const distances = readDepthDistances(scene, position, radius);
|
|
1760
|
+
return distances ? { distances, radius } : null;
|
|
1761
|
+
}
|
|
1762
|
+
catch (e) {
|
|
1763
|
+
return null;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1701
1766
|
/*
|
|
1702
1767
|
* Offsets of the surface pixel around the centre for each radius where clearly nearer pixels surround it.
|
|
1703
1768
|
*/
|
|
@@ -1735,15 +1800,7 @@ void main()
|
|
|
1735
1800
|
/*
|
|
1736
1801
|
* The point cloud surface around a pick that looked through a gap between its points, or null when it did not.
|
|
1737
1802
|
*/
|
|
1738
|
-
function fillGap(scene, position, picked) {
|
|
1739
|
-
const radius = GAP_RADII[GAP_RADII.length - 1];
|
|
1740
|
-
let distances = null;
|
|
1741
|
-
try {
|
|
1742
|
-
distances = readDepthDistances(scene, position, radius);
|
|
1743
|
-
}
|
|
1744
|
-
catch (e) {
|
|
1745
|
-
return null;
|
|
1746
|
-
}
|
|
1803
|
+
function fillGap(scene, position, picked, distances, radius) {
|
|
1747
1804
|
if (!distances) {
|
|
1748
1805
|
return null;
|
|
1749
1806
|
}
|
|
@@ -1763,9 +1820,80 @@ void main()
|
|
|
1763
1820
|
return null;
|
|
1764
1821
|
}
|
|
1765
1822
|
/*
|
|
1766
|
-
* The
|
|
1823
|
+
* The view-axis distance within which a share of the window around the cursor is drawn, ground aside.
|
|
1824
|
+
*/
|
|
1825
|
+
function NearClearance(distances, radius, groundAt) {
|
|
1826
|
+
const width = 2 * radius + 1;
|
|
1827
|
+
const near = [];
|
|
1828
|
+
for (let dy = -radius; dy <= radius; dy++) {
|
|
1829
|
+
for (let dx = -radius; dx <= radius; dx++) {
|
|
1830
|
+
const distance = distances[(radius + dy) * width + (radius + dx)];
|
|
1831
|
+
if (!Number.isFinite(distance)) {
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
const ground = groundAt ? groundAt(dx, dy) : Infinity;
|
|
1835
|
+
if (!(ground > 0 && distance >= ground * CLEARANCE_GROUND)) {
|
|
1836
|
+
near.push(distance);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
const needed = Math.max(1, Math.ceil(width * width * CLEARANCE_SHARE));
|
|
1841
|
+
if (near.length < needed) {
|
|
1842
|
+
return Infinity;
|
|
1843
|
+
}
|
|
1844
|
+
near.sort((a, b) => a - b);
|
|
1845
|
+
return near[needed - 1];
|
|
1846
|
+
}
|
|
1847
|
+
/*
|
|
1848
|
+
* The level ground's view-axis distance through each window pixel, or null when there is no ground.
|
|
1849
|
+
*/
|
|
1850
|
+
function groundDistances(state, position) {
|
|
1851
|
+
const scene = state.viewer.scene;
|
|
1852
|
+
const camera = scene.camera;
|
|
1853
|
+
const frustum = camera.frustum;
|
|
1854
|
+
if (!(state.getModelSpaceFrame || hasGround(state)) ||
|
|
1855
|
+
typeof (frustum === null || frustum === void 0 ? void 0 : frustum.getPixelDimensions) !== "function") {
|
|
1856
|
+
return null;
|
|
1857
|
+
}
|
|
1858
|
+
const plane = groundPlane(state);
|
|
1859
|
+
if (!plane) {
|
|
1860
|
+
return null;
|
|
1861
|
+
}
|
|
1862
|
+
const width = scene.drawingBufferWidth;
|
|
1863
|
+
const height = scene.drawingBufferHeight;
|
|
1864
|
+
// The size of one buffer pixel one metre ahead, which turns a pixel offset into a ray direction.
|
|
1865
|
+
const pixel = frustum.getPixelDimensions(width, height, 1, 1, new Cesium.Cartesian2());
|
|
1866
|
+
const above = Cesium.Plane.getPointDistance(plane, camera.positionWC);
|
|
1867
|
+
const normal = plane.normal;
|
|
1868
|
+
const along = Cesium.Cartesian3.dot(camera.directionWC, normal);
|
|
1869
|
+
const right = Cesium.Cartesian3.dot(camera.rightWC, normal);
|
|
1870
|
+
const up = Cesium.Cartesian3.dot(camera.upWC, normal);
|
|
1871
|
+
// The cursor's offset from the centre in buffer pixels, rows bottom-up as the window's are.
|
|
1872
|
+
const x = Math.floor(position.x * width / scene.canvas.clientWidth) + 0.5 - width / 2;
|
|
1873
|
+
const y = height / 2 - Math.floor(position.y * height / scene.canvas.clientHeight) - 0.5;
|
|
1874
|
+
return (dx, dy) => {
|
|
1875
|
+
const rate = along + (x + dx) * pixel.x * right + (y + dy) * pixel.y * up;
|
|
1876
|
+
return rate < 0 ? -above / rate : Infinity;
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1879
|
+
/*
|
|
1880
|
+
* The point under a screen position, and how far a zoom toward it may go before passing parts beside it.
|
|
1767
1881
|
*/
|
|
1768
1882
|
function pickTarget(state, position) {
|
|
1883
|
+
const scene = state.viewer.scene;
|
|
1884
|
+
// Read before anything else picks, while the depth still holds the frame on screen.
|
|
1885
|
+
const depths = scene.pickPositionSupported ? readWindow(scene, position) : null;
|
|
1886
|
+
const target = pickPoint(state, position, depths);
|
|
1887
|
+
if (target && depths) {
|
|
1888
|
+
target.reach = NearClearance(depths.distances, depths.radius, groundDistances(state, position));
|
|
1889
|
+
target.reachFrom = Cesium.Cartesian3.clone(state.viewer.camera.positionWC);
|
|
1890
|
+
}
|
|
1891
|
+
return target;
|
|
1892
|
+
}
|
|
1893
|
+
/*
|
|
1894
|
+
* The point under a screen position: what is drawn there, else the ground plane, else a point at the last distance.
|
|
1895
|
+
*/
|
|
1896
|
+
function pickPoint(state, position, depths) {
|
|
1769
1897
|
const viewer = state.viewer;
|
|
1770
1898
|
const scene = viewer.scene;
|
|
1771
1899
|
const camera = viewer.camera;
|
|
@@ -1790,12 +1918,16 @@ void main()
|
|
|
1790
1918
|
}
|
|
1791
1919
|
const plausible = plausibleDistance(state);
|
|
1792
1920
|
// A click between point cloud points sees the background; turning or zooming about that throws the camera far off.
|
|
1793
|
-
const surface =
|
|
1921
|
+
const surface = depths ? fillGap(scene, position, ahead !== null && ahead !== void 0 ? ahead : null, depths.distances, depths.radius) : null;
|
|
1794
1922
|
if (isAhead(camera, surface) && Cesium.Cartesian3.distance(surface, camera.positionWC) < plausible) {
|
|
1795
1923
|
return { point: surface, source: "pick", ground: false };
|
|
1796
1924
|
}
|
|
1797
1925
|
if (isAhead(camera, picked) && Cesium.Cartesian3.distance(picked, camera.positionWC) < plausible) {
|
|
1798
|
-
|
|
1926
|
+
const ground = isGroundPick(state, position);
|
|
1927
|
+
// Right after a jump a stand-in tileset's coarse tiles cut far under the curve; use sea level.
|
|
1928
|
+
if (!ground || globeShown(state) || heightOf(state, picked) > GROUND_FLOOR) {
|
|
1929
|
+
return { point: picked, source: "pick", ground };
|
|
1930
|
+
}
|
|
1799
1931
|
}
|
|
1800
1932
|
const ground = groundPlane(state);
|
|
1801
1933
|
const onGround = ground ? Cesium.IntersectionTests.rayPlane(ray, ground) : null;
|
|
@@ -1897,8 +2029,8 @@ void main()
|
|
|
1897
2029
|
if (!picked) {
|
|
1898
2030
|
return;
|
|
1899
2031
|
}
|
|
1900
|
-
const target = picked.point;
|
|
1901
2032
|
const camera = viewer.camera;
|
|
2033
|
+
const target = kind === EDrag.Zoom ? picked.point : GrabPoint(camera, position, picked);
|
|
1902
2034
|
const distance = Cesium.Cartesian3.distance(camera.positionWC, target);
|
|
1903
2035
|
state.lastDistance = Math.max(distance, MIN_ZOOM_DISTANCE);
|
|
1904
2036
|
const drag = { kind, pointerId: e.pointerId, last: position, target, up: upAt(state, target), distance, picked };
|
|
@@ -1906,10 +2038,28 @@ void main()
|
|
|
1906
2038
|
drag.plane = panPlane(camera, target, drag.up);
|
|
1907
2039
|
}
|
|
1908
2040
|
else if (kind === EDrag.Zoom) {
|
|
2041
|
+
holdSurface(state);
|
|
1909
2042
|
drag.direction = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(target, camera.positionWC, new Cesium.Cartesian3()), new Cesium.Cartesian3());
|
|
1910
2043
|
}
|
|
1911
2044
|
state.drag = drag;
|
|
1912
2045
|
}
|
|
2046
|
+
/*
|
|
2047
|
+
* Where a pan or orbit takes hold: the pick, or beside the cursor when it looked far past parts there.
|
|
2048
|
+
*/
|
|
2049
|
+
function GrabPoint(camera, position, picked) {
|
|
2050
|
+
const reach = picked.reach;
|
|
2051
|
+
const ray = camera.getPickRay(position);
|
|
2052
|
+
if (!ray || reach == null || !Number.isFinite(reach)) {
|
|
2053
|
+
return picked.point;
|
|
2054
|
+
}
|
|
2055
|
+
const facing = Cesium.Cartesian3.dot(ray.direction, camera.directionWC);
|
|
2056
|
+
const depth = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(picked.point, camera.positionWC, new Cesium.Cartesian3()), camera.directionWC);
|
|
2057
|
+
if (facing <= 0 || depth <= reach * CLEARANCE_GRAB) {
|
|
2058
|
+
return picked.point;
|
|
2059
|
+
}
|
|
2060
|
+
// The reach is along the view axis, so the ray goes a little further to the same depth.
|
|
2061
|
+
return Cesium.Ray.getPoint(ray, Math.max(reach, MIN_ZOOM_DISTANCE) / facing);
|
|
2062
|
+
}
|
|
1913
2063
|
/*
|
|
1914
2064
|
* A level plane through the grabbed point, or one facing the camera when the level one is seen edge on.
|
|
1915
2065
|
*/
|
|
@@ -2058,6 +2208,7 @@ void main()
|
|
|
2058
2208
|
if (!target || !ray) {
|
|
2059
2209
|
return;
|
|
2060
2210
|
}
|
|
2211
|
+
holdSurface(state);
|
|
2061
2212
|
const step = zoomStep(state, ray.direction, target, notches);
|
|
2062
2213
|
Cesium.Cartesian3.add(state.pendingZoom, step, state.pendingZoom);
|
|
2063
2214
|
state.zoomPosition = Cesium.Cartesian3.clone(camera.position);
|
|
@@ -2086,6 +2237,8 @@ void main()
|
|
|
2086
2237
|
const step = Cesium.Cartesian3.multiplyByScalar(state.pendingZoom, share, new Cesium.Cartesian3());
|
|
2087
2238
|
Cesium.Cartesian3.subtract(state.pendingZoom, step, state.pendingZoom);
|
|
2088
2239
|
Cesium.Cartesian3.add(viewer.camera.position, step, viewer.camera.position);
|
|
2240
|
+
zoomMoved(state);
|
|
2241
|
+
keepAboveGround(state);
|
|
2089
2242
|
state.zoomPosition = Cesium.Cartesian3.clone(viewer.camera.position);
|
|
2090
2243
|
viewer.scene.requestRender();
|
|
2091
2244
|
if (share < 1) {
|
|
@@ -2095,6 +2248,7 @@ void main()
|
|
|
2095
2248
|
function moveAlong(state, direction, target, notches) {
|
|
2096
2249
|
const step = zoomStep(state, direction, target, notches);
|
|
2097
2250
|
Cesium.Cartesian3.add(state.viewer.camera.position, step, state.viewer.camera.position);
|
|
2251
|
+
zoomMoved(state);
|
|
2098
2252
|
}
|
|
2099
2253
|
/*
|
|
2100
2254
|
* The move for some notches toward a target along a direction, a share of the distance with a floor so it never stalls.
|
|
@@ -2104,7 +2258,14 @@ void main()
|
|
|
2104
2258
|
const target = picked.point;
|
|
2105
2259
|
// Where the camera will be once the glide already under way ends, which this step continues from.
|
|
2106
2260
|
const from = Cesium.Cartesian3.add(camera.positionWC, state.pendingZoom, new Cesium.Cartesian3());
|
|
2107
|
-
const
|
|
2261
|
+
const unit = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3());
|
|
2262
|
+
let distance = Cesium.Cartesian3.distance(from, target);
|
|
2263
|
+
// Between parts of a model, each step goes as far as it would on the nearest part around the cursor.
|
|
2264
|
+
if (picked.reach != null && picked.reachFrom) {
|
|
2265
|
+
const travelled = Cesium.Cartesian3.dot(Cesium.Cartesian3.subtract(from, picked.reachFrom, new Cesium.Cartesian3()), unit);
|
|
2266
|
+
distance = Math.min(distance, picked.reach - travelled);
|
|
2267
|
+
}
|
|
2268
|
+
distance = Math.max(distance, MIN_ZOOM_DISTANCE);
|
|
2108
2269
|
state.lastDistance = distance;
|
|
2109
2270
|
let length = distance * ZOOM_SHARE * notches * zoomSpeedShare(state, picked);
|
|
2110
2271
|
// A geospatial camera zooming out hands over to CesiumJS once it is high enough, so only model-space is capped.
|
|
@@ -2116,7 +2277,6 @@ void main()
|
|
|
2116
2277
|
return new Cesium.Cartesian3();
|
|
2117
2278
|
}
|
|
2118
2279
|
}
|
|
2119
|
-
const unit = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3());
|
|
2120
2280
|
// With the globe hidden there is no hand-over, so zooming out stops where the Earth is a dot.
|
|
2121
2281
|
if (length < 0 && !state.getModelSpaceFrame && !globeShown(state)) {
|
|
2122
2282
|
const rise = -Cesium.Cartesian3.dot(unit, upAt(state, from));
|
|
@@ -2132,15 +2292,14 @@ void main()
|
|
|
2132
2292
|
return length > 0 ? resistDescent(state, from, step, picked, notches) : step;
|
|
2133
2293
|
}
|
|
2134
2294
|
/*
|
|
2135
|
-
* How fast to zoom toward a target: slower toward a guess, or while the
|
|
2295
|
+
* How fast to zoom toward a target: slower toward a guess, or while the ground that would give a real one loads.
|
|
2136
2296
|
*/
|
|
2137
2297
|
function zoomSpeedShare(state, picked) {
|
|
2138
2298
|
let share = 1;
|
|
2139
2299
|
if (picked.source !== "pick") {
|
|
2140
2300
|
share *= ZOOM_GUESS_SHARE;
|
|
2141
2301
|
}
|
|
2142
|
-
|
|
2143
|
-
if (!state.getModelSpaceFrame && globeShown(state) && globe.tilesLoaded === false) {
|
|
2302
|
+
if (!state.getModelSpaceFrame && groundLoading(state)) {
|
|
2144
2303
|
share *= ZOOM_LOADING_SHARE;
|
|
2145
2304
|
}
|
|
2146
2305
|
return share;
|
|
@@ -2156,16 +2315,17 @@ void main()
|
|
|
2156
2315
|
if (picked === null || picked === void 0 ? void 0 : picked.ground) {
|
|
2157
2316
|
return { point: picked.point, up: upAt(state, picked.point) };
|
|
2158
2317
|
}
|
|
2159
|
-
if (!globeShown(state)) {
|
|
2160
|
-
return null;
|
|
2161
|
-
}
|
|
2162
2318
|
const ellipsoid = ellipsoidOf(state);
|
|
2163
2319
|
const end = Cesium.Cartesian3.add(from, step, new Cesium.Cartesian3());
|
|
2164
2320
|
const carto = ellipsoid.cartesianToCartographic(end);
|
|
2165
2321
|
if (!carto) {
|
|
2166
2322
|
return null;
|
|
2167
2323
|
}
|
|
2168
|
-
|
|
2324
|
+
// Unloaded terrain counts as sea level; an unknown stand-in tileset counts as nothing.
|
|
2325
|
+
const height = (_b = (_a = groundHeightAt(state, carto)) !== null && _a !== void 0 ? _a : groundHeightAt(state, ellipsoid.cartesianToCartographic(from))) !== null && _b !== void 0 ? _b : (globeShown(state) ? 0 : null);
|
|
2326
|
+
if (height == null) {
|
|
2327
|
+
return null;
|
|
2328
|
+
}
|
|
2169
2329
|
const point = Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, height, ellipsoid);
|
|
2170
2330
|
return { point, up: ellipsoid.geodeticSurfaceNormal(point, new Cesium.Cartesian3()) };
|
|
2171
2331
|
}
|
|
@@ -2215,12 +2375,77 @@ void main()
|
|
|
2215
2375
|
const needed = scanScene(state).undergroundData ? PUSH_NOTCHES_DATA_BELOW : PUSH_NOTCHES_NOTHING_BELOW;
|
|
2216
2376
|
if (state.push.notches >= needed) {
|
|
2217
2377
|
state.push.notches = 0;
|
|
2378
|
+
state.surface = { above: false, through: true, until: now + SURFACE_HOLD_MS, at: null };
|
|
2218
2379
|
// A shallow push would land far along the ground to get under it, so it goes no further than a usual step.
|
|
2219
2380
|
const through = Math.min((above + GROUND_BREAK_DEPTH) / sink, Math.max(length, (above + GROUND_BREAK_DEPTH) * 4));
|
|
2220
2381
|
return Cesium.Cartesian3.multiplyByScalar(unit, through, new Cesium.Cartesian3());
|
|
2221
2382
|
}
|
|
2222
2383
|
return Cesium.Cartesian3.multiplyByScalar(unit, toStandOff, new Cesium.Cartesian3());
|
|
2223
2384
|
}
|
|
2385
|
+
/*
|
|
2386
|
+
* The camera's height above the loaded ground under it, or undefined without ground or in model-space.
|
|
2387
|
+
*/
|
|
2388
|
+
function heightAboveGround(state) {
|
|
2389
|
+
if (state.getModelSpaceFrame || !hasGround(state)) {
|
|
2390
|
+
return undefined;
|
|
2391
|
+
}
|
|
2392
|
+
const carto = ellipsoidOf(state).cartesianToCartographic(state.viewer.camera.positionWC);
|
|
2393
|
+
const ground = carto ? groundHeightAt(state, carto) : undefined;
|
|
2394
|
+
return ground == null ? undefined : carto.height - ground;
|
|
2395
|
+
}
|
|
2396
|
+
/*
|
|
2397
|
+
* Notes whether the camera is above the ground as a zoom begins, unless it is being pushed through it.
|
|
2398
|
+
*/
|
|
2399
|
+
function holdSurface(state) {
|
|
2400
|
+
var _a;
|
|
2401
|
+
const now = Date.now();
|
|
2402
|
+
if (state.surface.through && now < state.surface.until) {
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
const at = Cesium.Cartesian3.clone(state.viewer.camera.positionWC);
|
|
2406
|
+
// Ground not loaded yet counts as sea level, as it does for a descent.
|
|
2407
|
+
const above = (_a = heightAboveGround(state)) !== null && _a !== void 0 ? _a : (hasGround(state) && !state.getModelSpaceFrame ? heightOf(state, at) : undefined);
|
|
2408
|
+
state.surface = { above: above != null && above > 0, through: false, until: now + SURFACE_HOLD_MS, at };
|
|
2409
|
+
}
|
|
2410
|
+
/*
|
|
2411
|
+
* Lifts a camera a zoom kept above the ground back over finer ground that loads in higher.
|
|
2412
|
+
*/
|
|
2413
|
+
function keepAboveGround(state) {
|
|
2414
|
+
const surface = state.surface;
|
|
2415
|
+
const now = Date.now();
|
|
2416
|
+
if (!surface.above || !state.ours || now > surface.until + SURFACE_LOADING_MS) {
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
// Ground that has finished loading does not move under a still camera.
|
|
2420
|
+
if (now > surface.until && !groundLoading(state)) {
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
const camera = state.viewer.camera;
|
|
2424
|
+
// A bookmark, fly-to or pan moved it since, which may mean to go below the ground.
|
|
2425
|
+
if (!surface.at || !Cesium.Cartesian3.equalsEpsilon(camera.positionWC, surface.at, 0, 1e-3)) {
|
|
2426
|
+
surface.above = false;
|
|
2427
|
+
return;
|
|
2428
|
+
}
|
|
2429
|
+
const above = heightAboveGround(state);
|
|
2430
|
+
if (above == null || above >= GROUND_STANDOFF / 2) {
|
|
2431
|
+
return;
|
|
2432
|
+
}
|
|
2433
|
+
const ellipsoid = ellipsoidOf(state);
|
|
2434
|
+
const carto = ellipsoid.cartesianToCartographic(camera.positionWC);
|
|
2435
|
+
Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, carto.height - above + GROUND_STANDOFF, ellipsoid, camera.position);
|
|
2436
|
+
// What is left of the glide would take it straight back down.
|
|
2437
|
+
state.pendingZoom = new Cesium.Cartesian3();
|
|
2438
|
+
surface.at = Cesium.Cartesian3.clone(camera.position);
|
|
2439
|
+
state.viewer.scene.requestRender();
|
|
2440
|
+
}
|
|
2441
|
+
/*
|
|
2442
|
+
* Notes where a zoom just put the camera, so the ground hold can tell its moves from others.
|
|
2443
|
+
*/
|
|
2444
|
+
function zoomMoved(state) {
|
|
2445
|
+
if (state.surface.at) {
|
|
2446
|
+
Cesium.Cartesian3.clone(state.viewer.camera.positionWC, state.surface.at);
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2224
2449
|
/*
|
|
2225
2450
|
* What the scene holds that the camera cares about, rescanned at most every couple of seconds.
|
|
2226
2451
|
*/
|
|
@@ -2231,7 +2456,7 @@ void main()
|
|
|
2231
2456
|
return applyOverride(state, state.scan);
|
|
2232
2457
|
}
|
|
2233
2458
|
const scene = state.viewer.scene;
|
|
2234
|
-
const found = { at: now, undergroundData: false, groundTileset: false };
|
|
2459
|
+
const found = { at: now, undergroundData: false, groundTileset: false, ground: null };
|
|
2235
2460
|
// Seeing through the ground is turned on to look at what is under it.
|
|
2236
2461
|
if ((_b = (_a = scene.globe) === null || _a === void 0 ? void 0 : _a.translucency) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
2237
2462
|
found.undergroundData = true;
|
|
@@ -2248,6 +2473,7 @@ void main()
|
|
|
2248
2473
|
}
|
|
2249
2474
|
if (primitive[GROUND_TILESET_KEY]) {
|
|
2250
2475
|
found.groundTileset = true;
|
|
2476
|
+
found.ground = primitive;
|
|
2251
2477
|
return;
|
|
2252
2478
|
}
|
|
2253
2479
|
if (!found.undergroundData && reachesBelowGround(state, lowestPointOf(primitive))) {
|
|
@@ -14288,7 +14514,7 @@ void main()
|
|
|
14288
14514
|
}
|
|
14289
14515
|
}
|
|
14290
14516
|
function updateEntity(viewer, entityId, register, refresh, cache = {}) {
|
|
14291
|
-
var _a, _b, _c;
|
|
14517
|
+
var _a, _b, _c, _d;
|
|
14292
14518
|
if (!entityId) {
|
|
14293
14519
|
// What are we doing?
|
|
14294
14520
|
return;
|
|
@@ -14375,7 +14601,8 @@ void main()
|
|
|
14375
14601
|
}
|
|
14376
14602
|
}
|
|
14377
14603
|
if (refresh === true || (refresh !== false && (refresh === null || refresh === void 0 ? void 0 : refresh.opacity))) {
|
|
14378
|
-
|
|
14604
|
+
// An Entity's own opacity wins over the one its menu item's bookmark style asks for.
|
|
14605
|
+
let effectiveOpacity = (_b = state.opacity) !== null && _b !== void 0 ? _b : register.GetMenuItemOpacity(rego.menuItemId);
|
|
14379
14606
|
if ((effectiveOpacity == null || effectiveOpacity == 1) && !state.isolated && visible) {
|
|
14380
14607
|
if (cache.isolationOpacity === undefined) {
|
|
14381
14608
|
cache.isolationOpacity = register.GetIsolationOpacity();
|
|
@@ -14406,14 +14633,14 @@ void main()
|
|
|
14406
14633
|
exports.EntityLabel.Attach({
|
|
14407
14634
|
rego,
|
|
14408
14635
|
viewer,
|
|
14409
|
-
api: (
|
|
14636
|
+
api: (_c = register.ApiGetters) === null || _c === void 0 ? void 0 : _c.GetBruceApi(),
|
|
14410
14637
|
visualRegister: register,
|
|
14411
14638
|
options: labelGroup ? labelGroup.options : register.GetLabelDefaults(),
|
|
14412
14639
|
groupId: labelGroup === null || labelGroup === void 0 ? void 0 : labelGroup.groupId,
|
|
14413
14640
|
persistent: true
|
|
14414
14641
|
});
|
|
14415
14642
|
}
|
|
14416
|
-
else if (!visible || ((
|
|
14643
|
+
else if (!visible || ((_d = exports.EntityLabel.GetLabel({ rego })) === null || _d === void 0 ? void 0 : _d.Persistent)) {
|
|
14417
14644
|
exports.EntityLabel.Detatch({
|
|
14418
14645
|
rego, force: true
|
|
14419
14646
|
});
|
|
@@ -14579,6 +14806,8 @@ void main()
|
|
|
14579
14806
|
// When no Menu Item ID is set, then the second key is a blank string.
|
|
14580
14807
|
// If an Entity ID state is set without a Menu Item ID, then it acts as a default for all Menu Items.
|
|
14581
14808
|
this.states = {};
|
|
14809
|
+
// Opacity a whole menu item is drawn at, from its bookmark style; never a saved state.
|
|
14810
|
+
this.menuItemOpacities = new Map();
|
|
14582
14811
|
// Queue of Entity updates to process in batches to avoid overloading the render loop.
|
|
14583
14812
|
this.updateQueue = [];
|
|
14584
14813
|
// Mirrors updateQueue for O(1) "already queued" checks.
|
|
@@ -15563,7 +15792,7 @@ void main()
|
|
|
15563
15792
|
return;
|
|
15564
15793
|
}
|
|
15565
15794
|
this.dimmingDirty = false;
|
|
15566
|
-
const dimming = Object.values(this.states).some(states => Object.values(states).some(state => state.isolated || (state.opacity != null && state.opacity < 1)));
|
|
15795
|
+
const dimming = Object.values(this.states).some(states => Object.values(states).some(state => state.isolated || (state.opacity != null && state.opacity < 1))) || this.menuItemOpacities.size > 0;
|
|
15567
15796
|
if (!exports.CesiumEntityStyler.SetDimming(this.viewer, this.id, dimming)) {
|
|
15568
15797
|
return;
|
|
15569
15798
|
}
|
|
@@ -17149,6 +17378,34 @@ void main()
|
|
|
17149
17378
|
}
|
|
17150
17379
|
return (totalOpacity && totalTicks) ? (totalOpacity / totalTicks) : totalOpacity != null && typeof totalOpacity == "number" ? totalOpacity : 1;
|
|
17151
17380
|
}
|
|
17381
|
+
/**
|
|
17382
|
+
* Draws every Entity of a menu item at this opacity unless it has its own; null puts them back.
|
|
17383
|
+
* It is not a visual state, so a Bookmark save does not store it per Entity.
|
|
17384
|
+
*/
|
|
17385
|
+
SetMenuItemOpacity(params) {
|
|
17386
|
+
var _a, _b, _c;
|
|
17387
|
+
const { menuItemId, opacity } = params;
|
|
17388
|
+
const wanted = typeof opacity === "number" && opacity >= 0 && opacity < 1 ? opacity : null;
|
|
17389
|
+
if (((_a = this.menuItemOpacities.get(menuItemId)) !== null && _a !== void 0 ? _a : null) === wanted) {
|
|
17390
|
+
return;
|
|
17391
|
+
}
|
|
17392
|
+
if (wanted == null) {
|
|
17393
|
+
this.menuItemOpacities.delete(menuItemId);
|
|
17394
|
+
}
|
|
17395
|
+
else {
|
|
17396
|
+
this.menuItemOpacities.set(menuItemId, wanted);
|
|
17397
|
+
}
|
|
17398
|
+
this.dimmingDirty = true;
|
|
17399
|
+
const entityIds = new Set(this.GetRegos({ menuItemId }).map(rego => rego.entityId).filter(Boolean));
|
|
17400
|
+
entityIds.forEach(entityId => this.queueUpdate({ entityId, refresh: { opacity: true } }));
|
|
17401
|
+
if (params.requestRender !== false) {
|
|
17402
|
+
(_c = (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.scene) === null || _c === void 0 ? void 0 : _c.requestRender();
|
|
17403
|
+
}
|
|
17404
|
+
}
|
|
17405
|
+
GetMenuItemOpacity(menuItemId) {
|
|
17406
|
+
var _a;
|
|
17407
|
+
return menuItemId ? ((_a = this.menuItemOpacities.get(menuItemId)) !== null && _a !== void 0 ? _a : null) : null;
|
|
17408
|
+
}
|
|
17152
17409
|
ClearOpacity(params) {
|
|
17153
17410
|
const clearedIds = new Set();
|
|
17154
17411
|
this.ForEachState((state) => {
|
|
@@ -17516,18 +17773,57 @@ void main()
|
|
|
17516
17773
|
BModels.MenuItem.EType.EntitiesLoaded,
|
|
17517
17774
|
BModels.MenuItem.EType.DataLab
|
|
17518
17775
|
];
|
|
17776
|
+
// The row every Entities render manager draws an item with when it names none.
|
|
17777
|
+
const DEFAULT_ZOOM_ROW = {
|
|
17778
|
+
MinZoom: 0,
|
|
17779
|
+
MaxZoom: 200000,
|
|
17780
|
+
DisplayType: BModels.ZoomControl.EDisplayType.Model3D,
|
|
17781
|
+
LODCategoryID: "glb",
|
|
17782
|
+
LODLevel: 0,
|
|
17783
|
+
StyleID: 0
|
|
17784
|
+
};
|
|
17785
|
+
// Instructions an overlay carries that are not style fields, so a merge never copies them onto a style.
|
|
17786
|
+
const INSTRUCTION_KEYS = ["types", "expandSources", "opacity"];
|
|
17519
17787
|
/**
|
|
17520
|
-
* Returns the base style with each field the overlay sets laid over it.
|
|
17788
|
+
* Returns the base style with each field the overlay sets laid over it, then its style for the Entity Type when given.
|
|
17521
17789
|
*/
|
|
17522
|
-
function Merge(base, overlay) {
|
|
17523
|
-
var _a
|
|
17790
|
+
function Merge(base, overlay, entityTypeId) {
|
|
17791
|
+
var _a;
|
|
17524
17792
|
if (!overlay) {
|
|
17525
17793
|
return base;
|
|
17526
17794
|
}
|
|
17527
|
-
const merged = { ...(base !== null && base !== void 0 ? base : {}) };
|
|
17795
|
+
const merged = layFields({ ...(base !== null && base !== void 0 ? base : {}) }, overlay);
|
|
17796
|
+
const typed = entityTypeId ? (_a = overlay.types) === null || _a === void 0 ? void 0 : _a[entityTypeId] : null;
|
|
17797
|
+
return typed ? layFields(merged, typed) : merged;
|
|
17798
|
+
}
|
|
17799
|
+
MenuItemStyleOverlay.Merge = Merge;
|
|
17800
|
+
/**
|
|
17801
|
+
* Returns whether an overlay paints a model fill, for the layer or for any Entity Type in it.
|
|
17802
|
+
*/
|
|
17803
|
+
function SetsModelFill(overlay) {
|
|
17804
|
+
var _a;
|
|
17805
|
+
if (!overlay) {
|
|
17806
|
+
return false;
|
|
17807
|
+
}
|
|
17808
|
+
const types = Object.values((_a = overlay.types) !== null && _a !== void 0 ? _a : {});
|
|
17809
|
+
return [overlay, ...types].some(style => { var _a; return isSet((_a = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _a === void 0 ? void 0 : _a.fillColor); });
|
|
17810
|
+
}
|
|
17811
|
+
MenuItemStyleOverlay.SetsModelFill = SetsModelFill;
|
|
17812
|
+
/**
|
|
17813
|
+
* Returns whether an overlay asks for attributes read from the Entities' sources.
|
|
17814
|
+
*/
|
|
17815
|
+
function ExpandsSources(overlay) {
|
|
17816
|
+
return Boolean(overlay === null || overlay === void 0 ? void 0 : overlay.expandSources);
|
|
17817
|
+
}
|
|
17818
|
+
MenuItemStyleOverlay.ExpandsSources = ExpandsSources;
|
|
17819
|
+
/*
|
|
17820
|
+
* Lays each style field an overlay sets onto a copy already taken, leaving its instructions behind.
|
|
17821
|
+
*/
|
|
17822
|
+
function layFields(merged, overlay) {
|
|
17823
|
+
var _a, _b;
|
|
17528
17824
|
for (const key of Object.keys(overlay)) {
|
|
17529
17825
|
const value = overlay[key];
|
|
17530
|
-
if (!isSet(value)) {
|
|
17826
|
+
if (INSTRUCTION_KEYS.includes(key) || !isSet(value)) {
|
|
17531
17827
|
continue;
|
|
17532
17828
|
}
|
|
17533
17829
|
if (isPlainObject(value)) {
|
|
@@ -17543,12 +17839,11 @@ void main()
|
|
|
17543
17839
|
}
|
|
17544
17840
|
return merged;
|
|
17545
17841
|
}
|
|
17546
|
-
MenuItemStyleOverlay.Merge = Merge;
|
|
17547
17842
|
/**
|
|
17548
|
-
* Returns the overlay a zoom control row carries laid over the style it resolved.
|
|
17843
|
+
* Returns the overlay a zoom control row carries laid over the style it resolved, for an Entity of the given type.
|
|
17549
17844
|
*/
|
|
17550
|
-
function ApplyRow(style, row) {
|
|
17551
|
-
return Merge(style, row === null || row === void 0 ? void 0 : row.StyleOverlay);
|
|
17845
|
+
function ApplyRow(style, row, entityTypeId) {
|
|
17846
|
+
return Merge(style, row === null || row === void 0 ? void 0 : row.StyleOverlay, entityTypeId);
|
|
17552
17847
|
}
|
|
17553
17848
|
MenuItemStyleOverlay.ApplyRow = ApplyRow;
|
|
17554
17849
|
/**
|
|
@@ -17587,7 +17882,7 @@ void main()
|
|
|
17587
17882
|
* Returns a copy carrying the overlay, or the item itself when it cannot take one and carries none.
|
|
17588
17883
|
*/
|
|
17589
17884
|
function With(item, overlay) {
|
|
17590
|
-
var _a;
|
|
17885
|
+
var _a, _b;
|
|
17591
17886
|
const target = Supports(item) ? overlay : null;
|
|
17592
17887
|
if (!target && !Get(item)) {
|
|
17593
17888
|
return item;
|
|
@@ -17603,9 +17898,11 @@ void main()
|
|
|
17603
17898
|
return next;
|
|
17604
17899
|
}
|
|
17605
17900
|
const zItem = item;
|
|
17901
|
+
// An item with no rows is drawn on the render managers' own default row, which has to carry the overlay too.
|
|
17902
|
+
const rows = ((_a = zItem.CameraZoomSettings) === null || _a === void 0 ? void 0 : _a.length) || !target ? ((_b = zItem.CameraZoomSettings) !== null && _b !== void 0 ? _b : []) : [{ ...DEFAULT_ZOOM_ROW }];
|
|
17606
17903
|
return {
|
|
17607
17904
|
...zItem,
|
|
17608
|
-
CameraZoomSettings:
|
|
17905
|
+
CameraZoomSettings: rows.map(row => {
|
|
17609
17906
|
const next = { ...row };
|
|
17610
17907
|
if (target) {
|
|
17611
17908
|
next.StyleOverlay = target;
|
|
@@ -17807,6 +18104,8 @@ void main()
|
|
|
17807
18104
|
this.scenario = 0;
|
|
17808
18105
|
// Indicates that we should expand the sources of the Entity.
|
|
17809
18106
|
this.expandSources = false;
|
|
18107
|
+
// What the item itself asks for, which an overlay reading sourced attributes can only add to.
|
|
18108
|
+
this.ownExpandSources = false;
|
|
17810
18109
|
// Indicates that we are retrieving historic records.
|
|
17811
18110
|
// This means that the current scene's time is included in the request.
|
|
17812
18111
|
this.historic = false;
|
|
@@ -17872,8 +18171,9 @@ void main()
|
|
|
17872
18171
|
this.applyStyles = Boolean(applyStyles);
|
|
17873
18172
|
}
|
|
17874
18173
|
if (expandSources != null) {
|
|
17875
|
-
this.
|
|
18174
|
+
this.ownExpandSources = expandSources;
|
|
17876
18175
|
}
|
|
18176
|
+
this.expandSources = this.ownExpandSources || exports.MenuItemStyleOverlay.ExpandsSources(this.styleOverlay);
|
|
17877
18177
|
if (fallbackStyleId != null) {
|
|
17878
18178
|
this.fallbackStyleId = fallbackStyleId;
|
|
17879
18179
|
}
|
|
@@ -18010,11 +18310,13 @@ void main()
|
|
|
18010
18310
|
this.historic = params.historic;
|
|
18011
18311
|
}
|
|
18012
18312
|
if (params.expandSources != null) {
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18313
|
+
this.ownExpandSources = params.expandSources;
|
|
18314
|
+
}
|
|
18315
|
+
const expandSources = this.ownExpandSources || exports.MenuItemStyleOverlay.ExpandsSources(this.styleOverlay);
|
|
18316
|
+
if (this.expandSources != expandSources) {
|
|
18317
|
+
this.shouldUpdateRegoStates = true;
|
|
18017
18318
|
}
|
|
18319
|
+
this.expandSources = expandSources;
|
|
18018
18320
|
// Reload styles.
|
|
18019
18321
|
if (this.loaded) {
|
|
18020
18322
|
this.styledEntityIds.clear();
|
|
@@ -18089,12 +18391,12 @@ void main()
|
|
|
18089
18391
|
* Replaces the tileset's own colours while an overlay sets a model fill, so features show exactly what it maps to.
|
|
18090
18392
|
*/
|
|
18091
18393
|
applyOverlayBlend() {
|
|
18092
|
-
var _a, _b
|
|
18394
|
+
var _a, _b;
|
|
18093
18395
|
if (!this.cTileset || ((_b = (_a = this.cTileset).isDestroyed) === null || _b === void 0 ? void 0 : _b.call(_a))) {
|
|
18094
18396
|
return;
|
|
18095
18397
|
}
|
|
18096
|
-
|
|
18097
|
-
const colours =
|
|
18398
|
+
// A fill for one Entity Type replaces too, as does a hide, which is a fully transparent fill.
|
|
18399
|
+
const colours = exports.MenuItemStyleOverlay.SetsModelFill(this.styleOverlay);
|
|
18098
18400
|
if (colours && this.blendBeforeOverlay == null) {
|
|
18099
18401
|
this.blendBeforeOverlay = this.cTileset.colorBlendMode;
|
|
18100
18402
|
this.cTileset.colorBlendMode = Cesium.Cesium3DTileColorBlendMode.REPLACE;
|
|
@@ -18570,7 +18872,7 @@ void main()
|
|
|
18570
18872
|
style = (_b = this.fallbackStyle) === null || _b === void 0 ? void 0 : _b.Settings;
|
|
18571
18873
|
styleId = this.fallbackStyleId != null ? Number(this.fallbackStyleId) : null;
|
|
18572
18874
|
}
|
|
18573
|
-
style = exports.MenuItemStyleOverlay.Merge(style, this.styleOverlay);
|
|
18875
|
+
style = exports.MenuItemStyleOverlay.Merge(style, this.styleOverlay, entityTypeId);
|
|
18574
18876
|
if (!style || !((_c = style === null || style === void 0 ? void 0 : style.modelStyle) === null || _c === void 0 ? void 0 : _c.customize)) {
|
|
18575
18877
|
return { settings: null, styleId: null };
|
|
18576
18878
|
}
|
|
@@ -22977,7 +23279,7 @@ void main()
|
|
|
22977
23279
|
console.error(e);
|
|
22978
23280
|
}
|
|
22979
23281
|
}
|
|
22980
|
-
style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem);
|
|
23282
|
+
style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem, entityTypeId);
|
|
22981
23283
|
const pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
22982
23284
|
const lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
22983
23285
|
const polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
@@ -24078,7 +24380,7 @@ void main()
|
|
|
24078
24380
|
if (!style) {
|
|
24079
24381
|
style = zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.Style;
|
|
24080
24382
|
}
|
|
24081
|
-
style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem);
|
|
24383
|
+
style = exports.MenuItemStyleOverlay.ApplyRow(style, zoomItem, entityTypeId);
|
|
24082
24384
|
const pStyle = (_h = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _h !== void 0 ? _h : {};
|
|
24083
24385
|
const lStyle = (_j = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _j !== void 0 ? _j : {};
|
|
24084
24386
|
const polygonsClamped = ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == null ? true : ((_l = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _l === void 0 ? void 0 : _l.id) == 0;
|
|
@@ -35551,7 +35853,15 @@ void main()
|
|
|
35551
35853
|
if (laid == null) {
|
|
35552
35854
|
return next;
|
|
35553
35855
|
}
|
|
35554
|
-
|
|
35856
|
+
// These two only run a Styler with Apply Styles on, and a bookmark that lays colours on one needs them drawn; opacity alone does not.
|
|
35857
|
+
const inline = exports.MenuItemStyleOverlay.GetItemStyle(alternation);
|
|
35858
|
+
const drawsStyle = inline
|
|
35859
|
+
? Object.keys(inline).some(key => key !== "opacity" && key !== "expandSources")
|
|
35860
|
+
: exports.MenuItemStyleOverlay.GetItemStyleId(alternation) != null;
|
|
35861
|
+
const styled = drawsStyle && (next.Type === BModels.MenuItem.EType.ArbTileset || next.Type === BModels.MenuItem.EType.EntityTileset) && !next.ApplyStyles
|
|
35862
|
+
? { ...next, ApplyStyles: true }
|
|
35863
|
+
: next;
|
|
35864
|
+
return exports.MenuItemStyleOverlay.WithItemStyle(styled, itemStyle);
|
|
35555
35865
|
}
|
|
35556
35866
|
MenuItemStyles.ApplyAlternation = ApplyAlternation;
|
|
35557
35867
|
/**
|
|
@@ -36302,6 +36612,7 @@ void main()
|
|
|
36302
36612
|
}
|
|
36303
36613
|
}
|
|
36304
36614
|
if (rItem.renderManager && !((_g = rItem.renderManager) === null || _g === void 0 ? void 0 : _g.Disposed)) {
|
|
36615
|
+
this.syncItemOpacity(rItem);
|
|
36305
36616
|
(_h = this.onUpdate) === null || _h === void 0 ? void 0 : _h.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
36306
36617
|
}
|
|
36307
36618
|
return rItem.id;
|
|
@@ -36312,7 +36623,7 @@ void main()
|
|
|
36312
36623
|
* @param params
|
|
36313
36624
|
*/
|
|
36314
36625
|
RemoveItemById(params) {
|
|
36315
|
-
var _a, _b;
|
|
36626
|
+
var _a, _b, _c;
|
|
36316
36627
|
let { menuItemId: id, recursive, allowHandoff } = params;
|
|
36317
36628
|
if (this.viewer.isDestroyed()) {
|
|
36318
36629
|
return;
|
|
@@ -36347,8 +36658,9 @@ void main()
|
|
|
36347
36658
|
}
|
|
36348
36659
|
this.ClearSeriesSegments(item.id);
|
|
36349
36660
|
}
|
|
36661
|
+
(_b = this.visualsRegister) === null || _b === void 0 ? void 0 : _b.SetMenuItemOpacity({ menuItemId: item.id, opacity: null, requestRender: false });
|
|
36350
36662
|
this.items = this.items.filter(x => x.id !== id);
|
|
36351
|
-
(
|
|
36663
|
+
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({ isEnabling: false, itemId: item.id });
|
|
36352
36664
|
}
|
|
36353
36665
|
}
|
|
36354
36666
|
/**
|
|
@@ -36387,6 +36699,7 @@ void main()
|
|
|
36387
36699
|
const next = exports.MenuItemStyleOverlay.With(chosen, this.getEffectiveOverlay(chosen, this.styleOverlay));
|
|
36388
36700
|
rItem.renderManager.SwapStyle(next);
|
|
36389
36701
|
rItem.item = next;
|
|
36702
|
+
this.syncItemOpacity(rItem);
|
|
36390
36703
|
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
36391
36704
|
return true;
|
|
36392
36705
|
}
|
|
@@ -36426,9 +36739,18 @@ void main()
|
|
|
36426
36739
|
}
|
|
36427
36740
|
rItem.renderManager.SwapStyle(next);
|
|
36428
36741
|
rItem.item = next;
|
|
36742
|
+
this.syncItemOpacity(rItem);
|
|
36429
36743
|
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
36430
36744
|
}
|
|
36431
36745
|
}
|
|
36746
|
+
/*
|
|
36747
|
+
* Draws an item at the opacity its bookmark style asks for, or opaque again once none is asked.
|
|
36748
|
+
*/
|
|
36749
|
+
syncItemOpacity(rItem) {
|
|
36750
|
+
var _a, _b;
|
|
36751
|
+
const wanted = (_a = exports.MenuItemStyleOverlay.GetItemStyle(rItem.item)) === null || _a === void 0 ? void 0 : _a.opacity;
|
|
36752
|
+
(_b = this.visualsRegister) === null || _b === void 0 ? void 0 : _b.SetMenuItemOpacity({ menuItemId: rItem.id, opacity: typeof wanted === "number" ? wanted : null });
|
|
36753
|
+
}
|
|
36432
36754
|
/**
|
|
36433
36755
|
* Lays an inline style or any Style record on one enabled item under the scene-wide one; neither clears it.
|
|
36434
36756
|
*/
|
|
@@ -36452,6 +36774,7 @@ void main()
|
|
|
36452
36774
|
const next = exports.MenuItemStyleOverlay.With(styled, this.getEffectiveOverlay(styled, this.styleOverlay));
|
|
36453
36775
|
rItem.renderManager.SwapStyle(next);
|
|
36454
36776
|
rItem.item = next;
|
|
36777
|
+
this.syncItemOpacity(rItem);
|
|
36455
36778
|
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
36456
36779
|
return true;
|
|
36457
36780
|
}
|
|
@@ -36501,6 +36824,7 @@ void main()
|
|
|
36501
36824
|
const next = exports.MenuItemStyleOverlay.With(rItem.item, effective);
|
|
36502
36825
|
rItem.renderManager.SwapStyle(next);
|
|
36503
36826
|
rItem.item = next;
|
|
36827
|
+
this.syncItemOpacity(rItem);
|
|
36504
36828
|
(_b = this.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({ isEnabling: true, itemId: rItem.id });
|
|
36505
36829
|
}
|
|
36506
36830
|
}
|
|
@@ -53310,7 +53634,7 @@ void main()
|
|
|
53310
53634
|
* @returns
|
|
53311
53635
|
*/
|
|
53312
53636
|
async function RenderGroup(params) {
|
|
53313
|
-
var _a, _b, _c, _d, _e;
|
|
53637
|
+
var _a, _b, _c, _d, _e, _f;
|
|
53314
53638
|
const api = params.apiGetter.getApi();
|
|
53315
53639
|
const cEntities = new Map();
|
|
53316
53640
|
// Gathering tags in case styling needs it.
|
|
@@ -53342,7 +53666,7 @@ void main()
|
|
|
53342
53666
|
const entity = params.entities[i];
|
|
53343
53667
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
53344
53668
|
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
53345
|
-
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
|
|
53669
|
+
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
|
|
53346
53670
|
// Pass through tags that may be needed for styling.
|
|
53347
53671
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
53348
53672
|
const tags = [];
|
|
@@ -53354,11 +53678,11 @@ void main()
|
|
|
53354
53678
|
}
|
|
53355
53679
|
}
|
|
53356
53680
|
}
|
|
53357
|
-
const pStyle = (
|
|
53681
|
+
const pStyle = (_c = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _c !== void 0 ? _c : {};
|
|
53358
53682
|
let rego = null;
|
|
53359
53683
|
// Only used for historic tracks right now.
|
|
53360
53684
|
// So won't bother getting it if we don't have historic data.
|
|
53361
|
-
if ((
|
|
53685
|
+
if ((_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]) {
|
|
53362
53686
|
rego = params.visualRegister.GetRego({
|
|
53363
53687
|
entityId: entity.Bruce.ID,
|
|
53364
53688
|
menuItemId: params.menuItemId
|
|
@@ -53373,8 +53697,8 @@ void main()
|
|
|
53373
53697
|
apiGetter: params.apiGetter,
|
|
53374
53698
|
maxDistance: zoomItem.MaxZoom,
|
|
53375
53699
|
minDistance: zoomItem.MinZoom,
|
|
53376
|
-
rendered: (
|
|
53377
|
-
entityHistoric: (
|
|
53700
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e.get(entity.Bruce.ID),
|
|
53701
|
+
entityHistoric: (_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID],
|
|
53378
53702
|
entityHistoricDrawTrack: params.entityHistoricDrawTrack,
|
|
53379
53703
|
fullStyle: style,
|
|
53380
53704
|
rego: rego
|
|
@@ -54200,7 +54524,7 @@ void main()
|
|
|
54200
54524
|
* @returns
|
|
54201
54525
|
*/
|
|
54202
54526
|
async function RenderGroup(params) {
|
|
54203
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
54527
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
54204
54528
|
const api = params.apiGetter.getApi();
|
|
54205
54529
|
await api.Loading;
|
|
54206
54530
|
const cEntities = new Map();
|
|
@@ -54238,7 +54562,7 @@ void main()
|
|
|
54238
54562
|
const entity = params.entities[i];
|
|
54239
54563
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
54240
54564
|
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
54241
|
-
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
|
|
54565
|
+
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
|
|
54242
54566
|
// Pass through tags that may be needed for styling.
|
|
54243
54567
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
54244
54568
|
const tags = [];
|
|
@@ -54250,7 +54574,7 @@ void main()
|
|
|
54250
54574
|
}
|
|
54251
54575
|
}
|
|
54252
54576
|
}
|
|
54253
|
-
const mStyle = (
|
|
54577
|
+
const mStyle = (_c = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _c !== void 0 ? _c : {};
|
|
54254
54578
|
let group = mStyle.lodGroup ? BModels.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
54255
54579
|
if (!group) {
|
|
54256
54580
|
group = "DEFAULT";
|
|
@@ -54277,8 +54601,8 @@ void main()
|
|
|
54277
54601
|
for (let i = 0; i < params.entities.length; i++) {
|
|
54278
54602
|
const entity = params.entities[i];
|
|
54279
54603
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
54280
|
-
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (
|
|
54281
|
-
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
|
|
54604
|
+
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_d = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _d === void 0 ? void 0 : _d.Settings : zoomItem.Style;
|
|
54605
|
+
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e["EntityType.ID"]);
|
|
54282
54606
|
const lod = lodData.find(x => x.entityId == entity.Bruce.ID);
|
|
54283
54607
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
54284
54608
|
continue;
|
|
@@ -54297,21 +54621,21 @@ void main()
|
|
|
54297
54621
|
let rego = null;
|
|
54298
54622
|
// Only used for historic tracks right now.
|
|
54299
54623
|
// So won't bother getting it if we don't have historic data.
|
|
54300
|
-
if ((
|
|
54624
|
+
if ((_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID]) {
|
|
54301
54625
|
rego = params.visualRegister.GetRego({
|
|
54302
54626
|
entityId: entity.Bruce.ID,
|
|
54303
54627
|
menuItemId: params.menuItemId
|
|
54304
54628
|
});
|
|
54305
54629
|
}
|
|
54306
|
-
const mStyle = (
|
|
54630
|
+
const mStyle = (_g = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _g !== void 0 ? _g : {};
|
|
54307
54631
|
const cEntity = Render({
|
|
54308
|
-
rendered: (
|
|
54632
|
+
rendered: (_h = params.rendered) === null || _h === void 0 ? void 0 : _h.get(entity.Bruce.ID),
|
|
54309
54633
|
entity: entity,
|
|
54310
|
-
entityHistoric: (
|
|
54634
|
+
entityHistoric: (_j = params.entitiesHistoric) === null || _j === void 0 ? void 0 : _j[entity.Bruce.ID],
|
|
54311
54635
|
style: mStyle,
|
|
54312
54636
|
tags: tags,
|
|
54313
54637
|
viewer: params.viewer,
|
|
54314
|
-
lodUrl: (
|
|
54638
|
+
lodUrl: (_k = lod.url) !== null && _k !== void 0 ? _k : BModels.ClientFile.GetUrl({
|
|
54315
54639
|
api,
|
|
54316
54640
|
fileId: lod.clientFileId,
|
|
54317
54641
|
viaCdn: true
|
|
@@ -54814,7 +55138,7 @@ void main()
|
|
|
54814
55138
|
* @returns
|
|
54815
55139
|
*/
|
|
54816
55140
|
async function RenderGroup(params) {
|
|
54817
|
-
var _a, _b, _c;
|
|
55141
|
+
var _a, _b, _c, _d;
|
|
54818
55142
|
const api = params.apiGetter.getApi();
|
|
54819
55143
|
const cEntities = new Map();
|
|
54820
55144
|
// Gathering tags in case styling needs it.
|
|
@@ -54846,7 +55170,7 @@ void main()
|
|
|
54846
55170
|
const entity = params.entities[i];
|
|
54847
55171
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
54848
55172
|
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
54849
|
-
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
|
|
55173
|
+
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
|
|
54850
55174
|
// Pass through tags that may be needed for styling.
|
|
54851
55175
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
54852
55176
|
const tags = [];
|
|
@@ -54858,7 +55182,7 @@ void main()
|
|
|
54858
55182
|
}
|
|
54859
55183
|
}
|
|
54860
55184
|
}
|
|
54861
|
-
const lStyle = (
|
|
55185
|
+
const lStyle = (_c = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _c !== void 0 ? _c : {};
|
|
54862
55186
|
const cEntity = Render({
|
|
54863
55187
|
entity: entity,
|
|
54864
55188
|
style: lStyle,
|
|
@@ -54866,7 +55190,7 @@ void main()
|
|
|
54866
55190
|
viewer: params.viewer,
|
|
54867
55191
|
maxDistance: zoomItem.MaxZoom,
|
|
54868
55192
|
minDistance: zoomItem.MinZoom,
|
|
54869
|
-
rendered: (
|
|
55193
|
+
rendered: (_d = params.rendered) === null || _d === void 0 ? void 0 : _d.get(entity.Bruce.ID)
|
|
54870
55194
|
});
|
|
54871
55195
|
if (cEntity) {
|
|
54872
55196
|
const name = await getName$2(api, entity, params.offline);
|
|
@@ -58185,6 +58509,23 @@ void main() {
|
|
|
58185
58509
|
GetPlacementKey() {
|
|
58186
58510
|
return [this.groundPixels ? 1 : 0, this.baseHeight, this.exaggeration, this.followGround ? 1 : 0].join("|");
|
|
58187
58511
|
}
|
|
58512
|
+
/**
|
|
58513
|
+
* Repaints the sheet with new colours, keeping its geometry and the frames it is reading.
|
|
58514
|
+
*/
|
|
58515
|
+
SetRamp(rampStops, lowColor, highColor) {
|
|
58516
|
+
const pixels = RampLookup(rampStops || null, lowColor || DEFAULT_LOW_COLOR, highColor || DEFAULT_HIGH_COLOR);
|
|
58517
|
+
// A re-render with the same colours keeps the texture it already has.
|
|
58518
|
+
if (this.rampPixels && pixels.length === this.rampPixels.length && pixels.every((value, i) => value === this.rampPixels[i])) {
|
|
58519
|
+
return;
|
|
58520
|
+
}
|
|
58521
|
+
this.rampPixels = pixels;
|
|
58522
|
+
this.maskFillValue = firstOpaqueStop(this.rampPixels);
|
|
58523
|
+
// Rebuilt from the new pixels on the next frame.
|
|
58524
|
+
if (this.rampTexture) {
|
|
58525
|
+
this.rampTexture.destroy();
|
|
58526
|
+
this.rampTexture = null;
|
|
58527
|
+
}
|
|
58528
|
+
}
|
|
58188
58529
|
/**
|
|
58189
58530
|
* The ramp the sheet is painted with, as 256 RGBA steps across the value range.
|
|
58190
58531
|
*/
|
|
@@ -58937,6 +59278,8 @@ void main() {
|
|
|
58937
59278
|
const EXTRUSION_ANIMATOR_KEY = "TextureFrameSeriesAnimator.ExtrusionAnimator";
|
|
58938
59279
|
const TEXTURE_VALUE_LABELS_KEY = "TextureValueLabels.Overlay";
|
|
58939
59280
|
const DISPLACED_SURFACE_KEY = "DisplacedSurfacePrimitive.Surface";
|
|
59281
|
+
// Whether the surface's animator was built hiding the baseline, which it cannot change afterwards.
|
|
59282
|
+
const EXTRUSION_BASELINE_KEY = "TextureFrameSeriesAnimator.ExtrusionBaseline";
|
|
58940
59283
|
(function (EntityRenderEnginePolygon) {
|
|
58941
59284
|
/**
|
|
58942
59285
|
* The height reference a polygon is actually drawn with.
|
|
@@ -59491,7 +59834,7 @@ void main() {
|
|
|
59491
59834
|
}
|
|
59492
59835
|
EntityRenderEnginePolygon.Render = Render;
|
|
59493
59836
|
async function RenderGroup(params) {
|
|
59494
|
-
var _a, _b, _c, _d;
|
|
59837
|
+
var _a, _b, _c, _d, _e;
|
|
59495
59838
|
const api = params.apiGetter.getApi();
|
|
59496
59839
|
const cEntities = new Map();
|
|
59497
59840
|
// Gathering tags in case styling needs it.
|
|
@@ -59523,7 +59866,7 @@ void main() {
|
|
|
59523
59866
|
const entity = params.entities[i];
|
|
59524
59867
|
const zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
59525
59868
|
const ownStyle = (!params.offline && zoomItem.StyleID != -1) ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
|
|
59526
|
-
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem);
|
|
59869
|
+
const style = exports.MenuItemStyleOverlay.ApplyRow(ownStyle, zoomItem, (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
|
|
59527
59870
|
// Pass through tags that may be needed for styling.
|
|
59528
59871
|
const tagIds = entity.Bruce["Layer.ID"];
|
|
59529
59872
|
const tags = [];
|
|
@@ -59535,7 +59878,7 @@ void main() {
|
|
|
59535
59878
|
}
|
|
59536
59879
|
}
|
|
59537
59880
|
}
|
|
59538
|
-
const pStyle = (
|
|
59881
|
+
const pStyle = (_c = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _c !== void 0 ? _c : {};
|
|
59539
59882
|
let cEntity = null;
|
|
59540
59883
|
try {
|
|
59541
59884
|
cEntity = await Render({
|
|
@@ -59549,14 +59892,14 @@ void main() {
|
|
|
59549
59892
|
// Temporarily disabling re-using graphics for polygons as they have some bugs, and
|
|
59550
59893
|
// they don't support any animation yet.
|
|
59551
59894
|
// rendered: null
|
|
59552
|
-
rendered: (
|
|
59895
|
+
rendered: (_d = params.rendered) === null || _d === void 0 ? void 0 : _d.get(entity.Bruce.ID),
|
|
59553
59896
|
menuItemId: params.menuItemId,
|
|
59554
59897
|
visualRegister: params.visualRegister,
|
|
59555
59898
|
onSeriesDiscovered: params.onSeriesDiscovered
|
|
59556
59899
|
});
|
|
59557
59900
|
}
|
|
59558
59901
|
catch (e) {
|
|
59559
|
-
console.error(`Polygon.RenderGroup: failed to render entity ${((
|
|
59902
|
+
console.error(`Polygon.RenderGroup: failed to render entity ${((_e = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _e === void 0 ? void 0 : _e.ID) || "<NONE>"}:`, e);
|
|
59560
59903
|
}
|
|
59561
59904
|
if (cEntity) {
|
|
59562
59905
|
const name = await getName$3(api, entity, params.offline);
|
|
@@ -59768,10 +60111,15 @@ void main() {
|
|
|
59768
60111
|
const placement = surfacePlacement(entity, heightRef, extrusionArchive && exports.TextureFrameSeriesAnimator.IsDatumHeight(extrusionArchive.metadata));
|
|
59769
60112
|
// Whether the surface follows terrain is baked into its ground sampling, so a change there has
|
|
59770
60113
|
// to rebuild rather than update in place.
|
|
59771
|
-
|
|
60114
|
+
// The baseline mask is read by the animator as it is built, so a change there rebuilds too.
|
|
60115
|
+
const baselineKept = cEntity[EXTRUSION_BASELINE_KEY] === Boolean(style.maskTextureBaseline);
|
|
60116
|
+
if (reusable && baselineKept && existingSurface.GetFollowsGround() === placement.followGround) {
|
|
59772
60117
|
existingSurface.SetBaseHeight(placement.baseHeight);
|
|
59773
60118
|
existingSurface.SetExaggeration(exaggerationFor(style));
|
|
59774
60119
|
existingSurface.SetWater(waterFor(style));
|
|
60120
|
+
// A restyle that only recolours, such as a bookmark's own ramp, repaints in place.
|
|
60121
|
+
const ramp = surfaceRamp(style.textureColorMask, extrusionArchive.metadata);
|
|
60122
|
+
existingSurface.SetRamp(ramp.rampStops, ramp.lowColor, ramp.highColor);
|
|
59775
60123
|
return;
|
|
59776
60124
|
}
|
|
59777
60125
|
disposeDisplacedSurface(cEntity, viewer);
|
|
@@ -59798,7 +60146,8 @@ void main() {
|
|
|
59798
60146
|
maskBaseline: style.maskTextureBaseline
|
|
59799
60147
|
});
|
|
59800
60148
|
cEntity[EXTRUSION_ANIMATOR_KEY] = animator;
|
|
59801
|
-
|
|
60149
|
+
cEntity[EXTRUSION_BASELINE_KEY] = Boolean(style.maskTextureBaseline);
|
|
60150
|
+
const ramp = surfaceRamp(style.textureColorMask, extrusionArchive.metadata);
|
|
59802
60151
|
const surface = new exports.DisplacedSurfacePrimitive.Surface({
|
|
59803
60152
|
extent,
|
|
59804
60153
|
// The grid has to be walked the way the raster was sampled, or the surface skews across the extent.
|
|
@@ -59812,18 +60161,28 @@ void main() {
|
|
|
59812
60161
|
packedValue: exports.TextureFrameSeriesAnimator.IsPackedValue(extrusionArchive.metadata),
|
|
59813
60162
|
exaggeration: exaggerationFor(style),
|
|
59814
60163
|
water: waterFor(style),
|
|
60164
|
+
lowColor: ramp.lowColor,
|
|
60165
|
+
highColor: ramp.highColor,
|
|
60166
|
+
rampStops: ramp.rampStops
|
|
60167
|
+
});
|
|
60168
|
+
surface.BindAnimator(animator);
|
|
60169
|
+
viewer.scene.primitives.add(surface);
|
|
60170
|
+
cEntity[DISPLACED_SURFACE_KEY] = surface;
|
|
60171
|
+
}
|
|
60172
|
+
/*
|
|
60173
|
+
* The colours a displaced surface paints with, from the style's mask.
|
|
60174
|
+
*/
|
|
60175
|
+
function surfaceRamp(mask, metadata) {
|
|
60176
|
+
return {
|
|
59815
60177
|
lowColor: mask ? BModels.Color.ColorFromStr(mask.minColor) : null,
|
|
59816
60178
|
highColor: mask ? BModels.Color.ColorFromStr(mask.maxColor) : null,
|
|
59817
60179
|
// Normalised the same way the animator normalises them, so the surface and the flat drape
|
|
59818
60180
|
// agree about which values the style hides.
|
|
59819
60181
|
rampStops: ((mask && mask.points) || []).map((stop) => ({
|
|
59820
|
-
position: exports.TextureFrameSeriesAnimator.NormalisePosition(
|
|
60182
|
+
position: exports.TextureFrameSeriesAnimator.NormalisePosition(metadata, stop.position),
|
|
59821
60183
|
color: BModels.Color.ColorFromStr(stop.color)
|
|
59822
60184
|
})).filter((stop) => Boolean(stop.color))
|
|
59823
|
-
}
|
|
59824
|
-
surface.BindAnimator(animator);
|
|
59825
|
-
viewer.scene.primitives.add(surface);
|
|
59826
|
-
cEntity[DISPLACED_SURFACE_KEY] = surface;
|
|
60185
|
+
};
|
|
59827
60186
|
}
|
|
59828
60187
|
/**
|
|
59829
60188
|
* Turns the polygon's altitude option into the two things the displaced surface needs:
|
|
@@ -61791,7 +62150,7 @@ void main() {
|
|
|
61791
62150
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
61792
62151
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
61793
62152
|
|
|
61794
|
-
const VERSION = "7.9.
|
|
62153
|
+
const VERSION = "7.9.4";
|
|
61795
62154
|
/**
|
|
61796
62155
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
61797
62156
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|
|
@@ -61833,6 +62192,8 @@ void main() {
|
|
|
61833
62192
|
exports.LIGHT_INTENSITY_COMPENSATION = LIGHT_INTENSITY_COMPENSATION;
|
|
61834
62193
|
exports.MAX_COMPENSATED_LIGHT_INTENSITY = MAX_COMPENSATED_LIGHT_INTENSITY;
|
|
61835
62194
|
exports.FindGapSurfaces = FindGapSurfaces;
|
|
62195
|
+
exports.NearClearance = NearClearance;
|
|
62196
|
+
exports.GrabPoint = GrabPoint;
|
|
61836
62197
|
exports.Draw3dPolygon = Draw3dPolygon;
|
|
61837
62198
|
exports.Draw3dPolyline = Draw3dPolyline;
|
|
61838
62199
|
exports.WidgetControlViewBarSearch = WidgetControlViewBarSearch;
|