bruce-cesium 4.3.6 → 4.3.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.
@@ -1,6 +1,6 @@
1
- import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } from 'bruce-models';
1
+ import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, ColorMaterialProperty, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, BoundingSphere, GeometryInstance, 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, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, 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.
@@ -2420,13 +2420,12 @@ var EntityUtils;
2420
2420
  });
2421
2421
  }); };
2422
2422
  getEntityPositions = function (sample) { return __awaiter(_this, void 0, void 0, function () {
2423
- 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, worldPivot, m1, hpr, transform, transformedOffset, geometryRadius, sphere;
2423
+ var entityId, entity, disallowRendered, evaluateRendered, evaluateRecord, renderedPosses, e_1, recordPosses, e_2, pos3d, eLocation, geometryRadius, sphere;
2424
2424
  var _this = this;
2425
- var _a, _b, _c, _d;
2426
- return __generator(this, function (_e) {
2427
- switch (_e.label) {
2425
+ return __generator(this, function (_a) {
2426
+ switch (_a.label) {
2428
2427
  case 0:
2429
- entityId = sample.entityId, entity = sample.entity, tileset = sample.tileset, tilesetId = sample.tilesetId, disallowRendered = sample.disallowRendered;
2428
+ entityId = sample.entityId, entity = sample.entity, disallowRendered = sample.disallowRendered;
2430
2429
  evaluateRendered = function () { return __awaiter(_this, void 0, void 0, function () {
2431
2430
  var rego, posses, parts, i, part, visualHeightRef, hierarchy, hPosses, hPossesSample, step, i_1, pPosses, pPossesSample, step, i_2, pPosses, pPossesSample, step, i_3, pos3d_1, toAdjust, modelExt, sphere, semiMajorAxis, semiMinorAxis, height, radius, sphere, data_1, pos3d_2, toAdjust, sphere;
2432
2431
  return __generator(this, function (_a) {
@@ -2578,24 +2577,11 @@ var EntityUtils;
2578
2577
  });
2579
2578
  }); };
2580
2579
  evaluateRecord = function () { return __awaiter(_this, void 0, void 0, function () {
2581
- var posses, assemblyLocation, latitude, longitude, pos3d_3, location, latitude, longitude, pos3d_4, geometry, pointStr, points, point, pos3d_5, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2580
+ var posses, location, latitude, longitude, pos3d_3, geometry, pointStr, points, point, pos3d_4, lineStr, points, pPosses, pRings, boundary, points, pPosses, boundaries, point, bPosses;
2582
2581
  return __generator(this, function (_a) {
2583
2582
  switch (_a.label) {
2584
2583
  case 0:
2585
2584
  posses = [];
2586
- assemblyLocation = Entity$1.GetValue({
2587
- entity: entity,
2588
- path: ["Bruce", "AssemblyLocation"]
2589
- });
2590
- if (assemblyLocation && typeof assemblyLocation == "object" && Carto.ValidateCarto(assemblyLocation)) {
2591
- latitude = EnsureNumber(assemblyLocation.latitude);
2592
- longitude = EnsureNumber(assemblyLocation.longitude);
2593
- // Disallowing exact 0.
2594
- if (latitude || longitude) {
2595
- pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
2596
- posses.push(pos3d_3);
2597
- }
2598
- }
2599
2585
  location = Entity$1.GetValue({
2600
2586
  entity: entity,
2601
2587
  path: ["Bruce", "Location"]
@@ -2605,8 +2591,8 @@ var EntityUtils;
2605
2591
  longitude = EnsureNumber(location.longitude);
2606
2592
  // Disallowing exact 0.
2607
2593
  if (latitude || longitude) {
2608
- pos3d_4 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2609
- posses.push(pos3d_4);
2594
+ pos3d_3 = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
2595
+ posses.push(pos3d_3);
2610
2596
  }
2611
2597
  }
2612
2598
  geometry = Entity$1.GetValue({
@@ -2621,8 +2607,8 @@ var EntityUtils;
2621
2607
  points = Geometry.ParsePoints(pointStr);
2622
2608
  point = points.length > 0 ? points[0] : null;
2623
2609
  if (point && Carto.ValidateCarto(point)) {
2624
- pos3d_5 = Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2625
- posses.push(pos3d_5);
2610
+ pos3d_4 = Cartesian3.fromDegrees(EnsureNumber(point.longitude), EnsureNumber(point.latitude), EnsureNumber(point.altitude));
2611
+ posses.push(pos3d_4);
2626
2612
  }
2627
2613
  }
2628
2614
  lineStr = geometry.LineString;
@@ -2675,18 +2661,18 @@ var EntityUtils;
2675
2661
  if (!(disallowRendered != true)) return [3 /*break*/, 2];
2676
2662
  return [4 /*yield*/, evaluateRendered()];
2677
2663
  case 1:
2678
- renderedPosses = _e.sent();
2664
+ renderedPosses = _a.sent();
2679
2665
  if (renderedPosses === null || renderedPosses === void 0 ? void 0 : renderedPosses.length) {
2680
2666
  return [2 /*return*/, renderedPosses];
2681
2667
  }
2682
- _e.label = 2;
2668
+ _a.label = 2;
2683
2669
  case 2:
2684
2670
  if (!!entity) return [3 /*break*/, 6];
2685
2671
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 6];
2686
2672
  apiCalls += 1;
2687
- _e.label = 3;
2673
+ _a.label = 3;
2688
2674
  case 3:
2689
- _e.trys.push([3, 5, , 6]);
2675
+ _a.trys.push([3, 5, , 6]);
2690
2676
  return [4 /*yield*/, Entity$1.Get({
2691
2677
  api: api,
2692
2678
  entityId: entityId,
@@ -2695,10 +2681,10 @@ var EntityUtils;
2695
2681
  migrated: true
2696
2682
  })];
2697
2683
  case 4:
2698
- entity = (_e.sent()).entity;
2684
+ entity = (_a.sent()).entity;
2699
2685
  return [3 /*break*/, 6];
2700
2686
  case 5:
2701
- e_1 = _e.sent();
2687
+ e_1 = _a.sent();
2702
2688
  console.error(e_1);
2703
2689
  return [3 /*break*/, 6];
2704
2690
  case 6:
@@ -2707,132 +2693,43 @@ var EntityUtils;
2707
2693
  }
2708
2694
  return [4 /*yield*/, evaluateRecord()];
2709
2695
  case 7:
2710
- recordPosses = _e.sent();
2696
+ recordPosses = _a.sent();
2711
2697
  if (recordPosses === null || recordPosses === void 0 ? void 0 : recordPosses.length) {
2712
2698
  return [2 /*return*/, recordPosses];
2713
2699
  }
2714
2700
  if (!(apiCalls < MAX_API_CALLS)) return [3 /*break*/, 11];
2715
- _e.label = 8;
2701
+ _a.label = 8;
2716
2702
  case 8:
2717
- _e.trys.push([8, 10, , 11]);
2703
+ _a.trys.push([8, 10, , 11]);
2718
2704
  apiCalls += 1;
2719
2705
  return [4 /*yield*/, Entity$1.Get({
2720
2706
  api: api,
2721
2707
  entityId: entityId,
2722
- // We'll be expanding relative positioning and related tilesets now.
2708
+ // We'll be expanding relative positioning and related assemblies now.
2723
2709
  expandLocation: true,
2724
2710
  migrated: true
2725
2711
  })];
2726
2712
  case 9:
2727
- entity = (_e.sent()).entity;
2713
+ entity = (_a.sent()).entity;
2728
2714
  return [3 /*break*/, 11];
2729
2715
  case 10:
2730
- e_2 = _e.sent();
2716
+ e_2 = _a.sent();
2731
2717
  console.warn(e_2);
2732
2718
  return [3 /*break*/, 11];
2733
2719
  case 11:
2734
- if (!tilesetId) {
2735
- tilesetIds = Entity$1.GetValue({
2736
- entity: entity,
2737
- path: ["Bruce", "TilesetIDs"]
2738
- });
2739
- tilesetId = (tilesetIds === null || tilesetIds === void 0 ? void 0 : tilesetIds.length) ? tilesetIds[0] : tilesetId;
2740
- }
2741
- if (!!tileset) return [3 /*break*/, 13];
2742
- if (!(tilesetId && apiCalls < MAX_API_CALLS)) return [3 /*break*/, 13];
2743
- apiCalls += 1;
2744
- return [4 /*yield*/, Tileset.Get({
2745
- api: api,
2746
- tilesetId: tilesetId
2747
- })];
2748
- case 12:
2749
- tileset = (_e.sent()).tileset;
2750
- _e.label = 13;
2751
- case 13:
2752
- tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
2753
2720
  pos3d = null;
2754
2721
  eLocation = Entity$1.GetValue({
2755
2722
  entity: entity,
2756
2723
  path: ["Bruce", "Location"]
2757
2724
  });
2758
- 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];
2759
- if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
2760
- alt = +eLocation.altitude;
2761
- if (isNaN(alt)) {
2762
- alt = 0;
2763
- }
2764
- pos3d = Cartesian3.fromDegrees(+eLocation.longitude, +eLocation.latitude, alt);
2765
- }
2766
- else {
2767
- alt = +tSettings.location.altitude;
2768
- if (isNaN(alt)) {
2769
- alt = 0;
2770
- }
2771
- pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
2772
- }
2773
- worldPosition = Entity$1.GetValue({
2774
- entity: entity,
2775
- path: ["Bruce", "AssemblyWorldPosition"]
2776
- });
2777
- if (!worldPosition) return [3 /*break*/, 16];
2778
- eTransform = Entity$1.GetValue({
2779
- entity: entity,
2780
- path: ["Bruce", "Transform"]
2781
- });
2782
- heading = 0;
2783
- pitch = 0;
2784
- roll = 0;
2785
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
2786
- heading = eTransform.heading;
2787
- }
2788
- else if ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _b === void 0 ? void 0 : _b.heading) {
2789
- heading = tSettings.transform.heading;
2790
- }
2791
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
2792
- pitch = eTransform.pitch;
2793
- }
2794
- else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.pitch) {
2795
- pitch = tSettings.transform.pitch;
2796
- }
2797
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
2798
- roll = eTransform.roll;
2799
- }
2800
- else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.roll) {
2801
- roll = tSettings.transform.roll;
2802
- }
2803
- heading = +heading;
2804
- if (isNaN(heading)) {
2805
- heading = 0;
2806
- }
2807
- pitch = +pitch;
2808
- if (isNaN(pitch)) {
2809
- pitch = 0;
2810
- }
2811
- roll = +roll;
2812
- if (isNaN(roll)) {
2813
- roll = 0;
2814
- }
2815
- matrix4 = worldPosition;
2816
- offset = new Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
2817
- worldPivot = Entity$1.GetValue({
2818
- entity: entity,
2819
- path: ["Bruce", "GeometryWorldPivot"]
2820
- });
2821
- if (worldPivot) //the position from worldMatrix + center of geometry offset
2822
- {
2823
- offset = new Cartesian3(worldPivot[0], worldPivot[1], worldPivot[2]);
2824
- }
2825
- m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
2826
- hpr = HeadingPitchRoll.fromDegrees(heading, pitch, roll, new HeadingPitchRoll());
2827
- transform = Matrix3.fromHeadingPitchRoll(hpr);
2828
- transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
2829
- pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
2830
- if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 15];
2725
+ if (!(eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude)) return [3 /*break*/, 14];
2726
+ pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
2727
+ if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) return [3 /*break*/, 13];
2831
2728
  return [4 /*yield*/, processPosHeight(pos3d, HeightReference.NONE)];
2832
- case 14:
2833
- pos3d = _e.sent();
2834
- _e.label = 15;
2835
- case 15:
2729
+ case 12:
2730
+ pos3d = _a.sent();
2731
+ _a.label = 13;
2732
+ case 13:
2836
2733
  geometryRadius = Entity$1.GetValue({
2837
2734
  entity: entity,
2838
2735
  path: ["Bruce", "GeometryRadius"]
@@ -2845,8 +2742,8 @@ var EntityUtils;
2845
2742
  spheres.push(sphere);
2846
2743
  }
2847
2744
  }
2848
- _e.label = 16;
2849
- case 16:
2745
+ _a.label = 14;
2746
+ case 14:
2850
2747
  if (pos3d) {
2851
2748
  return [2 /*return*/, [pos3d]];
2852
2749
  }
@@ -2968,9 +2865,9 @@ var EntityUtils;
2968
2865
  if ((rego === null || rego === void 0 ? void 0 : rego.visual) instanceof Entity) {
2969
2866
  var visual = rego.visual;
2970
2867
  if (visual.position) {
2971
- var pos3d_6 = GetValue(viewer, visual.position);
2868
+ var pos3d_5 = GetValue(viewer, visual.position);
2972
2869
  // Fix height reference.
2973
- if (pos3d_6 === null || pos3d_6 === void 0 ? void 0 : pos3d_6.x) {
2870
+ if (pos3d_5 === null || pos3d_5 === void 0 ? void 0 : pos3d_5.x) {
2974
2871
  var visualHeightRef = HeightReference.RELATIVE_TO_GROUND;
2975
2872
  if (visual.model) {
2976
2873
  visualHeightRef = GetValue(viewer, visual.model.heightReference);
@@ -2997,7 +2894,7 @@ var EntityUtils;
2997
2894
  return DrawingUtils.EnsurePosHeight({
2998
2895
  desiredHeightRef: params.returnHeightRef,
2999
2896
  heightRef: visualHeightRef,
3000
- pos3d: pos3d_6,
2897
+ pos3d: pos3d_5,
3001
2898
  viewer: viewer
3002
2899
  });
3003
2900
  }
@@ -3006,19 +2903,6 @@ var EntityUtils;
3006
2903
  return null;
3007
2904
  }
3008
2905
  function evaluateRecord() {
3009
- // Checking for a pre-calculated lat/lon for assembly entities.
3010
- var assemblyLocation = Entity$1.GetValue({
3011
- entity: entity,
3012
- path: ["Bruce", "AssemblyLocation"]
3013
- });
3014
- if (assemblyLocation && typeof assemblyLocation == "object" && Carto.ValidateCarto(assemblyLocation)) {
3015
- var latitude = EnsureNumber(assemblyLocation.latitude);
3016
- var longitude = EnsureNumber(assemblyLocation.longitude);
3017
- // Disallowing exact 0.
3018
- if (latitude || longitude) {
3019
- return Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(assemblyLocation.altitude));
3020
- }
3021
- }
3022
2906
  var location = Entity$1.GetValue({
3023
2907
  entity: entity,
3024
2908
  path: ["Bruce", "Location"]
@@ -3112,25 +2996,24 @@ var EntityUtils;
3112
2996
  EntityUtils.GetPos = GetPos;
3113
2997
  /**
3114
2998
  * Returns the position of the entity.
3115
- * This is an async variant that checks for related tilesets.
2999
+ * This is an async variant that checks for related assemblies.
3116
3000
  * @param params
3117
3001
  * @deprecated use GetLocation instead.
3118
3002
  * @returns
3119
3003
  */
3120
3004
  function GetPosAsync(params) {
3121
- var _a, _b, _c, _d;
3122
3005
  return __awaiter(this, void 0, void 0, function () {
3123
- 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, worldPivot, m1, hpr, transform, transformedOffset;
3124
- return __generator(this, function (_e) {
3125
- switch (_e.label) {
3006
+ var viewer, entityId, entity, visualRegister, returnHeightRef, recordHeightRef, api, lat, lon, location_1, e_3, e_4, pos3d, eLocation;
3007
+ return __generator(this, function (_a) {
3008
+ switch (_a.label) {
3126
3009
  case 0:
3127
- 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;
3010
+ viewer = params.viewer, entityId = params.entityId, entity = params.entity, visualRegister = params.visualRegister, returnHeightRef = params.returnHeightRef, recordHeightRef = params.recordHeightRef, api = params.api;
3128
3011
  if (!!entity) return [3 /*break*/, 9];
3129
3012
  lat = 0;
3130
3013
  lon = 0;
3131
- _e.label = 1;
3014
+ _a.label = 1;
3132
3015
  case 1:
3133
- _e.trys.push([1, 3, , 4]);
3016
+ _a.trys.push([1, 3, , 4]);
3134
3017
  return [4 /*yield*/, Entity$1.Get({
3135
3018
  api: api,
3136
3019
  entityId: entityId,
@@ -3138,7 +3021,7 @@ var EntityUtils;
3138
3021
  migrated: true
3139
3022
  })];
3140
3023
  case 2:
3141
- entity = (_e.sent()).entity;
3024
+ entity = (_a.sent()).entity;
3142
3025
  if (entity) {
3143
3026
  location_1 = Entity$1.GetValue({
3144
3027
  entity: entity,
@@ -3149,14 +3032,14 @@ var EntityUtils;
3149
3032
  }
3150
3033
  return [3 /*break*/, 4];
3151
3034
  case 3:
3152
- e_3 = _e.sent();
3035
+ e_3 = _a.sent();
3153
3036
  console.error(e_3);
3154
3037
  return [3 /*break*/, 4];
3155
3038
  case 4:
3156
3039
  if (!(entity && (isNaN(lat) || isNaN(lon) || (lat == 0 && lon == 0)))) return [3 /*break*/, 9];
3157
- _e.label = 5;
3040
+ _a.label = 5;
3158
3041
  case 5:
3159
- _e.trys.push([5, 7, , 9]);
3042
+ _a.trys.push([5, 7, , 9]);
3160
3043
  return [4 /*yield*/, Entity$1.Get({
3161
3044
  api: api,
3162
3045
  entityId: entityId,
@@ -3164,10 +3047,10 @@ var EntityUtils;
3164
3047
  migrated: true
3165
3048
  })];
3166
3049
  case 6:
3167
- entity = (_e.sent()).entity;
3050
+ entity = (_a.sent()).entity;
3168
3051
  return [3 /*break*/, 9];
3169
3052
  case 7:
3170
- e_4 = _e.sent();
3053
+ e_4 = _a.sent();
3171
3054
  console.warn(e_4);
3172
3055
  return [4 /*yield*/, Entity$1.Get({
3173
3056
  api: api,
@@ -3176,20 +3059,13 @@ var EntityUtils;
3176
3059
  migrated: true
3177
3060
  })];
3178
3061
  case 8:
3179
- entity = (_e.sent()).entity;
3062
+ entity = (_a.sent()).entity;
3180
3063
  return [3 /*break*/, 9];
3181
3064
  case 9:
3182
3065
  if (!entity) {
3183
3066
  return [2 /*return*/, null];
3184
3067
  }
3185
- if (!tilesetId) {
3186
- tilesetIds = Entity$1.GetValue({
3187
- entity: entity,
3188
- path: ["Bruce", "TilesetIDs"]
3189
- });
3190
- tilesetId = (tilesetIds === null || tilesetIds === void 0 ? void 0 : tilesetIds.length) ? tilesetIds[0] : tilesetId;
3191
- }
3192
- pos3d = tilesetId ? null : GetPos({
3068
+ pos3d = GetPos({
3193
3069
  viewer: viewer,
3194
3070
  entity: entity,
3195
3071
  visualRegister: visualRegister,
@@ -3199,94 +3075,12 @@ var EntityUtils;
3199
3075
  if (Cartes.ValidateCartes3(pos3d)) {
3200
3076
  return [2 /*return*/, pos3d];
3201
3077
  }
3202
- if (!!tileset) return [3 /*break*/, 11];
3203
- if (!tilesetId) return [3 /*break*/, 11];
3204
- return [4 /*yield*/, Tileset.Get({
3205
- api: api,
3206
- tilesetId: tilesetId
3207
- })];
3208
- case 10:
3209
- tileset = (_e.sent()).tileset;
3210
- _e.label = 11;
3211
- case 11:
3212
- tSettings = tileset === null || tileset === void 0 ? void 0 : tileset.settings;
3213
3078
  eLocation = Entity$1.GetValue({
3214
3079
  entity: entity,
3215
3080
  path: ["Bruce", "Location"]
3216
3081
  });
3217
- 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)) {
3218
- if (eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) {
3219
- alt = +eLocation.altitude;
3220
- if (isNaN(alt)) {
3221
- alt = 0;
3222
- }
3223
- pos3d = Cartesian3.fromDegrees(+eLocation.longitude, +eLocation.latitude, alt);
3224
- }
3225
- else {
3226
- alt = +tSettings.location.altitude;
3227
- if (isNaN(alt)) {
3228
- alt = 0;
3229
- }
3230
- pos3d = Cartesian3.fromDegrees(+tSettings.location.longitude, +tSettings.location.latitude, alt);
3231
- }
3232
- worldPosition = Entity$1.GetValue({
3233
- entity: entity,
3234
- path: ["Bruce", "AssemblyWorldPosition"]
3235
- });
3236
- if (worldPosition) {
3237
- heading = 0;
3238
- pitch = 0;
3239
- roll = 0;
3240
- eTransform = Entity$1.GetValue({
3241
- entity: entity,
3242
- path: ["Bruce", "Transform"]
3243
- });
3244
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.heading) {
3245
- heading = eTransform.heading;
3246
- }
3247
- else if ((_b = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _b === void 0 ? void 0 : _b.heading) {
3248
- heading = tSettings.transform.heading;
3249
- }
3250
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.pitch) {
3251
- pitch = eTransform.pitch;
3252
- }
3253
- else if ((_c = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _c === void 0 ? void 0 : _c.pitch) {
3254
- pitch = tSettings.transform.pitch;
3255
- }
3256
- if (eTransform === null || eTransform === void 0 ? void 0 : eTransform.roll) {
3257
- roll = eTransform.roll;
3258
- }
3259
- else if ((_d = tSettings === null || tSettings === void 0 ? void 0 : tSettings.transform) === null || _d === void 0 ? void 0 : _d.roll) {
3260
- roll = tSettings.transform.roll;
3261
- }
3262
- heading = +heading;
3263
- if (isNaN(heading)) {
3264
- heading = 0;
3265
- }
3266
- pitch = +pitch;
3267
- if (isNaN(pitch)) {
3268
- pitch = 0;
3269
- }
3270
- roll = +roll;
3271
- if (isNaN(roll)) {
3272
- roll = 0;
3273
- }
3274
- matrix4 = worldPosition;
3275
- offset = new Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
3276
- worldPivot = Entity$1.GetValue({
3277
- entity: entity,
3278
- path: ["Bruce", "GeometryWorldPivot"]
3279
- });
3280
- if (worldPivot) //the position from worldMatrix + center of geometry offset
3281
- {
3282
- offset = new Cartesian3(worldPivot[0], worldPivot[1], worldPivot[2]);
3283
- }
3284
- m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
3285
- hpr = HeadingPitchRoll.fromDegrees(heading, pitch, roll, new HeadingPitchRoll());
3286
- transform = Matrix3.fromHeadingPitchRoll(hpr);
3287
- transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
3288
- pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
3289
- }
3082
+ if (+(eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude)) {
3083
+ pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3290
3084
  }
3291
3085
  return [2 /*return*/, DrawingUtils.EnsurePosHeight({
3292
3086
  desiredHeightRef: params.returnHeightRef,
@@ -26543,7 +26337,7 @@ var ViewerUtils;
26543
26337
  ViewerUtils.AssertIonToken = AssertIonToken;
26544
26338
  })(ViewerUtils || (ViewerUtils = {}));
26545
26339
 
26546
- var VERSION = "4.3.6";
26340
+ var VERSION = "4.3.8";
26547
26341
 
26548
26342
  export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, WidgetSearchBar, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
26549
26343
  //# sourceMappingURL=bruce-cesium.es5.js.map