bruce-cesium 1.7.2 → 1.7.4

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, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, BatchedDataGetter, EntityRelationType, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartesian2, Cartographic, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, Cesium3DTileColorBlendMode, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, JulianDate, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, Cesium3DTileset, Matrix4, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
3
+ import { Cartesian2, Cartographic, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, EllipsoidTerrainProvider, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, JulianDate, Cesium3DTileset, Matrix4, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, createGooglePhotorealistic3DTileset } from 'cesium';
4
4
 
5
5
  var TIME_LAG = 300;
6
6
  var POSITION_CHECK_TIMER = 950;
@@ -6881,6 +6881,74 @@ var RelationsRenderManager;
6881
6881
  RelationsRenderManager.Manager = Manager;
6882
6882
  })(RelationsRenderManager || (RelationsRenderManager = {}));
6883
6883
 
6884
+ var TilesetGooglePhotosRenderManager;
6885
+ (function (TilesetGooglePhotosRenderManager) {
6886
+ var Manager = /** @class */ (function () {
6887
+ function Manager(params) {
6888
+ this.disposed = false;
6889
+ this.cTileset = null;
6890
+ var viewer = params.viewer, item = params.item;
6891
+ this.viewer = viewer;
6892
+ this.item = item;
6893
+ }
6894
+ Object.defineProperty(Manager.prototype, "Disposed", {
6895
+ get: function () {
6896
+ return this.disposed;
6897
+ },
6898
+ enumerable: false,
6899
+ configurable: true
6900
+ });
6901
+ Object.defineProperty(Manager.prototype, "Tileset", {
6902
+ get: function () {
6903
+ return this.cTileset;
6904
+ },
6905
+ enumerable: false,
6906
+ configurable: true
6907
+ });
6908
+ Manager.prototype.Dispose = function () {
6909
+ if (this.disposed) {
6910
+ return;
6911
+ }
6912
+ if (this.cTileset) {
6913
+ var viewer = this.viewer;
6914
+ if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
6915
+ this.cTileset.show = false;
6916
+ this.viewer.scene.primitives.remove(this.cTileset);
6917
+ }
6918
+ this.cTileset = null;
6919
+ }
6920
+ };
6921
+ Manager.prototype.Init = function () {
6922
+ return __awaiter(this, void 0, void 0, function () {
6923
+ var _a;
6924
+ return __generator(this, function (_b) {
6925
+ switch (_b.label) {
6926
+ case 0:
6927
+ _a = this;
6928
+ return [4 /*yield*/, createGooglePhotorealistic3DTileset()];
6929
+ case 1:
6930
+ _a.cTileset = _b.sent();
6931
+ if (this.disposed) {
6932
+ return [2 /*return*/];
6933
+ }
6934
+ this.viewer.scene.primitives.add(this.cTileset);
6935
+ return [2 /*return*/];
6936
+ }
6937
+ });
6938
+ });
6939
+ };
6940
+ Manager.prototype.ReRender = function (entityIds) {
6941
+ return __awaiter(this, void 0, void 0, function () {
6942
+ return __generator(this, function (_a) {
6943
+ return [2 /*return*/];
6944
+ });
6945
+ });
6946
+ };
6947
+ return Manager;
6948
+ }());
6949
+ TilesetGooglePhotosRenderManager.Manager = Manager;
6950
+ })(TilesetGooglePhotosRenderManager || (TilesetGooglePhotosRenderManager = {}));
6951
+
6884
6952
  /**
6885
6953
  * Utility to keep track of enabled menu items within a Cesium viewer.
6886
6954
  */
@@ -7053,6 +7121,12 @@ var MenuItemManager;
7053
7121
  viewer: this.viewer
7054
7122
  });
7055
7123
  break;
7124
+ case MenuItem.EType.GooglePhotoTileset:
7125
+ rItem.renderManager = new TilesetGooglePhotosRenderManager.Manager({
7126
+ item: params.item,
7127
+ viewer: this.viewer,
7128
+ });
7129
+ break;
7056
7130
  // Any "none" type can be ignored. These are just containers for other items.
7057
7131
  case MenuItem.EType.None:
7058
7132
  break;
@@ -8768,11 +8842,11 @@ function renderLegacyNavigator(params, bookmark, view) {
8768
8842
  * @param view
8769
8843
  */
8770
8844
  function renderNavigator(params, bookmark, view) {
8771
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
8845
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
8772
8846
  return __awaiter(this, void 0, void 0, function () {
8773
- var viewer, scene, vSettings, bSettings, defaults, camera, newLens, curLens, transition, pos, terrain, gOcclusion, hillShades, baseColor, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem;
8774
- return __generator(this, function (_3) {
8775
- switch (_3.label) {
8847
+ var viewer, scene, vSettings, bSettings, defaults, camera, newLens, curLens, transition, pos, terrain, gOcclusion, hillShades, baseColor, globeHidden, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem;
8848
+ return __generator(this, function (_4) {
8849
+ switch (_4.label) {
8776
8850
  case 0:
8777
8851
  viewer = params.manager.Viewer;
8778
8852
  scene = viewer.scene;
@@ -8834,8 +8908,8 @@ function renderNavigator(params, bookmark, view) {
8834
8908
  viewer: params.manager.Viewer,
8835
8909
  })];
8836
8910
  case 1:
8837
- _3.sent();
8838
- _3.label = 2;
8911
+ _4.sent();
8912
+ _4.label = 2;
8839
8913
  case 2:
8840
8914
  gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
8841
8915
  if (gOcclusion == null) {
@@ -8863,9 +8937,17 @@ function renderNavigator(params, bookmark, view) {
8863
8937
  baseColor = "#0326BE";
8864
8938
  }
8865
8939
  scene.globe.baseColor = Color.fromCssColorString(baseColor);
8940
+ globeHidden = bSettings === null || bSettings === void 0 ? void 0 : bSettings.globeHidden;
8941
+ if (globeHidden == null) {
8942
+ globeHidden = (_s = defaults.settings) === null || _s === void 0 ? void 0 : _s.globeHidden;
8943
+ }
8944
+ if (globeHidden == null) {
8945
+ globeHidden = false;
8946
+ }
8947
+ scene.globe.show = !globeHidden;
8866
8948
  shadows = bSettings === null || bSettings === void 0 ? void 0 : bSettings.shadows;
8867
8949
  if (shadows == null) {
8868
- shadows = (_s = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _s === void 0 ? void 0 : _s.shadows;
8950
+ shadows = (_t = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _t === void 0 ? void 0 : _t.shadows;
8869
8951
  }
8870
8952
  if (shadows == null) {
8871
8953
  shadows = {
@@ -8892,7 +8974,7 @@ function renderNavigator(params, bookmark, view) {
8892
8974
  }
8893
8975
  ambientOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.ambientOcclusion;
8894
8976
  if (ambientOcclusion == null) {
8895
- ambientOcclusion = (_t = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _t === void 0 ? void 0 : _t.ambientOcclusion;
8977
+ ambientOcclusion = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.ambientOcclusion;
8896
8978
  }
8897
8979
  if (ambientOcclusion == null) {
8898
8980
  ambientOcclusion = {
@@ -8915,7 +8997,7 @@ function renderNavigator(params, bookmark, view) {
8915
8997
  }
8916
8998
  lighting = bSettings === null || bSettings === void 0 ? void 0 : bSettings.lighting;
8917
8999
  if (lighting == null) {
8918
- lighting = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.lighting;
9000
+ lighting = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.lighting;
8919
9001
  }
8920
9002
  if (lighting == null) {
8921
9003
  lighting = {
@@ -8930,7 +9012,7 @@ function renderNavigator(params, bookmark, view) {
8930
9012
  }
8931
9013
  quality = bSettings === null || bSettings === void 0 ? void 0 : bSettings.quality;
8932
9014
  if (quality == null) {
8933
- quality = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.quality;
9015
+ quality = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.quality;
8934
9016
  }
8935
9017
  if (quality == null) {
8936
9018
  quality = {
@@ -8941,7 +9023,7 @@ function renderNavigator(params, bookmark, view) {
8941
9023
  fxaa.enabled = Boolean(quality.fxaa);
8942
9024
  dateTime = bSettings === null || bSettings === void 0 ? void 0 : bSettings.dateTime;
8943
9025
  if (dateTime == null) {
8944
- dateTime = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.dateTime;
9026
+ dateTime = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.dateTime;
8945
9027
  }
8946
9028
  if (dateTime != null) {
8947
9029
  clock = viewer.clock;
@@ -8949,7 +9031,7 @@ function renderNavigator(params, bookmark, view) {
8949
9031
  }
8950
9032
  selectedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.selectedEntityIds;
8951
9033
  if (selectedIds == null) {
8952
- selectedIds = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.selectedEntityIds;
9034
+ selectedIds = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.selectedEntityIds;
8953
9035
  }
8954
9036
  if (selectedIds != null) {
8955
9037
  params.manager.VisualsRegister.ClearSelected();
@@ -8962,7 +9044,7 @@ function renderNavigator(params, bookmark, view) {
8962
9044
  params.manager.VisualsRegister.ClearHidden();
8963
9045
  hiddenIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.hiddenEntityIds;
8964
9046
  if (hiddenIds == null) {
8965
- hiddenIds = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.hiddenEntityIds;
9047
+ hiddenIds = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.hiddenEntityIds;
8966
9048
  }
8967
9049
  if (hiddenIds != null) {
8968
9050
  params.manager.VisualsRegister.SetHidden({
@@ -8973,7 +9055,7 @@ function renderNavigator(params, bookmark, view) {
8973
9055
  params.manager.VisualsRegister.ClearIsolated();
8974
9056
  isolatedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.isolatedEntityIds;
8975
9057
  if (isolatedIds == null) {
8976
- isolatedIds = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.isolatedEntityIds;
9058
+ isolatedIds = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.isolatedEntityIds;
8977
9059
  }
8978
9060
  if (isolatedIds != null) {
8979
9061
  params.manager.VisualsRegister.SetIsolated({
@@ -8984,7 +9066,7 @@ function renderNavigator(params, bookmark, view) {
8984
9066
  params.manager.VisualsRegister.ClearOpacity();
8985
9067
  entityOpacityMap = bSettings === null || bSettings === void 0 ? void 0 : bSettings.entityOpacityMap;
8986
9068
  if (entityOpacityMap == null) {
8987
- entityOpacityMap = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.entityOpacityMap;
9069
+ entityOpacityMap = (_1 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _1 === void 0 ? void 0 : _1.entityOpacityMap;
8988
9070
  }
8989
9071
  if (entityOpacityMap != null) {
8990
9072
  for (entityId in entityOpacityMap) {
@@ -8997,7 +9079,7 @@ function renderNavigator(params, bookmark, view) {
8997
9079
  }
8998
9080
  }
8999
9081
  }
9000
- imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_1 = defaults.settings) === null || _1 === void 0 ? void 0 : _1.imagery;
9082
+ imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_2 = defaults.settings) === null || _2 === void 0 ? void 0 : _2.imagery;
9001
9083
  if (imagery == null) {
9002
9084
  // TODO: Need global default.
9003
9085
  imagery = [
@@ -9019,15 +9101,15 @@ function renderNavigator(params, bookmark, view) {
9019
9101
  viewer: params.manager.Viewer,
9020
9102
  })];
9021
9103
  case 3:
9022
- _3.sent();
9104
+ _4.sent();
9023
9105
  renderedRelationEntityIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
9024
9106
  if (!renderedRelationEntityIds) {
9025
9107
  renderedRelationEntityIds = [];
9026
9108
  }
9027
9109
  curEnabled = params.manager.GetEnabledItemIds();
9028
- newItemIds = (_2 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _2 !== void 0 ? _2 : [];
9110
+ newItemIds = (_3 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _3 !== void 0 ? _3 : [];
9029
9111
  _i = 0, curEnabled_1 = curEnabled;
9030
- _3.label = 4;
9112
+ _4.label = 4;
9031
9113
  case 4:
9032
9114
  if (!(_i < curEnabled_1.length)) return [3 /*break*/, 7];
9033
9115
  id = curEnabled_1[_i];
@@ -9037,8 +9119,8 @@ function renderNavigator(params, bookmark, view) {
9037
9119
  menuItemId: id
9038
9120
  })];
9039
9121
  case 5:
9040
- _3.sent();
9041
- _3.label = 6;
9122
+ _4.sent();
9123
+ _4.label = 6;
9042
9124
  case 6:
9043
9125
  _i++;
9044
9126
  return [3 /*break*/, 4];
@@ -9051,8 +9133,8 @@ function renderNavigator(params, bookmark, view) {
9051
9133
  bookmark: bookmark
9052
9134
  })];
9053
9135
  case 8:
9054
- _3.sent();
9055
- _3.label = 9;
9136
+ _4.sent();
9137
+ _4.label = 9;
9056
9138
  case 9:
9057
9139
  if (!(renderedRelationEntityIds.length > 0)) return [3 /*break*/, 11];
9058
9140
  menuItem = {
@@ -9068,8 +9150,8 @@ function renderNavigator(params, bookmark, view) {
9068
9150
  item: menuItem
9069
9151
  })];
9070
9152
  case 10:
9071
- _3.sent();
9072
- _3.label = 11;
9153
+ _4.sent();
9154
+ _4.label = 11;
9073
9155
  case 11: return [2 /*return*/];
9074
9156
  }
9075
9157
  });