bruce-cesium 6.1.3 → 6.1.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 +196 -3
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +193 -1
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/live-cursor.js +198 -0
- package/dist/lib/rendering/render-managers/common/live-cursor.js.map +1 -0
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/rendering/render-managers/common/live-cursor.d.ts +18 -0
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
|
|
4
4
|
|
|
5
5
|
const TIME_LAG = 300;
|
|
6
6
|
const POSITION_CHECK_TIMER = 950;
|
|
@@ -32782,6 +32782,199 @@ var ViewerUtils;
|
|
|
32782
32782
|
ViewerUtils$$1.GetEventTracker = GetEventTracker;
|
|
32783
32783
|
})(ViewerUtils || (ViewerUtils = {}));
|
|
32784
32784
|
|
|
32785
|
+
const labels = {};
|
|
32786
|
+
const updaters = {};
|
|
32787
|
+
const positions = {};
|
|
32788
|
+
const colors = {};
|
|
32789
|
+
const names = {};
|
|
32790
|
+
const entities = {};
|
|
32791
|
+
const viewers = {};
|
|
32792
|
+
function createDOMLabel(viewer, id, name, colorCss) {
|
|
32793
|
+
var _a;
|
|
32794
|
+
const label = document.createElement("div");
|
|
32795
|
+
label.innerHTML = `<div style="margin-bottom:0px">${name !== null && name !== void 0 ? name : ""}</div>`;
|
|
32796
|
+
label.setAttribute("style", `
|
|
32797
|
+
position: absolute;
|
|
32798
|
+
z-index: 1000;
|
|
32799
|
+
display: none;
|
|
32800
|
+
pointer-events: none;
|
|
32801
|
+
padding: 6px 10px;
|
|
32802
|
+
border-radius: 8px;
|
|
32803
|
+
font-family: Arial, sans-serif;
|
|
32804
|
+
font-size: 13px;
|
|
32805
|
+
font-weight: 500;
|
|
32806
|
+
color: #ffffff;
|
|
32807
|
+
background-color: ${colorCss !== null && colorCss !== void 0 ? colorCss : "#3b82f6"};
|
|
32808
|
+
border: 1px solid rgba(255,255,255,0.2);
|
|
32809
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.25);
|
|
32810
|
+
text-shadow: 0 1px 2px rgba(0,0,0,0.5);
|
|
32811
|
+
white-space: nowrap;
|
|
32812
|
+
transform: none;
|
|
32813
|
+
`);
|
|
32814
|
+
((_a = viewer === null || viewer === void 0 ? void 0 : viewer.container) !== null && _a !== void 0 ? _a : document.body).appendChild(label);
|
|
32815
|
+
labels[id] = label;
|
|
32816
|
+
colors[id] = colorCss;
|
|
32817
|
+
names[id] = name;
|
|
32818
|
+
return label;
|
|
32819
|
+
}
|
|
32820
|
+
function updateDOMLabel(viewer, label, pos3d) {
|
|
32821
|
+
var _a;
|
|
32822
|
+
if (!viewer || viewer.isDestroyed() || !label || !pos3d) {
|
|
32823
|
+
return;
|
|
32824
|
+
}
|
|
32825
|
+
const CESIUM = Cesium;
|
|
32826
|
+
const toWindow = SceneTransforms.hasOwnProperty("wgs84ToWindowCoordinates")
|
|
32827
|
+
? CESIUM.SceneTransforms.wgs84ToWindowCoordinates
|
|
32828
|
+
: CESIUM.SceneTransforms.worldToWindowCoordinates;
|
|
32829
|
+
const screenPos = toWindow(viewer.scene, pos3d);
|
|
32830
|
+
if (!screenPos || isNaN(screenPos.x) || isNaN(screenPos.y)) {
|
|
32831
|
+
label.style.display = "none";
|
|
32832
|
+
return;
|
|
32833
|
+
}
|
|
32834
|
+
const cameraPos = viewer.camera.position;
|
|
32835
|
+
const distance = Cartesian3.distance(cameraPos, pos3d);
|
|
32836
|
+
const maxDistance = 25000; // Max visibility distance for labels
|
|
32837
|
+
const canvas = viewer.canvas;
|
|
32838
|
+
const withinBounds = screenPos.x >= 0 && screenPos.x <= canvas.clientWidth &&
|
|
32839
|
+
screenPos.y >= 0 && screenPos.y <= canvas.clientHeight;
|
|
32840
|
+
if (!withinBounds || distance >= maxDistance) {
|
|
32841
|
+
label.style.display = "none";
|
|
32842
|
+
return;
|
|
32843
|
+
}
|
|
32844
|
+
const opacity = Math.max(0.2, 1 - (distance / maxDistance));
|
|
32845
|
+
const camHeight = ((_a = viewer.camera.positionCartographic) === null || _a === void 0 ? void 0 : _a.height) || distance;
|
|
32846
|
+
const driver = Math.min(distance, camHeight);
|
|
32847
|
+
const offsetX = 14 + Math.min(driver / 80, 30); // px
|
|
32848
|
+
const offsetY = 12 + Math.min(driver / 100, 24); // px
|
|
32849
|
+
let leftPx = screenPos.x + offsetX;
|
|
32850
|
+
let topPx = screenPos.y + offsetY;
|
|
32851
|
+
const pad = 8;
|
|
32852
|
+
const w = label.offsetWidth || 120;
|
|
32853
|
+
const h = label.offsetHeight || 28;
|
|
32854
|
+
leftPx = Math.min(Math.max(pad, leftPx), canvas.clientWidth - w - pad);
|
|
32855
|
+
topPx = Math.min(Math.max(pad, topPx), canvas.clientHeight - h - pad);
|
|
32856
|
+
label.style.left = `${leftPx}px`;
|
|
32857
|
+
label.style.top = `${topPx}px`;
|
|
32858
|
+
label.style.display = "block";
|
|
32859
|
+
label.style.opacity = `${opacity}`;
|
|
32860
|
+
}
|
|
32861
|
+
var LiveCursor;
|
|
32862
|
+
(function (LiveCursor) {
|
|
32863
|
+
function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30 }) {
|
|
32864
|
+
if (!labels[id]) {
|
|
32865
|
+
createDOMLabel(viewer, id, name !== null && name !== void 0 ? name : "", colorCss !== null && colorCss !== void 0 ? colorCss : "#3b82f6");
|
|
32866
|
+
}
|
|
32867
|
+
else {
|
|
32868
|
+
// Update text/color only if changed
|
|
32869
|
+
if (typeof name === "string" && name !== names[id]) {
|
|
32870
|
+
names[id] = name;
|
|
32871
|
+
labels[id].innerHTML = `<div style="margin-bottom:0px">${name}</div>`;
|
|
32872
|
+
}
|
|
32873
|
+
if (typeof colorCss === "string" && colorCss !== colors[id]) {
|
|
32874
|
+
colors[id] = colorCss;
|
|
32875
|
+
labels[id].style.backgroundColor = colorCss;
|
|
32876
|
+
}
|
|
32877
|
+
}
|
|
32878
|
+
positions[id] = pos3d;
|
|
32879
|
+
viewers[id] = viewer;
|
|
32880
|
+
// Manage Cesium entity
|
|
32881
|
+
if ((showBillboard || showEllipse) && !entities[id]) {
|
|
32882
|
+
const eid = entityId !== null && entityId !== void 0 ? entityId : `live-cursor-${id}`;
|
|
32883
|
+
const color = colorCss ? Color.fromCssColorString(colorCss) : Color.WHITE;
|
|
32884
|
+
const entity = viewer.entities.add({
|
|
32885
|
+
id: eid,
|
|
32886
|
+
position: pos3d,
|
|
32887
|
+
billboard: showBillboard && image ? {
|
|
32888
|
+
image,
|
|
32889
|
+
width: billboardWidth,
|
|
32890
|
+
height: billboardHeight,
|
|
32891
|
+
heightReference: HeightReference.NONE,
|
|
32892
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
32893
|
+
distanceDisplayCondition: new DistanceDisplayCondition(0, 30000),
|
|
32894
|
+
scaleByDistance: new NearFarScalar(100, 1.5, 10000, 0.8),
|
|
32895
|
+
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
32896
|
+
horizontalOrigin: HorizontalOrigin.CENTER
|
|
32897
|
+
} : undefined,
|
|
32898
|
+
ellipse: showEllipse ? {
|
|
32899
|
+
semiMajorAxis: 50.0,
|
|
32900
|
+
semiMinorAxis: 50.0,
|
|
32901
|
+
height: 0,
|
|
32902
|
+
outline: true,
|
|
32903
|
+
outlineColor: color.withAlpha(0.8),
|
|
32904
|
+
outlineWidth: 3,
|
|
32905
|
+
fill: true,
|
|
32906
|
+
material: color.withAlpha(0.2),
|
|
32907
|
+
heightReference: HeightReference.CLAMP_TO_GROUND,
|
|
32908
|
+
distanceDisplayCondition: new DistanceDisplayCondition(0, 15000)
|
|
32909
|
+
} : undefined
|
|
32910
|
+
});
|
|
32911
|
+
if (entity.ellipse) {
|
|
32912
|
+
entity.ellipse.semiMajorAxis = new CallbackProperty(() => {
|
|
32913
|
+
const time = viewer.clock.currentTime;
|
|
32914
|
+
const pulse = Math.sin(JulianDate.secondsDifference(time, viewer.clock.startTime) * 2) * 0.5 + 1;
|
|
32915
|
+
return 50 + (pulse * 20);
|
|
32916
|
+
}, false);
|
|
32917
|
+
entity.ellipse.semiMinorAxis = new CallbackProperty(() => {
|
|
32918
|
+
const time = viewer.clock.currentTime;
|
|
32919
|
+
const pulse = Math.sin(JulianDate.secondsDifference(time, viewer.clock.startTime) * 2) * 0.5 + 1;
|
|
32920
|
+
return 50 + (pulse * 20);
|
|
32921
|
+
}, false);
|
|
32922
|
+
}
|
|
32923
|
+
entities[id] = entity;
|
|
32924
|
+
}
|
|
32925
|
+
else if ((showBillboard || showEllipse) && entities[id]) {
|
|
32926
|
+
const entity = entities[id];
|
|
32927
|
+
const animated = new CesiumAnimatedProperty.AnimatePosition({
|
|
32928
|
+
durationMs: 50,
|
|
32929
|
+
targetPos3d: pos3d,
|
|
32930
|
+
startPos3d: entity.position,
|
|
32931
|
+
viewer: viewer
|
|
32932
|
+
});
|
|
32933
|
+
entity.position = new CallbackProperty(() => animated.GetValue(), false);
|
|
32934
|
+
}
|
|
32935
|
+
if (!updaters[id]) {
|
|
32936
|
+
const remover = viewer.scene.postUpdate.addEventListener(() => {
|
|
32937
|
+
const label = labels[id];
|
|
32938
|
+
const p = positions[id];
|
|
32939
|
+
if (!label || !p) {
|
|
32940
|
+
return;
|
|
32941
|
+
}
|
|
32942
|
+
updateDOMLabel(viewer, label, p);
|
|
32943
|
+
});
|
|
32944
|
+
updaters[id] = remover;
|
|
32945
|
+
}
|
|
32946
|
+
// Perform an immediate update for the current frame
|
|
32947
|
+
updateDOMLabel(viewer, labels[id], pos3d);
|
|
32948
|
+
}
|
|
32949
|
+
LiveCursor.Upsert = Upsert;
|
|
32950
|
+
function Remove(id) {
|
|
32951
|
+
const label = labels[id];
|
|
32952
|
+
if (label && label.parentElement) {
|
|
32953
|
+
label.parentElement.removeChild(label);
|
|
32954
|
+
}
|
|
32955
|
+
delete labels[id];
|
|
32956
|
+
delete positions[id];
|
|
32957
|
+
delete names[id];
|
|
32958
|
+
delete colors[id];
|
|
32959
|
+
if (updaters[id]) {
|
|
32960
|
+
try {
|
|
32961
|
+
updaters[id]();
|
|
32962
|
+
}
|
|
32963
|
+
catch { }
|
|
32964
|
+
delete updaters[id];
|
|
32965
|
+
}
|
|
32966
|
+
// Remove entity if present
|
|
32967
|
+
const entity = entities[id];
|
|
32968
|
+
const viewer = viewers[id];
|
|
32969
|
+
if (entity && viewer && viewer.entities.contains(entity)) {
|
|
32970
|
+
viewer.entities.remove(entity);
|
|
32971
|
+
}
|
|
32972
|
+
delete entities[id];
|
|
32973
|
+
delete viewers[id];
|
|
32974
|
+
}
|
|
32975
|
+
LiveCursor.Remove = Remove;
|
|
32976
|
+
})(LiveCursor || (LiveCursor = {}));
|
|
32977
|
+
|
|
32785
32978
|
var WidgetControlViewBar;
|
|
32786
32979
|
(function (WidgetControlViewBar) {
|
|
32787
32980
|
class AControl {
|
|
@@ -33554,7 +33747,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
33554
33747
|
}
|
|
33555
33748
|
}
|
|
33556
33749
|
|
|
33557
|
-
const VERSION = "6.1.
|
|
33750
|
+
const VERSION = "6.1.4";
|
|
33558
33751
|
|
|
33559
|
-
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
33752
|
+
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, LiveCursor, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
33560
33753
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|