bruce-cesium 1.7.3 → 1.7.5

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, Cesium3DTileColorBlendMode, HeadingPitchRange, KmlDataSource, createOsmBuildings, Cesium3DTileStyle, createWorldTerrain, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, OrthographicFrustum, JulianDate, ColorMaterialProperty, Matrix3, Matrix4, EasingFunction, GeometryInstance, Cesium3DTileset, IonResource, createGooglePhotorealistic3DTileset } 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, 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';
4
4
 
5
5
  var TIME_LAG = 300;
6
6
  var POSITION_CHECK_TIMER = 950;
@@ -5509,48 +5509,52 @@ var TilesetCadRenderManager;
5509
5509
  }
5510
5510
  };
5511
5511
  Manager.prototype.mapTilesetFeature = function (feature) {
5512
- var _a, _b, _c, _d, _e, _f, _g;
5513
- var version = (_c = (_b = (_a = feature === null || feature === void 0 ? void 0 : feature.tileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree) === null || _c === void 0 ? void 0 : _c.version;
5514
- if (!version) {
5515
- version = 1;
5516
- }
5512
+ var _a, _b, _c, _d;
5517
5513
  var rego = {
5518
5514
  entityId: null,
5519
5515
  entityTypeId: null,
5520
5516
  menuItemId: this.item.id,
5521
5517
  priority: 0,
5522
5518
  visual: feature,
5523
- accountId: (_e = (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.ClientAccountID) !== null && _e !== void 0 ? _e : this.apiGetter.accountId,
5524
- tilesetId: (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.TilesetID
5519
+ accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.apiGetter.accountId,
5520
+ tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID
5525
5521
  };
5526
- if (version == 1) {
5527
- var pathStr = feature.getProperty("BrucePath");
5528
- if (pathStr != undefined) {
5529
- var path = pathStr.split("|");
5530
- var entityTypeId = this.getEntityTypeByPath(path);
5531
- rego.entityTypeId = entityTypeId;
5532
- rego.entityId = path[path.length - 1];
5522
+ var propertyNames = feature.getPropertyNames();
5523
+ for (var i = 0; i < propertyNames.length; i++) {
5524
+ var prop = propertyNames[i];
5525
+ var name_1 = String(prop).toLocaleLowerCase();
5526
+ if (name_1 == "bruceid") {
5527
+ rego.entityId = feature.getProperty(prop);
5528
+ break;
5533
5529
  }
5534
- }
5535
- else if (version == 2) {
5536
- var geomId = +feature.getProperty("GeomId");
5537
- if (geomId != null && (!!geomId || geomId == 0)) {
5538
- var meta = this.getMetaByGeomId(geomId, feature.tileset);
5539
- if (meta) {
5540
- rego.entityId = meta.id;
5541
- rego.entityTypeId = meta.typeId;
5530
+ else if (name_1 == "brucepath") {
5531
+ var pathStr = feature.getProperty(prop);
5532
+ if (pathStr != undefined) {
5533
+ var path = pathStr.split("|");
5534
+ var entityTypeId = this.getEntityTypeByPath(path);
5535
+ rego.entityTypeId = entityTypeId;
5536
+ rego.entityId = path[path.length - 1];
5537
+ break;
5538
+ }
5539
+ }
5540
+ else if (name_1 == "geomid") {
5541
+ var geomId = +feature.getProperty(prop);
5542
+ if (geomId != null && (!!geomId || geomId == 0)) {
5543
+ var meta = this.getMetaByGeomId(geomId, feature.tileset);
5544
+ if (meta) {
5545
+ rego.entityId = meta.id;
5546
+ rego.entityTypeId = meta.typeId;
5547
+ break;
5548
+ }
5542
5549
  }
5543
5550
  }
5544
- }
5545
- else {
5546
- console.log("Unhandled tileset tree version = " + version);
5547
5551
  }
5548
5552
  if (!rego.entityId) {
5549
5553
  return null;
5550
5554
  }
5551
5555
  // Optional menu item restriction.
5552
5556
  // Allows only showing certain entities from a tileset.
5553
- var onlyIds = (_g = this.item.BruceEntity) === null || _g === void 0 ? void 0 : _g.EntityIds;
5557
+ var onlyIds = (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.EntityIds;
5554
5558
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
5555
5559
  if (this.item.BruceEntity.Ghosts) {
5556
5560
  feature.color = Color.WHITE.clone().withAlpha(0.5);
@@ -6919,15 +6923,18 @@ var TilesetGooglePhotosRenderManager;
6919
6923
  }
6920
6924
  };
6921
6925
  Manager.prototype.Init = function () {
6926
+ var _a, _b;
6922
6927
  return __awaiter(this, void 0, void 0, function () {
6923
- var _a;
6924
- return __generator(this, function (_b) {
6925
- switch (_b.label) {
6928
+ var _c;
6929
+ return __generator(this, function (_d) {
6930
+ switch (_d.label) {
6926
6931
  case 0:
6927
- _a = this;
6928
- return [4 /*yield*/, createGooglePhotorealistic3DTileset()];
6932
+ // Using as any to be OK with older versions.
6933
+ _c = this;
6934
+ return [4 /*yield*/, ((_b = (_a = Cesium).createGooglePhotorealistic3DTileset) === null || _b === void 0 ? void 0 : _b.call(_a))];
6929
6935
  case 1:
6930
- _a.cTileset = _b.sent();
6936
+ // Using as any to be OK with older versions.
6937
+ _c.cTileset = _d.sent();
6931
6938
  if (this.disposed) {
6932
6939
  return [2 /*return*/];
6933
6940
  }
@@ -8842,11 +8849,11 @@ function renderLegacyNavigator(params, bookmark, view) {
8842
8849
  * @param view
8843
8850
  */
8844
8851
  function renderNavigator(params, bookmark, view) {
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;
8852
+ 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;
8846
8853
  return __awaiter(this, void 0, void 0, function () {
8847
- 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;
8848
- return __generator(this, function (_3) {
8849
- switch (_3.label) {
8854
+ 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;
8855
+ return __generator(this, function (_4) {
8856
+ switch (_4.label) {
8850
8857
  case 0:
8851
8858
  viewer = params.manager.Viewer;
8852
8859
  scene = viewer.scene;
@@ -8908,8 +8915,8 @@ function renderNavigator(params, bookmark, view) {
8908
8915
  viewer: params.manager.Viewer,
8909
8916
  })];
8910
8917
  case 1:
8911
- _3.sent();
8912
- _3.label = 2;
8918
+ _4.sent();
8919
+ _4.label = 2;
8913
8920
  case 2:
8914
8921
  gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
8915
8922
  if (gOcclusion == null) {
@@ -8937,9 +8944,17 @@ function renderNavigator(params, bookmark, view) {
8937
8944
  baseColor = "#0326BE";
8938
8945
  }
8939
8946
  scene.globe.baseColor = Color.fromCssColorString(baseColor);
8947
+ globeHidden = bSettings === null || bSettings === void 0 ? void 0 : bSettings.globeHidden;
8948
+ if (globeHidden == null) {
8949
+ globeHidden = (_s = defaults.settings) === null || _s === void 0 ? void 0 : _s.globeHidden;
8950
+ }
8951
+ if (globeHidden == null) {
8952
+ globeHidden = false;
8953
+ }
8954
+ scene.globe.show = !globeHidden;
8940
8955
  shadows = bSettings === null || bSettings === void 0 ? void 0 : bSettings.shadows;
8941
8956
  if (shadows == null) {
8942
- shadows = (_s = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _s === void 0 ? void 0 : _s.shadows;
8957
+ shadows = (_t = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _t === void 0 ? void 0 : _t.shadows;
8943
8958
  }
8944
8959
  if (shadows == null) {
8945
8960
  shadows = {
@@ -8966,7 +8981,7 @@ function renderNavigator(params, bookmark, view) {
8966
8981
  }
8967
8982
  ambientOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.ambientOcclusion;
8968
8983
  if (ambientOcclusion == null) {
8969
- ambientOcclusion = (_t = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _t === void 0 ? void 0 : _t.ambientOcclusion;
8984
+ ambientOcclusion = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.ambientOcclusion;
8970
8985
  }
8971
8986
  if (ambientOcclusion == null) {
8972
8987
  ambientOcclusion = {
@@ -8989,7 +9004,7 @@ function renderNavigator(params, bookmark, view) {
8989
9004
  }
8990
9005
  lighting = bSettings === null || bSettings === void 0 ? void 0 : bSettings.lighting;
8991
9006
  if (lighting == null) {
8992
- lighting = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.lighting;
9007
+ lighting = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.lighting;
8993
9008
  }
8994
9009
  if (lighting == null) {
8995
9010
  lighting = {
@@ -9004,7 +9019,7 @@ function renderNavigator(params, bookmark, view) {
9004
9019
  }
9005
9020
  quality = bSettings === null || bSettings === void 0 ? void 0 : bSettings.quality;
9006
9021
  if (quality == null) {
9007
- quality = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.quality;
9022
+ quality = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.quality;
9008
9023
  }
9009
9024
  if (quality == null) {
9010
9025
  quality = {
@@ -9015,7 +9030,7 @@ function renderNavigator(params, bookmark, view) {
9015
9030
  fxaa.enabled = Boolean(quality.fxaa);
9016
9031
  dateTime = bSettings === null || bSettings === void 0 ? void 0 : bSettings.dateTime;
9017
9032
  if (dateTime == null) {
9018
- dateTime = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.dateTime;
9033
+ dateTime = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.dateTime;
9019
9034
  }
9020
9035
  if (dateTime != null) {
9021
9036
  clock = viewer.clock;
@@ -9023,7 +9038,7 @@ function renderNavigator(params, bookmark, view) {
9023
9038
  }
9024
9039
  selectedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.selectedEntityIds;
9025
9040
  if (selectedIds == null) {
9026
- selectedIds = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.selectedEntityIds;
9041
+ selectedIds = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.selectedEntityIds;
9027
9042
  }
9028
9043
  if (selectedIds != null) {
9029
9044
  params.manager.VisualsRegister.ClearSelected();
@@ -9036,7 +9051,7 @@ function renderNavigator(params, bookmark, view) {
9036
9051
  params.manager.VisualsRegister.ClearHidden();
9037
9052
  hiddenIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.hiddenEntityIds;
9038
9053
  if (hiddenIds == null) {
9039
- hiddenIds = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.hiddenEntityIds;
9054
+ hiddenIds = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.hiddenEntityIds;
9040
9055
  }
9041
9056
  if (hiddenIds != null) {
9042
9057
  params.manager.VisualsRegister.SetHidden({
@@ -9047,7 +9062,7 @@ function renderNavigator(params, bookmark, view) {
9047
9062
  params.manager.VisualsRegister.ClearIsolated();
9048
9063
  isolatedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.isolatedEntityIds;
9049
9064
  if (isolatedIds == null) {
9050
- isolatedIds = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.isolatedEntityIds;
9065
+ isolatedIds = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.isolatedEntityIds;
9051
9066
  }
9052
9067
  if (isolatedIds != null) {
9053
9068
  params.manager.VisualsRegister.SetIsolated({
@@ -9058,7 +9073,7 @@ function renderNavigator(params, bookmark, view) {
9058
9073
  params.manager.VisualsRegister.ClearOpacity();
9059
9074
  entityOpacityMap = bSettings === null || bSettings === void 0 ? void 0 : bSettings.entityOpacityMap;
9060
9075
  if (entityOpacityMap == null) {
9061
- entityOpacityMap = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.entityOpacityMap;
9076
+ entityOpacityMap = (_1 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _1 === void 0 ? void 0 : _1.entityOpacityMap;
9062
9077
  }
9063
9078
  if (entityOpacityMap != null) {
9064
9079
  for (entityId in entityOpacityMap) {
@@ -9071,7 +9086,7 @@ function renderNavigator(params, bookmark, view) {
9071
9086
  }
9072
9087
  }
9073
9088
  }
9074
- imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_1 = defaults.settings) === null || _1 === void 0 ? void 0 : _1.imagery;
9089
+ imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_2 = defaults.settings) === null || _2 === void 0 ? void 0 : _2.imagery;
9075
9090
  if (imagery == null) {
9076
9091
  // TODO: Need global default.
9077
9092
  imagery = [
@@ -9093,15 +9108,15 @@ function renderNavigator(params, bookmark, view) {
9093
9108
  viewer: params.manager.Viewer,
9094
9109
  })];
9095
9110
  case 3:
9096
- _3.sent();
9111
+ _4.sent();
9097
9112
  renderedRelationEntityIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.renderedEntityRelations;
9098
9113
  if (!renderedRelationEntityIds) {
9099
9114
  renderedRelationEntityIds = [];
9100
9115
  }
9101
9116
  curEnabled = params.manager.GetEnabledItemIds();
9102
- newItemIds = (_2 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _2 !== void 0 ? _2 : [];
9117
+ newItemIds = (_3 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _3 !== void 0 ? _3 : [];
9103
9118
  _i = 0, curEnabled_1 = curEnabled;
9104
- _3.label = 4;
9119
+ _4.label = 4;
9105
9120
  case 4:
9106
9121
  if (!(_i < curEnabled_1.length)) return [3 /*break*/, 7];
9107
9122
  id = curEnabled_1[_i];
@@ -9111,8 +9126,8 @@ function renderNavigator(params, bookmark, view) {
9111
9126
  menuItemId: id
9112
9127
  })];
9113
9128
  case 5:
9114
- _3.sent();
9115
- _3.label = 6;
9129
+ _4.sent();
9130
+ _4.label = 6;
9116
9131
  case 6:
9117
9132
  _i++;
9118
9133
  return [3 /*break*/, 4];
@@ -9125,8 +9140,8 @@ function renderNavigator(params, bookmark, view) {
9125
9140
  bookmark: bookmark
9126
9141
  })];
9127
9142
  case 8:
9128
- _3.sent();
9129
- _3.label = 9;
9143
+ _4.sent();
9144
+ _4.label = 9;
9130
9145
  case 9:
9131
9146
  if (!(renderedRelationEntityIds.length > 0)) return [3 /*break*/, 11];
9132
9147
  menuItem = {
@@ -9142,8 +9157,8 @@ function renderNavigator(params, bookmark, view) {
9142
9157
  item: menuItem
9143
9158
  })];
9144
9159
  case 10:
9145
- _3.sent();
9146
- _3.label = 11;
9160
+ _4.sent();
9161
+ _4.label = 11;
9147
9162
  case 11: return [2 /*return*/];
9148
9163
  }
9149
9164
  });