bruce-cesium 2.6.4 → 2.6.5

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.
@@ -5757,8 +5757,67 @@
5757
5757
  enumerable: false,
5758
5758
  configurable: true
5759
5759
  });
5760
- Manager.prototype.Init = function () {
5760
+ /**
5761
+ * Adds entities to menu item and queues the render for them.
5762
+ * If the entity already exists in the menu item, it will be removed and redrawn.
5763
+ * @param params
5764
+ */
5765
+ Manager.prototype.AddEntities = function (params) {
5766
+ var _this = this;
5767
+ var _a;
5768
+ if (this.disposed) {
5769
+ throw (new Error("This item is disposed."));
5770
+ }
5771
+ if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
5772
+ this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
5773
+ }
5774
+ var entities = params.entities;
5775
+ entities.forEach(function (x) {
5776
+ var _a;
5777
+ // If already in the menu item we'll first remove it.
5778
+ // That way we're using the latest provided data.
5779
+ var entityId = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
5780
+ var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == entityId; });
5781
+ if (index > -1) {
5782
+ _this.item.BruceEntity.Entities.splice(index, 1);
5783
+ }
5784
+ _this.item.BruceEntity.Entities.push(x);
5785
+ });
5786
+ this.ReRender({
5787
+ entities: entities,
5788
+ entityIds: entities.map(function (x) { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; }),
5789
+ force: true
5790
+ });
5791
+ this.recreateGetter();
5792
+ };
5793
+ /**
5794
+ * Removes entities from the menu item that match provided IDs.
5795
+ * Any visuals will be removed as well.
5796
+ * @param params
5797
+ */
5798
+ Manager.prototype.RemoveEntities = function (params) {
5761
5799
  var _this = this;
5800
+ var _a;
5801
+ if (this.disposed) {
5802
+ throw (new Error("This item is disposed."));
5803
+ }
5804
+ if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.Entities)) {
5805
+ this.item.BruceEntity = __assign(__assign({}, this.item.BruceEntity), { Entities: [] });
5806
+ }
5807
+ var entityIds = params.entityIds;
5808
+ entityIds.forEach(function (x) {
5809
+ var index = _this.item.BruceEntity.Entities.findIndex(function (y) { var _a; return ((_a = y === null || y === void 0 ? void 0 : y.Bruce) === null || _a === void 0 ? void 0 : _a.ID) == x; });
5810
+ if (index > -1) {
5811
+ _this.item.BruceEntity.Entities.splice(index, 1);
5812
+ }
5813
+ _this.visualsManager.RemoveRegos({
5814
+ entityId: x,
5815
+ menuItemId: _this.item.id
5816
+ });
5817
+ });
5818
+ this.recreateGetter();
5819
+ };
5820
+ Manager.prototype.Init = function () {
5762
5821
  var _a;
5763
5822
  if (this.disposed) {
5764
5823
  throw (new Error("This item is disposed."));
@@ -5775,6 +5834,17 @@
5775
5834
  }
5776
5835
  ];
5777
5836
  }
5837
+ this.recreateGetter();
5838
+ };
5839
+ /**
5840
+ * Recreates the getter for the entities.
5841
+ * This is used when the entities within the menu item are updated.
5842
+ * @todo: this causes a bad side-effect where all menu item entities are queued for a re-render.
5843
+ */
5844
+ Manager.prototype.recreateGetter = function () {
5845
+ var _this = this;
5846
+ var _a;
5847
+ (_a = this.getterSub) === null || _a === void 0 ? void 0 : _a.call(this);
5778
5848
  this.getter = new bruceModels.BatchedDataGetter.Getter(this.item.BruceEntity.Entities, this.monitor, BATCH_SIZE$1);
5779
5849
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
5780
5850
  var _a;
@@ -15022,7 +15092,7 @@
15022
15092
  ViewerUtils.CreateWidgets = CreateWidgets;
15023
15093
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
15024
15094
 
15025
- var VERSION$1 = "2.6.4";
15095
+ var VERSION$1 = "2.6.5";
15026
15096
 
15027
15097
  exports.VERSION = VERSION$1;
15028
15098
  exports.CesiumViewMonitor = CesiumViewMonitor;