bruce-cesium 6.1.6 → 6.1.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.
@@ -16252,6 +16252,7 @@
16252
16252
  // Once the style is loaded, we can queue the set for styling.
16253
16253
  this.stylePendingEntityIds = new Map();
16254
16254
  this.fallbackStyle = null;
16255
+ this.styleFallbackLoaded = false;
16255
16256
  this.loadingCounter = 0;
16256
16257
  // Entity IDs -> boolean to indicate if we should override the feature colour.
16257
16258
  this.overrideFeatureColor = new Map();
@@ -16489,6 +16490,7 @@
16489
16490
  var _a, _b;
16490
16491
  const counter = ++this.loadingCounter;
16491
16492
  this.styleMappingLoaded = false;
16493
+ this.styleFallbackLoaded = false;
16492
16494
  this.styleMappingsLoaded.clear();
16493
16495
  // Apply state changes.
16494
16496
  this.entityGatherer.Empty();
@@ -16500,7 +16502,11 @@
16500
16502
  api: this.api,
16501
16503
  styleId: fallbackStyleId
16502
16504
  });
16505
+ if (this.loadingCounter != counter) {
16506
+ return;
16507
+ }
16503
16508
  this.fallbackStyle = data;
16509
+ this.styleFallbackLoaded = true;
16504
16510
  }
16505
16511
  catch (e) {
16506
16512
  console.error(e);
@@ -16608,7 +16614,17 @@
16608
16614
  // then we can pass them to the gatherer now.
16609
16615
  const relatedIds = this.stylePendingEntityIds.get(styleMap.EntityTypeID);
16610
16616
  if (relatedIds) {
16611
- this.entityGatherer.Queue(Array.from(relatedIds));
16617
+ if (this.getTilesetFeatureNeedsFullData(styleMap.EntityTypeID)) {
16618
+ this.entityGatherer.Queue(Array.from(relatedIds));
16619
+ }
16620
+ else {
16621
+ relatedIds.forEach(id => {
16622
+ const rego = this.getEntityRego(id);
16623
+ if (rego) {
16624
+ this.styleTilesetFeature(rego);
16625
+ }
16626
+ });
16627
+ }
16612
16628
  this.stylePendingEntityIds.delete(styleMap.EntityTypeID);
16613
16629
  }
16614
16630
  }
@@ -16624,9 +16640,19 @@
16624
16640
  // Queue all Entities that are pending styling.
16625
16641
  const pendingKeys = this.stylePendingEntityIds.keys();
16626
16642
  for (const key of pendingKeys) {
16627
- const relatedIds = this.stylePendingEntityIds[key];
16643
+ const relatedIds = this.stylePendingEntityIds.get(key);
16628
16644
  if (relatedIds) {
16629
- this.entityGatherer.Queue(Array.from(relatedIds));
16645
+ if (this.getTilesetFeatureNeedsFullData(key)) {
16646
+ this.entityGatherer.Queue(Array.from(relatedIds));
16647
+ }
16648
+ else {
16649
+ relatedIds.forEach(id => {
16650
+ const rego = this.getEntityRego(id);
16651
+ if (rego) {
16652
+ this.styleTilesetFeature(rego);
16653
+ }
16654
+ });
16655
+ }
16630
16656
  }
16631
16657
  }
16632
16658
  this.stylePendingEntityIds.clear();
@@ -16672,6 +16698,14 @@
16672
16698
  this.styleTilesetFeature(rego);
16673
16699
  }
16674
16700
  }
16701
+ else if (!this.styleMappingsLoaded.has(typeId) && this.styleFallbackLoaded) {
16702
+ if (this.getTilesetFeatureNeedsFullData(typeId)) {
16703
+ needsDataIds.push(rego.entityId);
16704
+ }
16705
+ else {
16706
+ this.styleTilesetFeature(rego);
16707
+ }
16708
+ }
16675
16709
  else {
16676
16710
  if (!this.stylePendingEntityIds.has(typeId)) {
16677
16711
  this.stylePendingEntityIds.set(typeId, new Set());
@@ -16835,11 +16869,12 @@
16835
16869
  }
16836
16870
  TilesetRenderEngine.OnTilesetReady = OnTilesetReady;
16837
16871
  function ApplyPosition(params) {
16838
- var _a;
16872
+ var _a, _b;
16839
16873
  const cTileset = params.cTileset;
16840
16874
  const root = cTileset.root;
16841
16875
  const position = params.position;
16842
- let location = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.location) ? position.ucs.location : position.location;
16876
+ const ucsTransform = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.transform) || {};
16877
+ let location = ((_b = position.ucs) === null || _b === void 0 ? void 0 : _b.location) ? position.ucs.location : position.location;
16843
16878
  let transform = position.transform;
16844
16879
  transform = {
16845
16880
  heading: 0,
@@ -16852,24 +16887,33 @@
16852
16887
  ...transform
16853
16888
  };
16854
16889
  transform.scale = EnsureNumber(transform.scale);
16855
- if (transform.scale <= 0) {
16856
- transform.scale = 0.000001;
16857
- }
16858
- // If we're in model-space we'll just go at 0,0 lat/lon and no h/p/r from the coords.
16890
+ // In model-space we focus on the UCS.
16891
+ // There's no location as we center the view around it.
16892
+ // TODO: although we should render the model relative to the UCS.
16859
16893
  if (params.modelSpace) {
16860
16894
  location = null;
16861
16895
  transform = {
16862
- heading: 0,
16863
- pitch: 0,
16864
- roll: 0,
16865
- scale: EnsureNumber(transform.scale, 1),
16866
- x: 0,
16867
- y: 0,
16868
- z: 0
16896
+ heading: EnsureNumber(ucsTransform.heading, 0),
16897
+ pitch: EnsureNumber(ucsTransform.pitch, 0),
16898
+ roll: EnsureNumber(ucsTransform.roll, 0),
16899
+ scale: EnsureNumber(ucsTransform.scale, 1),
16900
+ x: EnsureNumber(ucsTransform.x, 0),
16901
+ y: EnsureNumber(ucsTransform.y, 0),
16902
+ z: EnsureNumber(ucsTransform.z, 0)
16869
16903
  };
16870
- if (transform.scale <= 0) {
16871
- transform.scale = 0.000001;
16872
- }
16904
+ }
16905
+ // If not in model-space then scale/add UCS transform to the entity transform.
16906
+ else {
16907
+ transform.scale *= EnsureNumber(ucsTransform.scale, 1);
16908
+ transform.heading += EnsureNumber(ucsTransform.heading, 0);
16909
+ transform.pitch += EnsureNumber(ucsTransform.pitch, 0);
16910
+ transform.roll += EnsureNumber(ucsTransform.roll, 0);
16911
+ transform.x += EnsureNumber(ucsTransform.x, 0);
16912
+ transform.y += EnsureNumber(ucsTransform.y, 0);
16913
+ transform.z += EnsureNumber(ucsTransform.z, 0);
16914
+ }
16915
+ if (transform.scale <= 0) {
16916
+ transform.scale = 0.000001;
16873
16917
  }
16874
16918
  /**
16875
16919
  * Very cursed.
@@ -33652,7 +33696,7 @@
33652
33696
  }
33653
33697
  }
33654
33698
 
33655
- const VERSION = "6.1.6";
33699
+ const VERSION = "6.1.8";
33656
33700
 
33657
33701
  exports.VERSION = VERSION;
33658
33702
  exports.isOutlineChanged = isOutlineChanged;