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.
@@ -1,5 +1,5 @@
1
1
  import { BruceEvent, Cartes, Carto, Geometry, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, Entity as Entity$1, BatchedDataGetter, EntityRelationType, Tileset, EntityCoords, EntityFilterGetter, EntitySource, EntityRelation, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
2
- import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CallbackProperty, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, OrthographicFrustum, JulianDate, PolygonPipeline, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance } from 'cesium';
2
+ import { Cartesian2, Cartographic, Math as Math$1, Color, HeightReference, Cartesian3, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, createOsmBuildings, Cesium3DTileStyle, Rectangle, KmlDataSource, CallbackProperty, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, JulianDate, Matrix4, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, ColorMaterialProperty, Matrix3, EasingFunction, GeometryInstance, PolygonPipeline } from 'cesium';
3
3
 
4
4
  var TIME_LAG = 300;
5
5
  var POSITION_CHECK_TIMER = 950;
@@ -1732,7 +1732,6 @@ var EntityRenderEngine;
1732
1732
  show: false
1733
1733
  });
1734
1734
  cEntity._siblingGraphics = [];
1735
- console.count("POLYGON WIDTH = " + width + ", COLOR = " + (cLineColor === null || cLineColor === void 0 ? void 0 : cLineColor.toCssColorString()));
1736
1735
  if (width > 0 && cLineColor) {
1737
1736
  var cEntityBorder = new Entity({
1738
1737
  polyline: new PolylineGraphics({
@@ -2040,6 +2039,8 @@ var EntitiesRenderManager;
2040
2039
  this.entityCheckRemoval = null;
2041
2040
  this.isRunningCheck = false;
2042
2041
  this.viewMonitorRemoval = null;
2042
+ this.renderQueue = [];
2043
+ this.renderQueueInterval = null;
2043
2044
  var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
2044
2045
  this.viewer = viewer;
2045
2046
  this.sharedGetters = sharedGetters;
@@ -2072,6 +2073,7 @@ var EntitiesRenderManager;
2072
2073
  if (!tagsToRender) {
2073
2074
  tagsToRender = [];
2074
2075
  }
2076
+ tagsToRender = [].concat(tagsToRender);
2075
2077
  shouldRender = !isTagItem || tagsToRender.length > 0;
2076
2078
  (_a = this.getter) === null || _a === void 0 ? void 0 : _a.ExcludeMenuItem(this.item.id);
2077
2079
  this.getter = null;
@@ -2081,6 +2083,9 @@ var EntitiesRenderManager;
2081
2083
  this.viewMonitorRemoval = null;
2082
2084
  (_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Dispose();
2083
2085
  this.entityCheckQueue = null;
2086
+ clearInterval(this.renderQueueInterval);
2087
+ this.renderQueueInterval = null;
2088
+ this.renderQueue = [];
2084
2089
  this.visualsManager.RemoveRegos({
2085
2090
  menuItemId: this.item.id
2086
2091
  });
@@ -2093,15 +2098,17 @@ var EntitiesRenderManager;
2093
2098
  attrFilter: (_e = this.item.BruceEntity.Filter) !== null && _e !== void 0 ? _e : {},
2094
2099
  batchSize: 500,
2095
2100
  typeId: this.item.BruceEntity["EntityType.ID"],
2096
- monitor: this.monitor
2101
+ monitor: this.monitor,
2102
+ viewer: this.viewer,
2103
+ debugShowBounds: false
2097
2104
  });
2098
2105
  minMax = RenderManager.GetZoomMinMax({
2099
2106
  zoomControl: this.item.CameraZoomSettings
2100
2107
  });
2101
- this.getter.IncludeMenuItem(this.item.id, isTagItem ? tagsToRender : [], minMax[0], minMax[1]);
2108
+ this.getter.IncludeMenuItem(this.item.id, [], minMax[0], minMax[1]);
2102
2109
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
2103
2110
  if (isTagItem) {
2104
- _this.onGetterUpdate(entities.filter(function (entity) {
2111
+ _this.distributeForRender(entities.filter(function (entity) {
2105
2112
  var entityTags = entity.Bruce["Layer.ID"];
2106
2113
  if (!entityTags) {
2107
2114
  entityTags = [];
@@ -2112,7 +2119,7 @@ var EntitiesRenderManager;
2112
2119
  }));
2113
2120
  }
2114
2121
  else {
2115
- _this.onGetterUpdate(entities);
2122
+ _this.distributeForRender(entities);
2116
2123
  }
2117
2124
  });
2118
2125
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(function () {
@@ -2141,6 +2148,8 @@ var EntitiesRenderManager;
2141
2148
  });
2142
2149
  (_b = this.entityCheckRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
2143
2150
  (_c = this.viewMonitorRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
2151
+ clearInterval(this.renderQueueInterval);
2152
+ this.renderQueue = [];
2144
2153
  };
2145
2154
  Manager.prototype.ReRender = function (entityIds) {
2146
2155
  return __awaiter(this, void 0, void 0, function () {
@@ -2204,7 +2213,7 @@ var EntitiesRenderManager;
2204
2213
  if (this.disposed) {
2205
2214
  return [2 /*return*/];
2206
2215
  }
2207
- this.distributeGenerateBatches(entities);
2216
+ this.distributeForRender(entities);
2208
2217
  return [2 /*return*/];
2209
2218
  }
2210
2219
  });
@@ -2228,14 +2237,22 @@ var EntitiesRenderManager;
2228
2237
  });
2229
2238
  });
2230
2239
  };
2231
- Manager.prototype.distributeGenerateBatches = function (entities) {
2232
- var BATCH_SIZE = 50;
2233
- while (entities.length > 0) {
2234
- var batch = entities.splice(0, BATCH_SIZE);
2235
- this.onGetterUpdate(batch);
2240
+ Manager.prototype.distributeForRender = function (entities) {
2241
+ var _this = this;
2242
+ var BATCH_SIZE = 300;
2243
+ this.renderQueue = this.renderQueue.concat(entities);
2244
+ if (!this.renderQueueInterval && this.renderQueue.length) {
2245
+ this.renderQueueInterval = setInterval(function () {
2246
+ var batch = _this.renderQueue.splice(0, BATCH_SIZE);
2247
+ _this.renderEntities(batch);
2248
+ if (_this.renderQueue.length <= 0) {
2249
+ clearInterval(_this.renderQueueInterval);
2250
+ _this.renderQueueInterval = null;
2251
+ }
2252
+ }, 50);
2236
2253
  }
2237
2254
  };
2238
- Manager.prototype.onGetterUpdate = function (entities) {
2255
+ Manager.prototype.renderEntities = function (entities) {
2239
2256
  var _a, _b, _c;
2240
2257
  return __awaiter(this, void 0, void 0, function () {
2241
2258
  var typeId_1, cEntities, i, entity, id, cEntity, visual, tagIds, e_2;
@@ -2280,7 +2297,7 @@ var EntitiesRenderManager;
2280
2297
  priority: 0,
2281
2298
  entityTypeId: entity.Bruce["EntityType.ID"],
2282
2299
  accountId: this.apiGetter.accountId,
2283
- tagIds: tagIds ? tagIds : []
2300
+ tagIds: tagIds ? [].concat(tagIds) : []
2284
2301
  }
2285
2302
  });
2286
2303
  }
@@ -5072,6 +5089,26 @@ var SharedGetters;
5072
5089
  if (!getter) {
5073
5090
  getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, true);
5074
5091
  this.data[cacheKey] = getter;
5092
+ if (params.viewer && params.debugShowBounds) {
5093
+ getter.OnScanUpdate.Subscribe(function (cells) {
5094
+ cells.forEach(function (cell) {
5095
+ var bounds = cell.GetBounds();
5096
+ var id = bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
5097
+ if (params.viewer.entities.getById(id)) {
5098
+ return;
5099
+ }
5100
+ var rect = new Rectangle(Math$1.toRadians(bounds.west), Math$1.toRadians(bounds.south), Math$1.toRadians(bounds.east), Math$1.toRadians(bounds.north));
5101
+ params.viewer.entities.add(new Entity({
5102
+ id: id,
5103
+ rectangle: {
5104
+ coordinates: rect,
5105
+ fill: true,
5106
+ material: Color.fromRandom().withAlpha(0.3)
5107
+ }
5108
+ }));
5109
+ });
5110
+ });
5111
+ }
5075
5112
  }
5076
5113
  return getter;
5077
5114
  };