bruce-cesium 2.8.6 → 2.8.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
1
  import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, DelayQueue, BatchedDataGetter, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, JulianDate, SceneMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumInspector, defined, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Model, Matrix4, Matrix3, IonResource, Ion, PolygonPipeline, ColorMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere } from 'cesium';
3
+ import { Cartographic, JulianDate, Color, HeightReference, Cartesian3, DistanceDisplayCondition, NearFarScalar, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Math as Math$1, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cartesian2, CallbackProperty, Rectangle, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumInspector, defined, Cesium3DTileset, Matrix4, Matrix3, IonResource, Ion, EllipsoidGeodesic, sampleTerrainMostDetailed, Model, PolygonPipeline, ColorMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere } from 'cesium';
4
4
 
5
5
  var TIME_LAG = 300;
6
6
  var POSITION_CHECK_TIMER = 950;
@@ -3803,19 +3803,19 @@ var EntityLabel;
3803
3803
  * @param starterPos3d optional position to create label at. Ignored for billboard labels.
3804
3804
  */
3805
3805
  Label.prototype.createLabel = function (starterPos3d) {
3806
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
3806
+ var _a, _b, _c, _d, _e, _f, _g;
3807
3807
  return __awaiter(this, void 0, void 0, function () {
3808
3808
  var pos3d, counter, sizeInM, heightRef, pixelOffset, visual, hierarchy, posses, centerIndex, pos1, pos2, pos3, posses, isClamped, centerIndex, size, height, scale, posses, centerIndex, text, type, e_1, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel, terrTimeout;
3809
3809
  var _this = this;
3810
- return __generator(this, function (_l) {
3811
- switch (_l.label) {
3810
+ return __generator(this, function (_h) {
3811
+ switch (_h.label) {
3812
3812
  case 0:
3813
+ this.removeLabel();
3813
3814
  pos3d = starterPos3d ? starterPos3d.clone() : null;
3814
3815
  counter = ++this.counter;
3815
3816
  if (this.disposed) {
3816
3817
  return [2 /*return*/];
3817
3818
  }
3818
- this.removeLabel();
3819
3819
  sizeInM = 0;
3820
3820
  heightRef = null;
3821
3821
  pixelOffset = new Cartesian2(0, -5);
@@ -3948,12 +3948,12 @@ var EntityLabel;
3948
3948
  visualRegister: this.visualRegister
3949
3949
  })];
3950
3950
  case 1:
3951
- pos3d = _l.sent();
3951
+ pos3d = _h.sent();
3952
3952
  heightRef = HeightReference.NONE;
3953
- if (this.counter != counter) {
3953
+ if (this.counter != counter || this.disposed) {
3954
3954
  return [2 /*return*/];
3955
3955
  }
3956
- _l.label = 2;
3956
+ _h.label = 2;
3957
3957
  case 2:
3958
3958
  if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3959
3959
  return [2 /*return*/];
@@ -3969,42 +3969,55 @@ var EntityLabel;
3969
3969
  }
3970
3970
  this._pos3d = pos3d;
3971
3971
  text = "Unknown Entity";
3972
- if (!((_h = this.rego) === null || _h === void 0 ? void 0 : _h.relation)) return [3 /*break*/, 7];
3972
+ if (!this.rego) return [3 /*break*/, 8];
3973
+ if (!this.rego.relation) return [3 /*break*/, 7];
3973
3974
  type = this.rego.relation.RelationType;
3974
- if (!(!type && this.rego.relation["Related.Entity.ID"])) return [3 /*break*/, 6];
3975
- _l.label = 3;
3975
+ if (!(!type && this.rego.relation["Relation.Type.ID"])) return [3 /*break*/, 6];
3976
+ _h.label = 3;
3976
3977
  case 3:
3977
- _l.trys.push([3, 5, , 6]);
3978
+ _h.trys.push([3, 5, , 6]);
3978
3979
  return [4 /*yield*/, EntityRelationType.Get({
3979
3980
  api: this.api,
3980
- relationTypeId: this.rego.relation["Related.Entity.ID"]
3981
+ relationTypeId: this.rego.relation["Relation.Type.ID"]
3981
3982
  })];
3982
3983
  case 4:
3983
- type = (_j = (_l.sent())) === null || _j === void 0 ? void 0 : _j.relationType;
3984
+ type = (_h.sent()).relationType;
3984
3985
  return [3 /*break*/, 6];
3985
3986
  case 5:
3986
- e_1 = _l.sent();
3987
+ e_1 = _h.sent();
3987
3988
  console.error(e_1);
3988
3989
  return [3 /*break*/, 6];
3989
3990
  case 6:
3990
3991
  if (type) {
3991
3992
  text = type.Name ? type.Name : (type.ForwardName + "/" + type.ReverseName);
3992
3993
  }
3994
+ else {
3995
+ text = "Unknown Relationship";
3996
+ }
3993
3997
  return [3 /*break*/, 8];
3994
3998
  case 7:
3995
- if ((_k = this.rego) === null || _k === void 0 ? void 0 : _k.name) {
3999
+ if (this.rego.name) {
3996
4000
  text = this.rego.name;
3997
4001
  }
3998
4002
  else {
3999
4003
  text = "Unnamed Entity";
4000
4004
  }
4001
- _l.label = 8;
4005
+ _h.label = 8;
4002
4006
  case 8:
4003
- ele = document.createElement("div");
4004
- ele.innerHTML = text;
4005
- ele.setAttribute("style", "\n position: absolute;\n z-index: 0;\n display: none;\n pointer-events: none;\n padding: 6px 8px;\n border-radius: 6px;\n font-family: Arial;\n font-size: 12px;\n -webkit-backdrop-filter: blur(20px);\n backdrop-filter: blur(20px);\n background: rgba(33,39,42,.8);\n border-radius: 9px;\n box-shadow: 0 0 1px rgba(18,22,25,.36),0 18px 36px -4px rgba(18,22,25,.36);\n color: #ffffff;\n }");
4006
- this.label = ele;
4007
- this.viewer.container.appendChild(ele);
4007
+ if (this.disposed || this.counter != counter) {
4008
+ return [2 /*return*/];
4009
+ }
4010
+ ele = null;
4011
+ if (this.label) {
4012
+ ele = this.label;
4013
+ }
4014
+ else {
4015
+ ele = document.createElement("div");
4016
+ ele.innerHTML = text;
4017
+ ele.setAttribute("style", "\n position: absolute;\n z-index: 0;\n display: none;\n pointer-events: none;\n padding: 6px 8px;\n border-radius: 6px;\n font-family: Arial;\n font-size: 12px;\n -webkit-backdrop-filter: blur(20px);\n backdrop-filter: blur(20px);\n background: rgba(33,39,42,.8);\n border-radius: 9px;\n box-shadow: 0 0 1px rgba(18,22,25,.36),0 18px 36px -4px rgba(18,22,25,.36);\n color: #ffffff;\n }");
4018
+ this.label = ele;
4019
+ this.viewer.container.appendChild(ele);
4020
+ }
4008
4021
  _lastDistance = null;
4009
4022
  _lastCameraPos = null;
4010
4023
  getDistance = function () {
@@ -4107,12 +4120,12 @@ var EntityLabel;
4107
4120
  updateLabel();
4108
4121
  terrTimeout = null;
4109
4122
  this.terrChangedRemoval = this.viewer.scene.terrainProviderChanged.addEventListener(function () {
4110
- if (_this.disposed) {
4123
+ clearTimeout(terrTimeout);
4124
+ if (_this.disposed || _this.counter != counter) {
4111
4125
  return;
4112
4126
  }
4113
- clearTimeout(terrTimeout);
4114
4127
  terrTimeout = setTimeout(function () {
4115
- if (counter != _this.counter) {
4128
+ if (_this.disposed || counter != _this.counter) {
4116
4129
  return;
4117
4130
  }
4118
4131
  _this.createLabel(starterPos3d);
@@ -4346,6 +4359,11 @@ function updateEntity(viewer, entityId, register) {
4346
4359
  });
4347
4360
  }
4348
4361
  }
4362
+ else {
4363
+ EntityLabel.Detatch({
4364
+ rego: rego
4365
+ });
4366
+ }
4349
4367
  }
4350
4368
  }
4351
4369
  function markEntity(register, rego, visual, ignoreParent) {
@@ -4945,6 +4963,9 @@ var VisualsRegister;
4945
4963
  if (shouldRetain) {
4946
4964
  continue;
4947
4965
  }
4966
+ EntityLabel.Detatch({
4967
+ rego: rego
4968
+ });
4948
4969
  removeEntity(this.viewer, rego.visual);
4949
4970
  var doesInclude = this.rego[entityId_4].find(function (r) { return r.menuItemId === menuItemId; });
4950
4971
  if (doesInclude) {
@@ -4973,6 +4994,9 @@ var VisualsRegister;
4973
4994
  if (!rego) {
4974
4995
  return { value: void 0 };
4975
4996
  }
4997
+ EntityLabel.Detatch({
4998
+ rego: rego
4999
+ });
4976
5000
  removeEntity(this_2.viewer, rego.visual);
4977
5001
  (_b = this_2.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({
4978
5002
  type: EVisualUpdateType.Remove,
@@ -5000,6 +5024,9 @@ var VisualsRegister;
5000
5024
  if (!rego) {
5001
5025
  continue;
5002
5026
  }
5027
+ EntityLabel.Detatch({
5028
+ rego: rego
5029
+ });
5003
5030
  removeEntity(this.viewer, rego.visual);
5004
5031
  this.rego[entityId_5] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
5005
5032
  (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({
@@ -5020,7 +5047,7 @@ var VisualsRegister;
5020
5047
  /**
5021
5048
  * Returns an array of drilled visuals associated with this register.
5022
5049
  * The top array item is the first found.
5023
- * @param cursor
5050
+ * @param params
5024
5051
  * @returns
5025
5052
  */
5026
5053
  Register.prototype.GetRegosFromCursor = function (params) {
@@ -10405,8 +10432,7 @@ var MenuItemManager;
10405
10432
  /**
10406
10433
  * Disables a menu item by its id.
10407
10434
  * This will disable all children as well.
10408
- * @param id
10409
- * @param recursive
10435
+ * @param params
10410
10436
  */
10411
10437
  Manager.prototype.RemoveItemById = function (params) {
10412
10438
  var _a, _b;
@@ -12891,7 +12917,7 @@ function renderLegacyNavigator(iteration, params, bookmark, view) {
12891
12917
  function renderNavigator(iteration, params, bookmark, view) {
12892
12918
  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, _4, _5, _6;
12893
12919
  return __awaiter(this, void 0, void 0, function () {
12894
- var viewer, scene, vSettings, bSettings, defaults, camera, newLens, shouldBe2d, curIs2d, transition, pos, terrain, hillShades, baseColor, globeHidden, terrainWireframe, globeAlpha, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, labelledIds, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
12920
+ var viewer, scene, vSettings, bSettings, defaults, camera, newLens, shouldBe2d, curIs2d, transition, pos, terrain, hillShades, baseColor, globeHidden, terrainWireframe, globeAlpha, shadows, size, ambientOcclusion, AO, lighting, light, quality, fxaa, dateTime, clock, selectedIds, hiddenIds, isolatedIds, labelledIds, curLabelledIds, toUnLabel, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
12895
12921
  return __generator(this, function (_7) {
12896
12922
  switch (_7.label) {
12897
12923
  case 0:
@@ -13119,15 +13145,24 @@ function renderNavigator(iteration, params, bookmark, view) {
13119
13145
  entityIds: isolatedIds
13120
13146
  });
13121
13147
  }
13122
- params.manager.VisualsRegister.ClearLabelled();
13123
13148
  labelledIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.labelledEntityIds;
13124
13149
  if (labelledIds == null) {
13125
13150
  labelledIds = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.labelledEntityIds;
13126
13151
  }
13127
- if (labelledIds != null) {
13152
+ if (!(labelledIds === null || labelledIds === void 0 ? void 0 : labelledIds.length)) {
13153
+ params.manager.VisualsRegister.ClearLabelled();
13154
+ }
13155
+ else {
13156
+ curLabelledIds = params.manager.VisualsRegister.GetLabelled();
13128
13157
  params.manager.VisualsRegister.SetLabelled({
13129
13158
  labelled: true,
13130
- entityIds: labelledIds
13159
+ entityIds: labelledIds,
13160
+ requestRender: false
13161
+ });
13162
+ toUnLabel = curLabelledIds.filter(function (id) { return labelledIds.indexOf(id) === -1; });
13163
+ params.manager.VisualsRegister.SetLabelled({
13164
+ labelled: false,
13165
+ entityIds: toUnLabel
13131
13166
  });
13132
13167
  }
13133
13168
  params.manager.VisualsRegister.ClearOpacity();
@@ -16126,7 +16161,7 @@ var ViewerUtils;
16126
16161
  ViewerUtils.CreateWidgets = CreateWidgets;
16127
16162
  })(ViewerUtils || (ViewerUtils = {}));
16128
16163
 
16129
- var VERSION$1 = "2.8.6";
16164
+ var VERSION$1 = "2.8.8";
16130
16165
 
16131
16166
  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 };
16132
16167
  //# sourceMappingURL=bruce-cesium.es5.js.map