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.
@@ -2570,11 +2570,24 @@
2570
2570
  });
2571
2571
  }); };
2572
2572
  evaluateRecord = function () { return __awaiter(_this, void 0, void 0, function () {
2573
- var posses, location, latitude, longitude, pos3d_3, geometry, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2573
+ 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;
2574
2574
  return __generator(this, function (_a) {
2575
2575
  switch (_a.label) {
2576
2576
  case 0:
2577
2577
  posses = [];
2578
+ assemblyLocation = BModels.Entity.GetValue({
2579
+ entity: entity,
2580
+ path: ["Bruce", "AssemblyLocation"]
2581
+ });
2582
+ if (assemblyLocation && typeof assemblyLocation == "object" && BModels.Carto.ValidateCarto(assemblyLocation)) {
2583
+ latitude = EnsureNumber(assemblyLocation.latitude);
2584
+ longitude = EnsureNumber(assemblyLocation.longitude);
2585
+ // Disallowing exact 0.
2586
+ if (latitude || longitude) {
2587
+ pos3d_3 = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
2588
+ posses.push(pos3d_3);
2589
+ }
2590
+ }
2578
2591
  location = BModels.Entity.GetValue({
2579
2592
  entity: entity,
2580
2593
  path: ["Bruce", "Location"]
@@ -2584,8 +2597,8 @@
2584
2597
  longitude = EnsureNumber(location.longitude);
2585
2598
  // Disallowing exact 0.
2586
2599
  if (latitude || longitude) {
2587
- pos3d_3 = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2588
- posses.push(pos3d_3);
2600
+ pos3d_4 = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2601
+ posses.push(pos3d_4);
2589
2602
  }
2590
2603
  }
2591
2604
  geometry = BModels.Entity.GetValue({
@@ -2600,8 +2613,8 @@
2600
2613
  points = BModels.Geometry.ParsePoints(pointStr);
2601
2614
  point = points.length > 0 ? points[0] : null;
2602
2615
  if (point && BModels.Carto.ValidateCarto(point)) {
2603
- pos3d_4 = Cesium.Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2604
- posses.push(pos3d_4);
2616
+ pos3d_5 = Cesium.Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2617
+ posses.push(pos3d_5);
2605
2618
  }
2606
2619
  }
2607
2620
  lineStr = geometry.LineString;
@@ -2947,9 +2960,9 @@
2947
2960
  if ((rego === null || rego === void 0 ? void 0 : rego.visual) instanceof Cesium.Entity) {
2948
2961
  var visual = rego.visual;
2949
2962
  if (visual.position) {
2950
- var pos3d_5 = GetValue(viewer, visual.position);
2963
+ var pos3d_6 = GetValue(viewer, visual.position);
2951
2964
  // Fix height reference.
2952
- if (pos3d_5 === null || pos3d_5 === void 0 ? void 0 : pos3d_5.x) {
2965
+ if (pos3d_6 === null || pos3d_6 === void 0 ? void 0 : pos3d_6.x) {
2953
2966
  var visualHeightRef = Cesium.HeightReference.RELATIVE_TO_GROUND;
2954
2967
  if (visual.model) {
2955
2968
  visualHeightRef = GetValue(viewer, visual.model.heightReference);
@@ -2976,7 +2989,7 @@
2976
2989
  return exports.DrawingUtils.EnsurePosHeight({
2977
2990
  desiredHeightRef: params.returnHeightRef,
2978
2991
  heightRef: visualHeightRef,
2979
- pos3d: pos3d_5,
2992
+ pos3d: pos3d_6,
2980
2993
  viewer: viewer
2981
2994
  });
2982
2995
  }
@@ -2985,6 +2998,19 @@
2985
2998
  return null;
2986
2999
  }
2987
3000
  function evaluateRecord() {
3001
+ // Checking for a pre-calculated lat/lon for assembly entities.
3002
+ var assemblyLocation = BModels.Entity.GetValue({
3003
+ entity: entity,
3004
+ path: ["Bruce", "AssemblyLocation"]
3005
+ });
3006
+ if (assemblyLocation && typeof assemblyLocation == "object" && BModels.Carto.ValidateCarto(assemblyLocation)) {
3007
+ var latitude = EnsureNumber(assemblyLocation.latitude);
3008
+ var longitude = EnsureNumber(assemblyLocation.longitude);
3009
+ // Disallowing exact 0.
3010
+ if (latitude || longitude) {
3011
+ return Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
3012
+ }
3013
+ }
2988
3014
  var location = BModels.Entity.GetValue({
2989
3015
  entity: entity,
2990
3016
  path: ["Bruce", "Location"]
@@ -8742,14 +8768,28 @@
8742
8768
  // We get the pos3d and add 'n' to it, then turn it back into 2d.
8743
8769
  var lineEndPos3d = _this._pos3d.clone();
8744
8770
  var lineEndPoint = Cesium.Cartographic.fromCartesian(lineEndPos3d);
8745
- // If known then calculate based on size.
8746
- // If we're close then we'll favour the distance over the size.
8747
- var addHeight = sizeInM > 0 ? Math.max(5, Math.min(distance / 5, sizeInM * 1.2)) : null;
8748
- // If unknown then calculate based on camera height or distance.
8749
- // Radius is unknown for Tileset things. We could bake the radius in possibly as a feature property.
8750
- // We have to make it work for both labels against tall skyscrapers, and up-close assembly models.
8751
- if (addHeight == null) {
8752
- addHeight = Math.max(5, Math.min(distance, _this.viewer.camera.positionCartographic.height) / 5);
8771
+ var addHeight = null;
8772
+ // If we're pre-positioned that means the user is hovering over the entity.
8773
+ // We will keep the height low to avoid looking goofy.
8774
+ if (_this.prePositioned) {
8775
+ addHeight = distance / 12;
8776
+ }
8777
+ else {
8778
+ // If known then calculate based on size.
8779
+ // If we're close then we'll favour the distance over the size.
8780
+ if (sizeInM && sizeInM > 0) {
8781
+ addHeight = Math.min(distance / 5, sizeInM * 1.2);
8782
+ }
8783
+ // If unknown then calculate based on camera height or distance.
8784
+ // Radius is unknown for Tileset things. We could bake the radius in possibly as a feature property.
8785
+ // We have to make it work for both labels against tall skyscrapers, and up-close assembly models.
8786
+ else {
8787
+ addHeight = Math.min(distance, _this.viewer.camera.positionCartographic.height) / 7;
8788
+ }
8789
+ }
8790
+ // Safety check.
8791
+ if (!addHeight || addHeight <= 0) {
8792
+ addHeight = 0.001;
8753
8793
  }
8754
8794
  lineEndPoint.height += addHeight;
8755
8795
  lineEndPos3d = Cesium.Cartographic.toCartesian(lineEndPoint);
@@ -26426,7 +26466,7 @@
26426
26466
  ViewerUtils.AssertIonToken = AssertIonToken;
26427
26467
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
26428
26468
 
26429
- var VERSION = "4.3.3";
26469
+ var VERSION = "4.3.5";
26430
26470
 
26431
26471
  exports.VERSION = VERSION;
26432
26472
  exports.CesiumParabola = CesiumParabola;