bruce-cesium 4.3.3 → 4.3.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
1
  import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, 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, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Quaternion } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2578,11 +2578,24 @@ var EntityUtils;
2578
2578
  });
2579
2579
  }); };
2580
2580
  evaluateRecord = function () { return __awaiter(_this, void 0, void 0, function () {
2581
- var posses, location, latitude, longitude, pos3d_3, geometry, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2581
+ var posses, assemblyLocation, latitude, longitude, pos3d_3, location, latitude, longitude, pos3d_4, geometry, pointStr, points, point, pos3d_5, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2582
2582
  return __generator(this, function (_a) {
2583
2583
  switch (_a.label) {
2584
2584
  case 0:
2585
2585
  posses = [];
2586
+ assemblyLocation = Entity$1.GetValue({
2587
+ entity: entity,
2588
+ path: ["Bruce", "AssemblyLocation"]
2589
+ });
2590
+ if (assemblyLocation && typeof assemblyLocation == "object" && Carto.ValidateCarto(assemblyLocation)) {
2591
+ latitude = EnsureNumber(assemblyLocation.latitude);
2592
+ longitude = EnsureNumber(assemblyLocation.longitude);
2593
+ // Disallowing exact 0.
2594
+ if (latitude || longitude) {
2595
+ pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
2596
+ posses.push(pos3d_3);
2597
+ }
2598
+ }
2586
2599
  location = Entity$1.GetValue({
2587
2600
  entity: entity,
2588
2601
  path: ["Bruce", "Location"]
@@ -2592,8 +2605,8 @@ var EntityUtils;
2592
2605
  longitude = EnsureNumber(location.longitude);
2593
2606
  // Disallowing exact 0.
2594
2607
  if (latitude || longitude) {
2595
- pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2596
- posses.push(pos3d_3);
2608
+ pos3d_4 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2609
+ posses.push(pos3d_4);
2597
2610
  }
2598
2611
  }
2599
2612
  geometry = Entity$1.GetValue({
@@ -2608,8 +2621,8 @@ var EntityUtils;
2608
2621
  points = Geometry.ParsePoints(pointStr);
2609
2622
  point = points.length > 0 ? points[0] : null;
2610
2623
  if (point && Carto.ValidateCarto(point)) {
2611
- pos3d_4 = Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2612
- posses.push(pos3d_4);
2624
+ pos3d_5 = Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2625
+ posses.push(pos3d_5);
2613
2626
  }
2614
2627
  }
2615
2628
  lineStr = geometry.LineString;
@@ -2955,9 +2968,9 @@ var EntityUtils;
2955
2968
  if ((rego === null || rego === void 0 ? void 0 : rego.visual) instanceof Entity) {
2956
2969
  var visual = rego.visual;
2957
2970
  if (visual.position) {
2958
- var pos3d_5 = GetValue(viewer, visual.position);
2971
+ var pos3d_6 = GetValue(viewer, visual.position);
2959
2972
  // Fix height reference.
2960
- if (pos3d_5 === null || pos3d_5 === void 0 ? void 0 : pos3d_5.x) {
2973
+ if (pos3d_6 === null || pos3d_6 === void 0 ? void 0 : pos3d_6.x) {
2961
2974
  var visualHeightRef = HeightReference.RELATIVE_TO_GROUND;
2962
2975
  if (visual.model) {
2963
2976
  visualHeightRef = GetValue(viewer, visual.model.heightReference);
@@ -2984,7 +2997,7 @@ var EntityUtils;
2984
2997
  return DrawingUtils.EnsurePosHeight({
2985
2998
  desiredHeightRef: params.returnHeightRef,
2986
2999
  heightRef: visualHeightRef,
2987
- pos3d: pos3d_5,
3000
+ pos3d: pos3d_6,
2988
3001
  viewer: viewer
2989
3002
  });
2990
3003
  }
@@ -2993,6 +3006,19 @@ var EntityUtils;
2993
3006
  return null;
2994
3007
  }
2995
3008
  function evaluateRecord() {
3009
+ // Checking for a pre-calculated lat/lon for assembly entities.
3010
+ var assemblyLocation = Entity$1.GetValue({
3011
+ entity: entity,
3012
+ path: ["Bruce", "AssemblyLocation"]
3013
+ });
3014
+ if (assemblyLocation && typeof assemblyLocation == "object" && Carto.ValidateCarto(assemblyLocation)) {
3015
+ var latitude = EnsureNumber(assemblyLocation.latitude);
3016
+ var longitude = EnsureNumber(assemblyLocation.longitude);
3017
+ // Disallowing exact 0.
3018
+ if (latitude || longitude) {
3019
+ return Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
3020
+ }
3021
+ }
2996
3022
  var location = Entity$1.GetValue({
2997
3023
  entity: entity,
2998
3024
  path: ["Bruce", "Location"]
@@ -8757,14 +8783,28 @@ var EntityLabel;
8757
8783
  // We get the pos3d and add 'n' to it, then turn it back into 2d.
8758
8784
  var lineEndPos3d = _this._pos3d.clone();
8759
8785
  var lineEndPoint = Cartographic.fromCartesian(lineEndPos3d);
8760
- // If known then calculate based on size.
8761
- // If we're close then we'll favour the distance over the size.
8762
- var addHeight = sizeInM > 0 ? Math.max(5, Math.min(distance / 5, sizeInM * 1.2)) : null;
8763
- // If unknown then calculate based on camera height or distance.
8764
- // Radius is unknown for Tileset things. We could bake the radius in possibly as a feature property.
8765
- // We have to make it work for both labels against tall skyscrapers, and up-close assembly models.
8766
- if (addHeight == null) {
8767
- addHeight = Math.max(5, Math.min(distance, _this.viewer.camera.positionCartographic.height) / 5);
8786
+ var addHeight = null;
8787
+ // If we're pre-positioned that means the user is hovering over the entity.
8788
+ // We will keep the height low to avoid looking goofy.
8789
+ if (_this.prePositioned) {
8790
+ addHeight = distance / 12;
8791
+ }
8792
+ else {
8793
+ // If known then calculate based on size.
8794
+ // If we're close then we'll favour the distance over the size.
8795
+ if (sizeInM && sizeInM > 0) {
8796
+ addHeight = Math.min(distance / 5, sizeInM * 1.2);
8797
+ }
8798
+ // If unknown then calculate based on camera height or distance.
8799
+ // Radius is unknown for Tileset things. We could bake the radius in possibly as a feature property.
8800
+ // We have to make it work for both labels against tall skyscrapers, and up-close assembly models.
8801
+ else {
8802
+ addHeight = Math.min(distance, _this.viewer.camera.positionCartographic.height) / 7;
8803
+ }
8804
+ }
8805
+ // Safety check.
8806
+ if (!addHeight || addHeight <= 0) {
8807
+ addHeight = 0.001;
8768
8808
  }
8769
8809
  lineEndPoint.height += addHeight;
8770
8810
  lineEndPos3d = Cartographic.toCartesian(lineEndPoint);
@@ -26503,7 +26543,7 @@ var ViewerUtils;
26503
26543
  ViewerUtils.AssertIonToken = AssertIonToken;
26504
26544
  })(ViewerUtils || (ViewerUtils = {}));
26505
26545
 
26506
- var VERSION = "4.3.3";
26546
+ var VERSION = "4.3.5";
26507
26547
 
26508
26548
  export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
26509
26549
  //# sourceMappingURL=bruce-cesium.es5.js.map