bruce-cesium 2.7.5 → 2.7.7

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.
@@ -2644,6 +2644,10 @@
2644
2644
  if (width < 0.01) {
2645
2645
  width = 0;
2646
2646
  }
2647
+ var units = style.lineWidthUnits;
2648
+ if (units != "px" && units != "m") {
2649
+ units = "m";
2650
+ }
2647
2651
  // If both outline and fill is not available then don't render anything.
2648
2652
  if ((width <= 0 || cLineColor.alpha <= 0) &&
2649
2653
  cFillColor.alpha <= 0) {
@@ -2683,7 +2687,7 @@
2683
2687
  classificationType: classification,
2684
2688
  perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
2685
2689
  zIndex: zIndex,
2686
- distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, size, true)
2690
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
2687
2691
  },
2688
2692
  position: exports.EntityUtils.GetPos({
2689
2693
  viewer: params.viewer,
@@ -2719,17 +2723,17 @@
2719
2723
  borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
2720
2724
  }
2721
2725
  var cEntityBorder = new Cesium.Entity({
2722
- // polyline: new Cesium.PolylineGraphics({
2723
- // positions: borderPosses,
2724
- // material: <Cesium.MaterialProperty><any>cLineColor,
2725
- // width: width,
2726
- // clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2727
- // classificationType: Cesium.ClassificationType.TERRAIN,
2728
- // arcType: Cesium.ArcType.GEODESIC,
2729
- // zIndex: zIndex,
2730
- // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2731
- // }),
2732
- corridor: {
2726
+ polyline: units == "px" ? new Cesium.PolylineGraphics({
2727
+ positions: borderPosses,
2728
+ material: cLineColor,
2729
+ width: width,
2730
+ clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2731
+ classificationType: Cesium.ClassificationType.TERRAIN,
2732
+ arcType: Cesium.ArcType.GEODESIC,
2733
+ zIndex: zIndex,
2734
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2735
+ }) : null,
2736
+ corridor: units == "m" ? {
2733
2737
  positions: borderPosses,
2734
2738
  material: cLineColor,
2735
2739
  heightReference: heightRef,
@@ -2741,7 +2745,7 @@
2741
2745
  classificationType: classification,
2742
2746
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2743
2747
  shadows: Cesium.ShadowMode.ENABLED
2744
- },
2748
+ } : null,
2745
2749
  show: true
2746
2750
  });
2747
2751
  cEntityBorder._parentEntity = cEntity;
@@ -2750,17 +2754,17 @@
2750
2754
  var posses_1 = holePosses[i];
2751
2755
  bruceModels.Cartes.CloseRing3(posses_1);
2752
2756
  var cEntityHole = new Cesium.Entity({
2753
- // polyline: new Cesium.PolylineGraphics({
2754
- // positions: posses,
2755
- // material: <Cesium.MaterialProperty><any>cLineColor,
2756
- // width: width,
2757
- // clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2758
- // classificationType: Cesium.ClassificationType.TERRAIN,
2759
- // arcType: Cesium.ArcType.GEODESIC,
2760
- // zIndex: zIndex,
2761
- // distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2762
- // }),
2763
- corridor: {
2757
+ polyline: units == "px" ? new Cesium.PolylineGraphics({
2758
+ positions: posses_1,
2759
+ material: cLineColor,
2760
+ width: width,
2761
+ clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
2762
+ classificationType: Cesium.ClassificationType.TERRAIN,
2763
+ arcType: Cesium.ArcType.GEODESIC,
2764
+ zIndex: zIndex,
2765
+ distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
2766
+ }) : null,
2767
+ corridor: units == "m" ? {
2764
2768
  positions: borderPosses,
2765
2769
  material: cLineColor,
2766
2770
  heightReference: heightRef,
@@ -2772,7 +2776,7 @@
2772
2776
  classificationType: classification,
2773
2777
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
2774
2778
  shadows: Cesium.ShadowMode.ENABLED,
2775
- },
2779
+ } : null,
2776
2780
  show: true
2777
2781
  });
2778
2782
  cEntity._siblingGraphics.push(cEntityHole);
@@ -8219,6 +8223,7 @@
8219
8223
  (function (TilesetEntitiesRenderManager) {
8220
8224
  var Manager = /** @class */ (function () {
8221
8225
  function Manager(params) {
8226
+ this.initCounter = 0;
8222
8227
  this.disposed = false;
8223
8228
  this.cTileset = null;
8224
8229
  var viewer = params.viewer, visualsManager = params.register, apiGetter = params.getters, item = params.item;
@@ -8241,23 +8246,32 @@
8241
8246
  enumerable: false,
8242
8247
  configurable: true
8243
8248
  });
8244
- Manager.prototype.Init = function () {
8249
+ Manager.prototype.Init = function (params) {
8245
8250
  var _a;
8246
8251
  return __awaiter(this, void 0, void 0, function () {
8247
- var tilesetId;
8252
+ var counter, tilesetId;
8248
8253
  var _this = this;
8249
8254
  return __generator(this, function (_b) {
8255
+ this.initCounter += 1;
8256
+ counter = this.initCounter;
8257
+ if (this.disposed) {
8258
+ return [2 /*return*/];
8259
+ }
8260
+ if (params === null || params === void 0 ? void 0 : params.item) {
8261
+ this.item = params.item;
8262
+ }
8250
8263
  tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
8251
8264
  if (!tilesetId) {
8252
8265
  return [2 /*return*/];
8253
8266
  }
8254
8267
  (function () { return __awaiter(_this, void 0, void 0, function () {
8255
- var canAccess, e_1, accountId, api, tileset, cTileset, _a;
8268
+ var canAccess, e_1, accountId, api, tileset, cTileset, _a, attenuation, attenuationMax;
8256
8269
  var _this = this;
8257
8270
  var _b, _c, _d;
8258
8271
  return __generator(this, function (_e) {
8259
8272
  switch (_e.label) {
8260
8273
  case 0:
8274
+ if (!!this.cTileset) return [3 /*break*/, 9];
8261
8275
  if (!tilesetId) return [3 /*break*/, 5];
8262
8276
  canAccess = false;
8263
8277
  _e.label = 1;
@@ -8286,6 +8300,9 @@
8286
8300
  console.warn("No tileset id found. Skipping access check.");
8287
8301
  _e.label = 6;
8288
8302
  case 6:
8303
+ if (this.disposed || counter !== this.initCounter) {
8304
+ return [2 /*return*/];
8305
+ }
8289
8306
  accountId = (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.ClientAccountID;
8290
8307
  if (!accountId) {
8291
8308
  accountId = this.getters.GetAccountId();
@@ -8299,7 +8316,7 @@
8299
8316
  })];
8300
8317
  case 7:
8301
8318
  tileset = (_e.sent()).tileset;
8302
- if (!tileset || this.disposed) {
8319
+ if (!tileset || this.disposed || counter !== this.initCounter) {
8303
8320
  return [2 /*return*/];
8304
8321
  }
8305
8322
  this.typeId = tileset.settings.entityTypeId;
@@ -8333,6 +8350,25 @@
8333
8350
  cTileset.tileLoad.addEventListener(function (tile) {
8334
8351
  _this.mapCTile(tile);
8335
8352
  });
8353
+ _e.label = 9;
8354
+ case 9:
8355
+ attenuation = this.item.attenuation;
8356
+ if (!attenuation && attenuation != false) {
8357
+ attenuation = true;
8358
+ }
8359
+ attenuationMax = this.item.attenuationMax;
8360
+ if (isNaN(attenuationMax)) {
8361
+ attenuationMax = 20;
8362
+ }
8363
+ this.cTileset.readyPromise.then(function () {
8364
+ exports.TilesetRenderEngine.ApplySettings({
8365
+ cTileset: _this.cTileset,
8366
+ settings: {
8367
+ attenuation: attenuation,
8368
+ maximumAttenuation: attenuationMax
8369
+ }
8370
+ });
8371
+ });
8336
8372
  return [2 /*return*/];
8337
8373
  }
8338
8374
  });
@@ -9350,6 +9386,14 @@
9350
9386
  rItem.item = params.item;
9351
9387
  }
9352
9388
  }
9389
+ // This means we're updating a entities tileset menu item.
9390
+ // These have different point scaling settings based on bookmark settings.
9391
+ else if (rItem.type == bruceModels.MenuItem.EType.EntityTileset && params.item.Type == bruceModels.MenuItem.EType.EntityTileset) {
9392
+ rItem.renderManager.Init({
9393
+ item: params.item,
9394
+ });
9395
+ rItem.item = params.item;
9396
+ }
9353
9397
  }
9354
9398
  else {
9355
9399
  rItem = {
@@ -10017,7 +10061,7 @@
10017
10061
  renderedItemIds = [];
10018
10062
  if (!((menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) && (enabledIds === null || enabledIds === void 0 ? void 0 : enabledIds.length))) return [3 /*break*/, 10];
10019
10063
  traverseItems_1 = function (item) { return __awaiter(_this, void 0, void 0, function () {
10020
- var eItem, eItemAlt, itemId, i;
10064
+ var eItem, eItemAlt, tItem, tItemAlt, itemId, i;
10021
10065
  var _a;
10022
10066
  return __generator(this, function (_b) {
10023
10067
  switch (_b.label) {
@@ -10032,6 +10076,12 @@
10032
10076
  eItem.BruceEntity = __assign(__assign({}, eItem.BruceEntity), { SelectedExpandLayers: (_a = eItemAlt.BruceEntity) === null || _a === void 0 ? void 0 : _a.SelectedExpandLayers });
10033
10077
  }
10034
10078
  }
10079
+ else if (item.Type == bruceModels.MenuItem.EType.EntityTileset) {
10080
+ tItem = item;
10081
+ tItemAlt = alternations[item.id];
10082
+ tItem.attenuation = tItemAlt.attenuation;
10083
+ tItem.attenuationMax = tItemAlt.attenuationMax;
10084
+ }
10035
10085
  }
10036
10086
  if (!enabledIds.includes(item.id)) return [3 /*break*/, 2];
10037
10087
  return [4 /*yield*/, manager.RenderItem({
@@ -15189,7 +15239,7 @@
15189
15239
  ViewerUtils.CreateWidgets = CreateWidgets;
15190
15240
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15191
15241
 
15192
- var VERSION$1 = "2.7.5";
15242
+ var VERSION$1 = "2.7.7";
15193
15243
 
15194
15244
  exports.VERSION = VERSION$1;
15195
15245
  exports.CesiumViewMonitor = CesiumViewMonitor;