bruce-cesium 3.9.6 → 3.9.8

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.
@@ -2417,11 +2417,11 @@ var EntityUtils;
2417
2417
  });
2418
2418
  }); };
2419
2419
  getEntityPositions = function (sample) { return __awaiter(_this, void 0, void 0, function () {
2420
- var entityId, entity, tileset, tilesetId, disallowRendered, evaluateRendered, evaluateRecord, renderedPosses, e_1, recordPosses, e_2, tSettings, pos3d, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset, sphere;
2420
+ var entityId, entity, tileset, tilesetId, disallowRendered, evaluateRendered, evaluateRecord, renderedPosses, e_1, recordPosses, e_2, tSettings, pos3d, eLocation, alt, alt, eTransform, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset, sphere;
2421
2421
  var _this = this;
2422
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2423
- return __generator(this, function (_l) {
2424
- switch (_l.label) {
2422
+ var _a, _b, _c, _d, _e;
2423
+ return __generator(this, function (_f) {
2424
+ switch (_f.label) {
2425
2425
  case 0:
2426
2426
  entityId = sample.entityId, entity = sample.entity, tileset = sample.tileset, tilesetId = sample.tilesetId, disallowRendered = sample.disallowRendered;
2427
2427
  evaluateRendered = function () { return __awaiter(_this, void 0, void 0, function () {
@@ -2575,23 +2575,30 @@ var EntityUtils;
2575
2575
  });
2576
2576
  }); };
2577
2577
  evaluateRecord = function () { return __awaiter(_this, void 0, void 0, function () {
2578
- var posses, location_1, latitude, longitude, pos3d_3, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, point, bPosses;
2578
+ var posses, location, latitude, longitude, pos3d_3, geometry, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2579
2579
  return __generator(this, function (_a) {
2580
2580
  switch (_a.label) {
2581
2581
  case 0:
2582
2582
  posses = [];
2583
- if (entity.location && Carto.ValidateCarto(entity.location)) {
2584
- location_1 = entity.location;
2585
- latitude = EnsureNumber(location_1.latitude);
2586
- longitude = EnsureNumber(location_1.longitude);
2583
+ location = Entity$1.GetValue({
2584
+ entity: entity,
2585
+ path: ["location"]
2586
+ });
2587
+ if (location && typeof location == "object" && Carto.ValidateCarto(location)) {
2588
+ latitude = EnsureNumber(location.latitude);
2589
+ longitude = EnsureNumber(location.longitude);
2587
2590
  // Disallowing exact 0.
2588
2591
  if (latitude || longitude) {
2589
- pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location_1.altitude));
2592
+ pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2590
2593
  posses.push(pos3d_3);
2591
2594
  }
2592
2595
  }
2593
- if (!(entity.geometry && typeof entity.geometry == "object")) return [3 /*break*/, 4];
2594
- pointStr = entity.geometry.Point;
2596
+ geometry = Entity$1.GetValue({
2597
+ entity: entity,
2598
+ path: ["geometry"]
2599
+ });
2600
+ if (!(geometry && typeof geometry == "object")) return [3 /*break*/, 4];
2601
+ pointStr = geometry.Point;
2595
2602
  // "0.0,0.0" seems to be generated on missing geometry in our re-index.
2596
2603
  // No location -> turns into 0,0 -> turns into 0.0,0.0 point geometry.
2597
2604
  if (pointStr && typeof pointStr == "string" && pointStr != "0.0,0.0") {
@@ -2602,7 +2609,7 @@ var EntityUtils;
2602
2609
  posses.push(pos3d_4);
2603
2610
  }
2604
2611
  }
2605
- lineStr = entity.geometry.LineString;
2612
+ lineStr = geometry.LineString;
2606
2613
  if (!(lineStr && typeof lineStr == "string")) return [3 /*break*/, 2];
2607
2614
  points = Geometry.ParsePoints(lineStr);
2608
2615
  if (!(points.length > 0)) return [3 /*break*/, 2];
@@ -2613,7 +2620,7 @@ var EntityUtils;
2613
2620
  posses = posses.concat(pPosses);
2614
2621
  _a.label = 2;
2615
2622
  case 2:
2616
- pRings = entity.geometry.Polygon;
2623
+ pRings = geometry.Polygon;
2617
2624
  if (!(pRings && typeof pRings == "object")) return [3 /*break*/, 4];
2618
2625
  boundary = pRings.find(function (x) { return x.Facing == Geometry.EPolygonRingType.Boundaries; });
2619
2626
  if (!(boundary === null || boundary === void 0 ? void 0 : boundary.LinearRing)) return [3 /*break*/, 4];
@@ -2625,16 +2632,20 @@ var EntityUtils;
2625
2632
  posses = posses.concat(pPosses);
2626
2633
  _a.label = 4;
2627
2634
  case 4:
2628
- if (!entity.boundaries) return [3 /*break*/, 6];
2635
+ boundaries = Entity$1.GetValue({
2636
+ entity: entity,
2637
+ path: ["boundaries"]
2638
+ });
2639
+ if (!(boundaries && typeof boundaries == "object")) return [3 /*break*/, 6];
2629
2640
  point = {
2630
- latitude: (EnsureNumber(entity.boundaries.minLatitude) + EnsureNumber(entity.boundaries.maxLatitude)) / 2,
2631
- longitude: (EnsureNumber(entity.boundaries.minLongitude) + EnsureNumber(entity.boundaries.maxLongitude)) / 2,
2641
+ latitude: (EnsureNumber(boundaries.minLatitude) + EnsureNumber(boundaries.maxLatitude)) / 2,
2642
+ longitude: (EnsureNumber(boundaries.minLongitude) + EnsureNumber(boundaries.maxLongitude)) / 2,
2632
2643
  altitude: 0
2633
2644
  };
2634
2645
  if (!(point.latitude || point.longitude)) return [3 /*break*/, 6];
2635
2646
  bPosses = [
2636
- Cartesian3.fromDegrees(EnsureNumber(entity.boundaries.minLongitude), EnsureNumber(entity.boundaries.minLatitude), EnsureNumber(entity.boundaries.minAltitude)),
2637
- Cartesian3.fromDegrees(EnsureNumber(entity.boundaries.maxLongitude), EnsureNumber(entity.boundaries.maxLatitude), EnsureNumber(entity.boundaries.maxAltitude))
2647
+ Cartesian3.fromDegrees(EnsureNumber(boundaries.minLongitude), EnsureNumber(boundaries.minLatitude), EnsureNumber(boundaries.minAltitude)),
2648
+ Cartesian3.fromDegrees(EnsureNumber(boundaries.maxLongitude), EnsureNumber(boundaries.maxLatitude), EnsureNumber(boundaries.maxAltitude))
2638
2649
  ];
2639
2650
  return [4 /*yield*/, ensureHeightRefs(bPosses, sample)];
2640
2651
  case 5:
@@ -2648,18 +2659,18 @@ var EntityUtils;
2648
2659
  if (!(disallowRendered != true)) return [3 /*break*/, 2];
2649
2660
  return [4 /*yield*/, evaluateRendered()];
2650
2661
  case 1:
2651
- renderedPosses = _l.sent();
2662
+ renderedPosses = _f.sent();
2652
2663
  if (renderedPosses === null || renderedPosses === void 0 ? void 0 : renderedPosses.length) {
2653
2664
  return [2 /*return*/, renderedPosses];
2654
2665
  }
2655
- _l.label = 2;
2666
+ _f.label = 2;
2656
2667
  case 2:
2657
2668
  if (!!entity) return [3 /*break*/, 6];
2658
2669
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 6];
2659
2670
  apiCalls += 1;
2660
- _l.label = 3;
2671
+ _f.label = 3;
2661
2672
  case 3:
2662
- _l.trys.push([3, 5, , 6]);
2673
+ _f.trys.push([3, 5, , 6]);
2663
2674
  return [4 /*yield*/, Entity$1.Get({
2664
2675
  api: api,
2665
2676
  entityId: entityId,
@@ -2667,10 +2678,10 @@ var EntityUtils;
2667
2678
  expandLocation: false
2668
2679
  })];
2669
2680
  case 4:
2670
- entity = (_l.sent()).entity;
2681
+ entity = (_f.sent()).entity;
2671
2682
  return [3 /*break*/, 6];
2672
2683
  case 5:
2673
- e_1 = _l.sent();
2684
+ e_1 = _f.sent();
2674
2685
  console.error(e_1);
2675
2686
  return [3 /*break*/, 6];
2676
2687
  case 6:
@@ -2679,14 +2690,14 @@ var EntityUtils;
2679
2690
  }
2680
2691
  return [4 /*yield*/, evaluateRecord()];
2681
2692
  case 7:
2682
- recordPosses = _l.sent();
2693
+ recordPosses = _f.sent();
2683
2694
  if (recordPosses === null || recordPosses === void 0 ? void 0 : recordPosses.length) {
2684
2695
  return [2 /*return*/, recordPosses];
2685
2696
  }
2686
2697
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 11];
2687
- _l.label = 8;
2698
+ _f.label = 8;
2688
2699
  case 8:
2689
- _l.trys.push([8, 10, , 11]);
2700
+ _f.trys.push([8, 10, , 11]);
2690
2701
  apiCalls += 1;
2691
2702
  return [4 /*yield*/, Entity$1.Get({
2692
2703
  api: api,
@@ -2695,10 +2706,10 @@ var EntityUtils;
2695
2706
  expandLocation: true
2696
2707
  })];
2697
2708
  case 9:
2698
- entity = (_l.sent()).entity;
2709
+ entity = (_f.sent()).entity;
2699
2710
  return [3 /*break*/, 11];
2700
2711
  case 10:
2701
- e_2 = _l.sent();
2712
+ e_2 = _f.sent();
2702
2713
  console.warn(e_2);
2703
2714
  return [3 /*break*/, 11];
2704
2715
  case 11:
@@ -2713,18 +2724,22 @@ var EntityUtils;
2713
2724
  tilesetId: tilesetId
2714
2725
  })];
2715
2726
  case 12:
2716
- tileset = (_l.sent()).tileset;
2717
- _l.label = 13;
2727
+ tileset = (_f.sent()).tileset;
2728
+ _f.label = 13;
2718
2729
  case 13:
2719
2730
  tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
2720
2731
  pos3d = null;
2721
- if (!(((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude) || ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _c === void 0 ? void 0 : _c.longitude))) return [3 /*break*/, 16];
2722
- if ((_d = entity === null || entity === void 0 ? void 0 : entity.location) === null || _d === void 0 ? void 0 : _d.longitude) {
2723
- alt = +entity.location.altitude;
2732
+ eLocation = Entity$1.GetValue({
2733
+ entity: entity,
2734
+ path: ["location"]
2735
+ });
2736
+ if (!((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) || ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _b === void 0 ? void 0 : _b.longitude))) return [3 /*break*/, 16];
2737
+ if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
2738
+ alt = +eLocation.altitude;
2724
2739
  if (isNaN(alt)) {
2725
2740
  alt = 0;
2726
2741
  }
2727
- pos3d = Cartesian3.fromDegrees(+entity.location.longitude, +entity.location.latitude, alt);
2742
+ pos3d = Cartesian3.fromDegrees(+eLocation.longitude, +eLocation.latitude, alt);
2728
2743
  }
2729
2744
  else {
2730
2745
  alt = +tSettings.location.altitude;
@@ -2734,25 +2749,29 @@ var EntityUtils;
2734
2749
  pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
2735
2750
  }
2736
2751
  if (!(entity === null || entity === void 0 ? void 0 : entity.worldPosition)) return [3 /*break*/, 16];
2752
+ eTransform = Entity$1.GetValue({
2753
+ entity: entity,
2754
+ path: ["transform"]
2755
+ });
2737
2756
  heading = 0;
2738
2757
  pitch = 0;
2739
2758
  roll = 0;
2740
- if ((_e = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _e === void 0 ? void 0 : _e.heading) {
2741
- heading = entity.transform.heading;
2759
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
2760
+ heading = eTransform.heading;
2742
2761
  }
2743
- else if ((_f = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _f === void 0 ? void 0 : _f.heading) {
2762
+ else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.heading) {
2744
2763
  heading = tSettings.transform.heading;
2745
2764
  }
2746
- if ((_g = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _g === void 0 ? void 0 : _g.pitch) {
2747
- pitch = entity.transform.pitch;
2765
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
2766
+ pitch = eTransform.pitch;
2748
2767
  }
2749
- else if ((_h = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _h === void 0 ? void 0 : _h.pitch) {
2768
+ else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.pitch) {
2750
2769
  pitch = tSettings.transform.pitch;
2751
2770
  }
2752
- if ((_j = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _j === void 0 ? void 0 : _j.roll) {
2753
- roll = entity.transform.roll;
2771
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
2772
+ roll = eTransform.roll;
2754
2773
  }
2755
- else if ((_k = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _k === void 0 ? void 0 : _k.roll) {
2774
+ else if ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _e === void 0 ? void 0 : _e.roll) {
2756
2775
  roll = tSettings.transform.roll;
2757
2776
  }
2758
2777
  heading = +heading;
@@ -2781,8 +2800,8 @@ var EntityUtils;
2781
2800
  if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 15];
2782
2801
  return [4 /*yield*/, processPosHeight(pos3d, HeightReference.NONE)];
2783
2802
  case 14:
2784
- pos3d = _l.sent();
2785
- _l.label = 15;
2803
+ pos3d = _f.sent();
2804
+ _f.label = 15;
2786
2805
  case 15:
2787
2806
  if ((entity === null || entity === void 0 ? void 0 : entity.geometryRadius) && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
2788
2807
  sphere = BoundingSphere.fromPoints([pos3d]);
@@ -2792,7 +2811,7 @@ var EntityUtils;
2792
2811
  spheres.push(sphere);
2793
2812
  }
2794
2813
  }
2795
- _l.label = 16;
2814
+ _f.label = 16;
2796
2815
  case 16:
2797
2816
  if (pos3d) {
2798
2817
  return [2 /*return*/, [pos3d]];
@@ -2953,17 +2972,24 @@ var EntityUtils;
2953
2972
  return null;
2954
2973
  }
2955
2974
  function evaluateRecord() {
2956
- if (entity.location && Carto.ValidateCarto(entity.location)) {
2957
- var location_2 = entity.location;
2958
- var latitude = EnsureNumber(location_2.latitude);
2959
- var longitude = EnsureNumber(location_2.longitude);
2975
+ var location = Entity$1.GetValue({
2976
+ entity: entity,
2977
+ path: ["location"]
2978
+ });
2979
+ if (location && typeof location == "object" && Carto.ValidateCarto(location)) {
2980
+ var latitude = EnsureNumber(location.latitude);
2981
+ var longitude = EnsureNumber(location.longitude);
2960
2982
  // Disallowing exact 0.
2961
2983
  if (latitude || longitude) {
2962
- return Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location_2.altitude));
2984
+ return Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2963
2985
  }
2964
2986
  }
2965
- if (entity.geometry && typeof entity.geometry == "object") {
2966
- var pointStr = entity.geometry.Point;
2987
+ var geometry = Entity$1.GetValue({
2988
+ entity: entity,
2989
+ path: ["geometry"]
2990
+ });
2991
+ if (geometry && typeof geometry == "object") {
2992
+ var pointStr = geometry.Point;
2967
2993
  if (pointStr && typeof pointStr == "string") {
2968
2994
  var points = Geometry.ParsePoints(pointStr);
2969
2995
  var point = points.length > 0 ? points[0] : null;
@@ -2971,7 +2997,7 @@ var EntityUtils;
2971
2997
  return Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2972
2998
  }
2973
2999
  }
2974
- var lineStr = entity.geometry.LineString;
3000
+ var lineStr = geometry.LineString;
2975
3001
  if (lineStr && typeof lineStr == "string") {
2976
3002
  var points = Geometry.ParsePoints(lineStr);
2977
3003
  if (points.length > 0) {
@@ -2994,7 +3020,7 @@ var EntityUtils;
2994
3020
  }
2995
3021
  }
2996
3022
  }
2997
- var pRings = entity.geometry.Polygon;
3023
+ var pRings = geometry.Polygon;
2998
3024
  if (pRings && typeof pRings == "object") {
2999
3025
  var boundary = pRings.find(function (x) { return x.Facing == Geometry.EPolygonRingType.Boundaries; });
3000
3026
  if (boundary === null || boundary === void 0 ? void 0 : boundary.LinearRing) {
@@ -3006,10 +3032,14 @@ var EntityUtils;
3006
3032
  }
3007
3033
  }
3008
3034
  }
3009
- if (entity.boundaries) {
3035
+ var boundaries = Entity$1.GetValue({
3036
+ entity: entity,
3037
+ path: ["boundaries"]
3038
+ });
3039
+ if (boundaries && typeof boundaries == "object") {
3010
3040
  var point = {
3011
- latitude: (EnsureNumber(entity.boundaries.minLatitude) + EnsureNumber(entity.boundaries.maxLatitude)) / 2,
3012
- longitude: (EnsureNumber(entity.boundaries.minLongitude) + EnsureNumber(entity.boundaries.maxLongitude)) / 2,
3041
+ latitude: (EnsureNumber(boundaries.minLatitude) + EnsureNumber(boundaries.maxLatitude)) / 2,
3042
+ longitude: (EnsureNumber(boundaries.minLongitude) + EnsureNumber(boundaries.maxLongitude)) / 2,
3013
3043
  altitude: 0
3014
3044
  };
3015
3045
  // Disallowing exact 0.
@@ -3041,48 +3071,54 @@ var EntityUtils;
3041
3071
  * @returns
3042
3072
  */
3043
3073
  function GetPosAsync(params) {
3044
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3074
+ var _a, _b, _c, _d, _e;
3045
3075
  return __awaiter(this, void 0, void 0, function () {
3046
- var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, e_3, e_4, pos3d, tSettings, alt, alt, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset;
3047
- return __generator(this, function (_o) {
3048
- switch (_o.label) {
3076
+ var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, location_1, e_3, e_4, pos3d, tSettings, eLocation, alt, alt, heading, pitch, roll, eTransform, matrix4, offset, m1, hpr, transform, transformedOffset;
3077
+ return __generator(this, function (_f) {
3078
+ switch (_f.label) {
3049
3079
  case 0:
3050
3080
  viewer = params.viewer, entityId = params.entityId, entity = params.entity, tileset = params.tileset, tilesetId = params.tilesetId, visualRegister = params.visualRegister, returnHeightRef = params.returnHeightRef, recordHeightRef = params.recordHeightRef, api = params.api;
3051
3081
  if (!!entity) return [3 /*break*/, 9];
3052
3082
  lat = 0;
3053
3083
  lon = 0;
3054
- _o.label = 1;
3084
+ _f.label = 1;
3055
3085
  case 1:
3056
- _o.trys.push([1, 3, , 4]);
3086
+ _f.trys.push([1, 3, , 4]);
3057
3087
  return [4 /*yield*/, Entity$1.Get({
3058
3088
  api: api,
3059
3089
  entityId: entityId,
3060
3090
  expandLocation: false
3061
3091
  })];
3062
3092
  case 2:
3063
- entity = (_o.sent()).entity;
3064
- lat = +((_a = entity === null || entity === void 0 ? void 0 : entity.location) === null || _a === void 0 ? void 0 : _a.latitude);
3065
- lon = +((_b = entity === null || entity === void 0 ? void 0 : entity.location) === null || _b === void 0 ? void 0 : _b.longitude);
3093
+ entity = (_f.sent()).entity;
3094
+ if (entity) {
3095
+ location_1 = Entity$1.GetValue({
3096
+ entity: entity,
3097
+ path: ["location"]
3098
+ });
3099
+ lat = +(location_1 === null || location_1 === void 0 ? void 0 : location_1.latitude);
3100
+ lon = +(location_1 === null || location_1 === void 0 ? void 0 : location_1.longitude);
3101
+ }
3066
3102
  return [3 /*break*/, 4];
3067
3103
  case 3:
3068
- e_3 = _o.sent();
3104
+ e_3 = _f.sent();
3069
3105
  console.error(e_3);
3070
3106
  return [3 /*break*/, 4];
3071
3107
  case 4:
3072
3108
  if (!(entity && (isNaN(lat) || isNaN(lon) || (lat == 0 && lon == 0)))) return [3 /*break*/, 9];
3073
- _o.label = 5;
3109
+ _f.label = 5;
3074
3110
  case 5:
3075
- _o.trys.push([5, 7, , 9]);
3111
+ _f.trys.push([5, 7, , 9]);
3076
3112
  return [4 /*yield*/, Entity$1.Get({
3077
3113
  api: api,
3078
3114
  entityId: entityId,
3079
3115
  expandLocation: true
3080
3116
  })];
3081
3117
  case 6:
3082
- entity = (_o.sent()).entity;
3118
+ entity = (_f.sent()).entity;
3083
3119
  return [3 /*break*/, 9];
3084
3120
  case 7:
3085
- e_4 = _o.sent();
3121
+ e_4 = _f.sent();
3086
3122
  console.warn(e_4);
3087
3123
  return [4 /*yield*/, Entity$1.Get({
3088
3124
  api: api,
@@ -3090,14 +3126,14 @@ var EntityUtils;
3090
3126
  expandLocation: false
3091
3127
  })];
3092
3128
  case 8:
3093
- entity = (_o.sent()).entity;
3129
+ entity = (_f.sent()).entity;
3094
3130
  return [3 /*break*/, 9];
3095
3131
  case 9:
3096
3132
  if (!entity) {
3097
3133
  return [2 /*return*/, null];
3098
3134
  }
3099
3135
  if (!tilesetId) {
3100
- tilesetId = ((_c = entity.tilesetID) === null || _c === void 0 ? void 0 : _c.length) ? entity.tilesetID[0] : tilesetId;
3136
+ tilesetId = ((_a = entity.tilesetID) === null || _a === void 0 ? void 0 : _a.length) ? entity.tilesetID[0] : tilesetId;
3101
3137
  }
3102
3138
  pos3d = tilesetId ? null : GetPos({
3103
3139
  viewer: viewer,
@@ -3116,17 +3152,21 @@ var EntityUtils;
3116
3152
  tilesetId: tilesetId
3117
3153
  })];
3118
3154
  case 10:
3119
- tileset = (_o.sent()).tileset;
3120
- _o.label = 11;
3155
+ tileset = (_f.sent()).tileset;
3156
+ _f.label = 11;
3121
3157
  case 11:
3122
3158
  tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
3123
- if (((_d = entity.location) === null || _d === void 0 ? void 0 : _d.longitude) || ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _e === void 0 ? void 0 : _e.longitude)) {
3124
- if ((_f = entity === null || entity === void 0 ? void 0 : entity.location) === null || _f === void 0 ? void 0 : _f.longitude) {
3125
- alt = +entity.location.altitude;
3159
+ eLocation = Entity$1.GetValue({
3160
+ entity: entity,
3161
+ path: ["location"]
3162
+ });
3163
+ if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) || ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _b === void 0 ? void 0 : _b.longitude)) {
3164
+ if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
3165
+ alt = +eLocation.altitude;
3126
3166
  if (isNaN(alt)) {
3127
3167
  alt = 0;
3128
3168
  }
3129
- pos3d = Cartesian3.fromDegrees(+entity.location.longitude, +entity.location.latitude, alt);
3169
+ pos3d = Cartesian3.fromDegrees(+eLocation.longitude, +eLocation.latitude, alt);
3130
3170
  }
3131
3171
  else {
3132
3172
  alt = +tSettings.location.altitude;
@@ -3140,22 +3180,26 @@ var EntityUtils;
3140
3180
  heading = 0;
3141
3181
  pitch = 0;
3142
3182
  roll = 0;
3143
- if ((_g = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _g === void 0 ? void 0 : _g.heading) {
3144
- heading = entity.transform.heading;
3183
+ eTransform = Entity$1.GetValue({
3184
+ entity: entity,
3185
+ path: ["transform"]
3186
+ });
3187
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
3188
+ heading = eTransform.heading;
3145
3189
  }
3146
- else if ((_h = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _h === void 0 ? void 0 : _h.heading) {
3190
+ else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.heading) {
3147
3191
  heading = tSettings.transform.heading;
3148
3192
  }
3149
- if ((_j = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _j === void 0 ? void 0 : _j.pitch) {
3150
- pitch = entity.transform.pitch;
3193
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
3194
+ pitch = eTransform.pitch;
3151
3195
  }
3152
- else if ((_k = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _k === void 0 ? void 0 : _k.pitch) {
3196
+ else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.pitch) {
3153
3197
  pitch = tSettings.transform.pitch;
3154
3198
  }
3155
- if ((_l = entity === null || entity === void 0 ? void 0 : entity.transform) === null || _l === void 0 ? void 0 : _l.roll) {
3156
- roll = entity.transform.roll;
3199
+ if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
3200
+ roll = eTransform.roll;
3157
3201
  }
3158
- else if ((_m = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _m === void 0 ? void 0 : _m.roll) {
3202
+ else if ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _e === void 0 ? void 0 : _e.roll) {
3159
3203
  roll = tSettings.transform.roll;
3160
3204
  }
3161
3205
  heading = +heading;
@@ -3439,7 +3483,19 @@ function createCacheKey(point, entity) {
3439
3483
  longitude: MathUtils.Round(+point.longitude, 5),
3440
3484
  altitude: MathUtils.Round(+point.altitude, 4)
3441
3485
  };
3442
- var entityData = __assign(__assign(__assign({}, entity.location), entity.geometry), entity.boundaries);
3486
+ var location_1 = Entity$1.GetValue({
3487
+ entity: entity,
3488
+ path: ["location"]
3489
+ });
3490
+ var geometry = Entity$1.GetValue({
3491
+ entity: entity,
3492
+ path: ["geometry"]
3493
+ });
3494
+ var boundaries = Entity$1.GetValue({
3495
+ entity: entity,
3496
+ path: ["boundaries"]
3497
+ });
3498
+ var entityData = __assign(__assign(__assign({}, location_1), geometry), boundaries);
3443
3499
  return JSON.stringify(pointData) + '|' + JSON.stringify(entityData);
3444
3500
  }
3445
3501
  catch (e) {
@@ -3464,12 +3520,16 @@ function calculateDistance(point, entity) {
3464
3520
  var pointPos = Cartesian3.fromDegrees(point.longitude, point.latitude, point.altitude);
3465
3521
  // We'll start by using the entity location if it's available.
3466
3522
  var entityPos3d = null;
3467
- if (entity.location && entity.location.latitude) {
3468
- var latitude = EnsureNumber(entity.location.latitude);
3469
- var longitude = EnsureNumber(entity.location.longitude);
3523
+ var location = Entity$1.GetValue({
3524
+ entity: entity,
3525
+ path: ["location"]
3526
+ });
3527
+ if (location && location.latitude) {
3528
+ var latitude = EnsureNumber(location.latitude);
3529
+ var longitude = EnsureNumber(location.longitude);
3470
3530
  // Disallowing exact 0.
3471
3531
  if (latitude || longitude) {
3472
- var altitude = EnsureNumber(entity.location.altitude);
3532
+ var altitude = EnsureNumber(location.altitude);
3473
3533
  entityPos3d = Cartesian3.fromDegrees(longitude, latitude, altitude);
3474
3534
  }
3475
3535
  }
@@ -3477,10 +3537,14 @@ function calculateDistance(point, entity) {
3477
3537
  minDistance = Cartesian3.distance(pointPos, entityPos3d);
3478
3538
  }
3479
3539
  // Check geometry if it's available.
3480
- if (entity.geometry) {
3540
+ var geometry = Entity$1.GetValue({
3541
+ entity: entity,
3542
+ path: ["geometry"]
3543
+ });
3544
+ if (geometry) {
3481
3545
  var passedGeometry = false;
3482
- if (entity.geometry.Polygon) {
3483
- var polygonRings = entity.geometry.Polygon;
3546
+ if (geometry.Polygon) {
3547
+ var polygonRings = geometry.Polygon;
3484
3548
  var polygon = typeof polygonRings == "string" ? String(polygonRings) : polygonRings.length ? polygonRings[0].LinearRing : "";
3485
3549
  var points = polygon ? Geometry.ParsePoints(polygon) : [];
3486
3550
  if (points.length > 2) {
@@ -3491,8 +3555,8 @@ function calculateDistance(point, entity) {
3491
3555
  }
3492
3556
  }
3493
3557
  }
3494
- if (!passedGeometry && entity.geometry.LineString) {
3495
- var points = Geometry.ParsePoints(entity.geometry.LineString);
3558
+ if (!passedGeometry && geometry.LineString) {
3559
+ var points = Geometry.ParsePoints(geometry.LineString);
3496
3560
  if (points.length > 1) {
3497
3561
  var pointsLen = points.length;
3498
3562
  for (var i = 0; i < pointsLen; i++) {
@@ -3519,18 +3583,24 @@ function calculateDistance(point, entity) {
3519
3583
  }
3520
3584
  }
3521
3585
  }
3522
- // Backup is using boundaries.
3523
- if (minDistance === Infinity && entity.boundaries) {
3524
- var point_1 = {
3525
- latitude: (EnsureNumber(entity.boundaries.minLatitude) + EnsureNumber(entity.boundaries.maxLatitude)) / 2,
3526
- longitude: (EnsureNumber(entity.boundaries.minLongitude) + EnsureNumber(entity.boundaries.maxLongitude)) / 2,
3527
- altitude: 0
3528
- };
3529
- // Disallowing exact 0.
3530
- if (point_1.latitude || point_1.longitude) {
3531
- if (Carto.ValidateCarto(point_1)) {
3532
- var boundsPoint = Cartesian3.fromDegrees(point_1.longitude, point_1.latitude, point_1.altitude);
3533
- minDistance = Cartesian3.distance(pointPos, boundsPoint);
3586
+ // Backup is using Entity boundaries.
3587
+ if (minDistance === Infinity) {
3588
+ var boundaries = Entity$1.GetValue({
3589
+ entity: entity,
3590
+ path: ["boundaries"]
3591
+ });
3592
+ if (boundaries && typeof boundaries == "object") {
3593
+ var point_1 = {
3594
+ latitude: (EnsureNumber(boundaries.minLatitude) + EnsureNumber(boundaries.maxLatitude)) / 2,
3595
+ longitude: (EnsureNumber(boundaries.minLongitude) + EnsureNumber(boundaries.maxLongitude)) / 2,
3596
+ altitude: 0
3597
+ };
3598
+ // Disallowing exact 0.
3599
+ if (point_1.latitude || point_1.longitude) {
3600
+ if (Carto.ValidateCarto(point_1)) {
3601
+ var boundsPoint = Cartesian3.fromDegrees(point_1.longitude, point_1.latitude, point_1.altitude);
3602
+ minDistance = Cartesian3.distance(pointPos, boundsPoint);
3603
+ }
3534
3604
  }
3535
3605
  }
3536
3606
  }
@@ -4544,7 +4614,6 @@ function colorToCColor(color) {
4544
4614
  return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
4545
4615
  }
4546
4616
  function getPolygonStyleExtrusion(pStyle, entity, tags, heightRef) {
4547
- var _a;
4548
4617
  var attrPath = pStyle.extrusionPath;
4549
4618
  if (!pStyle.useExtrusion || !attrPath) {
4550
4619
  return null;
@@ -4559,7 +4628,10 @@ function getPolygonStyleExtrusion(pStyle, entity, tags, heightRef) {
4559
4628
  If you want something that is 50 meters above sea, and 5 meters tall,
4560
4629
  You need to extrude by 55 meters, if you extrude by 5 it will extrude from sea and look flat.
4561
4630
  */
4562
- var height = (_a = entity.location) === null || _a === void 0 ? void 0 : _a.altitude;
4631
+ var height = Entity$1.GetValue({
4632
+ entity: entity,
4633
+ path: ["location", "altitude"]
4634
+ });
4563
4635
  return heightRef != HeightReference.CLAMP_TO_GROUND ? extrusion + height : extrusion;
4564
4636
  }
4565
4637
  catch (e) {
@@ -4568,7 +4640,6 @@ function getPolygonStyleExtrusion(pStyle, entity, tags, heightRef) {
4568
4640
  return 0;
4569
4641
  }
4570
4642
  function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
4571
- var _a;
4572
4643
  var data = {
4573
4644
  value: undefined,
4574
4645
  exHeightRef: HeightReference.RELATIVE_TO_GROUND,
@@ -4580,7 +4651,10 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
4580
4651
  if (heightRef == HeightReference.NONE) {
4581
4652
  // Let's normalize all point heights to be the same (at entity altitude).
4582
4653
  // This let's us have a consistent extrusion height, and be adjustable easier by user.
4583
- var alt_1 = (_a = entity === null || entity === void 0 ? void 0 : entity.location) === null || _a === void 0 ? void 0 : _a.altitude;
4654
+ var alt_1 = Entity$1.GetValue({
4655
+ entity: entity,
4656
+ path: ["location", "altitude"]
4657
+ });
4584
4658
  if (!alt_1) {
4585
4659
  alt_1 = 0;
4586
4660
  }
@@ -4621,7 +4695,6 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
4621
4695
  return data;
4622
4696
  }
4623
4697
  function getCylinderStyleExtrusion(style, entity, tags, heightRef) {
4624
- var _a;
4625
4698
  if (!style) {
4626
4699
  return null;
4627
4700
  }
@@ -4635,7 +4708,10 @@ function getCylinderStyleExtrusion(style, entity, tags, heightRef) {
4635
4708
  If you want something that is 50 meters above sea, and 5 meters tall,
4636
4709
  You need to extrude by 55 meters, if you extrude by 5 it will extrude from sea and look flat.
4637
4710
  */
4638
- var height = EnsureNumber((_a = entity.location) === null || _a === void 0 ? void 0 : _a.altitude, 0);
4711
+ var height = EnsureNumber(Entity$1.GetValue({
4712
+ entity: entity,
4713
+ path: ["location", "altitude"]
4714
+ }), 0);
4639
4715
  return heightRef != HeightReference.CLAMP_TO_GROUND ? extrusion + height : extrusion;
4640
4716
  }
4641
4717
  catch (e) {
@@ -4852,40 +4928,40 @@ function getDisplayCondition(min, max, meterSize, isPolygon) {
4852
4928
  * @param entity
4853
4929
  */
4854
4930
  function getSizeOfPolygonEntity(entity) {
4855
- var _a, _b;
4856
4931
  if (!entity) {
4857
4932
  return null;
4858
4933
  }
4859
- var hasResetBounds = false;
4860
- var resetBounds = function () {
4861
- hasResetBounds = true;
4862
- entity.boundaries = Bounds.FromEntity(entity);
4863
- return entity.boundaries;
4934
+ var hasCalculatedBounds = false;
4935
+ var bounds = Entity$1.GetValue({
4936
+ entity: entity,
4937
+ path: ["boundaries"]
4938
+ });
4939
+ var calculateBounds = function () {
4940
+ hasCalculatedBounds = true;
4941
+ bounds = Bounds.FromEntity(entity);
4864
4942
  };
4865
4943
  var checkHasArea = function () {
4866
- var _a, _b, _c, _d;
4867
- return ((_a = entity.boundaries) === null || _a === void 0 ? void 0 : _a.minLongitude) != ((_b = entity.boundaries) === null || _b === void 0 ? void 0 : _b.maxLongitude) || ((_c = entity.boundaries) === null || _c === void 0 ? void 0 : _c.minLatitude) != ((_d = entity.boundaries) === null || _d === void 0 ? void 0 : _d.maxLatitude);
4944
+ return (bounds === null || bounds === void 0 ? void 0 : bounds.minLongitude) != (bounds === null || bounds === void 0 ? void 0 : bounds.maxLongitude) || (bounds === null || bounds === void 0 ? void 0 : bounds.minLatitude) != (bounds === null || bounds === void 0 ? void 0 : bounds.maxLatitude);
4868
4945
  };
4869
4946
  // Create bounds if missing entirely.
4870
- if (!entity.boundaries) {
4871
- resetBounds();
4947
+ if (!bounds) {
4948
+ calculateBounds();
4872
4949
  }
4873
- if (!((_a = entity.boundaries) === null || _a === void 0 ? void 0 : _a.minLatitude)) {
4950
+ if (!(bounds === null || bounds === void 0 ? void 0 : bounds.minLatitude)) {
4874
4951
  return null;
4875
4952
  }
4876
4953
  // Check for bounds that are a single point.
4877
4954
  if (!checkHasArea()) {
4878
4955
  // Already tried to reconstruct, so we'll just give up.
4879
- if (hasResetBounds) {
4956
+ if (hasCalculatedBounds) {
4880
4957
  return null;
4881
4958
  }
4882
- resetBounds();
4959
+ calculateBounds();
4883
4960
  // Check after reconstruction. If still bad then give up.
4884
- if (!((_b = entity.boundaries) === null || _b === void 0 ? void 0 : _b.minLatitude) || !checkHasArea()) {
4961
+ if (!(bounds === null || bounds === void 0 ? void 0 : bounds.minLatitude) || !checkHasArea()) {
4885
4962
  return null;
4886
4963
  }
4887
4964
  }
4888
- var bounds = entity === null || entity === void 0 ? void 0 : entity.boundaries;
4889
4965
  var minLat = +(bounds === null || bounds === void 0 ? void 0 : bounds.minLatitude);
4890
4966
  var maxLat = +(bounds === null || bounds === void 0 ? void 0 : bounds.maxLatitude);
4891
4967
  var minLon = +(bounds === null || bounds === void 0 ? void 0 : bounds.minLongitude);
@@ -4899,6 +4975,18 @@ function getSizeOfPolygonEntity(entity) {
4899
4975
  if (isNaN(length) || length <= 0) {
4900
4976
  return null;
4901
4977
  }
4978
+ if (hasCalculatedBounds) {
4979
+ // Data not migrated to an internal field.
4980
+ // We'll set the change in both places.
4981
+ if (entity.boundaries) {
4982
+ entity.boundaries = bounds;
4983
+ entity.Bruce.boundaries = bounds;
4984
+ }
4985
+ // Data migrated to an internal field.
4986
+ else {
4987
+ entity.Bruce.boundaries = bounds;
4988
+ }
4989
+ }
4902
4990
  return length;
4903
4991
  }
4904
4992
  var _billboardCache = new LRUCache(150);
@@ -5195,11 +5283,11 @@ function compareColorMaterials(viewer, a, b) {
5195
5283
  var EntityRenderEngine;
5196
5284
  (function (EntityRenderEngine) {
5197
5285
  function Render(params) {
5198
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5286
+ var _a, _b, _c, _d, _e, _f, _g;
5199
5287
  return __awaiter(this, void 0, void 0, function () {
5200
- var groupRenderParams, i, entity, geometry, updated, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
5201
- return __generator(this, function (_k) {
5202
- switch (_k.label) {
5288
+ var groupRenderParams, i, entity, geometry, updated, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, geometry, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
5289
+ return __generator(this, function (_h) {
5290
+ switch (_h.label) {
5203
5291
  case 0:
5204
5292
  groupRenderParams = {
5205
5293
  apiGetter: params.apiGetter,
@@ -5212,9 +5300,20 @@ var EntityRenderEngine;
5212
5300
  // Flatten multi-geometry if it's only got 1 piece.
5213
5301
  for (i = 0; i < params.entities.length; i++) {
5214
5302
  entity = params.entities[i];
5215
- geometry = entity.geometry;
5303
+ geometry = Entity$1.GetValue({
5304
+ entity: entity,
5305
+ path: ["geometry"]
5306
+ });
5216
5307
  if (((_a = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _a === void 0 ? void 0 : _a.length) == 1) {
5217
- entity.geometry = __assign(__assign(__assign({}, entity.geometry), geometry.MultiGeometry[0]), { MultiGeometry: [] });
5308
+ // Not migrated to internal, set in both places.
5309
+ if (entity.geometry) {
5310
+ entity.geometry = __assign(__assign(__assign({}, entity.geometry), geometry.MultiGeometry[0]), { MultiGeometry: [] });
5311
+ entity.Bruce.geometry = entity.geometry;
5312
+ }
5313
+ // Migrated to internal, we'll set it there.
5314
+ else if (entity.Bruce.geometry) {
5315
+ entity.Bruce.geometry = __assign(__assign(__assign({}, entity.Bruce.geometry), geometry.MultiGeometry[0]), { MultiGeometry: [] });
5316
+ }
5218
5317
  }
5219
5318
  }
5220
5319
  updated = new Map();
@@ -5252,7 +5351,7 @@ var EntityRenderEngine;
5252
5351
  newRenderId == oldRenderId &&
5253
5352
  !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
5254
5353
  // If historic metadata is different then it's also stale.
5255
- ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.historicDateTime))) {
5354
+ ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.HistoricDateTime))) {
5256
5355
  // No sorting category needed. Already rendered the way we want.
5257
5356
  cEntities.set(id, existingRego.visual);
5258
5357
  }
@@ -5263,8 +5362,8 @@ var EntityRenderEngine;
5263
5362
  // Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
5264
5363
  existingRego.stale = false;
5265
5364
  // Update metadata for the same reason.
5266
- existingRego.historicDateTime = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.historicDateTime;
5267
- existingRego.historicAttrKey = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicAttrKey;
5365
+ existingRego.historicDateTime = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.HistoricDateTime;
5366
+ existingRego.historicAttrKey = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.HistoricAttrKey;
5268
5367
  existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
5269
5368
  updated.set(id, true);
5270
5369
  }
@@ -5272,7 +5371,11 @@ var EntityRenderEngine;
5272
5371
  models.push(entity);
5273
5372
  }
5274
5373
  else if (displayType == ZoomControl.EDisplayType.Geometry) {
5275
- if ((_g = (_f = entity.geometry) === null || _f === void 0 ? void 0 : _f.MultiGeometry) === null || _g === void 0 ? void 0 : _g.length) {
5374
+ geometry = Entity$1.GetValue({
5375
+ entity: entity,
5376
+ path: ["geometry"]
5377
+ });
5378
+ if ((_f = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _f === void 0 ? void 0 : _f.length) {
5276
5379
  multiGeometry.push(entity);
5277
5380
  }
5278
5381
  else {
@@ -5290,7 +5393,7 @@ var EntityRenderEngine;
5290
5393
  mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models, entitiesHistoric: params.entitiesHistoric });
5291
5394
  return [4 /*yield*/, Model3d.RenderGroup(mParams)];
5292
5395
  case 1:
5293
- mEntities = _k.sent();
5396
+ mEntities = _h.sent();
5294
5397
  for (i = 0; i < mParams.entities.length; i++) {
5295
5398
  entity = mParams.entities[i];
5296
5399
  id = entity.Bruce.ID;
@@ -5302,30 +5405,34 @@ var EntityRenderEngine;
5302
5405
  multiGeometry.push(entity);
5303
5406
  }
5304
5407
  }
5305
- _k.label = 2;
5408
+ _h.label = 2;
5306
5409
  case 2:
5307
5410
  if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
5308
5411
  _loop_1 = function (i) {
5309
- var entity, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
5310
- return __generator(this, function (_l) {
5311
- switch (_l.label) {
5412
+ var entity, geometry, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
5413
+ return __generator(this, function (_j) {
5414
+ switch (_j.label) {
5312
5415
  case 0:
5313
5416
  entity = multiGeometry[i];
5314
- if (!((_j = (_h = entity.geometry) === null || _h === void 0 ? void 0 : _h.MultiGeometry) === null || _j === void 0 ? void 0 : _j.length)) {
5417
+ geometry = Entity$1.GetValue({
5418
+ entity: entity,
5419
+ path: ["geometry"]
5420
+ });
5421
+ if (!((_g = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _g === void 0 ? void 0 : _g.length)) {
5315
5422
  polygons.push(entity);
5316
5423
  return [2 /*return*/, "continue"];
5317
5424
  }
5318
5425
  pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
5319
5426
  pParams.entitiesHistoric = params.entitiesHistoric;
5320
5427
  zoomItem = pParams.zoomItems[entity.Bruce.ID];
5321
- for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
5322
- subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: ObjectUtils.UId() }) });
5428
+ for (j = 0; j < geometry.MultiGeometry.length; j++) {
5429
+ subEntity = __assign(__assign({}, entity), { geometry: geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: ObjectUtils.UId() }) });
5323
5430
  pParams.zoomItems[subEntity.Bruce.ID] = zoomItem;
5324
5431
  pParams.entities.push(subEntity);
5325
5432
  }
5326
5433
  return [4 /*yield*/, Polygon.RenderGroup(pParams)];
5327
5434
  case 1:
5328
- cPoly = _l.sent();
5435
+ cPoly = _j.sent();
5329
5436
  Array.from(cPoly.keys()).forEach(function (key) {
5330
5437
  if (cPoly.get(key)) {
5331
5438
  pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
@@ -5334,7 +5441,7 @@ var EntityRenderEngine;
5334
5441
  rendered = Array.from(cPoly.values());
5335
5442
  return [4 /*yield*/, Polyline.RenderGroup(pParams)];
5336
5443
  case 2:
5337
- cLines = _l.sent();
5444
+ cLines = _j.sent();
5338
5445
  Array.from(cLines.keys()).forEach(function (key) {
5339
5446
  if (cLines.get(key)) {
5340
5447
  pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
@@ -5344,9 +5451,9 @@ var EntityRenderEngine;
5344
5451
  if (!!rendered.length) return [3 /*break*/, 4];
5345
5452
  return [4 /*yield*/, Point.RenderGroup(pParams)];
5346
5453
  case 3:
5347
- cPoints = _l.sent();
5454
+ cPoints = _j.sent();
5348
5455
  rendered = rendered.concat(Array.from(cPoints.values()));
5349
- _l.label = 4;
5456
+ _j.label = 4;
5350
5457
  case 4:
5351
5458
  rendered = rendered.filter(function (x) { return x != null; });
5352
5459
  if (rendered.length) {
@@ -5373,13 +5480,13 @@ var EntityRenderEngine;
5373
5480
  });
5374
5481
  };
5375
5482
  i = 0;
5376
- _k.label = 3;
5483
+ _h.label = 3;
5377
5484
  case 3:
5378
5485
  if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
5379
5486
  return [5 /*yield**/, _loop_1(i)];
5380
5487
  case 4:
5381
- _k.sent();
5382
- _k.label = 5;
5488
+ _h.sent();
5489
+ _h.label = 5;
5383
5490
  case 5:
5384
5491
  i++;
5385
5492
  return [3 /*break*/, 3];
@@ -5388,7 +5495,7 @@ var EntityRenderEngine;
5388
5495
  pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
5389
5496
  return [4 /*yield*/, Polygon.RenderGroup(pParams)];
5390
5497
  case 7:
5391
- pEntities = _k.sent();
5498
+ pEntities = _h.sent();
5392
5499
  for (i = 0; i < pParams.entities.length; i++) {
5393
5500
  entity = pParams.entities[i];
5394
5501
  cEntity = pEntities.get(entity.Bruce.ID);
@@ -5399,13 +5506,13 @@ var EntityRenderEngine;
5399
5506
  polylines.push(entity);
5400
5507
  }
5401
5508
  }
5402
- _k.label = 8;
5509
+ _h.label = 8;
5403
5510
  case 8:
5404
5511
  if (!(polylines.length > 0)) return [3 /*break*/, 10];
5405
5512
  pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
5406
5513
  return [4 /*yield*/, Polyline.RenderGroup(pParams)];
5407
5514
  case 9:
5408
- pEntities = _k.sent();
5515
+ pEntities = _h.sent();
5409
5516
  for (i = 0; i < pParams.entities.length; i++) {
5410
5517
  entity = pParams.entities[i];
5411
5518
  cEntity = pEntities.get(entity.Bruce.ID);
@@ -5416,13 +5523,13 @@ var EntityRenderEngine;
5416
5523
  points.push(entity);
5417
5524
  }
5418
5525
  }
5419
- _k.label = 10;
5526
+ _h.label = 10;
5420
5527
  case 10:
5421
5528
  if (!(points.length > 0)) return [3 /*break*/, 12];
5422
5529
  pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities, entitiesHistoric: params.entitiesHistoric });
5423
5530
  return [4 /*yield*/, Point.RenderGroup(pParams)];
5424
5531
  case 11:
5425
- pEntities = _k.sent();
5532
+ pEntities = _h.sent();
5426
5533
  for (i = 0; i < pParams.entities.length; i++) {
5427
5534
  entity = pParams.entities[i];
5428
5535
  cEntity = pEntities.get(entity.Bruce.ID);
@@ -5430,7 +5537,7 @@ var EntityRenderEngine;
5430
5537
  cEntities.set(entity.Bruce.ID, cEntity);
5431
5538
  }
5432
5539
  }
5433
- _k.label = 12;
5540
+ _h.label = 12;
5434
5541
  case 12: return [2 /*return*/, {
5435
5542
  entities: cEntities,
5436
5543
  updated: updated
@@ -6034,10 +6141,12 @@ var EntityRenderEngine;
6034
6141
  var Polyline;
6035
6142
  (function (Polyline) {
6036
6143
  function Render(params) {
6037
- var _a;
6038
6144
  var entity = params.entity;
6039
- var line = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.LineString;
6040
- var points = line && typeof line == "string" ? Geometry.ParsePoints(line) : [];
6145
+ var lineString = Entity$1.GetValue({
6146
+ entity: entity,
6147
+ path: ["geometry", "LineString"]
6148
+ });
6149
+ var points = lineString && typeof lineString == "string" ? Geometry.ParsePoints(lineString) : [];
6041
6150
  if (!points || points.length < 2) {
6042
6151
  return null;
6043
6152
  }
@@ -6295,10 +6404,13 @@ var EntityRenderEngine;
6295
6404
  var Polygon;
6296
6405
  (function (Polygon) {
6297
6406
  function Render(params) {
6298
- var _a, _b, _c;
6407
+ var _a, _b;
6299
6408
  var entity = params.entity;
6300
- var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
6301
- if (pRings == null || pRings.length <= 0) {
6409
+ var pRings = Entity$1.GetValue({
6410
+ entity: entity,
6411
+ path: ["geometry", "Polygon"]
6412
+ });
6413
+ if (pRings == null || !Array.isArray(pRings) || pRings.length <= 0) {
6302
6414
  return null;
6303
6415
  }
6304
6416
  var style = params.style;
@@ -6463,7 +6575,7 @@ var EntityRenderEngine;
6463
6575
  }
6464
6576
  }
6465
6577
  var borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
6466
- var cEntityBorder = (_c = (_b = params.rendered) === null || _b === void 0 ? void 0 : _b._siblingGraphics) === null || _c === void 0 ? void 0 : _c[0];
6578
+ var cEntityBorder = (_b = (_a = params.rendered) === null || _a === void 0 ? void 0 : _a._siblingGraphics) === null || _b === void 0 ? void 0 : _b[0];
6467
6579
  cEntity._siblingGraphics = [];
6468
6580
  if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
6469
6581
  (!cEntityBorder.corridor && units == "m"))) {
@@ -11148,7 +11260,7 @@ var EntitiesRenderManager;
11148
11260
  case 0:
11149
11261
  entitiesHistoric = {};
11150
11262
  if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey)) return [3 /*break*/, 2];
11151
- toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
11263
+ toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey); });
11152
11264
  for (i = 0; i < toRemove.length; i++) {
11153
11265
  entity = toRemove[i];
11154
11266
  this.visualsManager.RemoveRegos({
@@ -11158,7 +11270,7 @@ var EntitiesRenderManager;
11158
11270
  });
11159
11271
  (_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
11160
11272
  }
11161
- entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
11273
+ entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey); });
11162
11274
  if (!this.item.historicInterpolation) return [3 /*break*/, 2];
11163
11275
  if (!entities.length) return [3 /*break*/, 2];
11164
11276
  startTmp = JulianDate.toDate(this.viewer.clock.startTime);
@@ -11212,7 +11324,7 @@ var EntitiesRenderManager;
11212
11324
  tagIds = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c["Layer.ID"];
11213
11325
  rego_1 = {
11214
11326
  entityId: id,
11215
- schemaId: (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.schemaId,
11327
+ schemaId: (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.SchemaID,
11216
11328
  menuItemId: this.item.id,
11217
11329
  visual: cEntity,
11218
11330
  priority: 0,
@@ -11222,8 +11334,8 @@ var EntitiesRenderManager;
11222
11334
  overrideShow: wasClustered ? false : null,
11223
11335
  name: cEntity.name,
11224
11336
  cdn: this.item.cdnEnabled,
11225
- historicDateTime: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime,
11226
- historicAttrKey: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey
11337
+ historicDateTime: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.HistoricDateTime,
11338
+ historicAttrKey: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricAttrKey
11227
11339
  };
11228
11340
  this.visualsManager.AddRego({
11229
11341
  rego: rego_1,
@@ -11235,10 +11347,10 @@ var EntitiesRenderManager;
11235
11347
  rego.visual = cEntity;
11236
11348
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
11237
11349
  rego.tagIds = ((_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
11238
- rego.historicDateTime = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.historicDateTime;
11239
- rego.historicAttrKey = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.historicAttrKey;
11350
+ rego.historicDateTime = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.HistoricDateTime;
11351
+ rego.historicAttrKey = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.HistoricAttrKey;
11240
11352
  rego.cdn = this.item.cdnEnabled;
11241
- rego.schemaId = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.schemaId;
11353
+ rego.schemaId = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.SchemaID;
11242
11354
  // We manually trigger an update event since the graphic was updated but not recreated.
11243
11355
  this.visualsManager.OnUpdate.Trigger({
11244
11356
  type: VisualsRegister.EVisualUpdateType.Update,
@@ -24391,7 +24503,7 @@ var ViewRenderEngine;
24391
24503
  ViewRenderEngine.Render = Render;
24392
24504
  })(ViewRenderEngine || (ViewRenderEngine = {}));
24393
24505
 
24394
- var VERSION = "3.9.6";
24506
+ var VERSION = "3.9.8";
24395
24507
 
24396
24508
  export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline };
24397
24509
  //# sourceMappingURL=bruce-cesium.es5.js.map