bruce-cesium 3.2.2 → 3.2.3

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 { Cartes, ProjectViewTile, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ProgramKey, ENVIRONMENT, 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, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, HeadingPitchRange, Cesium3DTileColorBlendMode, KmlDataSource, Ion, Cesium3DTileStyle, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, Cesium3DTileset, Matrix4, Matrix3, IonResource, PolygonPipeline, CesiumInspector, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, ColorMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, Entity, Primitive, Cesium3DTileFeature, JulianDate, SceneMode, DistanceDisplayCondition, NearFarScalar, Model, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, PolygonPipeline, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ScreenSpaceEventHandler, ScreenSpaceEventType, ColorMaterialProperty, BoundingSphere, GeometryInstance, CesiumInspector, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3006,24 +3006,27 @@ function getModelEntity(url, scale) {
3006
3006
  return __awaiter(this, void 0, void 0, function () {
3007
3007
  var CESIUM;
3008
3008
  return __generator(this, function (_a) {
3009
- CESIUM = Cesium;
3010
- // Newer versions of Cesium have a fromGltfAsync method.
3011
- if (CESIUM.Model.hasOwnProperty("fromGltfAsync")) {
3012
- return [2 /*return*/, CESIUM.Model.fromGltfAsync({
3013
- url: url,
3014
- asynchronous: true,
3015
- scale: scale
3016
- })];
3017
- }
3018
- // Older versions of Cesium have a fromGltf method.
3019
- else if (Model.hasOwnProperty("fromGltf")) {
3020
- return [2 /*return*/, CESIUM.Model.fromGltf({
3021
- url: url,
3022
- asynchronous: true,
3023
- scale: scale
3024
- })];
3025
- }
3026
- return [2 /*return*/, null];
3009
+ switch (_a.label) {
3010
+ case 0:
3011
+ CESIUM = Cesium;
3012
+ if (!CESIUM.Model.hasOwnProperty("fromGltfAsync")) return [3 /*break*/, 2];
3013
+ return [4 /*yield*/, CESIUM.Model.fromGltfAsync({
3014
+ url: url,
3015
+ asynchronous: true,
3016
+ scale: scale
3017
+ })];
3018
+ case 1: return [2 /*return*/, _a.sent()];
3019
+ case 2:
3020
+ if (Model.hasOwnProperty("fromGltf")) {
3021
+ return [2 /*return*/, CESIUM.Model.fromGltf({
3022
+ url: url,
3023
+ asynchronous: true,
3024
+ scale: scale
3025
+ })];
3026
+ }
3027
+ _a.label = 3;
3028
+ case 3: return [2 /*return*/, null];
3029
+ }
3027
3030
  });
3028
3031
  });
3029
3032
  }
@@ -4082,7 +4085,7 @@ var EntityRenderEngine;
4082
4085
  var heightProm = _fileRadiusCache.Get(fileRadiusKey);
4083
4086
  if (!heightProm) {
4084
4087
  heightProm = new Promise(function (res) { return __awaiter(_this, void 0, void 0, function () {
4085
- var modelPrim_1, e_6;
4088
+ var modelPrim_1, onReady_1, readyEventRemoval_1, e_6;
4086
4089
  return __generator(this, function (_a) {
4087
4090
  switch (_a.label) {
4088
4091
  case 0:
@@ -4090,7 +4093,9 @@ var EntityRenderEngine;
4090
4093
  return [4 /*yield*/, getModelEntity(params.lodUrl, scale * styleScale)];
4091
4094
  case 1:
4092
4095
  modelPrim_1 = _a.sent();
4093
- modelPrim_1.readyPromise.then(function (loaded) {
4096
+ onReady_1 = function () {
4097
+ readyEventRemoval_1 === null || readyEventRemoval_1 === void 0 ? void 0 : readyEventRemoval_1();
4098
+ readyEventRemoval_1 = null;
4094
4099
  var kill = function () {
4095
4100
  if (params.viewer && !params.viewer.isDestroyed() && params.viewer.scene.primitives.contains(modelPrim_1)) {
4096
4101
  params.viewer.scene.primitives.remove(modelPrim_1);
@@ -4099,13 +4104,13 @@ var EntityRenderEngine;
4099
4104
  modelPrim_1.destroy();
4100
4105
  }
4101
4106
  };
4102
- if (!cEntity || !(loaded === null || loaded === void 0 ? void 0 : loaded.boundingSphere)) {
4107
+ if (!cEntity || !(modelPrim_1 === null || modelPrim_1 === void 0 ? void 0 : modelPrim_1.boundingSphere)) {
4103
4108
  kill();
4104
4109
  res(null);
4105
4110
  return;
4106
4111
  }
4107
- var radius = loaded.boundingSphere.radius;
4108
- var centerOffset = loaded.boundingSphere.center;
4112
+ var radius = modelPrim_1.boundingSphere.radius;
4113
+ var centerOffset = modelPrim_1.boundingSphere.center;
4109
4114
  if (centerOffset) {
4110
4115
  // Add the center offset to the radius because I am not good at math.
4111
4116
  var magnitude = Cartesian3.magnitude(centerOffset);
@@ -4118,10 +4123,21 @@ var EntityRenderEngine;
4118
4123
  }
4119
4124
  kill();
4120
4125
  res(radius);
4121
- }).catch(function (e) {
4122
- console.error(e);
4123
- res(null);
4124
- });
4126
+ };
4127
+ readyEventRemoval_1 = null;
4128
+ // Newer Cesium versions have readyEvent. They don't use readyPromise.
4129
+ if (modelPrim_1["readyEvent"]) {
4130
+ modelPrim_1["readyEvent"].addEventListener(onReady_1);
4131
+ }
4132
+ // Older Cesium versions don't have readyEvent, they use readyPromise.
4133
+ else if (modelPrim_1["readyPromise"]) {
4134
+ modelPrim_1["readyPromise"].then(function () {
4135
+ onReady_1();
4136
+ }).catch(function (e) {
4137
+ console.error(e);
4138
+ res(null);
4139
+ });
4140
+ }
4125
4141
  params.viewer.scene.primitives.add(modelPrim_1);
4126
4142
  return [3 /*break*/, 3];
4127
4143
  case 2:
@@ -19399,7 +19415,7 @@ var CesiumViewMonitor;
19399
19415
  CesiumViewMonitor$$1.Monitor = Monitor;
19400
19416
  })(CesiumViewMonitor || (CesiumViewMonitor = {}));
19401
19417
 
19402
- var VERSION$1 = "3.2.2";
19418
+ var VERSION$1 = "3.2.3";
19403
19419
 
19404
19420
  export { VERSION$1 as 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, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
19405
19421
  //# sourceMappingURL=bruce-cesium.es5.js.map