bruce-cesium 0.3.7 → 0.3.9

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.
@@ -4237,12 +4237,12 @@
4237
4237
  var layer = curEnabledArr.find(function (x) { var _a, _b; return ((_a = x._bMeta) === null || _a === void 0 ? void 0 : _a.accountId) === enabled.accountId && ((_b = x._bMeta) === null || _b === void 0 ? void 0 : _b.tilesetId) === enabled.tilesetId; });
4238
4238
  if (layer) {
4239
4239
  params.viewer.imageryLayers.raiseToTop(layer);
4240
- layer.alpha = Number(enabled.alpha);
4241
- layer.brightness = Number(enabled.brightness);
4242
- layer.contrast = Number(enabled.contrast);
4243
- layer.hue = Number(enabled.hue);
4244
- layer.saturation = Number(enabled.saturation);
4245
- layer.gamma = Number(enabled.gamma);
4240
+ layer.alpha = Number(enabled.alpha == null ? 1 : enabled.alpha);
4241
+ layer.brightness = Number(enabled.brightness == null ? 1 : enabled.brightness);
4242
+ layer.contrast = Number(enabled.contrast == null ? 1 : enabled.contrast);
4243
+ layer.hue = Number(enabled.hue == null ? 0 : enabled.hue);
4244
+ layer.saturation = Number(enabled.saturation == null ? 1 : enabled.saturation);
4245
+ layer.gamma = Number(enabled.gamma == null ? 1 : enabled.gamma);
4246
4246
  }
4247
4247
  };
4248
4248
  for (i = 0; i < params.enabled.length; i++) {
@@ -4484,11 +4484,11 @@
4484
4484
  });
4485
4485
  }
4486
4486
  function renderV2(params, bookmark, view) {
4487
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
4487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
4488
4488
  return __awaiter(this, void 0, void 0, function () {
4489
- var viewer, scene, vSettings, bSettings, defaults, camera, newLens, curLens, transition, pos, gOcclusion, terrain, source, imagery, iSources, curEnabled, newItemIds, _i, curEnabled_1, id;
4490
- return __generator(this, function (_p) {
4491
- switch (_p.label) {
4489
+ var viewer, scene, vSettings, bSettings, defaults, camera, newLens, curLens, transition, pos, gOcclusion, terrain, source, imagery, curEnabled, newItemIds, _i, curEnabled_1, id;
4490
+ return __generator(this, function (_u) {
4491
+ switch (_u.label) {
4492
4492
  case 0:
4493
4493
  viewer = params.manager.Viewer;
4494
4494
  scene = viewer.scene;
@@ -4496,9 +4496,12 @@
4496
4496
  bSettings = ((_a = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Settings) !== null && _a !== void 0 ? _a : {});
4497
4497
  defaults = (_b = vSettings.defaults) !== null && _b !== void 0 ? _b : {};
4498
4498
  camera = ((_c = bookmark.Camera) !== null && _c !== void 0 ? _c : {});
4499
+ if (!bruceModels.Carto.ValidateCarto(camera)) {
4500
+ camera = __assign(__assign({}, camera), { altitude: (_d = defaults.camera) === null || _d === void 0 ? void 0 : _d.altitude, latitude: (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.latitude, longitude: (_f = defaults.camera) === null || _f === void 0 ? void 0 : _f.longitude, heading: (_g = defaults.camera) === null || _g === void 0 ? void 0 : _g.heading, pitch: (_h = defaults.camera) === null || _h === void 0 ? void 0 : _h.pitch, roll: (_j = defaults.camera) === null || _j === void 0 ? void 0 : _j.roll });
4501
+ }
4499
4502
  newLens = camera.cameraFrustum;
4500
4503
  if (newLens == null) {
4501
- newLens = (_d = defaults.camera) === null || _d === void 0 ? void 0 : _d.cameraFrustum;
4504
+ newLens = (_k = defaults.camera) === null || _k === void 0 ? void 0 : _k.cameraFrustum;
4502
4505
  }
4503
4506
  if (newLens == null) {
4504
4507
  // TODO: Need global default.
@@ -4519,7 +4522,7 @@
4519
4522
  }
4520
4523
  transition = params.skipTransition ? 0 : curLens === newLens ? camera.transition : 0;
4521
4524
  if (transition == null) {
4522
- transition = (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.transition;
4525
+ transition = (_l = defaults.camera) === null || _l === void 0 ? void 0 : _l.transition;
4523
4526
  }
4524
4527
  if (transition == null) {
4525
4528
  // TODO: Need global default.
@@ -4530,25 +4533,25 @@
4530
4533
  scene.camera.flyTo({
4531
4534
  destination: pos,
4532
4535
  orientation: {
4533
- heading: +camera.heading,
4534
- pitch: +camera.pitch,
4535
- roll: +camera.roll
4536
+ heading: Cesium.Math.toRadians(+camera.heading),
4537
+ pitch: Cesium.Math.toRadians(+camera.pitch),
4538
+ roll: Cesium.Math.toRadians(+camera.roll)
4536
4539
  },
4537
4540
  duration: transition != 0 ? transition / 1000 : 0
4538
4541
  });
4539
4542
  }
4540
4543
  gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
4541
4544
  if (gOcclusion == null) {
4542
- gOcclusion = (_f = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _f === void 0 ? void 0 : _f.groundOcclusion;
4545
+ gOcclusion = (_m = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _m === void 0 ? void 0 : _m.groundOcclusion;
4543
4546
  }
4544
4547
  if (gOcclusion == null) {
4545
4548
  // TODO: Need global default.
4546
4549
  gOcclusion = true;
4547
4550
  }
4548
4551
  scene.globe.depthTestAgainstTerrain = Boolean(gOcclusion);
4549
- terrain = (_g = bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain) !== null && _g !== void 0 ? _g : (_h = defaults.settings) === null || _h === void 0 ? void 0 : _h.terrain;
4552
+ terrain = (_o = bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain) !== null && _o !== void 0 ? _o : (_p = defaults.settings) === null || _p === void 0 ? void 0 : _p.terrain;
4550
4553
  if (!terrain) return [3 /*break*/, 2];
4551
- source = (_j = vSettings.terrains) === null || _j === void 0 ? void 0 : _j.find(function (x) { return x.accountId === terrain.accountId && x.tilesetId === terrain.tilesetId; });
4554
+ source = (_q = vSettings.terrains) === null || _q === void 0 ? void 0 : _q.find(function (x) { return x.accountId === terrain.accountId && x.tilesetId === terrain.tilesetId; });
4552
4555
  if (!source) return [3 /*break*/, 2];
4553
4556
  return [4 /*yield*/, exports.TileRenderEngine.Terrain.V2.Render({
4554
4557
  apiGetter: params.apiGetter,
@@ -4557,10 +4560,10 @@
4557
4560
  viewer: params.manager.Viewer,
4558
4561
  })];
4559
4562
  case 1:
4560
- _p.sent();
4561
- _p.label = 2;
4563
+ _u.sent();
4564
+ _u.label = 2;
4562
4565
  case 2:
4563
- imagery = (_k = bSettings.imagery) !== null && _k !== void 0 ? _k : (_l = defaults.settings) === null || _l === void 0 ? void 0 : _l.imagery;
4566
+ imagery = (_r = bSettings.imagery) !== null && _r !== void 0 ? _r : (_s = defaults.settings) === null || _s === void 0 ? void 0 : _s.imagery;
4564
4567
  if (imagery == null) {
4565
4568
  // TODO: Need global default.
4566
4569
  imagery = [
@@ -4576,31 +4579,26 @@
4576
4579
  }
4577
4580
  ];
4578
4581
  }
4579
- iSources = (_m = vSettings.imageries) === null || _m === void 0 ? void 0 : _m.filter(function (x) {
4580
- return imagery.find(function (y) {
4581
- y.accountId === x.accountId && y.tilesetId === x.tilesetId;
4582
- });
4583
- });
4584
4582
  return [4 /*yield*/, exports.TileRenderEngine.Map.V2.Render({
4585
4583
  apiGetter: params.apiGetter,
4586
4584
  enabled: imagery,
4587
- sources: iSources,
4585
+ sources: vSettings.imageries,
4588
4586
  viewer: params.manager.Viewer,
4589
4587
  })];
4590
4588
  case 3:
4591
- _p.sent();
4589
+ _u.sent();
4592
4590
  curEnabled = params.manager.GetEnabledItemIds();
4593
- newItemIds = (_o = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _o !== void 0 ? _o : [];
4591
+ newItemIds = (_t = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _t !== void 0 ? _t : [];
4594
4592
  _i = 0, curEnabled_1 = curEnabled;
4595
- _p.label = 4;
4593
+ _u.label = 4;
4596
4594
  case 4:
4597
4595
  if (!(_i < curEnabled_1.length)) return [3 /*break*/, 7];
4598
4596
  id = curEnabled_1[_i];
4599
4597
  if (!(newItemIds.indexOf(id) === -1)) return [3 /*break*/, 6];
4600
4598
  return [4 /*yield*/, params.manager.RemoveItemById(id)];
4601
4599
  case 5:
4602
- _p.sent();
4603
- _p.label = 6;
4600
+ _u.sent();
4601
+ _u.label = 6;
4604
4602
  case 6:
4605
4603
  _i++;
4606
4604
  return [3 /*break*/, 4];
@@ -4611,8 +4609,8 @@
4611
4609
  manager: params.manager,
4612
4610
  }, params.viewId, params.bookmarkId)];
4613
4611
  case 8:
4614
- _p.sent();
4615
- _p.label = 9;
4612
+ _u.sent();
4613
+ _u.label = 9;
4616
4614
  case 9: return [2 /*return*/];
4617
4615
  }
4618
4616
  });