bruce-cesium 2.8.2 → 2.8.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.
@@ -1842,6 +1842,7 @@
1842
1842
  return zoomItem.MinZoom + "-" + zoomItem.MaxZoom + "-" + shouldApplyFlatFix(terrain);
1843
1843
  }
1844
1844
  var _fileValidationCache = {};
1845
+ var _fileHeightCache = {};
1845
1846
  /**
1846
1847
  * @param min
1847
1848
  * @param max
@@ -2195,7 +2196,7 @@
2195
2196
  (function (Point) {
2196
2197
  function Render(params) {
2197
2198
  return __awaiter(this, void 0, void 0, function () {
2198
- var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, res, e_4, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef;
2199
+ var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl_1, res, blob_1, e_4, e_5, iconScale, disableDepthTest, heightRef, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, outlineExtrusion, bColor, cColor, size, heightRef;
2199
2200
  return __generator(this, function (_a) {
2200
2201
  switch (_a.label) {
2201
2202
  case 0:
@@ -2210,7 +2211,7 @@
2210
2211
  }
2211
2212
  cEntity = null;
2212
2213
  siblings = [];
2213
- if (!(type == bruceModels.Style.EPointType.Icon)) return [3 /*break*/, 7];
2214
+ if (!(type == bruceModels.Style.EPointType.Icon)) return [3 /*break*/, 12];
2214
2215
  iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
2215
2216
  iconUrlRows.forEach(function (row) {
2216
2217
  if (row.type == bruceModels.Calculator.EValueType.Color) {
@@ -2218,41 +2219,66 @@
2218
2219
  }
2219
2220
  });
2220
2221
  icon = bruceModels.Calculator.GetString(iconUrlRows, entity, params.tags);
2221
- iconUrl = null;
2222
+ iconUrl_1 = null;
2222
2223
  if (typeof icon == "string") {
2223
- iconUrl = icon;
2224
+ iconUrl_1 = icon;
2224
2225
  }
2225
- if (!iconUrl && style.iconId) {
2226
- iconUrl = bruceModels.ClientFile.GetUrl({
2226
+ if (!iconUrl_1 && style.iconId) {
2227
+ iconUrl_1 = bruceModels.ClientFile.GetUrl({
2227
2228
  api: params.api,
2228
2229
  fileId: style.iconId
2229
2230
  });
2230
2231
  }
2231
- if (!iconUrl) return [3 /*break*/, 6];
2232
+ if (!iconUrl_1) return [3 /*break*/, 11];
2232
2233
  _a.label = 1;
2233
2234
  case 1:
2234
- _a.trys.push([1, 5, , 6]);
2235
- if (!(_fileValidationCache[iconUrl] == null)) return [3 /*break*/, 3];
2236
- return [4 /*yield*/, fetch(iconUrl)];
2235
+ _a.trys.push([1, 10, , 11]);
2236
+ if (!(_fileValidationCache[iconUrl_1] == null)) return [3 /*break*/, 8];
2237
+ return [4 /*yield*/, fetch(iconUrl_1)];
2237
2238
  case 2:
2238
2239
  res = _a.sent();
2239
- if (res.status != 200) {
2240
- iconUrl = null;
2241
- }
2242
- _fileValidationCache[iconUrl] = Boolean(iconUrl);
2243
- return [3 /*break*/, 4];
2240
+ if (!(res.status != 200)) return [3 /*break*/, 3];
2241
+ iconUrl_1 = null;
2242
+ return [3 /*break*/, 7];
2244
2243
  case 3:
2245
- if (!_fileValidationCache[iconUrl]) {
2246
- iconUrl = null;
2247
- }
2248
- _a.label = 4;
2249
- case 4: return [3 /*break*/, 6];
2244
+ _a.trys.push([3, 6, , 7]);
2245
+ return [4 /*yield*/, res.blob()];
2246
+ case 4:
2247
+ blob_1 = _a.sent();
2248
+ return [4 /*yield*/, new Promise(function (res) {
2249
+ var img = new Image();
2250
+ img.onload = function () {
2251
+ _fileHeightCache[iconUrl_1] = img.height;
2252
+ res(null);
2253
+ };
2254
+ img.onerror = function () {
2255
+ _fileHeightCache[iconUrl_1] = undefined;
2256
+ res(null);
2257
+ };
2258
+ img.src = URL.createObjectURL(blob_1);
2259
+ })];
2250
2260
  case 5:
2251
- e_4 = _a.sent();
2252
- iconUrl = null;
2253
- return [3 /*break*/, 6];
2261
+ _a.sent();
2262
+ return [3 /*break*/, 7];
2254
2263
  case 6:
2255
- if (iconUrl) {
2264
+ e_4 = _a.sent();
2265
+ console.error(e_4);
2266
+ return [3 /*break*/, 7];
2267
+ case 7:
2268
+ _fileValidationCache[iconUrl_1] = Boolean(iconUrl_1);
2269
+ return [3 /*break*/, 9];
2270
+ case 8:
2271
+ if (!_fileValidationCache[iconUrl_1]) {
2272
+ iconUrl_1 = null;
2273
+ }
2274
+ _a.label = 9;
2275
+ case 9: return [3 /*break*/, 11];
2276
+ case 10:
2277
+ e_5 = _a.sent();
2278
+ iconUrl_1 = null;
2279
+ return [3 /*break*/, 11];
2280
+ case 11:
2281
+ if (iconUrl_1) {
2256
2282
  iconScale = EnsureNumber(bruceModels.Calculator.GetNumber(style.iconScale, entity, params.tags));
2257
2283
  if (!iconScale && iconScale != 0) {
2258
2284
  iconScale = 1;
@@ -2264,11 +2290,12 @@
2264
2290
  billboard: {
2265
2291
  horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
2266
2292
  verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
2267
- image: iconUrl,
2293
+ image: iconUrl_1,
2268
2294
  heightReference: getHeightRef(style),
2269
2295
  scale: iconScale,
2270
2296
  disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
2271
2297
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
2298
+ height: _fileHeightCache[iconUrl_1]
2272
2299
  // Would be great once we have a setting for this.
2273
2300
  // translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
2274
2301
  },
@@ -2282,8 +2309,8 @@
2282
2309
  });
2283
2310
  }
2284
2311
  }
2285
- _a.label = 7;
2286
- case 7:
2312
+ _a.label = 12;
2313
+ case 12:
2287
2314
  if (type == bruceModels.Style.EPointType.Cylinder) {
2288
2315
  radius = EnsureNumber(bruceModels.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
2289
2316
  if (radius <= 0) {
@@ -3686,6 +3713,270 @@
3686
3713
  })(Parabola = RelationRenderEngine.Parabola || (RelationRenderEngine.Parabola = {}));
3687
3714
  })(RelationRenderEngine || (RelationRenderEngine = {}));
3688
3715
 
3716
+ // Key where the label instance is stored within the cesium entity.
3717
+ // Eg: cEntity[ATTACH_KEY] = new EntityLabel(...);
3718
+ var ATTACH_KEY = "nextspace-navigator-entity-label";
3719
+ /**
3720
+ * Returns cesium property's value.
3721
+ * This will check if it's one that changes over time, or just a fixed value.
3722
+ * Eg: const pos3d = getValue<Cesium.Cartesian3>(cViewer, cEntity.point.position);
3723
+ * @param viewer
3724
+ * @param obj
3725
+ */
3726
+ function getValue$1(viewer, obj) {
3727
+ if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
3728
+ return obj.getValue(viewer.scene.lastRenderTime);
3729
+ }
3730
+ return obj;
3731
+ }
3732
+ (function (EntityLabel) {
3733
+ var Label = /** @class */ (function () {
3734
+ function Label(params) {
3735
+ var _this = this;
3736
+ // The label element itself.
3737
+ this.label = null;
3738
+ // Callback to kill render listener.
3739
+ this.renderRemoval = null;
3740
+ // Indicates the label was disposed and any actions will be ignored.
3741
+ this.disposed = false;
3742
+ this.creating = false;
3743
+ this.rego = params.rego;
3744
+ this.viewer = params.viewer;
3745
+ this.creating = true;
3746
+ this.createCLabel().then(function () {
3747
+ _this.creating = false;
3748
+ }).catch(function (e) {
3749
+ console.error("Failed to create label", e);
3750
+ _this.creating = false;
3751
+ });
3752
+ }
3753
+ Object.defineProperty(Label.prototype, "Disposed", {
3754
+ get: function () {
3755
+ return this.disposed;
3756
+ },
3757
+ enumerable: false,
3758
+ configurable: true
3759
+ });
3760
+ Object.defineProperty(Label.prototype, "Creating", {
3761
+ get: function () {
3762
+ return this.creating;
3763
+ },
3764
+ enumerable: false,
3765
+ configurable: true
3766
+ });
3767
+ /**
3768
+ * Disposes label and marks instance as disposed.
3769
+ * Recalling will be ignored.
3770
+ */
3771
+ Label.prototype.Dispose = function () {
3772
+ if (this.disposed) {
3773
+ return;
3774
+ }
3775
+ this.disposed = true;
3776
+ if (this.label &&
3777
+ this.label.parentElement) {
3778
+ this.label.parentElement.removeChild(this.label);
3779
+ this.label = null;
3780
+ }
3781
+ if (this.renderRemoval) {
3782
+ this.renderRemoval();
3783
+ this.renderRemoval = null;
3784
+ }
3785
+ };
3786
+ /**
3787
+ * Creates cesium entity for the label if one does not exist.
3788
+ */
3789
+ Label.prototype.createCLabel = function () {
3790
+ var _a, _b, _c;
3791
+ return __awaiter(this, void 0, void 0, function () {
3792
+ var pos3d, heightRef, heightOffset, pixelOffset, visual, isClamped, height, scale, carto, text, ele, _lastDistance, _lastCameraPos, getDistance, MAX_DISTANCE, updateLabel;
3793
+ var _this = this;
3794
+ return __generator(this, function (_d) {
3795
+ if (this.label || this.disposed) {
3796
+ return [2 /*return*/];
3797
+ }
3798
+ pos3d = null;
3799
+ heightRef = null;
3800
+ heightOffset = 10;
3801
+ pixelOffset = new Cesium.Cartesian2(0, 0);
3802
+ visual = (_a = this.rego) === null || _a === void 0 ? void 0 : _a.visual;
3803
+ if (visual && visual instanceof Cesium.Entity) {
3804
+ if (visual.polygon) {
3805
+ heightRef = getValue$1(this.viewer, visual.polygon.heightReference);
3806
+ }
3807
+ else if (visual.polyline) {
3808
+ isClamped = getValue$1(this.viewer, visual.polyline.clampToGround);
3809
+ heightRef = isClamped == false ? Cesium.HeightReference.NONE : Cesium.HeightReference.CLAMP_TO_GROUND;
3810
+ }
3811
+ else if (visual.model) {
3812
+ heightRef = getValue$1(this.viewer, visual.model.heightReference);
3813
+ }
3814
+ else if (visual.point) {
3815
+ heightRef = getValue$1(this.viewer, visual.point.heightReference);
3816
+ }
3817
+ else if (visual.billboard) {
3818
+ heightRef = getValue$1(this.viewer, visual.billboard.heightReference);
3819
+ height = getValue$1(this.viewer, visual.billboard.height);
3820
+ if (height) {
3821
+ scale = EnsureNumber(getValue$1(this.viewer, visual.billboard.scale), 1);
3822
+ pixelOffset.y = -(height * scale);
3823
+ }
3824
+ // Flat padding.
3825
+ pixelOffset.y -= 5;
3826
+ heightOffset = 0;
3827
+ }
3828
+ else if (visual.corridor) {
3829
+ heightRef = getValue$1(this.viewer, visual.corridor.heightReference);
3830
+ }
3831
+ else if (visual.ellipse) {
3832
+ heightRef = getValue$1(this.viewer, visual.ellipse.heightReference);
3833
+ }
3834
+ pos3d = getValue$1(this.viewer, visual.position);
3835
+ }
3836
+ if (isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3837
+ return [2 /*return*/];
3838
+ }
3839
+ carto = Cesium.Cartographic.fromCartesian(pos3d);
3840
+ // TODO: Check if we need to use heightRef and adjust to absolute height.
3841
+ // TODO: We should be smarter and not just add 10m to the height. Eg: use polygon extrusion.
3842
+ carto.height += heightOffset;
3843
+ pos3d = Cesium.Cartographic.toCartesian(carto);
3844
+ text = (_c = (_b = this.rego) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : "Unnamed Entity";
3845
+ ele = document.createElement("div");
3846
+ ele.innerHTML = text;
3847
+ ele.setAttribute("style", "\n position: absolute;\n z-index: 1;\n display: none;\n pointer-events: none;\n padding: 6px;\n border-radius: 6px;\n font-family: sans-serif;\n font-size: 12px;\n background-color: #000000;\n color: #ffffff;\n }");
3848
+ this.label = ele;
3849
+ this.viewer.container.appendChild(ele);
3850
+ _lastDistance = null;
3851
+ _lastCameraPos = null;
3852
+ getDistance = function () {
3853
+ var _a;
3854
+ if (_this.disposed) {
3855
+ return null;
3856
+ }
3857
+ var cameraPos = (_a = _this.viewer.camera) === null || _a === void 0 ? void 0 : _a.position;
3858
+ if (isNaN(cameraPos === null || cameraPos === void 0 ? void 0 : cameraPos.x)) {
3859
+ return null;
3860
+ }
3861
+ // If camera hasn't moved much then we can use the last distance.
3862
+ var TOLERANCE = 0.1;
3863
+ if (_lastCameraPos) {
3864
+ var totalMovement = Math.abs(_lastCameraPos.x - cameraPos.x) +
3865
+ Math.abs(_lastCameraPos.y - cameraPos.y) +
3866
+ Math.abs(_lastCameraPos.z - cameraPos.z);
3867
+ if (totalMovement < TOLERANCE) {
3868
+ return _lastDistance;
3869
+ }
3870
+ }
3871
+ // Check if there is a raycast collision between camera and pos3d.
3872
+ // We'll let the labels draw through a ground collision.
3873
+ // Commented out while it is WIP.
3874
+ // const direction = Cesium.Cartesian3.subtract(pos3d, cameraPos, new Cesium.Cartesian3());
3875
+ // const ray = new Cesium.Ray(pos3d.clone(), direction);
3876
+ // const objects = (this.viewer.scene as any).drillPickFromRay(ray, 1, [visuals]);
3877
+ // if (objects && objects.length > 0) {
3878
+ // for (let i = 0; i < objects.length; ++i) {
3879
+ // const obj = objects[i];
3880
+ // if (!visuals.find(x => x == obj?.id)) {
3881
+ // let isGround = true;
3882
+ // if (obj.object) {
3883
+ // const url = obj.object?.primitive?._basePath;
3884
+ // if (url && typeof url == "string") {
3885
+ // isGround = url.includes("tile.googleapis.com");
3886
+ // }
3887
+ // else {
3888
+ // isGround = false;
3889
+ // }
3890
+ // }
3891
+ // if (!isGround) {
3892
+ // return null;
3893
+ // }
3894
+ // }
3895
+ // }
3896
+ // }
3897
+ var distance = Cesium.Cartesian3.distance(cameraPos, pos3d);
3898
+ _lastDistance = distance;
3899
+ _lastCameraPos = cameraPos.clone();
3900
+ return distance;
3901
+ };
3902
+ MAX_DISTANCE = 5000;
3903
+ updateLabel = function () {
3904
+ if (_this.disposed || isNaN(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3905
+ return;
3906
+ }
3907
+ var distance = getDistance();
3908
+ if (isNaN(distance) || distance >= MAX_DISTANCE) {
3909
+ ele.style.display = "none";
3910
+ return;
3911
+ }
3912
+ var pos2d = Cesium.SceneTransforms.wgs84ToWindowCoordinates(_this.viewer.scene, pos3d);
3913
+ if (isNaN(pos2d === null || pos2d === void 0 ? void 0 : pos2d.x)) {
3914
+ ele.style.display = "none";
3915
+ return;
3916
+ }
3917
+ // If out of the screen then we can hide it.
3918
+ if (pos2d.x < 0 || pos2d.x > _this.viewer.canvas.clientWidth ||
3919
+ pos2d.y < 0 || pos2d.y > _this.viewer.canvas.clientHeight) {
3920
+ ele.style.display = "none";
3921
+ return;
3922
+ }
3923
+ ele.style.display = "block";
3924
+ // Check scale to apply based on distance between camera and pos3d.
3925
+ // We'll make the label smaller and less transparent when further away.
3926
+ var scale = 1 - (distance / MAX_DISTANCE);
3927
+ if (scale && scale > 0.15) {
3928
+ ele.style.transform = "scale(".concat(scale, ")");
3929
+ ele.style.opacity = "".concat(scale);
3930
+ var left = pos2d.x - (ele.clientWidth / 2) + pixelOffset.x;
3931
+ ele.style.left = "".concat(left, "px");
3932
+ var top_1 = pos2d.y - ele.clientHeight + (pixelOffset.y * scale);
3933
+ ele.style.top = "".concat(top_1, "px");
3934
+ }
3935
+ else {
3936
+ ele.style.transform = "";
3937
+ ele.style.opacity = "0";
3938
+ }
3939
+ };
3940
+ this.renderRemoval = this.viewer.scene.postUpdate.addEventListener(updateLabel);
3941
+ updateLabel();
3942
+ return [2 /*return*/];
3943
+ });
3944
+ });
3945
+ };
3946
+ return Label;
3947
+ }());
3948
+ EntityLabel.Label = Label;
3949
+ /**
3950
+ * Creates an entity label for a given rego.
3951
+ * If one exists then the action is ignored.
3952
+ */
3953
+ function Attach(params) {
3954
+ var rego = params.rego, viewer = params.viewer;
3955
+ if (!rego || !viewer || rego[ATTACH_KEY]) {
3956
+ return;
3957
+ }
3958
+ rego[ATTACH_KEY] = new Label({
3959
+ rego: rego,
3960
+ viewer: viewer
3961
+ });
3962
+ }
3963
+ EntityLabel.Attach = Attach;
3964
+ /**
3965
+ * Removes an entity label from a given rego.
3966
+ * If one doesn't exist then the action is ignored.
3967
+ */
3968
+ function Detatch(params) {
3969
+ var _a, _b;
3970
+ var rego = params.rego;
3971
+ if (!rego || !rego[ATTACH_KEY]) {
3972
+ return;
3973
+ }
3974
+ (_b = (_a = rego[ATTACH_KEY]).Dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3975
+ rego[ATTACH_KEY] = null;
3976
+ }
3977
+ EntityLabel.Detatch = Detatch;
3978
+ })(exports.EntityLabel || (exports.EntityLabel = {}));
3979
+
3689
3980
  /**
3690
3981
  * Returns if a given visual is alive and in the scene.
3691
3982
  * @param viewer
@@ -3814,7 +4105,24 @@
3814
4105
  for (var i = 0; i < regos.length; i++) {
3815
4106
  var rego = regos[i];
3816
4107
  rego.best = rego === highestPriority;
3817
- updateEntityShow(viewer, rego.visual, rego.suppressShow ? false : getShowState(rego));
4108
+ var visible = rego.suppressShow ? false : getShowState(rego);
4109
+ updateEntityShow(viewer, rego.visual, visible);
4110
+ if (rego.best) {
4111
+ var isLabelled = register.GetIsLabelled({
4112
+ entityId: entityId
4113
+ });
4114
+ if (isLabelled && visible) {
4115
+ exports.EntityLabel.Attach({
4116
+ rego: rego,
4117
+ viewer: viewer
4118
+ });
4119
+ }
4120
+ else {
4121
+ exports.EntityLabel.Detatch({
4122
+ rego: rego
4123
+ });
4124
+ }
4125
+ }
3818
4126
  }
3819
4127
  }
3820
4128
  function markEntity(register, rego, visual, ignoreParent) {
@@ -3991,6 +4299,10 @@
3991
4299
  this.hiddenIds = [];
3992
4300
  // Entity id -> opacity for visual.
3993
4301
  this.opacity = {};
4302
+ // Array of entity ids for entities who have labels drawn for them.
4303
+ // It will be drawn on the "best" visual, and only while the entity is visible.
4304
+ // Warning: this sucks for CAD entities.
4305
+ this.labelledEntityIds = [];
3994
4306
  this.viewer = viewer;
3995
4307
  }
3996
4308
  Object.defineProperty(Register.prototype, "Id", {
@@ -4029,6 +4341,71 @@
4029
4341
  }
4030
4342
  this.viewer.scene.requestRender();
4031
4343
  };
4344
+ /**
4345
+ * Marks given entityIds as either labelled or not labelled.
4346
+ * When an entity is labelled a label will be drawn on the "best" visual for it.
4347
+ * @param params
4348
+ */
4349
+ Register.prototype.SetLabelled = function (params) {
4350
+ var labelled = params.labelled, entityIds = params.entityIds, requestRender = params.requestRender;
4351
+ var _loop_3 = function (i) {
4352
+ var id = entityIds[i];
4353
+ var index = this_1.labelledEntityIds.findIndex(function (x) { return x == id; });
4354
+ if (labelled) {
4355
+ if (index <= -1) {
4356
+ this_1.labelledEntityIds.push(id);
4357
+ updateEntity(this_1.viewer, id, this_1);
4358
+ }
4359
+ }
4360
+ else {
4361
+ if (index > -1) {
4362
+ this_1.labelledEntityIds.splice(index, 1);
4363
+ updateEntity(this_1.viewer, id, this_1);
4364
+ }
4365
+ }
4366
+ };
4367
+ var this_1 = this;
4368
+ for (var i = 0; i < entityIds.length; i++) {
4369
+ _loop_3(i);
4370
+ }
4371
+ if (requestRender != false) {
4372
+ this.viewer.scene.requestRender();
4373
+ }
4374
+ };
4375
+ /**
4376
+ * Returns if given entity id is labelled.
4377
+ * @param params
4378
+ */
4379
+ Register.prototype.GetIsLabelled = function (params) {
4380
+ var id = params.entityId;
4381
+ return this.labelledEntityIds.indexOf(id) !== -1;
4382
+ };
4383
+ /**
4384
+ * Clears all labelled entities.
4385
+ * @param params
4386
+ */
4387
+ Register.prototype.ClearLabelled = function (params) {
4388
+ var ids = [].concat(this.labelledEntityIds);
4389
+ this.labelledEntityIds = [];
4390
+ for (var i = 0; i < ids.length; i++) {
4391
+ var id = ids[i];
4392
+ updateEntity(this.viewer, id, this);
4393
+ }
4394
+ if ((params === null || params === void 0 ? void 0 : params.requestRender) != false) {
4395
+ this.viewer.scene.requestRender();
4396
+ }
4397
+ };
4398
+ /**
4399
+ * Returns all labelled entity ids.
4400
+ */
4401
+ Register.prototype.GetLabelled = function () {
4402
+ return this.labelledEntityIds;
4403
+ };
4404
+ /**
4405
+ * Updates the selection color.
4406
+ * This will not update the selection color for already selected entities.
4407
+ * @param color
4408
+ */
4032
4409
  Register.prototype.SetSelectionColor = function (color) {
4033
4410
  this.selectionColor = color;
4034
4411
  };
@@ -4354,26 +4731,26 @@
4354
4731
  return;
4355
4732
  }
4356
4733
  var menuItems = menuItemId ? [menuItemId] : entityRegos.map(function (x) { return x.menuItemId; });
4357
- var _loop_3 = function (i) {
4734
+ var _loop_4 = function (i) {
4358
4735
  var menuItemId_2 = menuItems[i];
4359
4736
  var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId_2; });
4360
4737
  if (!rego) {
4361
4738
  return { value: void 0 };
4362
4739
  }
4363
- removeEntity(this_1.viewer, rego.visual);
4364
- (_b = this_1.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({
4740
+ removeEntity(this_2.viewer, rego.visual);
4741
+ (_b = this_2.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({
4365
4742
  type: EVisualUpdateType.Remove,
4366
4743
  entityId: rego.entityId,
4367
4744
  rego: rego
4368
4745
  });
4369
- this_1.rego[entityId] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId_2; });
4746
+ this_2.rego[entityId] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId_2; });
4370
4747
  if (doUpdate && menuItemId_2) {
4371
- updateEntity(this_1.viewer, entityId, this_1);
4748
+ updateEntity(this_2.viewer, entityId, this_2);
4372
4749
  }
4373
4750
  };
4374
- var this_1 = this;
4751
+ var this_2 = this;
4375
4752
  for (var i = 0; i < menuItems.length; i++) {
4376
- var state_1 = _loop_3(i);
4753
+ var state_1 = _loop_4(i);
4377
4754
  if (typeof state_1 === "object")
4378
4755
  return state_1.value;
4379
4756
  }
@@ -12214,11 +12591,11 @@
12214
12591
  * @param view
12215
12592
  */
12216
12593
  function renderNavigator(iteration, params, bookmark, view) {
12217
- 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;
12594
+ 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;
12218
12595
  return __awaiter(this, void 0, void 0, function () {
12219
- 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, entityOpacityMap, entityId, opacity, imagery, renderedRelationEntityIds, curEnabled, newItemIds, _i, curEnabled_1, id, menuItem, gOcclusion;
12220
- return __generator(this, function (_6) {
12221
- switch (_6.label) {
12596
+ 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;
12597
+ return __generator(this, function (_7) {
12598
+ switch (_7.label) {
12222
12599
  case 0:
12223
12600
  viewer = params.manager.Viewer;
12224
12601
  scene = viewer.scene;
@@ -12280,11 +12657,11 @@
12280
12657
  viewer: params.manager.Viewer,
12281
12658
  })];
12282
12659
  case 1:
12283
- _6.sent();
12660
+ _7.sent();
12284
12661
  if (!assertIteration$1(params.viewer, iteration)) {
12285
12662
  return [2 /*return*/];
12286
12663
  }
12287
- _6.label = 2;
12664
+ _7.label = 2;
12288
12665
  case 2:
12289
12666
  hillShades = (_o = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Settings) === null || _o === void 0 ? void 0 : _o.hillShades;
12290
12667
  if (hillShades == null) {
@@ -12444,10 +12821,21 @@
12444
12821
  entityIds: isolatedIds
12445
12822
  });
12446
12823
  }
12824
+ params.manager.VisualsRegister.ClearLabelled();
12825
+ labelledIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.labelledEntityIds;
12826
+ if (labelledIds == null) {
12827
+ labelledIds = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.labelledEntityIds;
12828
+ }
12829
+ if (labelledIds != null) {
12830
+ params.manager.VisualsRegister.SetLabelled({
12831
+ labelled: true,
12832
+ entityIds: labelledIds
12833
+ });
12834
+ }
12447
12835
  params.manager.VisualsRegister.ClearOpacity();
12448
12836
  entityOpacityMap = bSettings === null || bSettings === void 0 ? void 0 : bSettings.entityOpacityMap;
12449
12837
  if (entityOpacityMap == null) {
12450
- entityOpacityMap = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.entityOpacityMap;
12838
+ entityOpacityMap = (_3 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _3 === void 0 ? void 0 : _3.entityOpacityMap;
12451
12839
  }
12452
12840
  if (entityOpacityMap != null) {
12453
12841
  for (entityId in entityOpacityMap) {
@@ -12460,7 +12848,7 @@
12460
12848
  }
12461
12849
  }
12462
12850
  }
12463
- imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_3 = defaults.settings) === null || _3 === void 0 ? void 0 : _3.imagery;
12851
+ imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_4 = defaults.settings) === null || _4 === void 0 ? void 0 : _4.imagery;
12464
12852
  if (imagery == null) {
12465
12853
  // TODO: Need global default.
12466
12854
  imagery = [
@@ -12487,7 +12875,7 @@
12487
12875
  renderedRelationEntityIds = [];
12488
12876
  }
12489
12877
  curEnabled = params.manager.GetEnabledItemIds();
12490
- newItemIds = (_4 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _4 !== void 0 ? _4 : [];
12878
+ newItemIds = (_5 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _5 !== void 0 ? _5 : [];
12491
12879
  for (_i = 0, curEnabled_1 = curEnabled; _i < curEnabled_1.length; _i++) {
12492
12880
  id = curEnabled_1[_i];
12493
12881
  if (newItemIds.indexOf(id) === -1 ||
@@ -12505,11 +12893,11 @@
12505
12893
  bookmark: bookmark
12506
12894
  })];
12507
12895
  case 3:
12508
- _6.sent();
12896
+ _7.sent();
12509
12897
  if (!assertIteration$1(params.viewer, iteration)) {
12510
12898
  return [2 /*return*/];
12511
12899
  }
12512
- _6.label = 4;
12900
+ _7.label = 4;
12513
12901
  case 4:
12514
12902
  if (!renderedRelationEntityIds.length) return [3 /*break*/, 6];
12515
12903
  menuItem = {
@@ -12525,15 +12913,15 @@
12525
12913
  item: menuItem
12526
12914
  })];
12527
12915
  case 5:
12528
- _6.sent();
12916
+ _7.sent();
12529
12917
  if (!assertIteration$1(params.viewer, iteration)) {
12530
12918
  return [2 /*return*/];
12531
12919
  }
12532
- _6.label = 6;
12920
+ _7.label = 6;
12533
12921
  case 6:
12534
12922
  gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
12535
12923
  if (gOcclusion == null) {
12536
- gOcclusion = (_5 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _5 === void 0 ? void 0 : _5.groundOcclusion;
12924
+ gOcclusion = (_6 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _6 === void 0 ? void 0 : _6.groundOcclusion;
12537
12925
  }
12538
12926
  if (gOcclusion == null) {
12539
12927
  // TODO: Need global default.
@@ -15435,7 +15823,7 @@
15435
15823
  ViewerUtils.CreateWidgets = CreateWidgets;
15436
15824
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15437
15825
 
15438
- var VERSION$1 = "2.8.2";
15826
+ var VERSION$1 = "2.8.3";
15439
15827
 
15440
15828
  exports.VERSION = VERSION$1;
15441
15829
  exports.CesiumViewMonitor = CesiumViewMonitor;