bruce-cesium 6.1.3 → 6.1.5

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.
@@ -1,6 +1,6 @@
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';
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, ProjectViewLegacyTile, Camera, 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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, NearFarScalar, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, CesiumInspector, OrthographicFrustum, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EasingFunction, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, 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,211 @@ 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: 2; /* keep under app panels */
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
+ if (!viewer || viewer.isDestroyed() || !label || !pos3d) {
32822
+ return;
32823
+ }
32824
+ const CESIUM = Cesium;
32825
+ const toWindow = SceneTransforms.hasOwnProperty("wgs84ToWindowCoordinates")
32826
+ ? CESIUM.SceneTransforms.wgs84ToWindowCoordinates
32827
+ : CESIUM.SceneTransforms.worldToWindowCoordinates;
32828
+ const screenPos = toWindow(viewer.scene, pos3d);
32829
+ if (!screenPos || isNaN(screenPos.x) || isNaN(screenPos.y)) {
32830
+ label.style.display = "none";
32831
+ return;
32832
+ }
32833
+ const cameraPos = viewer.camera.position;
32834
+ const distance = Cartesian3.distance(cameraPos, pos3d);
32835
+ const maxDistance = 25000; // Max visibility distance for labels
32836
+ const canvas = viewer.canvas;
32837
+ const withinBounds = screenPos.x >= 0 && screenPos.x <= canvas.clientWidth &&
32838
+ screenPos.y >= 0 && screenPos.y <= canvas.clientHeight;
32839
+ if (!withinBounds || distance >= maxDistance) {
32840
+ label.style.display = "none";
32841
+ return;
32842
+ }
32843
+ // Keep full opacity; no distance-based fading
32844
+ // Keep the label close to the cursor regardless of zoom
32845
+ // Use small, constant pixel offsets to bottom-right
32846
+ const offsetX = 12; // px
32847
+ const offsetY = 10; // px
32848
+ let leftPx = screenPos.x + offsetX;
32849
+ let topPx = screenPos.y + offsetY;
32850
+ const pad = 8;
32851
+ const w = label.offsetWidth || 120;
32852
+ const h = label.offsetHeight || 28;
32853
+ leftPx = Math.min(Math.max(pad, leftPx), canvas.clientWidth - w - pad);
32854
+ topPx = Math.min(Math.max(pad, topPx), canvas.clientHeight - h - pad);
32855
+ label.style.left = `${leftPx}px`;
32856
+ label.style.top = `${topPx}px`;
32857
+ label.style.display = "block";
32858
+ label.style.opacity = "1";
32859
+ }
32860
+ var LiveCursor;
32861
+ (function (LiveCursor) {
32862
+ function Upsert({ viewer, id, name, colorCss, pos3d, entityId, image, showBillboard = true, showEllipse = true, billboardWidth = 30, billboardHeight = 30, labelZIndex }) {
32863
+ if (!labels[id]) {
32864
+ createDOMLabel(viewer, id, name !== null && name !== void 0 ? name : "", colorCss !== null && colorCss !== void 0 ? colorCss : "#3b82f6");
32865
+ }
32866
+ else {
32867
+ // Update text/color only if changed
32868
+ if (typeof name === "string" && name !== names[id]) {
32869
+ names[id] = name;
32870
+ labels[id].innerHTML = `<div style="margin-bottom:0px">${name}</div>`;
32871
+ }
32872
+ if (typeof colorCss === "string" && colorCss !== colors[id]) {
32873
+ colors[id] = colorCss;
32874
+ labels[id].style.backgroundColor = colorCss;
32875
+ }
32876
+ }
32877
+ if (typeof labelZIndex === "number") {
32878
+ labels[id].style.zIndex = `${labelZIndex}`;
32879
+ }
32880
+ positions[id] = pos3d;
32881
+ viewers[id] = viewer;
32882
+ // Manage Cesium entity
32883
+ if ((showBillboard || showEllipse) && !entities[id]) {
32884
+ const eid = entityId !== null && entityId !== void 0 ? entityId : `live-cursor-${id}`;
32885
+ const color = colorCss ? Color.fromCssColorString(colorCss) : Color.WHITE;
32886
+ const entity = viewer.entities.add({
32887
+ id: eid,
32888
+ position: pos3d,
32889
+ billboard: showBillboard && image ? {
32890
+ image,
32891
+ width: billboardWidth,
32892
+ height: billboardHeight,
32893
+ heightReference: HeightReference.NONE,
32894
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
32895
+ distanceDisplayCondition: new DistanceDisplayCondition(0, 30000),
32896
+ scaleByDistance: new NearFarScalar(100, 1.5, 10000, 0.8),
32897
+ verticalOrigin: VerticalOrigin.BOTTOM,
32898
+ horizontalOrigin: HorizontalOrigin.CENTER
32899
+ } : undefined,
32900
+ ellipse: showEllipse ? {
32901
+ semiMajorAxis: 50.0,
32902
+ semiMinorAxis: 50.0,
32903
+ height: 0,
32904
+ outline: true,
32905
+ outlineColor: color.withAlpha(0.8),
32906
+ outlineWidth: 3,
32907
+ fill: true,
32908
+ material: color.withAlpha(0.2),
32909
+ heightReference: HeightReference.CLAMP_TO_GROUND,
32910
+ distanceDisplayCondition: new DistanceDisplayCondition(0, 15000)
32911
+ } : undefined
32912
+ });
32913
+ if (entity.ellipse) {
32914
+ entity.ellipse.semiMajorAxis = new CallbackProperty(() => {
32915
+ const time = viewer.clock.currentTime;
32916
+ const pulse = Math.sin(JulianDate.secondsDifference(time, viewer.clock.startTime) * 2) * 0.5 + 1;
32917
+ return 50 + (pulse * 20);
32918
+ }, false);
32919
+ entity.ellipse.semiMinorAxis = new CallbackProperty(() => {
32920
+ const time = viewer.clock.currentTime;
32921
+ const pulse = Math.sin(JulianDate.secondsDifference(time, viewer.clock.startTime) * 2) * 0.5 + 1;
32922
+ return 50 + (pulse * 20);
32923
+ }, false);
32924
+ }
32925
+ entities[id] = entity;
32926
+ }
32927
+ else if ((showBillboard || showEllipse) && entities[id]) {
32928
+ const entity = entities[id];
32929
+ const animated = new CesiumAnimatedProperty.AnimatePosition({
32930
+ durationMs: 50,
32931
+ targetPos3d: pos3d,
32932
+ startPos3d: entity.position,
32933
+ viewer: viewer
32934
+ });
32935
+ entity.position = new CallbackProperty(() => animated.GetValue(), false);
32936
+ }
32937
+ if (!updaters[id]) {
32938
+ const remover = viewer.scene.postUpdate.addEventListener(() => {
32939
+ const label = labels[id];
32940
+ let p = positions[id];
32941
+ // If we manage an entity with an animated position, follow its current value
32942
+ const ent = entities[id];
32943
+ if (ent === null || ent === void 0 ? void 0 : ent.position) {
32944
+ const posProp = ent.position;
32945
+ const date = viewer.scene.lastRenderTime || viewer.clock.currentTime;
32946
+ const val = (posProp === null || posProp === void 0 ? void 0 : posProp.getValue) ? posProp.getValue(date) : posProp;
32947
+ if (val && !isNaN(val.x)) {
32948
+ p = val;
32949
+ }
32950
+ }
32951
+ if (!label || !p) {
32952
+ return;
32953
+ }
32954
+ updateDOMLabel(viewer, label, p);
32955
+ });
32956
+ updaters[id] = remover;
32957
+ }
32958
+ // Perform an immediate update for the current frame
32959
+ updateDOMLabel(viewer, labels[id], pos3d);
32960
+ }
32961
+ LiveCursor.Upsert = Upsert;
32962
+ function Remove(id) {
32963
+ const label = labels[id];
32964
+ if (label && label.parentElement) {
32965
+ label.parentElement.removeChild(label);
32966
+ }
32967
+ delete labels[id];
32968
+ delete positions[id];
32969
+ delete names[id];
32970
+ delete colors[id];
32971
+ if (updaters[id]) {
32972
+ try {
32973
+ updaters[id]();
32974
+ }
32975
+ catch { }
32976
+ delete updaters[id];
32977
+ }
32978
+ // Remove entity if present
32979
+ const entity = entities[id];
32980
+ const viewer = viewers[id];
32981
+ if (entity && viewer && viewer.entities.contains(entity)) {
32982
+ viewer.entities.remove(entity);
32983
+ }
32984
+ delete entities[id];
32985
+ delete viewers[id];
32986
+ }
32987
+ LiveCursor.Remove = Remove;
32988
+ })(LiveCursor || (LiveCursor = {}));
32989
+
32785
32990
  var WidgetControlViewBar;
32786
32991
  (function (WidgetControlViewBar) {
32787
32992
  class AControl {
@@ -33554,7 +33759,7 @@ class WidgetViewBar extends Widget.AWidget {
33554
33759
  }
33555
33760
  }
33556
33761
 
33557
- const VERSION = "6.1.3";
33762
+ const VERSION = "6.1.5";
33558
33763
 
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 };
33764
+ 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
33765
  //# sourceMappingURL=bruce-cesium.es5.js.map