bruce-cesium 1.3.2 → 1.3.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.
@@ -1215,6 +1215,8 @@
1215
1215
  else if (displayType == "polygon") {
1216
1216
  displayType = bruceModels.ZoomControl.EDisplayType.Geometry;
1217
1217
  }
1218
+ displayType = bruceModels.ZoomControl.EDisplayType.Geometry;
1219
+ // @ts-ignore
1218
1220
  if (displayType != bruceModels.ZoomControl.EDisplayType.Hidden) {
1219
1221
  newRenderId = getRenderGroupId(zoomItem);
1220
1222
  existingRego = params.visualRegister.GetRego({
@@ -1226,6 +1228,7 @@
1226
1228
  cEntities[id] = existingRego.visual;
1227
1229
  }
1228
1230
  else {
1231
+ // @ts-ignore
1229
1232
  if (displayType == bruceModels.ZoomControl.EDisplayType.Model3D) {
1230
1233
  models.push(entity);
1231
1234
  }
@@ -1729,7 +1732,6 @@
1729
1732
  show: false
1730
1733
  });
1731
1734
  cEntity._siblingGraphics = [];
1732
- console.count("POLYGON WIDTH = " + width + ", COLOR = " + (cLineColor === null || cLineColor === void 0 ? void 0 : cLineColor.toCssColorString()));
1733
1735
  if (width > 0 && cLineColor) {
1734
1736
  var cEntityBorder = new Cesium.Entity({
1735
1737
  polyline: new Cesium.PolylineGraphics({
@@ -2032,6 +2034,8 @@
2032
2034
  this.entityCheckRemoval = null;
2033
2035
  this.isRunningCheck = false;
2034
2036
  this.viewMonitorRemoval = null;
2037
+ this.renderQueue = [];
2038
+ this.renderQueueInterval = null;
2035
2039
  var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
2036
2040
  this.viewer = viewer;
2037
2041
  this.sharedGetters = sharedGetters;
@@ -2064,6 +2068,7 @@
2064
2068
  if (!tagsToRender) {
2065
2069
  tagsToRender = [];
2066
2070
  }
2071
+ tagsToRender = [].concat(tagsToRender);
2067
2072
  shouldRender = !isTagItem || tagsToRender.length > 0;
2068
2073
  (_a = this.getter) === null || _a === void 0 ? void 0 : _a.ExcludeMenuItem(this.item.id);
2069
2074
  this.getter = null;
@@ -2073,6 +2078,9 @@
2073
2078
  this.viewMonitorRemoval = null;
2074
2079
  (_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Dispose();
2075
2080
  this.entityCheckQueue = null;
2081
+ clearInterval(this.renderQueueInterval);
2082
+ this.renderQueueInterval = null;
2083
+ this.renderQueue = [];
2076
2084
  this.visualsManager.RemoveRegos({
2077
2085
  menuItemId: this.item.id
2078
2086
  });
@@ -2085,15 +2093,17 @@
2085
2093
  attrFilter: (_e = this.item.BruceEntity.Filter) !== null && _e !== void 0 ? _e : {},
2086
2094
  batchSize: 500,
2087
2095
  typeId: this.item.BruceEntity["EntityType.ID"],
2088
- monitor: this.monitor
2096
+ monitor: this.monitor,
2097
+ viewer: this.viewer,
2098
+ debugShowBounds: false
2089
2099
  });
2090
2100
  minMax = exports.RenderManager.GetZoomMinMax({
2091
2101
  zoomControl: this.item.CameraZoomSettings
2092
2102
  });
2093
- this.getter.IncludeMenuItem(this.item.id, isTagItem ? tagsToRender : [], minMax[0], minMax[1]);
2103
+ this.getter.IncludeMenuItem(this.item.id, [], minMax[0], minMax[1]);
2094
2104
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
2095
2105
  if (isTagItem) {
2096
- _this.onGetterUpdate(entities.filter(function (entity) {
2106
+ _this.distributeForRender(entities.filter(function (entity) {
2097
2107
  var entityTags = entity.Bruce["Layer.ID"];
2098
2108
  if (!entityTags) {
2099
2109
  entityTags = [];
@@ -2104,7 +2114,7 @@
2104
2114
  }));
2105
2115
  }
2106
2116
  else {
2107
- _this.onGetterUpdate(entities);
2117
+ _this.distributeForRender(entities);
2108
2118
  }
2109
2119
  });
2110
2120
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(function () {
@@ -2133,6 +2143,8 @@
2133
2143
  });
2134
2144
  (_b = this.entityCheckRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
2135
2145
  (_c = this.viewMonitorRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
2146
+ clearInterval(this.renderQueueInterval);
2147
+ this.renderQueue = [];
2136
2148
  };
2137
2149
  Manager.prototype.ReRender = function (entityIds) {
2138
2150
  return __awaiter(this, void 0, void 0, function () {
@@ -2196,7 +2208,7 @@
2196
2208
  if (this.disposed) {
2197
2209
  return [2 /*return*/];
2198
2210
  }
2199
- this.distributeGenerateBatches(entities);
2211
+ this.distributeForRender(entities);
2200
2212
  return [2 /*return*/];
2201
2213
  }
2202
2214
  });
@@ -2220,14 +2232,22 @@
2220
2232
  });
2221
2233
  });
2222
2234
  };
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);
2235
+ Manager.prototype.distributeForRender = function (entities) {
2236
+ var _this = this;
2237
+ var BATCH_SIZE = 300;
2238
+ this.renderQueue = this.renderQueue.concat(entities);
2239
+ if (!this.renderQueueInterval && this.renderQueue.length) {
2240
+ this.renderQueueInterval = setInterval(function () {
2241
+ var batch = _this.renderQueue.splice(0, BATCH_SIZE);
2242
+ _this.renderEntities(batch);
2243
+ if (_this.renderQueue.length <= 0) {
2244
+ clearInterval(_this.renderQueueInterval);
2245
+ _this.renderQueueInterval = null;
2246
+ }
2247
+ }, 50);
2228
2248
  }
2229
2249
  };
2230
- Manager.prototype.onGetterUpdate = function (entities) {
2250
+ Manager.prototype.renderEntities = function (entities) {
2231
2251
  var _a, _b, _c;
2232
2252
  return __awaiter(this, void 0, void 0, function () {
2233
2253
  var typeId_1, cEntities, i, entity, id, cEntity, visual, tagIds, e_2;
@@ -2272,7 +2292,7 @@
2272
2292
  priority: 0,
2273
2293
  entityTypeId: entity.Bruce["EntityType.ID"],
2274
2294
  accountId: this.apiGetter.accountId,
2275
- tagIds: tagIds ? tagIds : []
2295
+ tagIds: tagIds ? [].concat(tagIds) : []
2276
2296
  }
2277
2297
  });
2278
2298
  }
@@ -5037,6 +5057,26 @@
5037
5057
  if (!getter) {
5038
5058
  getter = new bruceModels.EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, true);
5039
5059
  this.data[cacheKey] = getter;
5060
+ if (params.viewer && params.debugShowBounds) {
5061
+ getter.OnScanUpdate.Subscribe(function (cells) {
5062
+ cells.forEach(function (cell) {
5063
+ var bounds = cell.GetBounds();
5064
+ var id = bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
5065
+ if (params.viewer.entities.getById(id)) {
5066
+ return;
5067
+ }
5068
+ 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));
5069
+ params.viewer.entities.add(new Cesium.Entity({
5070
+ id: id,
5071
+ rectangle: {
5072
+ coordinates: rect,
5073
+ fill: true,
5074
+ material: Cesium.Color.fromRandom().withAlpha(0.3)
5075
+ }
5076
+ }));
5077
+ });
5078
+ });
5079
+ }
5040
5080
  }
5041
5081
  return getter;
5042
5082
  };