bruce-cesium 3.9.9 → 4.0.1

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, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } 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, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, 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, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, Cesium3DTileset, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Matrix4, Matrix3, IonResource, PolygonPipeline, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -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, eLocation, alt, alt, eTransform, 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, tilesetIds, tSettings, pos3d, eLocation, alt, alt, worldPosition, eTransform, heading, pitch, roll, matrix4, offset, m1, hpr, transform, transformedOffset, geometryRadius, sphere;
2421
2421
  var _this = this;
2422
- var _a, _b, _c, _d, _e;
2423
- return __generator(this, function (_f) {
2424
- switch (_f.label) {
2422
+ var _a, _b, _c, _d;
2423
+ return __generator(this, function (_e) {
2424
+ switch (_e.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 () {
@@ -2582,7 +2582,7 @@ var EntityUtils;
2582
2582
  posses = [];
2583
2583
  location = Entity$1.GetValue({
2584
2584
  entity: entity,
2585
- path: ["location"]
2585
+ path: ["Bruce", "location"]
2586
2586
  });
2587
2587
  if (location && typeof location == "object" && Carto.ValidateCarto(location)) {
2588
2588
  latitude = EnsureNumber(location.latitude);
@@ -2595,7 +2595,7 @@ var EntityUtils;
2595
2595
  }
2596
2596
  geometry = Entity$1.GetValue({
2597
2597
  entity: entity,
2598
- path: ["geometry"]
2598
+ path: ["Bruce", "geometry"]
2599
2599
  });
2600
2600
  if (!(geometry && typeof geometry == "object")) return [3 /*break*/, 4];
2601
2601
  pointStr = geometry.Point;
@@ -2659,18 +2659,18 @@ var EntityUtils;
2659
2659
  if (!(disallowRendered != true)) return [3 /*break*/, 2];
2660
2660
  return [4 /*yield*/, evaluateRendered()];
2661
2661
  case 1:
2662
- renderedPosses = _f.sent();
2662
+ renderedPosses = _e.sent();
2663
2663
  if (renderedPosses === null || renderedPosses === void 0 ? void 0 : renderedPosses.length) {
2664
2664
  return [2 /*return*/, renderedPosses];
2665
2665
  }
2666
- _f.label = 2;
2666
+ _e.label = 2;
2667
2667
  case 2:
2668
2668
  if (!!entity) return [3 /*break*/, 6];
2669
2669
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 6];
2670
2670
  apiCalls += 1;
2671
- _f.label = 3;
2671
+ _e.label = 3;
2672
2672
  case 3:
2673
- _f.trys.push([3, 5, , 6]);
2673
+ _e.trys.push([3, 5, , 6]);
2674
2674
  return [4 /*yield*/, Entity$1.Get({
2675
2675
  api: api,
2676
2676
  entityId: entityId,
@@ -2678,10 +2678,10 @@ var EntityUtils;
2678
2678
  expandLocation: false
2679
2679
  })];
2680
2680
  case 4:
2681
- entity = (_f.sent()).entity;
2681
+ entity = (_e.sent()).entity;
2682
2682
  return [3 /*break*/, 6];
2683
2683
  case 5:
2684
- e_1 = _f.sent();
2684
+ e_1 = _e.sent();
2685
2685
  console.error(e_1);
2686
2686
  return [3 /*break*/, 6];
2687
2687
  case 6:
@@ -2690,14 +2690,14 @@ var EntityUtils;
2690
2690
  }
2691
2691
  return [4 /*yield*/, evaluateRecord()];
2692
2692
  case 7:
2693
- recordPosses = _f.sent();
2693
+ recordPosses = _e.sent();
2694
2694
  if (recordPosses === null || recordPosses === void 0 ? void 0 : recordPosses.length) {
2695
2695
  return [2 /*return*/, recordPosses];
2696
2696
  }
2697
2697
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 11];
2698
- _f.label = 8;
2698
+ _e.label = 8;
2699
2699
  case 8:
2700
- _f.trys.push([8, 10, , 11]);
2700
+ _e.trys.push([8, 10, , 11]);
2701
2701
  apiCalls += 1;
2702
2702
  return [4 /*yield*/, Entity$1.Get({
2703
2703
  api: api,
@@ -2706,15 +2706,19 @@ var EntityUtils;
2706
2706
  expandLocation: true
2707
2707
  })];
2708
2708
  case 9:
2709
- entity = (_f.sent()).entity;
2709
+ entity = (_e.sent()).entity;
2710
2710
  return [3 /*break*/, 11];
2711
2711
  case 10:
2712
- e_2 = _f.sent();
2712
+ e_2 = _e.sent();
2713
2713
  console.warn(e_2);
2714
2714
  return [3 /*break*/, 11];
2715
2715
  case 11:
2716
2716
  if (!tilesetId) {
2717
- tilesetId = ((_a = entity.tilesetID) === null || _a === void 0 ? void 0 : _a.length) ? entity.tilesetID[0] : tilesetId;
2717
+ tilesetIds = Entity$1.GetValue({
2718
+ entity: entity,
2719
+ path: ["Bruce", "tilesetID"]
2720
+ });
2721
+ tilesetId = (tilesetIds === null || tilesetIds === void 0 ? void 0 : tilesetIds.length) ? tilesetIds[0] : tilesetId;
2718
2722
  }
2719
2723
  if (!!tileset) return [3 /*break*/, 13];
2720
2724
  if (!(tilesetId && apiCalls < MAX_API_CALLS)) return [3 /*break*/, 13];
@@ -2724,16 +2728,16 @@ var EntityUtils;
2724
2728
  tilesetId: tilesetId
2725
2729
  })];
2726
2730
  case 12:
2727
- tileset = (_f.sent()).tileset;
2728
- _f.label = 13;
2731
+ tileset = (_e.sent()).tileset;
2732
+ _e.label = 13;
2729
2733
  case 13:
2730
2734
  tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
2731
2735
  pos3d = null;
2732
2736
  eLocation = Entity$1.GetValue({
2733
2737
  entity: entity,
2734
- path: ["location"]
2738
+ path: ["Bruce", "location"]
2735
2739
  });
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];
2740
+ if (!((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) || ((_a = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _a === void 0 ? void 0 : _a.longitude))) return [3 /*break*/, 16];
2737
2741
  if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
2738
2742
  alt = +eLocation.altitude;
2739
2743
  if (isNaN(alt)) {
@@ -2748,10 +2752,14 @@ var EntityUtils;
2748
2752
  }
2749
2753
  pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
2750
2754
  }
2751
- if (!(entity === null || entity === void 0 ? void 0 : entity.worldPosition)) return [3 /*break*/, 16];
2755
+ worldPosition = Entity$1.GetValue({
2756
+ entity: entity,
2757
+ path: ["Bruce", "transform", "worldPosition"]
2758
+ });
2759
+ if (!worldPosition) return [3 /*break*/, 16];
2752
2760
  eTransform = Entity$1.GetValue({
2753
2761
  entity: entity,
2754
- path: ["transform"]
2762
+ path: ["Bruce", "transform"]
2755
2763
  });
2756
2764
  heading = 0;
2757
2765
  pitch = 0;
@@ -2759,19 +2767,19 @@ var EntityUtils;
2759
2767
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
2760
2768
  heading = eTransform.heading;
2761
2769
  }
2762
- else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.heading) {
2770
+ else if ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _b === void 0 ? void 0 : _b.heading) {
2763
2771
  heading = tSettings.transform.heading;
2764
2772
  }
2765
2773
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
2766
2774
  pitch = eTransform.pitch;
2767
2775
  }
2768
- else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.pitch) {
2776
+ else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.pitch) {
2769
2777
  pitch = tSettings.transform.pitch;
2770
2778
  }
2771
2779
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
2772
2780
  roll = eTransform.roll;
2773
2781
  }
2774
- else if ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _e === void 0 ? void 0 : _e.roll) {
2782
+ else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.roll) {
2775
2783
  roll = tSettings.transform.roll;
2776
2784
  }
2777
2785
  heading = +heading;
@@ -2786,7 +2794,7 @@ var EntityUtils;
2786
2794
  if (isNaN(roll)) {
2787
2795
  roll = 0;
2788
2796
  }
2789
- matrix4 = entity.worldPosition;
2797
+ matrix4 = worldPosition;
2790
2798
  offset = new Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
2791
2799
  if (entity.worldPivot) //the position from worldMatrix + center of geometry offset
2792
2800
  {
@@ -2800,18 +2808,22 @@ var EntityUtils;
2800
2808
  if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 15];
2801
2809
  return [4 /*yield*/, processPosHeight(pos3d, HeightReference.NONE)];
2802
2810
  case 14:
2803
- pos3d = _f.sent();
2804
- _f.label = 15;
2811
+ pos3d = _e.sent();
2812
+ _e.label = 15;
2805
2813
  case 15:
2806
- if ((entity === null || entity === void 0 ? void 0 : entity.geometryRadius) && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
2814
+ geometryRadius = Entity$1.GetValue({
2815
+ entity: entity,
2816
+ path: ["Bruce", "geometryRadius"]
2817
+ });
2818
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
2807
2819
  sphere = BoundingSphere.fromPoints([pos3d]);
2808
2820
  // For now making sure it's less than x amount because we had a bug which made it huge.
2809
- if (entity.geometryRadius && entity.geometryRadius < 500 && entity.geometryRadius > 1) {
2810
- sphere.radius = entity.geometryRadius;
2821
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 1) {
2822
+ sphere.radius = geometryRadius;
2811
2823
  spheres.push(sphere);
2812
2824
  }
2813
2825
  }
2814
- _f.label = 16;
2826
+ _e.label = 16;
2815
2827
  case 16:
2816
2828
  if (pos3d) {
2817
2829
  return [2 /*return*/, [pos3d]];
@@ -2974,7 +2986,7 @@ var EntityUtils;
2974
2986
  function evaluateRecord() {
2975
2987
  var location = Entity$1.GetValue({
2976
2988
  entity: entity,
2977
- path: ["location"]
2989
+ path: ["Bruce", "location"]
2978
2990
  });
2979
2991
  if (location && typeof location == "object" && Carto.ValidateCarto(location)) {
2980
2992
  var latitude = EnsureNumber(location.latitude);
@@ -2986,7 +2998,7 @@ var EntityUtils;
2986
2998
  }
2987
2999
  var geometry = Entity$1.GetValue({
2988
3000
  entity: entity,
2989
- path: ["geometry"]
3001
+ path: ["Bruce", "geometry"]
2990
3002
  });
2991
3003
  if (geometry && typeof geometry == "object") {
2992
3004
  var pointStr = geometry.Point;
@@ -3034,7 +3046,7 @@ var EntityUtils;
3034
3046
  }
3035
3047
  var boundaries = Entity$1.GetValue({
3036
3048
  entity: entity,
3037
- path: ["boundaries"]
3049
+ path: ["Bruce", "boundaries"]
3038
3050
  });
3039
3051
  if (boundaries && typeof boundaries == "object") {
3040
3052
  var point = {
@@ -3071,54 +3083,54 @@ var EntityUtils;
3071
3083
  * @returns
3072
3084
  */
3073
3085
  function GetPosAsync(params) {
3074
- var _a, _b, _c, _d, _e;
3086
+ var _a, _b, _c, _d;
3075
3087
  return __awaiter(this, void 0, void 0, function () {
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) {
3088
+ var viewer, entityId, entity, tileset, tilesetId, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, location_1, e_3, e_4, tilesetIds, pos3d, tSettings, eLocation, alt, alt, worldPosition, heading, pitch, roll, eTransform, matrix4, offset, m1, hpr, transform, transformedOffset;
3089
+ return __generator(this, function (_e) {
3090
+ switch (_e.label) {
3079
3091
  case 0:
3080
3092
  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;
3081
3093
  if (!!entity) return [3 /*break*/, 9];
3082
3094
  lat = 0;
3083
3095
  lon = 0;
3084
- _f.label = 1;
3096
+ _e.label = 1;
3085
3097
  case 1:
3086
- _f.trys.push([1, 3, , 4]);
3098
+ _e.trys.push([1, 3, , 4]);
3087
3099
  return [4 /*yield*/, Entity$1.Get({
3088
3100
  api: api,
3089
3101
  entityId: entityId,
3090
3102
  expandLocation: false
3091
3103
  })];
3092
3104
  case 2:
3093
- entity = (_f.sent()).entity;
3105
+ entity = (_e.sent()).entity;
3094
3106
  if (entity) {
3095
3107
  location_1 = Entity$1.GetValue({
3096
3108
  entity: entity,
3097
- path: ["location"]
3109
+ path: ["Bruce", "location"]
3098
3110
  });
3099
3111
  lat = +(location_1 === null || location_1 === void 0 ? void 0 : location_1.latitude);
3100
3112
  lon = +(location_1 === null || location_1 === void 0 ? void 0 : location_1.longitude);
3101
3113
  }
3102
3114
  return [3 /*break*/, 4];
3103
3115
  case 3:
3104
- e_3 = _f.sent();
3116
+ e_3 = _e.sent();
3105
3117
  console.error(e_3);
3106
3118
  return [3 /*break*/, 4];
3107
3119
  case 4:
3108
3120
  if (!(entity && (isNaN(lat) || isNaN(lon) || (lat == 0 && lon == 0)))) return [3 /*break*/, 9];
3109
- _f.label = 5;
3121
+ _e.label = 5;
3110
3122
  case 5:
3111
- _f.trys.push([5, 7, , 9]);
3123
+ _e.trys.push([5, 7, , 9]);
3112
3124
  return [4 /*yield*/, Entity$1.Get({
3113
3125
  api: api,
3114
3126
  entityId: entityId,
3115
3127
  expandLocation: true
3116
3128
  })];
3117
3129
  case 6:
3118
- entity = (_f.sent()).entity;
3130
+ entity = (_e.sent()).entity;
3119
3131
  return [3 /*break*/, 9];
3120
3132
  case 7:
3121
- e_4 = _f.sent();
3133
+ e_4 = _e.sent();
3122
3134
  console.warn(e_4);
3123
3135
  return [4 /*yield*/, Entity$1.Get({
3124
3136
  api: api,
@@ -3126,14 +3138,18 @@ var EntityUtils;
3126
3138
  expandLocation: false
3127
3139
  })];
3128
3140
  case 8:
3129
- entity = (_f.sent()).entity;
3141
+ entity = (_e.sent()).entity;
3130
3142
  return [3 /*break*/, 9];
3131
3143
  case 9:
3132
3144
  if (!entity) {
3133
3145
  return [2 /*return*/, null];
3134
3146
  }
3135
3147
  if (!tilesetId) {
3136
- tilesetId = ((_a = entity.tilesetID) === null || _a === void 0 ? void 0 : _a.length) ? entity.tilesetID[0] : tilesetId;
3148
+ tilesetIds = Entity$1.GetValue({
3149
+ entity: entity,
3150
+ path: ["Bruce", "tilesetID"]
3151
+ });
3152
+ tilesetId = (tilesetIds === null || tilesetIds === void 0 ? void 0 : tilesetIds.length) ? tilesetIds[0] : tilesetId;
3137
3153
  }
3138
3154
  pos3d = tilesetId ? null : GetPos({
3139
3155
  viewer: viewer,
@@ -3152,15 +3168,15 @@ var EntityUtils;
3152
3168
  tilesetId: tilesetId
3153
3169
  })];
3154
3170
  case 10:
3155
- tileset = (_f.sent()).tileset;
3156
- _f.label = 11;
3171
+ tileset = (_e.sent()).tileset;
3172
+ _e.label = 11;
3157
3173
  case 11:
3158
3174
  tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
3159
3175
  eLocation = Entity$1.GetValue({
3160
3176
  entity: entity,
3161
- path: ["location"]
3177
+ path: ["Bruce", "location"]
3162
3178
  });
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)) {
3179
+ if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) || ((_a = tSettings === null || tSettings === void 0 ? void 0 : tSettings.location) === null || _a === void 0 ? void 0 : _a.longitude)) {
3164
3180
  if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
3165
3181
  alt = +eLocation.altitude;
3166
3182
  if (isNaN(alt)) {
@@ -3175,31 +3191,34 @@ var EntityUtils;
3175
3191
  }
3176
3192
  pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
3177
3193
  }
3178
- // World position = we got lat/lon/alt from the tileset, now we need to apply relative movement.
3179
- if (entity === null || entity === void 0 ? void 0 : entity.worldPosition) {
3194
+ worldPosition = Entity$1.GetValue({
3195
+ entity: entity,
3196
+ path: ["Bruce", "transform", "worldPosition"]
3197
+ });
3198
+ if (worldPosition) {
3180
3199
  heading = 0;
3181
3200
  pitch = 0;
3182
3201
  roll = 0;
3183
3202
  eTransform = Entity$1.GetValue({
3184
3203
  entity: entity,
3185
- path: ["transform"]
3204
+ path: ["Bruce", "transform"]
3186
3205
  });
3187
3206
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
3188
3207
  heading = eTransform.heading;
3189
3208
  }
3190
- else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.heading) {
3209
+ else if ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _b === void 0 ? void 0 : _b.heading) {
3191
3210
  heading = tSettings.transform.heading;
3192
3211
  }
3193
3212
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
3194
3213
  pitch = eTransform.pitch;
3195
3214
  }
3196
- else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.pitch) {
3215
+ else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.pitch) {
3197
3216
  pitch = tSettings.transform.pitch;
3198
3217
  }
3199
3218
  if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
3200
3219
  roll = eTransform.roll;
3201
3220
  }
3202
- else if ((_e = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _e === void 0 ? void 0 : _e.roll) {
3221
+ else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.roll) {
3203
3222
  roll = tSettings.transform.roll;
3204
3223
  }
3205
3224
  heading = +heading;
@@ -3214,7 +3233,7 @@ var EntityUtils;
3214
3233
  if (isNaN(roll)) {
3215
3234
  roll = 0;
3216
3235
  }
3217
- matrix4 = entity.worldPosition;
3236
+ matrix4 = worldPosition;
3218
3237
  offset = new Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
3219
3238
  if (entity.worldPivot) //the position from worldMatrix + center of geometry offset
3220
3239
  {
@@ -3485,15 +3504,15 @@ function createCacheKey(point, entity) {
3485
3504
  };
3486
3505
  var location_1 = Entity$1.GetValue({
3487
3506
  entity: entity,
3488
- path: ["location"]
3507
+ path: ["Bruce", "location"]
3489
3508
  });
3490
3509
  var geometry = Entity$1.GetValue({
3491
3510
  entity: entity,
3492
- path: ["geometry"]
3511
+ path: ["Bruce", "geometry"]
3493
3512
  });
3494
3513
  var boundaries = Entity$1.GetValue({
3495
3514
  entity: entity,
3496
- path: ["boundaries"]
3515
+ path: ["Bruce", "boundaries"]
3497
3516
  });
3498
3517
  var entityData = __assign(__assign(__assign({}, location_1), geometry), boundaries);
3499
3518
  return JSON.stringify(pointData) + '|' + JSON.stringify(entityData);
@@ -3522,7 +3541,7 @@ function calculateDistance(point, entity) {
3522
3541
  var entityPos3d = null;
3523
3542
  var location = Entity$1.GetValue({
3524
3543
  entity: entity,
3525
- path: ["location"]
3544
+ path: ["Bruce", "location"]
3526
3545
  });
3527
3546
  if (location && location.latitude) {
3528
3547
  var latitude = EnsureNumber(location.latitude);
@@ -3539,7 +3558,7 @@ function calculateDistance(point, entity) {
3539
3558
  // Check geometry if it's available.
3540
3559
  var geometry = Entity$1.GetValue({
3541
3560
  entity: entity,
3542
- path: ["geometry"]
3561
+ path: ["Bruce", "geometry"]
3543
3562
  });
3544
3563
  if (geometry) {
3545
3564
  var passedGeometry = false;
@@ -3587,7 +3606,7 @@ function calculateDistance(point, entity) {
3587
3606
  if (minDistance === Infinity) {
3588
3607
  var boundaries = Entity$1.GetValue({
3589
3608
  entity: entity,
3590
- path: ["boundaries"]
3609
+ path: ["Bruce", "boundaries"]
3591
3610
  });
3592
3611
  if (boundaries && typeof boundaries == "object") {
3593
3612
  var point_1 = {
@@ -4630,7 +4649,7 @@ function getPolygonStyleExtrusion(pStyle, entity, tags, heightRef) {
4630
4649
  */
4631
4650
  var height = Entity$1.GetValue({
4632
4651
  entity: entity,
4633
- path: ["location", "altitude"]
4652
+ path: ["Bruce", "location", "altitude"]
4634
4653
  });
4635
4654
  return heightRef != HeightReference.CLAMP_TO_GROUND ? extrusion + height : extrusion;
4636
4655
  }
@@ -4653,7 +4672,7 @@ function getPolygonExtrusion(entity, tags, ring, posses, heightRef, pStyle) {
4653
4672
  // This let's us have a consistent extrusion height, and be adjustable easier by user.
4654
4673
  var alt_1 = Entity$1.GetValue({
4655
4674
  entity: entity,
4656
- path: ["location", "altitude"]
4675
+ path: ["Bruce", "location", "altitude"]
4657
4676
  });
4658
4677
  if (!alt_1) {
4659
4678
  alt_1 = 0;
@@ -4710,7 +4729,7 @@ function getCylinderStyleExtrusion(style, entity, tags, heightRef) {
4710
4729
  */
4711
4730
  var height = EnsureNumber(Entity$1.GetValue({
4712
4731
  entity: entity,
4713
- path: ["location", "altitude"]
4732
+ path: ["Bruce", "location", "altitude"]
4714
4733
  }), 0);
4715
4734
  return heightRef != HeightReference.CLAMP_TO_GROUND ? extrusion + height : extrusion;
4716
4735
  }
@@ -4934,7 +4953,7 @@ function getSizeOfPolygonEntity(entity) {
4934
4953
  var hasCalculatedBounds = false;
4935
4954
  var bounds = Entity$1.GetValue({
4936
4955
  entity: entity,
4937
- path: ["boundaries"]
4956
+ path: ["Bruce", "boundaries"]
4938
4957
  });
4939
4958
  var calculateBounds = function () {
4940
4959
  hasCalculatedBounds = true;
@@ -5302,7 +5321,7 @@ var EntityRenderEngine;
5302
5321
  entity = params.entities[i];
5303
5322
  geometry = Entity$1.GetValue({
5304
5323
  entity: entity,
5305
- path: ["geometry"]
5324
+ path: ["Bruce", "geometry"]
5306
5325
  });
5307
5326
  if (((_a = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _a === void 0 ? void 0 : _a.length) == 1) {
5308
5327
  // Not migrated to internal, set in both places.
@@ -5373,7 +5392,7 @@ var EntityRenderEngine;
5373
5392
  else if (displayType == ZoomControl.EDisplayType.Geometry) {
5374
5393
  geometry = Entity$1.GetValue({
5375
5394
  entity: entity,
5376
- path: ["geometry"]
5395
+ path: ["Bruce", "geometry"]
5377
5396
  });
5378
5397
  if ((_f = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _f === void 0 ? void 0 : _f.length) {
5379
5398
  multiGeometry.push(entity);
@@ -5416,7 +5435,7 @@ var EntityRenderEngine;
5416
5435
  entity = multiGeometry[i];
5417
5436
  geometry = Entity$1.GetValue({
5418
5437
  entity: entity,
5419
- path: ["geometry"]
5438
+ path: ["Bruce", "geometry"]
5420
5439
  });
5421
5440
  if (!((_g = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _g === void 0 ? void 0 : _g.length)) {
5422
5441
  polygons.push(entity);
@@ -6144,7 +6163,7 @@ var EntityRenderEngine;
6144
6163
  var entity = params.entity;
6145
6164
  var lineString = Entity$1.GetValue({
6146
6165
  entity: entity,
6147
- path: ["geometry", "LineString"]
6166
+ path: ["Bruce", "geometry", "LineString"]
6148
6167
  });
6149
6168
  var points = lineString && typeof lineString == "string" ? Geometry.ParsePoints(lineString) : [];
6150
6169
  if (!points || points.length < 2) {
@@ -6408,7 +6427,7 @@ var EntityRenderEngine;
6408
6427
  var entity = params.entity;
6409
6428
  var pRings = Entity$1.GetValue({
6410
6429
  entity: entity,
6411
- path: ["geometry", "Polygon"]
6430
+ path: ["Bruce", "geometry", "Polygon"]
6412
6431
  });
6413
6432
  if (pRings == null || !Array.isArray(pRings) || pRings.length <= 0) {
6414
6433
  return null;
@@ -6786,7 +6805,7 @@ var EntityRenderEngine;
6786
6805
  }
6787
6806
  var transform = Entity$1.GetValue({
6788
6807
  entity: entity,
6789
- path: ["transform"]
6808
+ path: ["Bruce", "transform"]
6790
6809
  });
6791
6810
  var heading = EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading);
6792
6811
  heading = (heading + 90) % 360;
@@ -13289,16 +13308,29 @@ var TilesetRenderEngine;
13289
13308
  _a.sent();
13290
13309
  loadUrl = params.tileset.loadUrl;
13291
13310
  // CDN enabled and tileset url template is available.
13292
- if (params.viaCdn && api.TilesetCdnUrl) {
13293
- loadUrl = api.TilesetCdnUrl.replace("<TILESETID>", params.tileset.id).replace("<FILEPATH>", "files/tileset.json");
13294
- // First url param reserved for accountId. This is set within the API instance.
13295
- loadUrl += "&generation=" + params.tileset.generateVersion;
13311
+ if (params.viaCdn && api.GetCdnBaseUrl()) {
13312
+ /*
13313
+ loadUrl = api.TilesetCdnUrl.replace("<TILESETID>", params.tileset.id).replace("<FILEPATH>", "files/tileset.json");
13314
+ // First url param reserved for accountId. This is set within the API instance.
13315
+ loadUrl += "&generation=" + params.tileset.generateVersion;
13316
+ */
13317
+ loadUrl = Tileset.GetFileUrl({
13318
+ file: "tileset.json",
13319
+ tilesetId: params.tileset.id,
13320
+ viaCdn: true,
13321
+ legacy: false,
13322
+ cacheToken: params.tileset.generateVersion,
13323
+ api: api
13324
+ });
13296
13325
  }
13297
13326
  if (!(params.tileset.type == Tileset.EType.Cad)) return [3 /*break*/, 3];
13298
- return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetPublicFileUrl({
13327
+ return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetFileUrl({
13299
13328
  api: api,
13300
13329
  tilesetId: params.tileset.id,
13301
- file: "tileset.json"
13330
+ file: "tileset.json",
13331
+ cacheToken: params.tileset.generateVersion,
13332
+ legacy: false,
13333
+ viaCdn: false
13302
13334
  }) + "?generation=" + params.tileset.generateVersion, null)];
13303
13335
  case 2:
13304
13336
  cTileset_1 = _a.sent();
@@ -13334,10 +13366,13 @@ var TilesetRenderEngine;
13334
13366
  return [2 /*return*/, cTileset_1];
13335
13367
  case 3:
13336
13368
  if (!(params.tileset.type === Tileset.EType.EntitiesSet)) return [3 /*break*/, 5];
13337
- return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetPublicFileUrl({
13369
+ return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetFileUrl({
13338
13370
  api: api,
13339
13371
  tilesetId: params.tileset.id,
13340
- file: "tileset.json"
13372
+ file: "tileset.json",
13373
+ cacheToken: params.tileset.generateVersion,
13374
+ legacy: false,
13375
+ viaCdn: false
13341
13376
  }) + "?generation=" + params.tileset.generateVersion, null)];
13342
13377
  case 4:
13343
13378
  cTileset = _a.sent();
@@ -13345,10 +13380,13 @@ var TilesetRenderEngine;
13345
13380
  return [2 /*return*/, cTileset];
13346
13381
  case 5:
13347
13382
  if (!(params.tileset.type == Tileset.EType.PointCloud)) return [3 /*break*/, 7];
13348
- return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetPublicFileUrl({
13383
+ return [4 /*yield*/, createTileset(loadUrl ? loadUrl : Tileset.GetFileUrl({
13349
13384
  api: api,
13350
13385
  tilesetId: params.tileset.id,
13351
- file: "tileset.json"
13386
+ file: "tileset.json",
13387
+ cacheToken: params.tileset.generateVersion,
13388
+ legacy: false,
13389
+ viaCdn: false
13352
13390
  }) + "?generation=" + params.tileset.generateVersion, null)];
13353
13391
  case 6:
13354
13392
  cTileset_2 = _a.sent();
@@ -13391,7 +13429,7 @@ var TilesetRenderEngine;
13391
13429
  TilesetRenderEngine.Render = Render;
13392
13430
  function RenderLegacy(params) {
13393
13431
  return __awaiter(this, void 0, void 0, function () {
13394
- var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, accountId, settings, visual, etc, api, rootFile, api, rootFile, cTileset;
13432
+ var apiGetter, viewer, tileset, ionId, loadUrl, viaCdn, accountId, settings, visual, etc, api, api, cTileset;
13395
13433
  return __generator(this, function (_a) {
13396
13434
  switch (_a.label) {
13397
13435
  case 0:
@@ -13415,23 +13453,55 @@ var TilesetRenderEngine;
13415
13453
  }
13416
13454
  _a.label = 3;
13417
13455
  case 3:
13418
- if (!loadUrl && tileset) {
13419
- api = apiGetter.getApi(accountId);
13420
- rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
13421
- loadUrl = api.GetBaseUrl() + "ui.tileset/".concat(tileset.ID, "/file/").concat(rootFile);
13422
- }
13423
- if (viaCdn && (tileset === null || tileset === void 0 ? void 0 : tileset.ID)) {
13424
- api = apiGetter.getApi(accountId);
13425
- if (api.LegacyTilesetCdnUrl) {
13426
- rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
13427
- loadUrl = api.LegacyTilesetCdnUrl
13428
- .replace("<TILESETID>", tileset.ID)
13429
- .replace("<FILEPATH>", rootFile)
13430
- .replace("<ACCOUNT>", accountId);
13431
- }
13432
- }
13433
- return [4 /*yield*/, createTileset(loadUrl, null)];
13456
+ if (!(!loadUrl && tileset)) return [3 /*break*/, 5];
13457
+ api = apiGetter.getApi(accountId);
13458
+ return [4 /*yield*/, api.Loading
13459
+ /*
13460
+ const rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
13461
+ loadUrl = api.GetBaseUrl() + `ui.tileset/${tileset.ID}/file/${rootFile}`;
13462
+ */
13463
+ ];
13434
13464
  case 4:
13465
+ _a.sent();
13466
+ /*
13467
+ const rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
13468
+ loadUrl = api.GetBaseUrl() + `ui.tileset/${tileset.ID}/file/${rootFile}`;
13469
+ */
13470
+ loadUrl = Tileset.GetFileUrl({
13471
+ file: "tileset.json",
13472
+ tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
13473
+ viaCdn: false,
13474
+ legacy: true,
13475
+ cacheToken: tileset.GenerateVersion,
13476
+ api: api
13477
+ });
13478
+ _a.label = 5;
13479
+ case 5:
13480
+ if (!(viaCdn && (tileset === null || tileset === void 0 ? void 0 : tileset.ID))) return [3 /*break*/, 7];
13481
+ api = apiGetter.getApi(accountId);
13482
+ return [4 /*yield*/, api.Loading];
13483
+ case 6:
13484
+ _a.sent();
13485
+ if (api.GetCdnBaseUrl()) {
13486
+ /*
13487
+ const rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
13488
+ loadUrl = api.LegacyTilesetCdnUrl
13489
+ .replace("<TILESETID>", tileset.ID)
13490
+ .replace("<FILEPATH>", rootFile)
13491
+ .replace("<ACCOUNT>", accountId);
13492
+ */
13493
+ loadUrl = Tileset.GetFileUrl({
13494
+ file: "tileset.json",
13495
+ tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
13496
+ viaCdn: true,
13497
+ legacy: true,
13498
+ cacheToken: params.tileset.generateVersion,
13499
+ api: api
13500
+ });
13501
+ }
13502
+ _a.label = 7;
13503
+ case 7: return [4 /*yield*/, createTileset(loadUrl, null)];
13504
+ case 8:
13435
13505
  cTileset = _a.sent();
13436
13506
  viewer.scene.primitives.add(cTileset);
13437
13507
  OnTilesetReady(cTileset).then(function () {
@@ -24506,7 +24576,7 @@ var ViewRenderEngine;
24506
24576
  ViewRenderEngine.Render = Render;
24507
24577
  })(ViewRenderEngine || (ViewRenderEngine = {}));
24508
24578
 
24509
- var VERSION = "3.9.9";
24579
+ var VERSION = "4.0.1";
24510
24580
 
24511
24581
  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 };
24512
24582
  //# sourceMappingURL=bruce-cesium.es5.js.map