bruce-cesium 1.3.2 → 1.3.4

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.
@@ -1729,7 +1729,6 @@
1729
1729
  show: false
1730
1730
  });
1731
1731
  cEntity._siblingGraphics = [];
1732
- console.count("POLYGON WIDTH = " + width + ", COLOR = " + (cLineColor === null || cLineColor === void 0 ? void 0 : cLineColor.toCssColorString()));
1733
1732
  if (width > 0 && cLineColor) {
1734
1733
  var cEntityBorder = new Cesium.Entity({
1735
1734
  polyline: new Cesium.PolylineGraphics({
@@ -2032,6 +2031,8 @@
2032
2031
  this.entityCheckRemoval = null;
2033
2032
  this.isRunningCheck = false;
2034
2033
  this.viewMonitorRemoval = null;
2034
+ this.renderQueue = [];
2035
+ this.renderQueueInterval = null;
2035
2036
  var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
2036
2037
  this.viewer = viewer;
2037
2038
  this.sharedGetters = sharedGetters;
@@ -2064,6 +2065,7 @@
2064
2065
  if (!tagsToRender) {
2065
2066
  tagsToRender = [];
2066
2067
  }
2068
+ tagsToRender = [].concat(tagsToRender);
2067
2069
  shouldRender = !isTagItem || tagsToRender.length > 0;
2068
2070
  (_a = this.getter) === null || _a === void 0 ? void 0 : _a.ExcludeMenuItem(this.item.id);
2069
2071
  this.getter = null;
@@ -2073,6 +2075,9 @@
2073
2075
  this.viewMonitorRemoval = null;
2074
2076
  (_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Dispose();
2075
2077
  this.entityCheckQueue = null;
2078
+ clearInterval(this.renderQueueInterval);
2079
+ this.renderQueueInterval = null;
2080
+ this.renderQueue = [];
2076
2081
  this.visualsManager.RemoveRegos({
2077
2082
  menuItemId: this.item.id
2078
2083
  });
@@ -2085,15 +2090,17 @@
2085
2090
  attrFilter: (_e = this.item.BruceEntity.Filter) !== null && _e !== void 0 ? _e : {},
2086
2091
  batchSize: 500,
2087
2092
  typeId: this.item.BruceEntity["EntityType.ID"],
2088
- monitor: this.monitor
2093
+ monitor: this.monitor,
2094
+ viewer: this.viewer,
2095
+ debugShowBounds: false
2089
2096
  });
2090
2097
  minMax = exports.RenderManager.GetZoomMinMax({
2091
2098
  zoomControl: this.item.CameraZoomSettings
2092
2099
  });
2093
- this.getter.IncludeMenuItem(this.item.id, isTagItem ? tagsToRender : [], minMax[0], minMax[1]);
2100
+ this.getter.IncludeMenuItem(this.item.id, [], minMax[0], minMax[1]);
2094
2101
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
2095
2102
  if (isTagItem) {
2096
- _this.onGetterUpdate(entities.filter(function (entity) {
2103
+ _this.distributeForRender(entities.filter(function (entity) {
2097
2104
  var entityTags = entity.Bruce["Layer.ID"];
2098
2105
  if (!entityTags) {
2099
2106
  entityTags = [];
@@ -2104,7 +2111,7 @@
2104
2111
  }));
2105
2112
  }
2106
2113
  else {
2107
- _this.onGetterUpdate(entities);
2114
+ _this.distributeForRender(entities);
2108
2115
  }
2109
2116
  });
2110
2117
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(function () {
@@ -2133,6 +2140,8 @@
2133
2140
  });
2134
2141
  (_b = this.entityCheckRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
2135
2142
  (_c = this.viewMonitorRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
2143
+ clearInterval(this.renderQueueInterval);
2144
+ this.renderQueue = [];
2136
2145
  };
2137
2146
  Manager.prototype.ReRender = function (entityIds) {
2138
2147
  return __awaiter(this, void 0, void 0, function () {
@@ -2196,7 +2205,7 @@
2196
2205
  if (this.disposed) {
2197
2206
  return [2 /*return*/];
2198
2207
  }
2199
- this.distributeGenerateBatches(entities);
2208
+ this.distributeForRender(entities);
2200
2209
  return [2 /*return*/];
2201
2210
  }
2202
2211
  });
@@ -2220,14 +2229,22 @@
2220
2229
  });
2221
2230
  });
2222
2231
  };
2223
- Manager.prototype.distributeGenerateBatches = function (entities) {
2224
- var BATCH_SIZE = 50;
2225
- while (entities.length > 0) {
2226
- var batch = entities.splice(0, BATCH_SIZE);
2227
- this.onGetterUpdate(batch);
2232
+ Manager.prototype.distributeForRender = function (entities) {
2233
+ var _this = this;
2234
+ var BATCH_SIZE = 300;
2235
+ this.renderQueue = this.renderQueue.concat(entities);
2236
+ if (!this.renderQueueInterval && this.renderQueue.length) {
2237
+ this.renderQueueInterval = setInterval(function () {
2238
+ var batch = _this.renderQueue.splice(0, BATCH_SIZE);
2239
+ _this.renderEntities(batch);
2240
+ if (_this.renderQueue.length <= 0) {
2241
+ clearInterval(_this.renderQueueInterval);
2242
+ _this.renderQueueInterval = null;
2243
+ }
2244
+ }, 50);
2228
2245
  }
2229
2246
  };
2230
- Manager.prototype.onGetterUpdate = function (entities) {
2247
+ Manager.prototype.renderEntities = function (entities) {
2231
2248
  var _a, _b, _c;
2232
2249
  return __awaiter(this, void 0, void 0, function () {
2233
2250
  var typeId_1, cEntities, i, entity, id, cEntity, visual, tagIds, e_2;
@@ -2272,7 +2289,7 @@
2272
2289
  priority: 0,
2273
2290
  entityTypeId: entity.Bruce["EntityType.ID"],
2274
2291
  accountId: this.apiGetter.accountId,
2275
- tagIds: tagIds ? tagIds : []
2292
+ tagIds: tagIds ? [].concat(tagIds) : []
2276
2293
  }
2277
2294
  });
2278
2295
  }
@@ -5037,6 +5054,26 @@
5037
5054
  if (!getter) {
5038
5055
  getter = new bruceModels.EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, true);
5039
5056
  this.data[cacheKey] = getter;
5057
+ if (params.viewer && params.debugShowBounds) {
5058
+ getter.OnScanUpdate.Subscribe(function (cells) {
5059
+ cells.forEach(function (cell) {
5060
+ var bounds = cell.GetBounds();
5061
+ var id = bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
5062
+ if (params.viewer.entities.getById(id)) {
5063
+ return;
5064
+ }
5065
+ var rect = new Cesium.Rectangle(Cesium.Math.toRadians(bounds.west), Cesium.Math.toRadians(bounds.south), Cesium.Math.toRadians(bounds.east), Cesium.Math.toRadians(bounds.north));
5066
+ params.viewer.entities.add(new Cesium.Entity({
5067
+ id: id,
5068
+ rectangle: {
5069
+ coordinates: rect,
5070
+ fill: true,
5071
+ material: Cesium.Color.fromRandom().withAlpha(0.3)
5072
+ }
5073
+ }));
5074
+ });
5075
+ });
5076
+ }
5040
5077
  }
5041
5078
  return getter;
5042
5079
  };