bruce-cesium 3.4.2 → 3.4.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.
@@ -742,6 +742,52 @@
742
742
  }
743
743
  }
744
744
  CesiumEntityStyler.UpdateColorSetting = UpdateColorSetting;
745
+ function Refresh(params) {
746
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
747
+ if (!entity) {
748
+ return;
749
+ }
750
+ var parts = exports.EntityUtils.GatherEntity({
751
+ entity: entity
752
+ });
753
+ for (var i = 0; i < parts.length; i++) {
754
+ var part = parts[i];
755
+ if (!isAlive(viewer, part)) {
756
+ continue;
757
+ }
758
+ if (part instanceof Cesium.Cesium3DTileFeature) {
759
+ var opacity = getAppliedOpacity(part);
760
+ refreshColor(viewer, part, opacity);
761
+ }
762
+ else if (part instanceof Cesium.Entity) {
763
+ if (part.billboard) {
764
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
765
+ }
766
+ if (part.model) {
767
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
768
+ }
769
+ if (part.polyline) {
770
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
771
+ }
772
+ if (part.polygon) {
773
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
774
+ }
775
+ if (part.corridor) {
776
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
777
+ }
778
+ if (part.point) {
779
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
780
+ }
781
+ if (part.ellipse) {
782
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
783
+ }
784
+ }
785
+ }
786
+ if (requestRender != false) {
787
+ viewer.scene.requestRender();
788
+ }
789
+ }
790
+ CesiumEntityStyler.Refresh = Refresh;
745
791
  /**
746
792
  * Updates the default colour of a graphic.
747
793
  * This will not change the graphic's state to use it if the entity is selected/highlighted.
@@ -6466,16 +6512,40 @@
6466
6512
  };
6467
6513
  Register.prototype.ForceUpdate = function (params) {
6468
6514
  var _a;
6469
- var entityIds = params.entityIds;
6515
+ var entityIds = params.entityIds, requestRender = params.requestRender, refreshColors = params.refreshColors;
6516
+ var selectedIds = this.selectedIds;
6517
+ var highlightedIds = this.highlightedIds;
6470
6518
  for (var i = 0; i < entityIds.length; i++) {
6471
6519
  var entityId = entityIds[i];
6472
6520
  updateEntity(this.viewer, entityId, this);
6521
+ if (refreshColors) {
6522
+ if (selectedIds.includes(entityId)) {
6523
+ CesiumEntityStyler.Select({
6524
+ entity: this.GetRego({
6525
+ entityId: entityId
6526
+ }).visual,
6527
+ viewer: this.viewer,
6528
+ requestRender: false
6529
+ });
6530
+ }
6531
+ else if (highlightedIds.includes(entityId)) {
6532
+ CesiumEntityStyler.Highlight({
6533
+ entity: this.GetRego({
6534
+ entityId: entityId
6535
+ }).visual,
6536
+ viewer: this.viewer,
6537
+ requestRender: false
6538
+ });
6539
+ }
6540
+ }
6473
6541
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
6474
6542
  type: EVisualUpdateType.Update,
6475
6543
  entityId: entityId
6476
6544
  });
6477
6545
  }
6478
- this.viewer.scene.requestRender();
6546
+ if (requestRender != false) {
6547
+ this.viewer.scene.requestRender();
6548
+ }
6479
6549
  };
6480
6550
  /**
6481
6551
  * Marks given entityIds as either labelled or not labelled.
@@ -8480,7 +8550,7 @@
8480
8550
  Manager.prototype.renderAsGeojson = function (entities, force) {
8481
8551
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8482
8552
  return __awaiter(this, void 0, void 0, function () {
8483
- var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
8553
+ var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
8484
8554
  var _this = this;
8485
8555
  return __generator(this, function (_o) {
8486
8556
  switch (_o.label) {
@@ -8689,6 +8759,7 @@
8689
8759
  thing.polyline.width = width;
8690
8760
  }
8691
8761
  };
8762
+ toForceUpdate = [];
8692
8763
  register = function (thing) {
8693
8764
  var _a, _b, _c, _d;
8694
8765
  // See if the cesium entity already exists in a group.
@@ -8701,7 +8772,6 @@
8701
8772
  if (!entityId) {
8702
8773
  return;
8703
8774
  }
8704
- var needsUpdate = false;
8705
8775
  // Find group for the nextspace entity ID.
8706
8776
  group = groups.find(function (x) { return x.entityId == entityId; });
8707
8777
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -8716,6 +8786,7 @@
8716
8786
  rego: null
8717
8787
  };
8718
8788
  groups.push(group);
8789
+ applyStyle(thing, entityId, group.data);
8719
8790
  var rego = {
8720
8791
  entityId: entityId,
8721
8792
  menuItemId: _this.item.id,
@@ -8740,6 +8811,7 @@
8740
8811
  }
8741
8812
  // Found a group. We flag this as a sibling entity of the primary.
8742
8813
  else {
8814
+ applyStyle(thing, entityId, group.data);
8743
8815
  group.siblings.push(thing);
8744
8816
  group.visual._siblingGraphics = group.siblings;
8745
8817
  thing._parentEntity = group.visual;
@@ -8747,21 +8819,24 @@
8747
8819
  _this.visualsManager.RefreshMark({
8748
8820
  rego: group.rego
8749
8821
  });
8750
- needsUpdate = true;
8822
+ if (!toForceUpdate.includes(entityId)) {
8823
+ toForceUpdate.push(entityId);
8824
+ }
8751
8825
  }
8752
8826
  }
8753
- applyStyle(thing, entityId, group.data);
8754
- if (needsUpdate) {
8755
- _this.visualsManager.ForceUpdate({
8756
- entityIds: [entityId],
8757
- });
8758
- }
8759
8827
  };
8760
8828
  sEntities = source.entities.values;
8761
8829
  for (i = 0; i < sEntities.length; i++) {
8762
8830
  cEntity = sEntities[i];
8763
8831
  register(cEntity);
8764
8832
  }
8833
+ if (toForceUpdate.length) {
8834
+ this.visualsManager.ForceUpdate({
8835
+ entityIds: toForceUpdate,
8836
+ refreshColors: true,
8837
+ requestRender: false
8838
+ });
8839
+ }
8765
8840
  this.viewer.scene.requestRender();
8766
8841
  return [2 /*return*/];
8767
8842
  }
@@ -9282,7 +9357,7 @@
9282
9357
  Manager.prototype.renderAsGeojson = function (entities, force) {
9283
9358
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9284
9359
  return __awaiter(this, void 0, void 0, function () {
9285
- var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9360
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
9286
9361
  var _this = this;
9287
9362
  return __generator(this, function (_o) {
9288
9363
  switch (_o.label) {
@@ -9491,6 +9566,7 @@
9491
9566
  thing.polyline.width = width;
9492
9567
  }
9493
9568
  };
9569
+ toForceUpdate = [];
9494
9570
  register = function (thing) {
9495
9571
  var _a, _b, _c, _d;
9496
9572
  // See if the cesium entity already exists in a group.
@@ -9503,7 +9579,6 @@
9503
9579
  if (!entityId) {
9504
9580
  return;
9505
9581
  }
9506
- var needsUpdate = false;
9507
9582
  // Find group for the nextspace entity ID.
9508
9583
  group = groups.find(function (x) { return x.entityId == entityId; });
9509
9584
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -9518,6 +9593,7 @@
9518
9593
  rego: null
9519
9594
  };
9520
9595
  groups.push(group);
9596
+ applyStyle(thing, entityId, group.data);
9521
9597
  var rego = {
9522
9598
  entityId: entityId,
9523
9599
  menuItemId: _this.item.id,
@@ -9542,6 +9618,7 @@
9542
9618
  }
9543
9619
  // Found a group. We flag this as a sibling entity of the primary.
9544
9620
  else {
9621
+ applyStyle(thing, entityId, group.data);
9545
9622
  group.siblings.push(thing);
9546
9623
  group.visual._siblingGraphics = group.siblings;
9547
9624
  thing._parentEntity = group.visual;
@@ -9549,21 +9626,24 @@
9549
9626
  _this.visualsManager.RefreshMark({
9550
9627
  rego: group.rego
9551
9628
  });
9552
- needsUpdate = true;
9629
+ if (!toForceUpdate.includes(entityId)) {
9630
+ toForceUpdate.push(entityId);
9631
+ }
9553
9632
  }
9554
9633
  }
9555
- applyStyle(thing, entityId, group.data);
9556
- if (needsUpdate) {
9557
- _this.visualsManager.ForceUpdate({
9558
- entityIds: [entityId],
9559
- });
9560
- }
9561
9634
  };
9562
9635
  sEntities = source.entities.values;
9563
9636
  for (i = 0; i < sEntities.length; i++) {
9564
9637
  cEntity = sEntities[i];
9565
9638
  register(cEntity);
9566
9639
  }
9640
+ if (toForceUpdate.length) {
9641
+ this.visualsManager.ForceUpdate({
9642
+ entityIds: toForceUpdate,
9643
+ refreshColors: true,
9644
+ requestRender: false
9645
+ });
9646
+ }
9567
9647
  this.viewer.scene.requestRender();
9568
9648
  return [2 /*return*/];
9569
9649
  }
@@ -9877,7 +9957,7 @@
9877
9957
  Manager.prototype.renderAsGeojson = function (entities, force) {
9878
9958
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9879
9959
  return __awaiter(this, void 0, void 0, function () {
9880
- var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, register, sEntities, i, cEntity;
9960
+ var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
9881
9961
  var _this = this;
9882
9962
  return __generator(this, function (_o) {
9883
9963
  switch (_o.label) {
@@ -10086,6 +10166,7 @@
10086
10166
  thing.polyline.width = width;
10087
10167
  }
10088
10168
  };
10169
+ toForceUpdate = [];
10089
10170
  register = function (thing) {
10090
10171
  var _a, _b, _c, _d;
10091
10172
  // See if the cesium entity already exists in a group.
@@ -10098,7 +10179,6 @@
10098
10179
  if (!entityId) {
10099
10180
  return;
10100
10181
  }
10101
- var needsUpdate = false;
10102
10182
  // Find group for the nextspace entity ID.
10103
10183
  group = groups.find(function (x) { return x.entityId == entityId; });
10104
10184
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -10113,6 +10193,7 @@
10113
10193
  rego: null
10114
10194
  };
10115
10195
  groups.push(group);
10196
+ applyStyle(thing, entityId, group.data);
10116
10197
  var rego = {
10117
10198
  entityId: entityId,
10118
10199
  menuItemId: _this.item.id,
@@ -10137,6 +10218,7 @@
10137
10218
  }
10138
10219
  // Found a group. We flag this as a sibling entity of the primary.
10139
10220
  else {
10221
+ applyStyle(thing, entityId, group.data);
10140
10222
  group.siblings.push(thing);
10141
10223
  group.visual._siblingGraphics = group.siblings;
10142
10224
  thing._parentEntity = group.visual;
@@ -10144,21 +10226,24 @@
10144
10226
  _this.visualsManager.RefreshMark({
10145
10227
  rego: group.rego
10146
10228
  });
10147
- needsUpdate = true;
10229
+ if (!toForceUpdate.includes(entityId)) {
10230
+ toForceUpdate.push(entityId);
10231
+ }
10148
10232
  }
10149
10233
  }
10150
- applyStyle(thing, entityId, group.data);
10151
- if (needsUpdate) {
10152
- _this.visualsManager.ForceUpdate({
10153
- entityIds: [entityId],
10154
- });
10155
- }
10156
10234
  };
10157
10235
  sEntities = source.entities.values;
10158
10236
  for (i = 0; i < sEntities.length; i++) {
10159
10237
  cEntity = sEntities[i];
10160
10238
  register(cEntity);
10161
10239
  }
10240
+ if (toForceUpdate.length) {
10241
+ this.visualsManager.ForceUpdate({
10242
+ entityIds: toForceUpdate,
10243
+ refreshColors: true,
10244
+ requestRender: false
10245
+ });
10246
+ }
10162
10247
  this.viewer.scene.requestRender();
10163
10248
  return [2 /*return*/];
10164
10249
  }
@@ -21301,7 +21386,7 @@
21301
21386
  CesiumViewMonitor.Monitor = Monitor;
21302
21387
  })(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
21303
21388
 
21304
- var VERSION$1 = "3.4.2";
21389
+ var VERSION$1 = "3.4.3";
21305
21390
 
21306
21391
  exports.VERSION = VERSION$1;
21307
21392
  exports.CesiumParabola = CesiumParabola;